diff options
author | emersion <contact@emersion.fr> | 2018-03-21 19:59:35 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-03-21 20:11:53 +0100 |
commit | 731ee240899da70313412d7792946418ee663f15 (patch) | |
tree | e1ce064e137483adb86cbf86f752f6eb1b1a7079 | |
parent | ff2e08aa7481517d0bd4379ff0d0b51098f72064 (diff) |
xdg-shell, xdg-shell-v6: don't emit unmap if surface is unmapped
Some clients create an xdg_surface, then create an xdg_toplevel,
but don't map it and destroy it right after. The xdg_surface ends
up in a state where it isn't mapped but role-specific resources
have been allocated. xdg_surface_unmap needs to free these
resources without emitting the unmap signal.
-rw-r--r-- | types/wlr_xdg_shell.c | 4 | ||||
-rw-r--r-- | types/wlr_xdg_shell_v6.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/types/wlr_xdg_shell.c b/types/wlr_xdg_shell.c index 5b02088d..76859d7b 100644 --- a/types/wlr_xdg_shell.c +++ b/types/wlr_xdg_shell.c @@ -173,7 +173,9 @@ static void xdg_surface_unmap(struct wlr_xdg_surface *surface) { assert(surface->role != WLR_XDG_SURFACE_ROLE_NONE); // TODO: probably need to ungrab before this event - wlr_signal_emit_safe(&surface->events.unmap, surface); + if (surface->mapped) { + wlr_signal_emit_safe(&surface->events.unmap, surface); + } if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) { wl_resource_set_user_data(surface->toplevel->resource, NULL); diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index a0c74e6f..68fe4b29 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -173,7 +173,9 @@ static void xdg_surface_unmap(struct wlr_xdg_surface_v6 *surface) { assert(surface->role != WLR_XDG_SURFACE_V6_ROLE_NONE); // TODO: probably need to ungrab before this event - wlr_signal_emit_safe(&surface->events.unmap, surface); + if (surface->mapped) { + wlr_signal_emit_safe(&surface->events.unmap, surface); + } if (surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) { wl_resource_set_user_data(surface->toplevel->resource, NULL); |