Bug 1425841 - Implement GetWaylandDisplay() and GetWaylandSurface() needed by WindowSurfaceWayland, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Mon, 18 Dec 2017 15:53:50 +0100
changeset 714428 8f0367c9a53aeca41c5eb1d03b09a2365a7a88b1
parent 714427 6f1f9f585d3aa0b8ee83b887731798f9172fb20d
child 714429 b5e9d1d990501f52afa3c5e1b813b13fc2b58ec0
push id93921
push userhikezoe@mozilla.com
push dateSat, 23 Dec 2017 03:48:11 +0000
reviewersjhorak
bugs1425841
milestone59.0a1
Bug 1425841 - Implement GetWaylandDisplay() and GetWaylandSurface() needed by WindowSurfaceWayland, r=jhorak MozReview-Commit-ID: Hlo1ceAIrL2
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -7094,8 +7094,24 @@ nsWindow::IsComposited() const
     return false;
   }
 
   GdkScreen* gdkScreen = gdk_screen_get_default();
   return gdk_screen_is_composited(gdkScreen) &&
          (gdk_window_get_visual(mGdkWindow)
             == gdk_screen_get_rgba_visual(gdkScreen));
 }
+
+#ifdef MOZ_WAYLAND
+wl_display*
+nsWindow::GetWaylandDisplay()
+{
+  GdkDisplay* gdkDisplay = gdk_display_get_default();
+  return mIsX11Display ? nullptr :
+                         gdk_wayland_display_get_wl_display(gdkDisplay);
+}
+
+wl_surface*
+nsWindow::GetWaylandSurface()
+{
+  return moz_container_get_wl_surface(MOZ_CONTAINER(mContainer));
+}
+#endif
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -19,16 +19,19 @@
 #include "nsBaseWidget.h"
 #include "CompositorWidget.h"
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
 #ifdef MOZ_X11
 #include <gdk/gdkx.h>
 #endif /* MOZ_X11 */
+#ifdef MOZ_WAYLAND
+#include <gdk/gdkwayland.h>
+#endif
 
 #include "mozilla/widget/WindowSurface.h"
 #include "mozilla/widget/WindowSurfaceProvider.h"
 
 #ifdef ACCESSIBILITY
 #include "mozilla/a11y/Accessible.h"
 #endif
 #include "mozilla/EventForwards.h"
@@ -343,19 +346,24 @@ public:
     virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
                                                 TouchPointerState aPointerState,
                                                 LayoutDeviceIntPoint aPoint,
                                                 double aPointerPressure,
                                                 uint32_t aPointerOrientation,
                                                 nsIObserver* aObserver) override;
 #endif
 
+
 #ifdef MOZ_X11
     Display* XDisplay() { return mXDisplay; }
 #endif
+#ifdef MOZ_WAYLAND
+    wl_display* GetWaylandDisplay();
+    wl_surface* GetWaylandSurface();
+#endif
     virtual void GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData) override;
 
     virtual nsresult SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
     void SetDrawsInTitlebar(bool aState) override;
 
     // HiDPI scale conversion
     gint GdkScaleFactor();