Created
February 9, 2018 21:39
-
-
Save valpackett/99f2df1a29652c0b75f2799e4b1aad38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git i/gfx/gl/GLContextProviderEGL.cpp w/gfx/gl/GLContextProviderEGL.cpp | |
index d3dffdc9e6ab..a86827206d04 100644 | |
--- i/gfx/gl/GLContextProviderEGL.cpp | |
+++ w/gfx/gl/GLContextProviderEGL.cpp | |
@@ -5,9 +5,10 @@ | |
#if defined(MOZ_WIDGET_GTK) | |
#include <gdk/gdkx.h> | |
+ #include <gdk/gdkwayland.h> | |
// we're using default display for now | |
- #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget) ((EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow*)aWidget->GetNativeData(NS_NATIVE_WINDOW))) | |
- #define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget) ((EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow*)aWidget->RealWidget()->GetNativeData(NS_NATIVE_WINDOW))) | |
+ #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget) (GDK_IS_WAYLAND_WINDOW((GdkWindow*)aWidget->GetNativeData(NS_NATIVE_WINDOW)) ? (EGLNativeWindowType)gdk_wayland_window_get_wl_surface((GdkWindow*)aWidget->GetNativeData(NS_NATIVE_WINDOW)) : (EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow*)aWidget->GetNativeData(NS_NATIVE_WINDOW))) | |
+ #define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget) (GDK_IS_WAYLAND_WINDOW((GdkWindow*)aWidget->RealWidget()->GetNativeData(NS_NATIVE_WINDOW)) ? (EGLNativeWindowType)gdk_wayland_window_get_wl_surface((GdkWindow*)aWidget->RealWidget()->GetNativeData(NS_NATIVE_WINDOW)) : (EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow*)aWidget->RealWidget()->GetNativeData(NS_NATIVE_WINDOW))) | |
#elif defined(MOZ_WIDGET_ANDROID) | |
#define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_JAVA_SURFACE)) | |
#define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget) (aWidget->AsAndroid()->GetEGLNativeWindow()) | |
diff --git i/gfx/gl/GLLibraryEGL.cpp w/gfx/gl/GLLibraryEGL.cpp | |
index 3a9d9f6b7613..398f1b4678e9 100644 | |
--- i/gfx/gl/GLLibraryEGL.cpp | |
+++ w/gfx/gl/GLLibraryEGL.cpp | |
@@ -25,6 +25,9 @@ | |
#include <d3d11.h> | |
#endif | |
+#ifdef MOZ_WAYLAND | |
+#include <gdk/gdkwayland.h> | |
+#endif | |
#include "OGLShaderProgram.h" | |
#include "prenv.h" | |
#include "prsystem.h" | |
@@ -567,7 +570,14 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId | |
mIsWARP = true; | |
} | |
} else { | |
- chosenDisplay = GetAndInitDisplay(*this, EGL_DEFAULT_DISPLAY); | |
+ void* egl_display = EGL_DEFAULT_DISPLAY; | |
+#ifdef GDK_WINDOWING_WAYLAND | |
+ GdkDisplay* display = gdk_display_get_default(); | |
+ if (GDK_IS_WAYLAND_DISPLAY (display)) { | |
+ egl_display = (void*)gdk_wayland_display_get_wl_display(display); | |
+ } | |
+#endif | |
+ chosenDisplay = GetAndInitDisplay(*this, egl_display); | |
} | |
if (!chosenDisplay) { | |
diff --git i/gfx/gl/moz.build w/gfx/gl/moz.build | |
index 9ba59f96597c..7bbe14005c6d 100644 | |
--- i/gfx/gl/moz.build | |
+++ w/gfx/gl/moz.build | |
@@ -157,6 +157,10 @@ CXXFLAGS += CONFIG['TK_CFLAGS'] | |
CFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] | |
CFLAGS += CONFIG['TK_CFLAGS'] | |
+ | |
+if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT'] and CONFIG['MOZ_WAYLAND']: | |
+ OS_LIBS += ['gdk-3'] | |
+ | |
LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES'] | |
if CONFIG['CC_TYPE'] in ('clang', 'gcc'): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment