x11: Add a destroy listener for X11 surfaces
This commit is contained in:
@@ -952,6 +952,7 @@ shell_init(struct wlsc_compositor *ec)
|
|||||||
if (shell == NULL)
|
if (shell == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
memset(shell, 0, sizeof *shell);
|
||||||
shell->compositor = ec;
|
shell->compositor = ec;
|
||||||
shell->shell.activate = activate;
|
shell->shell.activate = activate;
|
||||||
shell->shell.lock = lock;
|
shell->shell.lock = lock;
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ struct wlsc_wm {
|
|||||||
struct wlsc_wm_window {
|
struct wlsc_wm_window {
|
||||||
xcb_window_t id;
|
xcb_window_t id;
|
||||||
struct wlsc_surface *surface;
|
struct wlsc_surface *surface;
|
||||||
|
struct wl_listener surface_destroy_listener;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -567,6 +568,17 @@ wlsc_xserver_cleanup(struct wlsc_process *process, int status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
surface_destroy(struct wl_listener *listener,
|
||||||
|
struct wl_resource *resource, uint32_t time)
|
||||||
|
{
|
||||||
|
struct wlsc_wm_window *window =
|
||||||
|
container_of(listener,
|
||||||
|
struct wlsc_wm_window, surface_destroy_listener);
|
||||||
|
|
||||||
|
fprintf(stderr, "surface for xid %d destroyed\n", window->id);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
|
xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
|
||||||
struct wl_resource *surface_resource, uint32_t id)
|
struct wl_resource *surface_resource, uint32_t id)
|
||||||
@@ -588,7 +600,9 @@ xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
|
|||||||
fprintf(stderr, "set_window_id %d for surface %p\n", id, surface);
|
fprintf(stderr, "set_window_id %d for surface %p\n", id, surface);
|
||||||
|
|
||||||
window->surface = (struct wlsc_surface *) surface;
|
window->surface = (struct wlsc_surface *) surface;
|
||||||
/* FIXME: Do we need a surface destroy listener? */
|
window->surface_destroy_listener.func = surface_destroy;
|
||||||
|
wl_list_insert(surface->resource.destroy_listener_list.prev,
|
||||||
|
&window->surface_destroy_listener.link);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct xserver_interface xserver_implementation = {
|
static const struct xserver_interface xserver_implementation = {
|
||||||
|
|||||||
Reference in New Issue
Block a user