view: update focused surface and activated view together

When minimizing the last/only focusable view, its "activated" state is
set to false, and server->focused_view is cleared, but at the wlroots
level the focused surface is not cleared (seat_focus_surface() is not
called).

When attempting to unminimize, desktop_focus_and_activate_view() sees
that view->surface is still focused, and returns without setting the
activated state of the view; server->focused_view also remains NULL.

To try and keep everything in sync better, replace view_set_activated()
with view_set_focused(), which allows setting or clearing both the focus
and the activated state of the view. Then use the new function in both
view_minimize() and desktop_focus_and_activate_view().
This commit is contained in:
John Lindgren 2023-09-26 01:35:36 -04:00
parent ce36cbac2d
commit 7327a38d9a
3 changed files with 39 additions and 32 deletions

View file

@ -257,7 +257,7 @@ bool view_isfocusable(struct view *view);
bool view_inhibits_keybinds(struct view *view);
void view_toggle_keybinds(struct view *view);
void view_set_activated(struct view *view);
void view_set_focused(struct view *view, bool focused);
void view_set_output(struct view *view, struct output *output);
void view_close(struct view *view);