From 75d03f2b68a7c7a2739cb20b16f12d4a291eef28 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Sat, 11 Mar 2023 14:01:02 +0300 Subject: xwm: introduce associate/dissociate events We'll soon introduce a unified wlr_surface map event. Up until now, compositors have been using wlr_xwayland_surface's map event to setup various wlr_surface related listeners (e.g. commit). This will no longer be possible when that event is moved over to wlr_surface. Introduce new events where the compositor can add/remove wlr_surface event listeners. --- include/wlr/xwayland/xwayland.h | 3 +++ xwayland/xwm.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/include/wlr/xwayland/xwayland.h b/include/wlr/xwayland/xwayland.h index a8983f1f..4e618f5b 100644 --- a/include/wlr/xwayland/xwayland.h +++ b/include/wlr/xwayland/xwayland.h @@ -150,6 +150,9 @@ struct wlr_xwayland_surface { struct wl_signal request_fullscreen; struct wl_signal request_activate; + struct wl_signal associate; + struct wl_signal dissociate; + struct wl_signal map; struct wl_signal unmap; struct wl_signal set_title; diff --git a/xwayland/xwm.c b/xwayland/xwm.c index ec99875e..c285ea43 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -171,6 +171,8 @@ static struct wlr_xwayland_surface *xwayland_surface_create( wl_signal_init(&surface->events.request_maximize); wl_signal_init(&surface->events.request_fullscreen); wl_signal_init(&surface->events.request_activate); + wl_signal_init(&surface->events.associate); + wl_signal_init(&surface->events.dissociate); wl_signal_init(&surface->events.map); wl_signal_init(&surface->events.unmap); wl_signal_init(&surface->events.set_class); @@ -399,6 +401,8 @@ static void xwayland_surface_dissociate(struct wlr_xwayland_surface *xsurface) { xwayland_surface_set_mapped(xsurface, false); if (xsurface->surface != NULL) { + wl_signal_emit_mutable(&xsurface->events.dissociate, NULL); + wl_list_remove(&xsurface->surface_commit.link); wl_list_remove(&xsurface->surface_precommit.link); wlr_addon_finish(&xsurface->surface_addon); @@ -962,6 +966,8 @@ static void xwayland_surface_associate(struct wlr_xwm *xwm, if (xwm->xres) { read_surface_client_id(xwm, xsurface); } + + wl_signal_emit_mutable(&xsurface->events.associate, NULL); } static void xwm_handle_create_notify(struct wlr_xwm *xwm, -- cgit v1.2.3