void (*map)(struct view *view);
void (*set_activated)(struct view *view, bool activated);
void (*set_fullscreen)(struct view *view, bool fullscreen);
- void (*unmap)(struct view *view);
+ /*
+ * client_request is true if the client unmapped its own
+ * surface; false if we are just minimizing the view. The two
+ * cases are similar but have subtle differences (e.g., when
+ * minimizing we don't destroy the foreign toplevel handle).
+ */
+ void (*unmap)(struct view *view, bool client_request);
void (*maximize)(struct view *view, bool maximize);
void (*minimize)(struct view *view, bool minimize);
void (*move_to_front)(struct view *view);
}
view->minimized = minimized;
if (minimized) {
- view->impl->unmap(view);
+ view->impl->unmap(view, /* client_request */ false);
_view_set_activated(view, false);
if (view == view->server->focused_view) {
/*
handle_unmap(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, unmap);
- view->impl->unmap(view);
+ view->impl->unmap(view, /* client_request */ true);
}
static void
}
static void
-xdg_toplevel_view_unmap(struct view *view)
+xdg_toplevel_view_unmap(struct view *view, bool client_request)
{
if (view->mapped) {
view->mapped = false;
handle_unmap(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, unmap);
- view->impl->unmap(view);
-
- /*
- * Some xwayland clients leave unmapped child views around, typically
- * when a dialog window is closed. Although handle_destroy() is not
- * called for these, we have to deal with them as such in terms of the
- * foreign-toplevel protocol to avoid panels and the like still showing
- * them.
- */
- if (view->toplevel.handle) {
- wlr_foreign_toplevel_handle_v1_destroy(view->toplevel.handle);
- view->toplevel.handle = NULL;
- }
+ view->impl->unmap(view, /* client_request */ true);
}
static void
}
static void
-xwayland_view_unmap(struct view *view)
+xwayland_view_unmap(struct view *view, bool client_request)
{
if (!view->mapped) {
return;
wl_list_remove(&view->commit.link);
wlr_scene_node_set_enabled(&view->scene_tree->node, false);
desktop_focus_topmost_mapped_view(view->server);
+
+ /*
+ * If the view was explicitly unmapped by the client (rather
+ * than just minimized), destroy the foreign toplevel handle so
+ * the unmapped view doesn't show up in panels and the like.
+ */
+ if (client_request && view->toplevel.handle) {
+ wlr_foreign_toplevel_handle_v1_destroy(view->toplevel.handle);
+ view->toplevel.handle = NULL;
+ }
}
static void