xdg-shell: use wlr_surface.unmap_commit

master
Kirill Primak 1 year ago
parent 1c2f608331
commit d253d70786

@ -275,7 +275,6 @@ struct wlr_xdg_surface {
// private state // private state
bool client_mapped;
struct wl_listener role_resource_destroy; struct wl_listener role_resource_destroy;
}; };

@ -24,9 +24,8 @@ static void xdg_surface_configure_destroy(
// 2) the xdg_surface role object implementation is destroyed // 2) the xdg_surface role object implementation is destroyed
static void reset_xdg_surface(struct wlr_xdg_surface *surface) { static void reset_xdg_surface(struct wlr_xdg_surface *surface) {
surface->client_mapped = false;
surface->initialized = false;
surface->configured = false; surface->configured = false;
surface->initialized = 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) {
@ -275,14 +274,14 @@ static void xdg_surface_role_commit(struct wlr_surface *wlr_surface) {
return; return;
} }
surface->initial_commit = !surface->initialized; if (surface->surface->unmap_commit) {
if (surface->client_mapped && !wlr_surface_has_buffer(wlr_surface)) {
assert(!surface->initial_commit);
// This commit has unmapped the surface
reset_xdg_surface_role_object(surface); reset_xdg_surface_role_object(surface);
reset_xdg_surface(surface); reset_xdg_surface(surface);
assert(!surface->initial_commit);
surface->initial_commit = false;
} else { } else {
surface->initial_commit = !surface->initialized;
surface->initialized = true; surface->initialized = true;
} }
@ -315,7 +314,6 @@ static void xdg_surface_role_commit(struct wlr_surface *wlr_surface) {
} }
if (wlr_surface_has_buffer(wlr_surface)) { if (wlr_surface_has_buffer(wlr_surface)) {
surface->client_mapped = true;
wlr_surface_map(wlr_surface); wlr_surface_map(wlr_surface);
} }
} }

@ -513,7 +513,6 @@ void reset_xdg_toplevel(struct wlr_xdg_toplevel *toplevel) {
void destroy_xdg_toplevel(struct wlr_xdg_toplevel *toplevel) { void destroy_xdg_toplevel(struct wlr_xdg_toplevel *toplevel) {
wlr_surface_unmap(toplevel->base->surface); wlr_surface_unmap(toplevel->base->surface);
reset_xdg_toplevel(toplevel); reset_xdg_toplevel(toplevel);
// TODO: improve events // TODO: improve events

Loading…
Cancel
Save