summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Bradford <rob@linux.intel.com>2011-12-08 17:32:27 +0000
committerRob Bradford <rob@linux.intel.com>2011-12-08 17:44:53 +0000
commit34cc45dae5f05be80e3eb389c55e40aed2e97bf4 (patch)
treef74ee53fdd07f30bcf9f7fef15311be510afaafa
parentaf294aafe600145a2d891ad9a0ba5418f6583cc6 (diff)
downloadclutter-34cc45dae5f05be80e3eb389c55e40aed2e97bf4.tar.gz
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.
-rw-r--r--clutter/wayland/clutter-backend-wayland.c30
-rw-r--r--clutter/wayland/clutter-stage-wayland.c36
2 files changed, 36 insertions, 30 deletions
diff --git a/clutter/wayland/clutter-backend-wayland.c b/clutter/wayland/clutter-backend-wayland.c
index cd3388018..8aa51b235 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 0407bf757..17843f124 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;
}