From ce5e7e153c7046c96cb8f1ebfb49d1f3cfcdfaf9 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Tue, 30 Aug 2022 02:10:56 +0200 Subject: [PATCH] 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 --- src/view.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/view.c b/src/view.c index 68ccd17b..05f94432 100644 --- a/src/view.c +++ b/src/view.c @@ -217,6 +217,18 @@ view_minimize(struct view *view, bool minimized) if (minimized) { view->impl->unmap(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 { view->impl->map(view); }