Skip to content

Commit

Permalink
Revert "Bug 1285554 - Remove remnants of widget/qt. r=dougt,mshal."
Browse files Browse the repository at this point in the history
This reverts commit a913f99.
  • Loading branch information
rainemak committed May 27, 2020
1 parent 86a59a2 commit 089fddd
Show file tree
Hide file tree
Showing 31 changed files with 785 additions and 16 deletions.
2 changes: 1 addition & 1 deletion browser/base/content/browser-menubar.inc
Expand Up @@ -75,7 +75,7 @@
accesskey="&emailPageCmd.accesskey;"
command="Browser:SendLink"/>
<menuseparator/>
#if !defined(MOZ_WIDGET_GTK)
#if !defined(MOZ_WIDGET_GTK) && !defined(MOZ_WIDGET_QT)
<menuitem id="menu_printSetup"
label="&printSetupCmd.label;"
accesskey="&printSetupCmd.accesskey;"
Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/browser.css
Expand Up @@ -261,7 +261,7 @@ toolbar[customizing] > .overflow-button {
}
%endif

%if !defined(MOZ_WIDGET_GTK)
%if !defined(MOZ_WIDGET_GTK) && !defined(MOZ_WIDGET_QT)
#TabsToolbar > .private-browsing-indicator {
-moz-box-ordinal-group: 1000;
}
Expand Down
6 changes: 3 additions & 3 deletions browser/base/content/browser.xul
Expand Up @@ -546,7 +546,7 @@
#ifdef MENUBAR_CAN_AUTOHIDE
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"
#if defined(MOZ_WIDGET_GTK)
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
autohide="true"
#endif
#endif
Expand Down Expand Up @@ -575,7 +575,7 @@
context="toolbar-context-menu"
collapsed="true">

#if defined(MOZ_WIDGET_GTK)
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
<hbox id="private-browsing-indicator"
skipintoolbarset="true"/>
#endif
Expand Down Expand Up @@ -625,7 +625,7 @@
</menupopup>
</toolbarbutton>

#if !defined(MOZ_WIDGET_GTK)
#if !defined(MOZ_WIDGET_GTK) && !defined(MOZ_WIDGET_QT)
<hbox class="private-browsing-indicator" skipintoolbarset="true"/>
#endif
#ifdef CAN_DRAW_IN_TITLEBAR
Expand Down
2 changes: 1 addition & 1 deletion browser/themes/moz.build
Expand Up @@ -8,7 +8,7 @@ toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']

if toolkit == 'cocoa':
DIRS += ['osx']
elif toolkit in ('gtk2', 'gtk3'):
elif toolkit in ('gtk2', 'gtk3', 'qt'):
DIRS += ['linux']
else:
DIRS += ['windows']
Expand Down
6 changes: 3 additions & 3 deletions browser/themes/shared/notification-icons.inc.css
Expand Up @@ -55,7 +55,7 @@
.geo-icon {
%ifdef XP_MACOSX
list-style-image: url(chrome://browser/skin/notification-icons.svg#geo-osx);
%elif defined(MOZ_WIDGET_GTK)
%elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
list-style-image: url(chrome://browser/skin/notification-icons.svg#geo-linux);
%else
list-style-image: url(chrome://browser/skin/notification-icons.svg#geo-windows);
Expand All @@ -65,7 +65,7 @@
.geo-icon.blocked-permission-icon {
%ifdef XP_MACOSX
list-style-image: url(chrome://browser/skin/notification-icons.svg#geo-osx-blocked);
%elif defined(MOZ_WIDGET_GTK)
%elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
list-style-image: url(chrome://browser/skin/notification-icons.svg#geo-linux-blocked);
%else
list-style-image: url(chrome://browser/skin/notification-icons.svg#geo-windows-blocked);
Expand All @@ -75,7 +75,7 @@
.popup-notification-icon[popupid="geolocation"] {
%ifdef XP_MACOSX
list-style-image: url(chrome://browser/skin/notification-icons.svg#geo-osx);
%elif defined(MOZ_WIDGET_GTK)
%elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
list-style-image: url(chrome://browser/skin/notification-icons.svg#geo-linux-detailed);
%else
list-style-image: url(chrome://browser/skin/notification-icons.svg#geo-windows-detailed);
Expand Down
2 changes: 1 addition & 1 deletion browser/themes/shared/tab-selected.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion dom/plugins/ipc/PluginModuleChild.cpp
Expand Up @@ -320,7 +320,6 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
}

#if defined(MOZ_WIDGET_GTK)

typedef void (*GObjectDisposeFn)(GObject*);
typedef gboolean (*GtkWidgetScrollEventFn)(GtkWidget*, GdkEventScroll*);
typedef void (*GtkPlugEmbeddedFn)(GtkPlug*);
Expand Down
9 changes: 9 additions & 0 deletions intl/locale/nsLocaleService.cpp
Expand Up @@ -3,6 +3,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifdef MOZ_WIDGET_QT
#include <QString>
#include <QtCore/QLocale>
#endif

#include "nsCOMPtr.h"
#include "nsILocale.h"
#include "nsILocaleService.h"
Expand Down Expand Up @@ -117,8 +122,12 @@ nsLocaleService::nsLocaleService(void)
RefPtr<nsLocale> resultLocale(new nsLocale());
NS_ENSURE_TRUE_VOID(resultLocale);

#ifdef MOZ_WIDGET_QT
const char* lang = QLocale::system().name().toUtf8();
#else
// Get system configuration
const char* lang = getenv("LANG");
#endif

nsAutoString xpLocale, platformLocale;
nsAutoString category, category_platform;
Expand Down
5 changes: 5 additions & 0 deletions media/webrtc/signaling/test/common.build
Expand Up @@ -126,6 +126,11 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
'freetype',
]

if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
OS_LIBS += CONFIG['XLIBS']
OS_LIBS += CONFIG['TK_LIBS']
OS_LIBS += CONFIG['MOZ_PANGO_LIBS']

if CONFIG['OS_TARGET'] in ('Linux', 'DragonFly', 'FreeBSD', 'NetBSD',
'OpenBSD'):
OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']
Expand Down
5 changes: 5 additions & 0 deletions old-configure.in
Expand Up @@ -1466,13 +1466,15 @@ if test -n "$MOZ_X11"; then
AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
[MISSING_X="$MISSING_X -lXext"], $XLIBS)

if test "$MOZ_WIDGET_TOOLKIT" != qt; then
AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
unset ac_cv_lib_Xt_XtFree
AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
[MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
])
fi

dnl ========================================================
dnl = Check for xcb
Expand Down Expand Up @@ -5251,6 +5253,9 @@ if test "$MOZ_TREE_CAIRO"; then
fi

case "$MOZ_WIDGET_TOOLKIT" in
qt)
QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
;;
cocoa | uikit)
QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
Expand Down
4 changes: 4 additions & 0 deletions toolkit/components/remote/moz.build
Expand Up @@ -18,6 +18,10 @@ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
SOURCES += [
'nsGTKRemoteService.cpp',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
SOURCES += [
'nsQtRemoteService.cpp',
]

FINAL_LIBRARY = 'xul'

Expand Down
142 changes: 142 additions & 0 deletions toolkit/components/remote/nsQtRemoteService.cpp
@@ -0,0 +1,142 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=8:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <QWindow>
#include "nsQtRemoteService.h"

#include "mozilla/ModuleUtils.h"
#include "mozilla/X11Util.h"
#include "nsIServiceManager.h"
#include "nsIAppShellService.h"

#include "nsCOMPtr.h"

/**
Helper class which is used to receive notification about property changes
*/
class MozQRemoteEventHandlerWidget: public QWindow {
public:
/**
Constructor
@param aRemoteService remote service, which is notified about atom change
*/
MozQRemoteEventHandlerWidget(nsQtRemoteService &aRemoteService);
virtual ~MozQRemoteEventHandlerWidget() {}

protected:
/**
Event filter, which receives all XEvents
@return false which continues event handling
*/
bool x11Event(XEvent *);

private:
/**
Service which is notified about property change
*/
nsQtRemoteService &mRemoteService;
};

MozQRemoteEventHandlerWidget::MozQRemoteEventHandlerWidget(nsQtRemoteService &aRemoteService)
:mRemoteService(aRemoteService)
{
}

bool
MozQRemoteEventHandlerWidget::x11Event(XEvent *aEvt)
{
if (aEvt->type == PropertyNotify && aEvt->xproperty.state == PropertyNewValue)
mRemoteService.PropertyNotifyEvent(aEvt);

return false;
}

NS_IMPL_ISUPPORTS(nsQtRemoteService,
nsIRemoteService,
nsIObserver)

nsQtRemoteService::nsQtRemoteService():
mServerWindow(0)
{
}

nsQtRemoteService::~nsQtRemoteService()
{
}

NS_IMETHODIMP
nsQtRemoteService::Startup(const char* aAppName, const char* aProfileName)
{
if (mServerWindow) return NS_ERROR_ALREADY_INITIALIZED;
NS_ASSERTION(aAppName, "Don't pass a null appname!");

XRemoteBaseStartup(aAppName,aProfileName);

//Create window, which is not shown.
mServerWindow = new MozQRemoteEventHandlerWidget(*this);

HandleCommandsFor(mServerWindow->winId());
return NS_OK;
}

NS_IMETHODIMP
nsQtRemoteService::RegisterWindow(nsIDOMWindow* aWindow)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

NS_IMETHODIMP
nsQtRemoteService::Shutdown()
{
if (!mServerWindow)
return NS_ERROR_NOT_INITIALIZED;

delete mServerWindow;
mServerWindow = nullptr;

return NS_OK;
}

void
nsQtRemoteService::PropertyNotifyEvent(XEvent *aEvt)
{
HandleNewProperty(aEvt->xproperty.window,
mozilla::DefaultXDisplay(),
aEvt->xproperty.time,
aEvt->xproperty.atom,
0);
}

void
nsQtRemoteService::SetDesktopStartupIDOrTimestamp(const nsACString& aDesktopStartupID,
uint32_t aTimestamp)
{
}

// {C0773E90-5799-4eff-AD03-3EBCD85624AC}
#define NS_REMOTESERVICE_CID \
{ 0xc0773e90, 0x5799, 0x4eff, { 0xad, 0x3, 0x3e, 0xbc, 0xd8, 0x56, 0x24, 0xac } }

NS_GENERIC_FACTORY_CONSTRUCTOR(nsQtRemoteService)
NS_DEFINE_NAMED_CID(NS_REMOTESERVICE_CID);

static const mozilla::Module::CIDEntry kRemoteCIDs[] = {
{ &kNS_REMOTESERVICE_CID, false, nullptr, nsQtRemoteServiceConstructor },
{ nullptr }
};

static const mozilla::Module::ContractIDEntry kRemoteContracts[] = {
{ "@mozilla.org/toolkit/remote-service;1", &kNS_REMOTESERVICE_CID },
{ nullptr }
};

static const mozilla::Module kRemoteModule = {
mozilla::Module::kVersion,
kRemoteCIDs,
kRemoteContracts
};

NSMODULE_DEFN(RemoteServiceModule) = &kRemoteModule;
37 changes: 37 additions & 0 deletions toolkit/components/remote/nsQtRemoteService.h
@@ -0,0 +1,37 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef __nsQtRemoteService_h__
#define __nsQtRemoteService_h__

#include "nsXRemoteService.h"
#include <X11/Xlib.h>

class RemoteEventHandlerWidget;

class nsQtRemoteService : public nsXRemoteService
{
public:
// We will be a static singleton, so don't use the ordinary methods.
NS_DECL_ISUPPORTS
NS_DECL_NSIREMOTESERVICE

nsQtRemoteService();

private:
virtual ~nsQtRemoteService();

virtual void SetDesktopStartupIDOrTimestamp(const nsACString& aDesktopStartupID,
uint32_t aTimestamp) override;

void PropertyNotifyEvent(XEvent *evt);
friend class MozQRemoteEventHandlerWidget;

QWindow *mServerWindow;
};

#endif // __nsQtRemoteService_h__
2 changes: 2 additions & 0 deletions toolkit/modules/AppConstants.jsm
Expand Up @@ -157,6 +157,8 @@ this.AppConstants = Object.freeze({
platform:
#ifdef MOZ_WIDGET_GTK
"linux",
#elif MOZ_WIDGET_QT
"linux",
#elif XP_WIN
"win",
#elif XP_MACOSX
Expand Down
2 changes: 1 addition & 1 deletion toolkit/moz.build
Expand Up @@ -38,7 +38,7 @@ if CONFIG['MOZ_MAINTENANCE_SERVICE']:

DIRS += ['xre']

if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'qt'):
DIRS += ['system/unixproxy']
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
DIRS += ['system/osxproxy']
Expand Down
2 changes: 1 addition & 1 deletion toolkit/themes/moz.build
Expand Up @@ -21,7 +21,7 @@ app = CONFIG['MOZ_BUILD_APP']

if toolkit == 'cocoa':
DIRS += ['osx']
elif toolkit in ('gtk2', 'gtk3'):
elif toolkit in ('gtk2', 'gtk3', 'qt'):
DIRS += ['linux']
elif app == 'mobile/android':
DIRS += ['mobile']
Expand Down
7 changes: 7 additions & 0 deletions toolkit/xre/moz.build
Expand Up @@ -44,6 +44,13 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
'nsNativeAppSupportDefault.cpp',
'UIKitDirProvider.mm',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
EXPORTS += ['nsQAppInstance.h']
SOURCES += [
'!moc_nsNativeAppSupportQt.cpp',
'nsNativeAppSupportQt.cpp',
'nsQAppInstance.cpp',
]
elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
UNIFIED_SOURCES += [
'nsNativeAppSupportUnix.cpp',
Expand Down

0 comments on commit 089fddd

Please sign in to comment.