Bug 1415078 - Use DBus remote exclusively on MOZ_WAYLAND builds, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Mon, 01 Oct 2018 08:17:04 +0000
changeset 487295 1b1f60137afc591468e5e144f0d29123b62fa6a6
parent 487294 ea8e57754ff21e84274c9cbd967466856c8a5275
child 487296 59ea9b4671d0bd8491e03f2c735d402ef6d7fc23
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewersjhorak
bugs1415078
milestone64.0a1
Bug 1415078 - Use DBus remote exclusively on MOZ_WAYLAND builds, r=jhorak Differential Revision: https://phabricator.services.mozilla.com/D6899
toolkit/components/remote/nsRemoteService.cpp
widget/xremoteclient/moz.build
--- a/toolkit/components/remote/nsRemoteService.cpp
+++ b/toolkit/components/remote/nsRemoteService.cpp
@@ -29,30 +29,28 @@
 
 NS_IMPL_ISUPPORTS(nsRemoteService,
                   nsIRemoteService,
                   nsIObserver)
 
 NS_IMETHODIMP
 nsRemoteService::Startup(const char* aAppName, const char* aProfileName)
 {
-#if defined(MOZ_ENABLE_DBUS)
+#if defined(MOZ_ENABLE_DBUS) && defined(MOZ_WAYLAND)
     nsresult rv;
     mDBusRemoteService = new nsDBusRemoteService();
     rv = mDBusRemoteService->Startup(aAppName, aProfileName);
     if (NS_FAILED(rv)) {
         mDBusRemoteService = nullptr;
     }
+#elif !defined(MOZ_WAYLAND)
+    mGtkRemoteService = new nsGTKRemoteService();
+    mGtkRemoteService->Startup(aAppName, aProfileName);
 #endif
 
-    if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
-        mGtkRemoteService = new nsGTKRemoteService();
-        mGtkRemoteService->Startup(aAppName, aProfileName);
-    }
-
     if (!mDBusRemoteService && !mGtkRemoteService)
         return NS_ERROR_FAILURE;
 
     nsCOMPtr<nsIObserverService> obs(do_GetService("@mozilla.org/observer-service;1"));
     if (obs) {
         obs->AddObserver(this, "xpcom-shutdown", false);
         obs->AddObserver(this, "quit-application", false);
     }
@@ -68,17 +66,17 @@ nsRemoteService::RegisterWindow(mozIDOMW
         mGtkRemoteService->RegisterWindow(aWindow);
     }
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsRemoteService::Shutdown()
 {
-#if defined(MOZ_ENABLE_DBUS)
+#if defined(MOZ_ENABLE_DBUS) && defined(MOZ_WAYLAND)
     if (mDBusRemoteService) {
         mDBusRemoteService->Shutdown();
         mDBusRemoteService = nullptr;
     }
 #endif
     if (mGtkRemoteService) {
         mGtkRemoteService->Shutdown();
         mGtkRemoteService = nullptr;
--- a/widget/xremoteclient/moz.build
+++ b/widget/xremoteclient/moz.build
@@ -6,17 +6,20 @@
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "Widget")
 
 FINAL_LIBRARY = 'xul'
 
 SOURCES += [
     'RemoteUtils.cpp',
-    'XRemoteClient.cpp',
 ]
 
 if CONFIG['MOZ_ENABLE_DBUS'] and CONFIG['MOZ_WAYLAND']:
     SOURCES += [
         'DBusRemoteClient.cpp',
     ]
     CXXFLAGS += CONFIG['TK_CFLAGS']
     CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
+else:
+    SOURCES += [
+        'XRemoteClient.cpp',
+    ]