Bug 1504904 - Don't use GDK_IS_WAYLAND_DISPLAY() as it's missing on Gtk+ X11 only builds, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Mon, 12 Nov 2018 15:25:38 +0000
changeset 505207 05353b73a6ac0b364461093a90f0a02a3a1b32cb
parent 505206 92a23275c087fb829e45e766b23afeed7ea0b816
child 505208 8915c3a205b8baa99a08177bd30897f3e247cfae
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhorak
bugs1504904
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1504904 - Don't use GDK_IS_WAYLAND_DISPLAY() as it's missing on Gtk+ X11 only builds, r=jhorak Differential Revision: https://phabricator.services.mozilla.com/D11610
gfx/gl/GLContextProviderEGL.cpp
gfx/gl/GLLibraryEGL.cpp
gfx/thebes/gfxPlatformGtk.cpp
toolkit/xre/nsAppRunner.cpp
widget/gtk/ScreenHelperGTK.cpp
widget/gtk/mozcontainer.cpp
widget/gtk/mozwayland/mozwayland.c
widget/gtk/nsWindow.cpp
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -95,17 +95,17 @@ private:
 static nsDataHashtable<nsPtrHashKey<void>, WaylandGLSurface*>
         sWaylandGLSurface;
 
 void
 DeleteWaylandGLSurface(EGLSurface surface)
 {
     // We're running on Wayland which means our EGLSurface may
     // have attached Wayland backend data which must be released.
-    if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
+    if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
         auto entry = sWaylandGLSurface.Lookup(surface);
         if (entry) {
             delete entry.Data();
             entry.Remove();
         }
     }
 }
 #endif
