Title: [185453] trunk
Revision
185453
Author
clo...@igalia.com
Date
2015-06-11 08:21:07 -0700 (Thu, 11 Jun 2015)

Log Message

[GTK] [Wayland] Should be possible to build with support for both X11 and Wayland.
https://bugs.webkit.org/show_bug.cgi?id=145701

Reviewed by Žan Doberšek.

.:

* Source/cmake/OptionsGTK.cmake: Remove conflicting options.

Source/WebCore:

No new tests, no behavior changes.

When building both targets, we have to include the wayland-egl
headers in order to build the Wayland target. This causes that
EGLNativePixmapType and EGLNativeWindowType get defined as
different types than when building only the X11 target.

By type casting them to the ones that are expected, we are able
to build both targets at the same time.

I have done tests (building each target alone as also both targets
at the same time), and everything seems to works as expected.

Once built for both targets, if you try to launch the MiniBrowser
from inside a Wayland compositor (Weston on top of X for example),
it will trigger the X11 target if the DISPLAY environment variable
is set and the environment variable GDK_BACKEND is not set to wayland,
otherwise it will trigger the Wayland target.

* platform/graphics/GLContext.cpp:
(WebCore::GLContext::createContextForWindow): Add type cast.
* platform/graphics/egl/GLContextEGL.cpp: Add missing include when
building both targets that is required for defining DefaultRootWindow().
(WebCore::GLContextEGL::createPixmapContext): Add type cast.

Modified Paths

Diff

Modified: trunk/ChangeLog (185452 => 185453)


--- trunk/ChangeLog	2015-06-11 12:05:25 UTC (rev 185452)
+++ trunk/ChangeLog	2015-06-11 15:21:07 UTC (rev 185453)
@@ -1,3 +1,12 @@
+2015-06-11  Carlos Alberto Lopez Perez  <clo...@igalia.com>
+
+        [GTK] [Wayland] Should be possible to build with support for both X11 and Wayland.
+        https://bugs.webkit.org/show_bug.cgi?id=145701
+
+        Reviewed by Žan Doberšek.
+
+        * Source/cmake/OptionsGTK.cmake: Remove conflicting options.
+
 2015-06-03  Daniel Bates  <daba...@apple.com>
 
         Caps lock indicator should not be shown in read-only or disabled field

Modified: trunk/Source/WebCore/ChangeLog (185452 => 185453)


--- trunk/Source/WebCore/ChangeLog	2015-06-11 12:05:25 UTC (rev 185452)
+++ trunk/Source/WebCore/ChangeLog	2015-06-11 15:21:07 UTC (rev 185453)
@@ -1,3 +1,35 @@
+2015-06-11  Carlos Alberto Lopez Perez  <clo...@igalia.com>
+
+        [GTK] [Wayland] Should be possible to build with support for both X11 and Wayland.
+        https://bugs.webkit.org/show_bug.cgi?id=145701
+
+        Reviewed by Žan Doberšek.
+
+        No new tests, no behavior changes.
+
+        When building both targets, we have to include the wayland-egl
+        headers in order to build the Wayland target. This causes that
+        EGLNativePixmapType and EGLNativeWindowType get defined as
+        different types than when building only the X11 target.
+
+        By type casting them to the ones that are expected, we are able
+        to build both targets at the same time.
+
+        I have done tests (building each target alone as also both targets
+        at the same time), and everything seems to works as expected.
+
+        Once built for both targets, if you try to launch the MiniBrowser
+        from inside a Wayland compositor (Weston on top of X for example),
+        it will trigger the X11 target if the DISPLAY environment variable
+        is set and the environment variable GDK_BACKEND is not set to wayland,
+        otherwise it will trigger the Wayland target.
+
+        * platform/graphics/GLContext.cpp:
+        (WebCore::GLContext::createContextForWindow): Add type cast.
+        * platform/graphics/egl/GLContextEGL.cpp: Add missing include when
+        building both targets that is required for defining DefaultRootWindow().
+        (WebCore::GLContextEGL::createPixmapContext): Add type cast.
+
 2015-06-11  Hunseop Jeong  <hs85.je...@samsung.com>
 
         [EFL] Fix the debug build after r185417.

Modified: trunk/Source/WebCore/platform/graphics/GLContext.cpp (185452 => 185453)


--- trunk/Source/WebCore/platform/graphics/GLContext.cpp	2015-06-11 12:05:25 UTC (rev 185452)
+++ trunk/Source/WebCore/platform/graphics/GLContext.cpp	2015-06-11 15:21:07 UTC (rev 185453)
@@ -123,7 +123,7 @@
 #endif
 
 #if USE(GLX)
-    if (auto glxContext = GLContextGLX::createContext(windowHandle, sharingContext))
+    if (auto glxContext = GLContextGLX::createContext(reinterpret_cast<XID>(windowHandle), sharingContext))
         return WTF::move(glxContext);
 #endif
 #if USE(EGL)

Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp (185452 => 185453)


--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2015-06-11 12:05:25 UTC (rev 185452)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2015-06-11 15:21:07 UTC (rev 185453)
@@ -37,6 +37,7 @@
 
 #if PLATFORM(X11)
 #include "PlatformDisplayX11.h"
+#include <X11/Xlib.h>
 #endif
 
 #if ENABLE(ACCELERATED_2D_CANVAS)
@@ -171,7 +172,7 @@
         return nullptr;
     }
 
-    EGLSurface surface = eglCreatePixmapSurface(display, config, pixmap.get(), 0);
+    EGLSurface surface = eglCreatePixmapSurface(display, config, reinterpret_cast<EGLNativePixmapType>(pixmap.get()), 0);
     if (surface == EGL_NO_SURFACE) {
         eglDestroyContext(display, context);
         return nullptr;

Modified: trunk/Source/cmake/OptionsGTK.cmake (185452 => 185453)


--- trunk/Source/cmake/OptionsGTK.cmake	2015-06-11 12:05:25 UTC (rev 185452)
+++ trunk/Source/cmake/OptionsGTK.cmake	2015-06-11 15:21:07 UTC (rev 185453)
@@ -80,9 +80,6 @@
 # FIXME: Can we use cairo-glesv2 to avoid this conflict?
 WEBKIT_OPTION_CONFLICT(ENABLE_ACCELERATED_2D_CANVAS ENABLE_GLES2)
 
-# FIXME: Should be possible to build with support for both X11 and Wayland.
-WEBKIT_OPTION_CONFLICT(ENABLE_WAYLAND_TARGET ENABLE_X11_TARGET)
-
 WEBKIT_OPTION_DEPEND(ENABLE_3D_TRANSFORMS ENABLE_OPENGL)
 WEBKIT_OPTION_DEPEND(ENABLE_ACCELERATED_2D_CANVAS ENABLE_OPENGL)
 WEBKIT_OPTION_DEPEND(ENABLE_GLES2 ENABLE_OPENGL)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to