commit 29ac393

Michael Forney  ·  2013-07-01 05:15:21 +0000 UTC
parent 533d15f
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.
2 files changed,  +14, -0
+5, -0
 1@@ -252,6 +252,9 @@ static void surface_destroy(struct wl_resource * resource)
 2 {
 3     struct swc_surface * surface = wl_resource_get_user_data(resource);
 4 
 5+    if (surface->shell_destructor)
 6+        surface->shell_destructor(surface);
 7+
 8     /* Finish the surface. */
 9     state_finish(&surface->state);
10     state_finish(&surface->pending.state);
11@@ -284,6 +287,8 @@ struct swc_surface * swc_surface_new(struct wl_client * client, uint32_t id)
12     surface->geometry.height = 0;
13     surface->border.width = 0;
14     surface->border.color = 0x000000;
15+    surface->shell_data = NULL;
16+    surface->shell_destructor = NULL;
17 
18     state_initialize(&surface->state);
19     state_initialize(&surface->pending.state);
+9, -0
 1@@ -39,6 +39,15 @@ struct swc_surface
 2     union swc_renderer_surface_state renderer_state;
 3     struct swc_compositor_surface_state compositor_state;
 4 
 5+    /* For usage by a shell implementation. */
 6+    void * shell_data;
 7+
 8+    /* Shells may want to use this destructor, guaranteed to run after all the
 9+     * other destroy listeners, rather than a destroy listener if they want to
10+     * do something like change keyboard focus after the currently focused
11+     * surface is destroyed. */
12+    void (* shell_destructor)(struct swc_surface * surface);
13+
14     struct
15     {
16         struct swc_surface_state state;