@@ -965,17 +965,17 @@ GLContextProviderEGL::DestroyEGLSurface(
 #endif // defined(ANDROID)
 
 static void
 FillContextAttribs(bool alpha, bool depth, bool stencil, bool bpp16,
                    bool es3, nsTArray<EGLint>* out)
 {
     out->AppendElement(LOCAL_EGL_SURFACE_TYPE);
 #if defined(MOZ_WAYLAND)
-    if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
+    if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
         // Wayland on desktop does not support PBuffer or FBO.
         // We create a dummy wl_egl_window instead.
         out->AppendElement(LOCAL_EGL_WINDOW_BIT);
     } else {
         out->AppendElement(LOCAL_EGL_PBUFFER_BIT);
     }
 #else
     out->AppendElement(LOCAL_EGL_PBUFFER_BIT);
@@ -1096,17 +1096,17 @@ GLContextEGL::CreateEGLPBufferOffscreenC
 
     if (GLContext::ShouldSpew()) {
         egl->DumpEGLConfig(config);
     }
 
     mozilla::gfx::IntSize pbSize(size);
     EGLSurface surface = nullptr;
 #if defined(MOZ_WAYLAND)
-    if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
+    if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
         surface = GLContextEGL::CreateWaylandBufferSurface(config, pbSize);
     } else
 #endif
     {
         surface = GLContextEGL::CreatePBufferSurfaceTryingPowerOfTwo(config,
                                                                      LOCAL_EGL_NONE,
                                                                      pbSize);
     }
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -769,17 +769,17 @@ GLLibraryEGL::CreateDisplay(bool forceAc
             }
             mIsWARP = true;
         }
     } else {
         void *nativeDisplay = EGL_DEFAULT_DISPLAY;
 #ifdef MOZ_WAYLAND
         // Some drivers doesn't support EGL_DEFAULT_DISPLAY
         GdkDisplay *gdkDisplay = gdk_display_get_default();
-        if (GDK_IS_WAYLAND_DISPLAY(gdkDisplay)) {
+        if (!GDK_IS_X11_DISPLAY(gdkDisplay)) {
             static auto sGdkWaylandDisplayGetWlDisplay =
                 (wl_display *(*)(GdkDisplay *))
                 dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
             nativeDisplay = sGdkWaylandDisplayGetWlDisplay(gdkDisplay);
             if (!nativeDisplay) {
                 NS_WARNING("Failed to get wl_display.");
                 return nullptr;
             }
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -794,17 +794,17 @@ private:
   // We need a refcounted VsyncSource::Display to use chromium IPC runnables.
   RefPtr<GLXDisplay> mGlobalDisplay;
 };
 
 already_AddRefed<gfx::VsyncSource>
 gfxPlatformGtk::CreateHardwareVsyncSource()
 {
 #ifdef MOZ_WAYLAND
-  if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
+  if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
     RefPtr<VsyncSource> vsyncSource = new GtkVsyncSource();
     VsyncSource::Display& display = vsyncSource->GetGlobalDisplay();
     static_cast<GtkVsyncSource::GLXDisplay&>(display).SetupWayland();
     return vsyncSource.forget();
   }
 #endif
 
   // Only use GLX vsync when the OpenGL compositor is being used.
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -4029,17 +4029,17 @@ XREMain::XRE_mainStartup(bool* aExitFlag
       }
       gdk_display_manager_set_default_display(gdk_display_manager_get(),
                                               mGdkDisplay);
       if (saveDisplayArg) {
         if (GDK_IS_X11_DISPLAY(mGdkDisplay)) {
             SaveWordToEnv("DISPLAY", nsDependentCString(display_name));
         }
 #ifdef MOZ_WAYLAND
-        else if (GDK_IS_WAYLAND_DISPLAY(mGdkDisplay)) {
+        else if (!GDK_IS_X11_DISPLAY(mGdkDisplay)) {
             SaveWordToEnv("WAYLAND_DISPLAY", nsDependentCString(display_name));
         }
 #endif
       }
     }
 #ifdef MOZ_WIDGET_GTK
     else {
       mGdkDisplay = gdk_display_manager_open_display(gdk_display_manager_get(),
--- a/widget/gtk/ScreenHelperGTK.cpp
+++ b/widget/gtk/ScreenHelperGTK.cpp
@@ -150,17 +150,17 @@ MakeScreen(GdkScreen* aScreen, gint aMon
                                 workarea.width * gdkScaleFactor,
                                 workarea.height * gdkScaleFactor);
   uint32_t pixelDepth = GetGTKPixelDepth();
 
   // Use per-monitor scaling factor in gtk/wayland, or 1.0 otherwise.
   DesktopToLayoutDeviceScale contentsScale(1.0);
 #ifdef MOZ_WAYLAND
     GdkDisplay* gdkDisplay = gdk_display_get_default();
-    if (GDK_IS_WAYLAND_DISPLAY(gdkDisplay)) {
+    if (!GDK_IS_X11_DISPLAY(gdkDisplay)) {
       contentsScale.scale = gdkScaleFactor;
     }
 #endif
 
   CSSToLayoutDeviceScale defaultCssScale(
     gdkScaleFactor * gfxPlatformGtk::GetFontScaleFactor());
 
   float dpi = 96.0f;
--- a/widget/gtk/mozcontainer.cpp
+++ b/widget/gtk/mozcontainer.cpp
@@ -210,17 +210,17 @@ moz_container_init (MozContainer *contai
     {
       container->subcompositor = nullptr;
       container->surface = nullptr;
       container->subsurface = nullptr;
       container->eglwindow = nullptr;
       container->parent_surface_committed = false;
 
       GdkDisplay *gdk_display = gtk_widget_get_display(GTK_WIDGET(container));
-      if (GDK_IS_WAYLAND_DISPLAY (gdk_display)) {
+      if (!GDK_IS_X11_DISPLAY(gdk_display)) {
           // Available as of GTK 3.8+
           static auto sGdkWaylandDisplayGetWlDisplay =
               (wl_display *(*)(GdkDisplay *))
               dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
 
           wl_display* display = sGdkWaylandDisplayGetWlDisplay(gdk_display);
           wl_registry* registry = wl_display_get_registry(display);
           wl_registry_add_listener(registry, &registry_listener, container);
--- a/widget/gtk/mozwayland/mozwayland.c
+++ b/widget/gtk/mozwayland/mozwayland.c
@@ -298,17 +298,8 @@ wl_egl_window_destroy(struct wl_egl_wind
 
 MOZ_EXPORT void
 wl_egl_window_resize(struct wl_egl_window *egl_window,
                      int width, int height,
                      int dx, int dy)
 {
 }
 
-MOZ_EXPORT GType
-gdk_wayland_display_get_type(void)
-{
-   // This shouldn't be ever called.
-   abort();
-
-   return GDK_TYPE_X11_DISPLAY;
-}
-
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -828,17 +828,17 @@ nsWindow::GetDefaultScaleInternal()
     return GdkScaleFactor() * gfxPlatformGtk::GetFontScaleFactor();
 }
 
 DesktopToLayoutDeviceScale
 nsWindow::GetDesktopToDeviceScale()
 {
 #ifdef MOZ_WAYLAND
     GdkDisplay* gdkDisplay = gdk_display_get_default();
-    if (GDK_IS_WAYLAND_DISPLAY(gdkDisplay)) {
+    if (!GDK_IS_X11_DISPLAY(gdkDisplay)) {
         return DesktopToLayoutDeviceScale(GdkScaleFactor());
     }
 #endif
 
     // In Gtk/X11, we manage windows using device pixels.
     return DesktopToLayoutDeviceScale(1.0);
 }
 
@@ -848,17 +848,17 @@ nsWindow::GetDesktopToDeviceScaleByScree
 #ifdef MOZ_WAYLAND
     GdkDisplay* gdkDisplay = gdk_display_get_default();
     // In Wayland there's no way to get absolute position of the window and use it to
     // determine the screen factor of the monitor on which the window is placed.
     // The window is notified of the current scale factor but not at this point,
     // so the GdkScaleFactor can return wrong value which can lead to wrong popup
     // placement.
     // We need to use parent's window scale factor for the new one.
-    if (GDK_IS_WAYLAND_DISPLAY(gdkDisplay)) {
+    if (!GDK_IS_X11_DISPLAY(gdkDisplay)) {
         nsView* view = nsView::GetViewFor(this);
         if (view) {
             nsView* parentView = view->GetParent();
             if (parentView) {
                 nsIWidget* parentWidget = parentView->GetNearestWidget(nullptr);
                 if (parentWidget) {
                     return DesktopToLayoutDeviceScale(parentWidget->RoundsWidgetCoordinatesTo());
                 } else {