diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index 536cd90b..b81b7a3b 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -275,7 +275,6 @@ struct wlr_xdg_surface { // private state - bool client_mapped; struct wl_listener role_resource_destroy; }; diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c index 0e0bace4..28d5dbad 100644 --- a/types/xdg_shell/wlr_xdg_surface.c +++ b/types/xdg_shell/wlr_xdg_surface.c @@ -24,9 +24,8 @@ static void xdg_surface_configure_destroy( // 2) the xdg_surface role object implementation is destroyed static void reset_xdg_surface(struct wlr_xdg_surface *surface) { - surface->client_mapped = false; - surface->initialized = false; surface->configured = false; + surface->initialized = false; struct wlr_xdg_popup *popup, *popup_tmp; 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; } - surface->initial_commit = !surface->initialized; - - if (surface->client_mapped && !wlr_surface_has_buffer(wlr_surface)) { - assert(!surface->initial_commit); - // This commit has unmapped the surface + if (surface->surface->unmap_commit) { reset_xdg_surface_role_object(surface); reset_xdg_surface(surface); + + assert(!surface->initial_commit); + surface->initial_commit = false; } else { + surface->initial_commit = !surface->initialized; 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)) { - surface->client_mapped = true; wlr_surface_map(wlr_surface); } } diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c index 3075d859..23e04db5 100644 --- a/types/xdg_shell/wlr_xdg_toplevel.c +++ b/types/xdg_shell/wlr_xdg_toplevel.c @@ -513,7 +513,6 @@ void reset_xdg_toplevel(struct wlr_xdg_toplevel *toplevel) { void destroy_xdg_toplevel(struct wlr_xdg_toplevel *toplevel) { wlr_surface_unmap(toplevel->base->surface); - reset_xdg_toplevel(toplevel); // TODO: improve events