commit 29ac3936fe7e2524282e82220e3a75a46dedee38
parent 533d15f0207be6debc2f14c7bbe6c50c8ba2ceef
Author: Michael Forney <mforney@mforney.org>
Date: Sun, 30 Jun 2013 22:15:21 -0700
Add shell_data and shell_destructor to surface
This is useful if a shell wants to change the focus when a focused
surface gets destroyed.
Diffstat:
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/surface.c b/surface.c
@@ -252,6 +252,9 @@ static void surface_destroy(struct wl_resource * resource)
{
struct swc_surface * surface = wl_resource_get_user_data(resource);
+ if (surface->shell_destructor)
+ surface->shell_destructor(surface);
+
/* Finish the surface. */
state_finish(&surface->state);
state_finish(&surface->pending.state);
@@ -284,6 +287,8 @@ struct swc_surface * swc_surface_new(struct wl_client * client, uint32_t id)
surface->geometry.height = 0;
surface->border.width = 0;
surface->border.color = 0x000000;
+ surface->shell_data = NULL;
+ surface->shell_destructor = NULL;
state_initialize(&surface->state);
state_initialize(&surface->pending.state);
diff --git a/surface.h b/surface.h
@@ -39,6 +39,15 @@ struct swc_surface
union swc_renderer_surface_state renderer_state;
struct swc_compositor_surface_state compositor_state;
+ /* For usage by a shell implementation. */
+ void * shell_data;
+
+ /* Shells may want to use this destructor, guaranteed to run after all the
+ * other destroy listeners, rather than a destroy listener if they want to
+ * do something like change keyboard focus after the currently focused
+ * surface is destroyed. */
+ void (* shell_destructor)(struct swc_surface * surface);
+
struct
{
struct swc_surface_state state;