mirror of
https://github.com/labwc/labwc.git
synced 2025-11-30 06:59:52 -05:00
view: separate (un)minimize and (un)map logic
Map/unmap logic is currently re-used for minimize/unminimize, but lots of it doesn't actually apply in that case. This is both confusing and creates some extra complexity, such as: - extra "client_request" parameter to unmap(), in which case it has to still do some cleanup even if view->mapped is already false - various "view->mapped || view->minimized" checks when we really just mean "is the view mapped" To clean this all up, let's put the logic that really is common into a new view_update_visiblity() function, and stop using map/unmap for minimize/unminimize. Note that this changes the meaning of "view->mapped", which used to mean "mapped and not minimized" but now really just means "mapped". I left some "view->mapped" conditions as-is (rather than changing to "view->mapped && !view->minimized") where it seemed to make sense. v2: add view_update_visibility() as suggested by tokyo4j
This commit is contained in:
parent
20087e89b2
commit
b5e2eb216e
6 changed files with 75 additions and 110 deletions
25
src/xdg.c
25
src/xdg.c
|
|
@ -614,7 +614,7 @@ xdg_toplevel_view_append_children(struct view *self, struct wl_array *children)
|
|||
if (view->type != LAB_XDG_SHELL_VIEW) {
|
||||
continue;
|
||||
}
|
||||
if (!view->mapped && !view->minimized) {
|
||||
if (!view->mapped) {
|
||||
continue;
|
||||
}
|
||||
if (top_parent_of(view) != toplevel) {
|
||||
|
|
@ -757,15 +757,7 @@ xdg_toplevel_view_map(struct view *view)
|
|||
view_set_output(view, output_nearest_to_cursor(view->server));
|
||||
}
|
||||
|
||||
/*
|
||||
* For initially minimized views, we do not set view->mapped
|
||||
* nor enable the scene node. All other map logic (positioning,
|
||||
* creating foreign toplevel, etc.) happens as normal.
|
||||
*/
|
||||
if (!view->minimized) {
|
||||
view->mapped = true;
|
||||
wlr_scene_node_set_enabled(&view->scene_tree->node, true);
|
||||
}
|
||||
view->mapped = true;
|
||||
|
||||
if (!view->foreign_toplevel) {
|
||||
view_impl_init_foreign_toplevel(view);
|
||||
|
|
@ -815,23 +807,12 @@ xdg_toplevel_view_map(struct view *view)
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_toplevel_view_unmap(struct view *view, bool client_request)
|
||||
xdg_toplevel_view_unmap(struct view *view)
|
||||
{
|
||||
if (view->mapped) {
|
||||
view->mapped = false;
|
||||
wlr_scene_node_set_enabled(&view->scene_tree->node, false);
|
||||
view_impl_unmap(view);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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->foreign_toplevel) {
|
||||
foreign_toplevel_destroy(view->foreign_toplevel);
|
||||
view->foreign_toplevel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static pid_t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue