Set mapped before firing map/unmap events

This allows whatever the user calls from the signal handlers to react to observe
the new state rather than the old, e.g. that a surface is no longer mapped in
the unmap handler.
This commit is contained in:
Kenny Levinsen 2022-08-02 18:26:46 +02:00
parent b24b50ec0c
commit 668b2740ff
6 changed files with 10 additions and 8 deletions

View file

@ -836,8 +836,8 @@ static void xwayland_surface_role_commit(struct wlr_surface *wlr_surface) {
}
if (!surface->mapped && wlr_surface_has_buffer(surface->surface)) {
wlr_signal_emit_safe(&surface->events.map, surface);
surface->mapped = true;
wlr_signal_emit_safe(&surface->events.map, surface);
xwm_set_net_client_list(surface->xwm);
}
}
@ -853,8 +853,8 @@ static void xwayland_surface_role_precommit(struct wlr_surface *wlr_surface,
if (state->committed & WLR_SURFACE_STATE_BUFFER && state->buffer == NULL) {
// This is a NULL commit
if (surface->mapped) {
wlr_signal_emit_safe(&surface->events.unmap, surface);
surface->mapped = false;
wlr_signal_emit_safe(&surface->events.unmap, surface);
xwm_set_net_client_list(surface->xwm);
}
}