Track Wayland changes
authorPaul Olav Tvete <paul.tvete@nokia.com>
Mon, 23 May 2011 10:29:54 +0000 (12:29 +0200)
committerPaul Olav Tvete <paul.tvete@nokia.com>
Mon, 23 May 2011 10:59:29 +0000 (12:59 +0200)
The wl_display_get_xxxx_visual() functions have been removed, and
are replaced by a compositor event.

Reviewed-by: Samuel
src/plugins/platforms/wayland/qwaylanddisplay.cpp
src/plugins/platforms/wayland/qwaylanddisplay.h
src/plugins/platforms/wayland/wayland_sha1.txt [new file with mode: 0644]

index 9011f57..7d7ffce 100644 (file)
@@ -81,17 +81,17 @@ struct wl_buffer *QWaylandDisplay::createShmBuffer(int fd,
 
 struct wl_visual *QWaylandDisplay::rgbVisual()
 {
-    return wl_display_get_rgb_visual(mDisplay);
+    return rgb_visual;
 }
 
 struct wl_visual *QWaylandDisplay::argbVisual()
 {
-    return wl_display_get_argb_visual(mDisplay);
+    return argb_visual;
 }
 
 struct wl_visual *QWaylandDisplay::argbPremultipliedVisual()
 {
-    return wl_display_get_premultiplied_argb_visual(mDisplay);
+    return premultiplied_argb_visual;
 }
 
 #ifdef QT_WAYLAND_GL_SUPPORT
@@ -127,6 +127,7 @@ const struct wl_shell_listener QWaylandDisplay::shellListener = {
 };
 
 QWaylandDisplay::QWaylandDisplay(void)
+    : argb_visual(0), premultiplied_argb_visual(0), rgb_visual(0)
 {
     mDisplay = wl_display_connect(NULL);
     if (mDisplay == NULL) {
@@ -243,6 +244,11 @@ const struct wl_output_listener QWaylandDisplay::outputListener = {
     QWaylandDisplay::outputHandleGeometry
 };
 
+const struct wl_compositor_listener QWaylandDisplay::compositorListener = {
+    QWaylandDisplay::handleVisual,
+};
+
+
 void QWaylandDisplay::waitForScreens()
 {
     flushRequests();
@@ -271,6 +277,8 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id,
         wl_output_add_listener(output, &outputListener, this);
     } else if (interface == "wl_compositor") {
         mCompositor = wl_compositor_create(mDisplay, id, 1);
+        wl_compositor_add_listener(mCompositor,
+                                   &compositorListener, this);
     } else if (interface == "wl_shm") {
         mShm = wl_shm_create(mDisplay, id, 1);
     } else if (interface == "wl_shell"){
@@ -286,3 +294,23 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id,
         clipboard->createSelectionOffer(id);
     }
 }
+
+void QWaylandDisplay::handleVisual(void *data,
+                                   struct wl_compositor *compositor,
+                                   uint32_t id, uint32_t token)
+{
+    QWaylandDisplay *self = static_cast<QWaylandDisplay *>(data);
+
+    switch (token) {
+    case WL_COMPOSITOR_VISUAL_ARGB32:
+        self->argb_visual = wl_visual_create(self->mDisplay, id, 1);
+        break;
+    case WL_COMPOSITOR_VISUAL_PREMULTIPLIED_ARGB32:
+        self->premultiplied_argb_visual =
+            wl_visual_create(self->mDisplay, id, 1);
+        break;
+    case WL_COMPOSITOR_VISUAL_XRGB32:
+        self->rgb_visual = wl_visual_create(self->mDisplay, id, 1);
+        break;
+    }
+}
index 6266360..16ab3f7 100644 (file)
@@ -116,7 +116,10 @@ private:
 
     uint32_t mSocketMask;
 
+    struct wl_visual *argb_visual, *premultiplied_argb_visual, *rgb_visual;
+
     static const struct wl_output_listener outputListener;
+    static const struct wl_compositor_listener compositorListener;
     static int sourceUpdate(uint32_t mask, void *data);
     static void displayHandleGlobal(struct wl_display *display,
                                     uint32_t id,
@@ -127,6 +130,9 @@ private:
                                      int32_t x, int32_t y,
                                      int32_t width, int32_t height);
 
+    static void handleVisual(void *data,
+                                       struct wl_compositor *compositor,
+                                       uint32_t id, uint32_t token);
 #ifdef QT_WAYLAND_GL_SUPPORT
     QWaylandGLIntegration *mEglIntegration;
 #endif
diff --git a/src/plugins/platforms/wayland/wayland_sha1.txt b/src/plugins/platforms/wayland/wayland_sha1.txt
new file mode 100644 (file)
index 0000000..d262437
--- /dev/null
@@ -0,0 +1,3 @@
+This version of the Qt Wayland plugin is checked against the following sha1
+from the Wayland repository:
+eff7fc0d99be2e51eaa351785030c8d374ac71de