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:
John Lindgren 2025-11-20 19:41:00 -05:00 committed by Hiroaki Yamamoto
parent 20087e89b2
commit b5e2eb216e
6 changed files with 75 additions and 110 deletions

View file

@ -145,7 +145,7 @@ desktop_topmost_focusable_view(struct server *server)
continue;
}
view = node_view_from_node(node);
if (view->mapped && view_is_focusable(view)) {
if (view_is_focusable(view) && !view->minimized) {
return view;
}
}