wlr_compositor: add signal for create_surface

This commit is contained in:
Dominique Martinet 2017-08-19 22:14:51 +02:00
parent b2bab1af5c
commit 3cc5b1acc6
3 changed files with 6 additions and 2 deletions

View file

@ -9,6 +9,8 @@ struct wlr_compositor {
struct wlr_renderer *renderer; struct wlr_renderer *renderer;
struct wl_list surfaces; struct wl_list surfaces;
struct wl_listener destroy_surface_listener; struct wl_listener destroy_surface_listener;
struct wl_signal create_surface_signal;
}; };
void wlr_compositor_destroy(struct wlr_compositor *wlr_compositor); void wlr_compositor_destroy(struct wlr_compositor *wlr_compositor);

View file

@ -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_resource_add_destroy_listener(surface_resource, &surface->compositor_listener);
wl_list_insert(&compositor->surfaces, wl_resource_get_link(surface_resource)); 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, 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; compositor->renderer = renderer;
wl_list_init(&compositor->wl_resources); wl_list_init(&compositor->wl_resources);
wl_list_init(&compositor->surfaces); wl_list_init(&compositor->surfaces);
wl_signal_init(&compositor->create_surface_signal);
return compositor; return compositor;
} }

View file

@ -62,8 +62,8 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
xwm->surface_listener.notify = create_surface_handler; xwm->surface_listener.notify = create_surface_handler;
//wl_signal_add(&wlr_xwayland->compositor->create_surface_signal, wl_signal_add(&wlr_xwayland->compositor->create_surface_signal,
// &xwm->surface_listener); &xwm->surface_listener);
return xwm; return xwm;
} }