diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2022-10-17 16:39:30 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2022-10-19 11:29:36 +0200 |
commit | 71e8be4e3645bd9664b3f7a9f4d958272d604de4 (patch) | |
tree | 40babcd05ba2a06d04249dc2a09118bccf255969 | |
parent | f883f6bc6ed5eb8112406da3225d306a30829bdc (diff) |
xwayland: Clear the "xwl-window" tag on unrealize
Now that we keep the Wayland surface around for longer than the
xwl_window, we might get events for that surface after the X11 window
is unrealized.
Make sure we untag the Wayland surface when the Wayland surface is
delayed, to break the wl_surface/xwl_window relationship, so that events
for that surface are discarded by Xwayland.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Fixes: e37f18ee9 - xwayland: Delay wl_surface destruction
(cherry picked from commit a1d14aa8c5afbae2f99aa68454d429aed5852b72)
-rw-r--r-- | hw/xwayland/xwayland-window.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index 0b18be64c..38992d5c1 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -121,6 +121,12 @@ xwl_window_set_xwayland_tag(struct xwl_window *xwl_window) wl_proxy_set_tag((struct wl_proxy *)xwl_window->surface, &xwl_surface_tag); } +static void +xwl_window_clear_xwayland_tag(struct xwl_window *xwl_window) +{ + wl_proxy_set_tag((struct wl_proxy *)xwl_window->surface, NULL); +} + Bool is_surface_from_xwl_window(struct wl_surface *surface) { @@ -618,9 +624,13 @@ release_wl_surface_for_window(struct xwl_window *xwl_window) return; } - /* Otherwise, schedule the destruction later, to mitigate the race - * between X11 and Wayland processing so that the compositor has the - * time to establish the association before the wl_surface is destroyed. + /* Break the wl_surface / xwl_window relationship */ + wl_surface_set_user_data(xwl_window->surface, NULL); + xwl_window_clear_xwayland_tag(xwl_window); + + /* Schedule the destruction later, to mitigate the race between X11 + * and Wayland processing so that the compositor has the time to + * establish the association before the wl_surface is destroyed. */ xwl_wl_surface = xnfcalloc(1, sizeof *xwl_wl_surface); xwl_wl_surface->wl_surface = xwl_window->surface; |