From 3cc5b1acc6014ef424630c2ac2ae5b024c2b57e8 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sat, 19 Aug 2017 22:14:51 +0200 Subject: [PATCH] wlr_compositor: add signal for create_surface --- include/wlr/types/wlr_compositor.h | 2 ++ types/wlr_compositor.c | 2 ++ xwayland/xwm.c | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index 1b2f890f..d8a2506f 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -9,6 +9,8 @@ struct wlr_compositor { struct wlr_renderer *renderer; struct wl_list surfaces; struct wl_listener destroy_surface_listener; + + struct wl_signal create_surface_signal; }; void wlr_compositor_destroy(struct wlr_compositor *wlr_compositor); diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index c153f525..6b6312d1 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -22,6 +22,7 @@ static void wl_compositor_create_surface(struct wl_client *client, wl_resource_add_destroy_listener(surface_resource, &surface->compositor_listener); wl_list_insert(&compositor->surfaces, wl_resource_get_link(surface_resource)); + wl_signal_emit(&compositor->create_surface_signal, surface); } static void wl_compositor_create_region(struct wl_client *client, @@ -80,5 +81,6 @@ struct wlr_compositor *wlr_compositor_create(struct wl_display *display, compositor->renderer = renderer; wl_list_init(&compositor->wl_resources); wl_list_init(&compositor->surfaces); + wl_signal_init(&compositor->create_surface_signal); return compositor; } diff --git a/xwayland/xwm.c b/xwayland/xwm.c index d39527c5..3b1d3b7b 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -62,8 +62,8 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) { xwm->surface_listener.notify = create_surface_handler; - //wl_signal_add(&wlr_xwayland->compositor->create_surface_signal, - // &xwm->surface_listener); + wl_signal_add(&wlr_xwayland->compositor->create_surface_signal, + &xwm->surface_listener); return xwm; }