[clutter] wayland: Update to latest Wayland API (wl_shell_surface transition)



commit 34cc45dae5f05be80e3eb389c55e40aed2e97bf4
Author: Rob Bradford <rob linux intel com>
Date:   Thu Dec 8 17:32:27 2011 +0000

    wayland: Update to latest Wayland API (wl_shell_surface transition)
    
    Previously the wl_shell object held the methods that allowed a client to
    request changes to the shell's state associated with a surface. These methods
    have now been moved to a wl_shell_surface object.
    
    This change allows configure events to be handled inside the stage rather than
    the backend.

 clutter/wayland/clutter-backend-wayland.c |   30 +-----------------------
 clutter/wayland/clutter-stage-wayland.c   |   36 ++++++++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 30 deletions(-)
---
diff --git a/clutter/wayland/clutter-backend-wayland.c b/clutter/wayland/clutter-backend-wayland.c
index cd33880..8aa51b2 100644
--- a/clutter/wayland/clutter-backend-wayland.c
+++ b/clutter/wayland/clutter-backend-wayland.c
@@ -68,34 +68,7 @@ clutter_backend_wayland_dispose (GObject *gobject)
   G_OBJECT_CLASS (clutter_backend_wayland_parent_class)->dispose (gobject);
 }
 
-static void
-handle_configure (void *data,
-                  struct wl_shell *shell,
-                  uint32_t timestamp,
-                  uint32_t edges,
-                  struct wl_surface *surface,
-                  int32_t width,
-                  int32_t height)
-{
-  ClutterStageCogl *stage_cogl = wl_surface_get_user_data (surface);
-  CoglFramebuffer *fb = COGL_FRAMEBUFFER (stage_cogl->onscreen);
-
-  if (cogl_framebuffer_get_width (fb) != width ||
-      cogl_framebuffer_get_height (fb) != height)
-    clutter_actor_queue_relayout (CLUTTER_ACTOR (stage_cogl->wrapper));
-
-  clutter_actor_set_size (CLUTTER_ACTOR (stage_cogl->wrapper),
-                         width, height);
 
-  /* the resize process is complete, so we can ask the stage
-   * to set up the GL viewport with the new size
-   */
-  clutter_stage_ensure_viewport (stage_cogl->wrapper);
-}
-
-static const struct wl_shell_listener shell_listener = {
-       handle_configure,
-};
 
 static void
 display_handle_global (struct wl_display *display,
@@ -118,8 +91,7 @@ display_handle_global (struct wl_display *display,
     {
       backend_wayland->wayland_shell =
         wl_display_bind (display, id, &wl_shell_interface);
-      wl_shell_add_listener (backend_wayland->wayland_shell,
-                             &shell_listener, backend_wayland);
+
     }
   else if (strcmp (interface, "wl_shm") == 0)
     backend_wayland->wayland_shm =
diff --git a/clutter/wayland/clutter-stage-wayland.c b/clutter/wayland/clutter-stage-wayland.c
index 0407bf7..17843f1 100644
--- a/clutter/wayland/clutter-stage-wayland.c
+++ b/clutter/wayland/clutter-stage-wayland.c
@@ -46,19 +46,53 @@ G_DEFINE_TYPE_WITH_CODE (ClutterStageWayland,
                          G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
                                                 clutter_stage_window_iface_init));
 
+static void
+handle_configure (void *data,
+                  struct wl_shell_surface *shell_surface,
+                  uint32_t timestamp,
+                  uint32_t edges,
+                  int32_t width,
+                  int32_t height)
+{
+  ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL(data);
+  CoglFramebuffer *fb = COGL_FRAMEBUFFER (stage_cogl->onscreen);
+
+  if (cogl_framebuffer_get_width (fb) != width ||
+      cogl_framebuffer_get_height (fb) != height)
+    clutter_actor_queue_relayout (CLUTTER_ACTOR (stage_cogl->wrapper));
+
+  clutter_actor_set_size (CLUTTER_ACTOR (stage_cogl->wrapper),
+                         width, height);
+
+  /* the resize process is complete, so we can ask the stage
+   * to set up the GL viewport with the new size
+   */
+  clutter_stage_ensure_viewport (stage_cogl->wrapper);
+}
+
+static const struct wl_shell_surface_listener shell_surface_listener = {
+       handle_configure,
+};
+
 static gboolean
 clutter_stage_wayland_realize (ClutterStageWindow *stage_window)
 {
   ClutterStageWayland *stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window);
   ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
   struct wl_surface *wl_surface;
+  struct wl_shell_surface *wl_shell_surface;
 
   clutter_stage_window_parent_iface->realize (stage_window);
 
   wl_surface = cogl_wayland_onscreen_get_surface (stage_cogl->onscreen);
-
   wl_surface_set_user_data (wl_surface, stage_wayland);
 
+  wl_shell_surface =
+    cogl_wayland_onscreen_get_shell_surface (stage_cogl->onscreen);
+  wl_shell_surface_add_listener (wl_shell_surface,
+                                 &shell_surface_listener,
+                                 stage_wayland);
+
   return TRUE;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]