src/view.c: Fix minimizing the last window

Before this patch, minimizing the last un-minimized window would
not cause it to be set to inactive. This in turn would confuse panels
which depend on the 'active' flag to decide when to either activate or
minimize the clicked on window.

Reported-by: @Flrian
Predicted-by: @johanmalm
This commit is contained in:
Consolatis 2022-08-30 02:10:56 +02:00
parent adc1e0876d
commit 8bc06c69e7

View file

@ -217,6 +217,18 @@ view_minimize(struct view *view, bool minimized)
if (minimized) { if (minimized) {
view->impl->unmap(view); view->impl->unmap(view);
desktop_move_to_back(view); desktop_move_to_back(view);
_view_set_activated(view, false);
if (view == view->server->focused_view) {
/*
* Prevents clearing the active view when
* we don't actually have keyboard focus.
*
* This may happen when using a custom mouse
* focus configuration or by using the foreign
* toplevel protocol via some panel.
*/
view->server->focused_view = NULL;
}
} else { } else {
view->impl->map(view); view->impl->map(view);
} }