diff options
author | emersion <contact@emersion.fr> | 2018-07-09 23:02:03 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-07-15 19:30:19 +0100 |
commit | 16d7e09d996f7fd211e3a6ff8960a15217ca3710 (patch) | |
tree | 71e824840f52651e950e220a8005f80cbc655d0d /xwayland | |
parent | 4984ea49eeaa292d66be9e535d93a4d8185f3e18 (diff) |
surface: add wlr_surface_role.precommit
This allows to emit the unmap event before the surface becomes
actually unmapped for most shells.
Diffstat (limited to 'xwayland')
-rw-r--r-- | xwayland/xwm.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c index bee3a005..54cb88d0 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -652,9 +652,27 @@ static void xwayland_surface_role_commit(struct wlr_surface *wlr_surface) { } } +static void xwayland_surface_role_precommit(struct wlr_surface *wlr_surface) { + assert(wlr_surface->role == &xwayland_surface_role); + struct wlr_xwayland_surface *surface = wlr_surface->role_data; + if (surface == NULL) { + return; + } + + if (wlr_surface->pending.committed & WLR_SURFACE_STATE_BUFFER && + wlr_surface->pending.buffer_resource == NULL) { + // This is a NULL commit + if (surface->mapped) { + wlr_signal_emit_safe(&surface->events.unmap, surface); + surface->mapped = false; + } + } +} + static const struct wlr_surface_role xwayland_surface_role = { .name = "wlr_xwayland_surface", .commit = xwayland_surface_role_commit, + .precommit = xwayland_surface_role_precommit, }; static void handle_surface_destroy(struct wl_listener *listener, void *data) { |