mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-10-30 07:30:46 +00: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
@ -112,8 +112,8 @@ static void drag_icon_set_mapped(struct wlr_drag_icon *icon, bool mapped) {
|
|||||||
icon->mapped = true;
|
icon->mapped = true;
|
||||||
wlr_signal_emit_safe(&icon->events.map, icon);
|
wlr_signal_emit_safe(&icon->events.map, icon);
|
||||||
} else if (!mapped && icon->mapped) {
|
} else if (!mapped && icon->mapped) {
|
||||||
wlr_signal_emit_safe(&icon->events.unmap, icon);
|
|
||||||
icon->mapped = false;
|
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;
|
popup_surface->mapped = true;
|
||||||
wlr_signal_emit_safe(&popup_surface->events.map, popup_surface);
|
wlr_signal_emit_safe(&popup_surface->events.map, popup_surface);
|
||||||
} else if (!mapped && popup_surface->mapped) {
|
} else if (!mapped && popup_surface->mapped) {
|
||||||
wlr_signal_emit_safe(&popup_surface->events.unmap, popup_surface);
|
|
||||||
popup_surface->mapped = false;
|
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) {
|
static void layer_surface_unmap(struct wlr_layer_surface_v1 *surface) {
|
||||||
|
surface->configured = surface->mapped = false;
|
||||||
|
|
||||||
// TODO: probably need to ungrab before this event
|
// TODO: probably need to ungrab before this event
|
||||||
wlr_signal_emit_safe(&surface->events.unmap, surface);
|
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);
|
layer_surface_configure_destroy(configure);
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->configured = surface->mapped = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void layer_surface_destroy(struct wlr_layer_surface_v1 *surface) {
|
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
|
// Now we can map the subsurface
|
||||||
wlr_signal_emit_safe(&subsurface->events.map, subsurface);
|
|
||||||
subsurface->mapped = true;
|
subsurface->mapped = true;
|
||||||
|
wlr_signal_emit_safe(&subsurface->events.map, subsurface);
|
||||||
|
|
||||||
// Try mapping all children too
|
// Try mapping all children too
|
||||||
struct wlr_subsurface *child;
|
struct wlr_subsurface *child;
|
||||||
@ -249,8 +249,8 @@ static void subsurface_unmap(struct wlr_subsurface *subsurface) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_signal_emit_safe(&subsurface->events.unmap, subsurface);
|
|
||||||
subsurface->mapped = false;
|
subsurface->mapped = false;
|
||||||
|
wlr_signal_emit_safe(&subsurface->events.unmap, subsurface);
|
||||||
|
|
||||||
// Unmap all children
|
// Unmap all children
|
||||||
struct wlr_subsurface *child;
|
struct wlr_subsurface *child;
|
||||||
|
@ -29,6 +29,7 @@ static void xdg_surface_configure_destroy(
|
|||||||
|
|
||||||
void unmap_xdg_surface(struct wlr_xdg_surface *surface) {
|
void unmap_xdg_surface(struct wlr_xdg_surface *surface) {
|
||||||
assert(surface->role != WLR_XDG_SURFACE_ROLE_NONE);
|
assert(surface->role != WLR_XDG_SURFACE_ROLE_NONE);
|
||||||
|
surface->configured = false;
|
||||||
|
|
||||||
struct wlr_xdg_popup *popup, *popup_tmp;
|
struct wlr_xdg_popup *popup, *popup_tmp;
|
||||||
wl_list_for_each_safe(popup, popup_tmp, &surface->popups, link) {
|
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
|
// TODO: probably need to ungrab before this event
|
||||||
if (surface->mapped) {
|
if (surface->mapped) {
|
||||||
|
surface->mapped = false;
|
||||||
wlr_signal_emit_safe(&surface->events.unmap, NULL);
|
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);
|
xdg_surface_configure_destroy(configure);
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->configured = surface->mapped = false;
|
|
||||||
if (surface->configure_idle) {
|
if (surface->configure_idle) {
|
||||||
wl_event_source_remove(surface->configure_idle);
|
wl_event_source_remove(surface->configure_idle);
|
||||||
surface->configure_idle = NULL;
|
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)) {
|
if (!surface->mapped && wlr_surface_has_buffer(surface->surface)) {
|
||||||
wlr_signal_emit_safe(&surface->events.map, surface);
|
|
||||||
surface->mapped = true;
|
surface->mapped = true;
|
||||||
|
wlr_signal_emit_safe(&surface->events.map, surface);
|
||||||
xwm_set_net_client_list(surface->xwm);
|
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) {
|
if (state->committed & WLR_SURFACE_STATE_BUFFER && state->buffer == NULL) {
|
||||||
// This is a NULL commit
|
// This is a NULL commit
|
||||||
if (surface->mapped) {
|
if (surface->mapped) {
|
||||||
wlr_signal_emit_safe(&surface->events.unmap, surface);
|
|
||||||
surface->mapped = false;
|
surface->mapped = false;
|
||||||
|
wlr_signal_emit_safe(&surface->events.unmap, surface);
|
||||||
xwm_set_net_client_list(surface->xwm);
|
xwm_set_net_client_list(surface->xwm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user