view: only focus topmost view if unmapped view was focused

The unmap() handlers should only call desktop_focus_topmost_view() if
the unmapped view was the focused view. Unmapping a view that was not
focused should not change the focus.

I expect this rarely had any effect in practice; it would only matter in
a focus-follows-mouse config where some view other than the one on top
was focused. But it still seems better to fix.

Rather than repeating the logic in two places, create a small
view_impl_unmap() helper. Perhaps more common "unmap" logic could be
moved there in future.
This commit is contained in:
John Lindgren 2023-10-14 22:29:24 -04:00 committed by Johan Malm
parent 8920e546db
commit b053c9e375
4 changed files with 12 additions and 2 deletions

View file

@ -531,7 +531,7 @@ xwayland_view_unmap(struct view *view, bool client_request)
view->mapped = false;
wl_list_remove(&view->commit.link);
wlr_scene_node_set_enabled(&view->scene_tree->node, false);
desktop_focus_topmost_view(view->server);
view_impl_unmap(view);
/*
* If the view was explicitly unmapped by the client (rather