mirror of
https://github.com/labwc/labwc.git
synced 2026-02-13 04:27:49 -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
|
|
@ -3,7 +3,6 @@
|
|||
#include "view-impl-common.h"
|
||||
#include "foreign-toplevel/foreign.h"
|
||||
#include "labwc.h"
|
||||
#include "output.h"
|
||||
#include "view.h"
|
||||
#include "window-rules.h"
|
||||
|
||||
|
|
@ -28,10 +27,8 @@ view_impl_init_foreign_toplevel(struct view *view)
|
|||
void
|
||||
view_impl_map(struct view *view)
|
||||
{
|
||||
/* Leave minimized, if minimized before map */
|
||||
if (!view->minimized) {
|
||||
desktop_focus_view(view, /*raise*/ true);
|
||||
}
|
||||
view_update_visibility(view);
|
||||
|
||||
if (!view->been_mapped) {
|
||||
window_rules_apply(view, LAB_WINDOW_RULE_EVENT_ON_FIRST_MAP);
|
||||
}
|
||||
|
|
@ -49,12 +46,6 @@ view_impl_map(struct view *view)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Some clients (e.g. Steam's Big Picture Mode window) request
|
||||
* fullscreen before mapping.
|
||||
*/
|
||||
desktop_update_top_layer_visibility(view->server);
|
||||
|
||||
wlr_log(WLR_DEBUG, "[map] identifier=%s, title=%s",
|
||||
view->app_id, view->title);
|
||||
}
|
||||
|
|
@ -62,30 +53,15 @@ view_impl_map(struct view *view)
|
|||
void
|
||||
view_impl_unmap(struct view *view)
|
||||
{
|
||||
struct server *server = view->server;
|
||||
/*
|
||||
* When exiting an xwayland application with multiple views
|
||||
* mapped, a race condition can occur: after the topmost view
|
||||
* is unmapped, the next view under it is offered focus, but is
|
||||
* also unmapped before accepting focus (so server->active_view
|
||||
* remains NULL). To avoid being left with no active view at
|
||||
* all, check for that case also.
|
||||
*/
|
||||
if (view == server->active_view || !server->active_view) {
|
||||
desktop_focus_topmost_view(server);
|
||||
}
|
||||
|
||||
desktop_update_top_layer_visibility(view->server);
|
||||
view_update_visibility(view);
|
||||
|
||||
/*
|
||||
* We may need to disable adaptive sync if view was fullscreen.
|
||||
*
|
||||
* FIXME: this logic doesn't account for multiple fullscreen
|
||||
* views. It should probably be combined with the existing
|
||||
* logic in desktop_update_top_layer_visibility().
|
||||
* Destroy the foreign toplevel handle so the unmapped view
|
||||
* doesn't show up in panels and the like.
|
||||
*/
|
||||
if (view->fullscreen) {
|
||||
output_set_has_fullscreen_view(view->output, false);
|
||||
if (view->foreign_toplevel) {
|
||||
foreign_toplevel_destroy(view->foreign_toplevel);
|
||||
view->foreign_toplevel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue