diff options
-rw-r--r-- | Applications/Taskbar/WindowList.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Applications/Taskbar/WindowList.cpp b/Applications/Taskbar/WindowList.cpp index 35f0c1a3cb..dc1b8da90a 100644 --- a/Applications/Taskbar/WindowList.cpp +++ b/Applications/Taskbar/WindowList.cpp @@ -25,9 +25,14 @@ Window& WindowList::ensure_window(const WindowIdentifier& identifier) return *it->value; auto window = make<Window>(identifier); window->set_button(aid_create_button(identifier)); - window->button()->on_click = [identifier] (GButton&) { + window->button()->on_click = [window = window.ptr(), identifier] (GButton&) { WSAPI_ClientMessage message; - message.type = WSAPI_ClientMessage::Type::WM_SetActiveWindow; + if (window->is_minimized() || !window->is_active()) { + message.type = WSAPI_ClientMessage::Type::WM_SetActiveWindow; + } else { + message.type = WSAPI_ClientMessage::Type::WM_SetWindowMinimized; + message.wm.minimized = true; + } message.wm.client_id = identifier.client_id(); message.wm.window_id = identifier.window_id(); bool success = GEventLoop::post_message_to_server(message); |