mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
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.
This commit is contained in:
parent
af294aafe6
commit
34cc45dae5
@ -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 =
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user