mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 18:09:49 +01:00
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:
parent
b24b50ec0c
commit
668b2740ff
6 changed files with 10 additions and 8 deletions
|
@ -112,8 +112,8 @@ static void drag_icon_set_mapped(struct wlr_drag_icon *icon, bool mapped) {
|
|||
icon->mapped = true;
|
||||
wlr_signal_emit_safe(&icon->events.map, icon);
|
||||
} else if (!mapped && icon->mapped) {
|
||||
wlr_signal_emit_safe(&icon->events.unmap, icon);
|
||||
icon->mapped = false;
|
||||
wlr_signal_emit_safe(&icon->events.unmap, icon);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,8 +143,8 @@ static void popup_surface_set_mapped(
|
|||
popup_surface->mapped = true;
|
||||
wlr_signal_emit_safe(&popup_surface->events.map, popup_surface);
|
||||
} else if (!mapped && popup_surface->mapped) {
|
||||
wlr_signal_emit_safe(&popup_surface->events.unmap, popup_surface);
|
||||
popup_surface->mapped = false;
|
||||
wlr_signal_emit_safe(&popup_surface->events.unmap, popup_surface);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -262,6 +262,8 @@ static const struct zwlr_layer_surface_v1_interface layer_surface_implementation
|
|||
};
|
||||
|
||||
static void layer_surface_unmap(struct wlr_layer_surface_v1 *surface) {
|
||||
surface->configured = surface->mapped = false;
|
||||
|
||||
// TODO: probably need to ungrab before this event
|
||||
wlr_signal_emit_safe(&surface->events.unmap, surface);
|
||||
|
||||
|
@ -275,7 +277,6 @@ static void layer_surface_unmap(struct wlr_layer_surface_v1 *surface) {
|
|||
layer_surface_configure_destroy(configure);
|
||||
}
|
||||
|
||||
surface->configured = surface->mapped = false;
|
||||
}
|
||||
|
||||
static void layer_surface_destroy(struct wlr_layer_surface_v1 *surface) {
|
||||
|
|
|
@ -229,8 +229,8 @@ static void subsurface_consider_map(struct wlr_subsurface *subsurface,
|
|||
}
|
||||
|
||||
// Now we can map the subsurface
|
||||
wlr_signal_emit_safe(&subsurface->events.map, subsurface);
|
||||
subsurface->mapped = true;
|
||||
wlr_signal_emit_safe(&subsurface->events.map, subsurface);
|
||||
|
||||
// Try mapping all children too
|
||||
struct wlr_subsurface *child;
|
||||
|
@ -249,8 +249,8 @@ static void subsurface_unmap(struct wlr_subsurface *subsurface) {
|
|||
return;
|
||||
}
|
||||
|
||||
wlr_signal_emit_safe(&subsurface->events.unmap, subsurface);
|
||||
subsurface->mapped = false;
|
||||
wlr_signal_emit_safe(&subsurface->events.unmap, subsurface);
|
||||
|
||||
// Unmap all children
|
||||
struct wlr_subsurface *child;
|
||||
|
|
|
@ -29,6 +29,7 @@ static void xdg_surface_configure_destroy(
|
|||
|
||||
void unmap_xdg_surface(struct wlr_xdg_surface *surface) {
|
||||
assert(surface->role != WLR_XDG_SURFACE_ROLE_NONE);
|
||||
surface->configured = false;
|
||||
|
||||
struct wlr_xdg_popup *popup, *popup_tmp;
|
||||
wl_list_for_each_safe(popup, popup_tmp, &surface->popups, link) {
|
||||
|
@ -37,6 +38,7 @@ void unmap_xdg_surface(struct wlr_xdg_surface *surface) {
|
|||
|
||||
// TODO: probably need to ungrab before this event
|
||||
if (surface->mapped) {
|
||||
surface->mapped = false;
|
||||
wlr_signal_emit_safe(&surface->events.unmap, NULL);
|
||||
}
|
||||
|
||||
|
@ -56,7 +58,6 @@ void unmap_xdg_surface(struct wlr_xdg_surface *surface) {
|
|||
xdg_surface_configure_destroy(configure);
|
||||
}
|
||||
|
||||
surface->configured = surface->mapped = false;
|
||||
if (surface->configure_idle) {
|
||||
wl_event_source_remove(surface->configure_idle);
|
||||
surface->configure_idle = NULL;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue