summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-24 02:48:02 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-24 02:48:02 +0200
commit16cbfd3f4eebf522d431a52685065a8474fff3a0 (patch)
tree855c10bc3ca759fb235e82a409516a528b2a0020 /Applications
parentd7cf841d3d1f381915cdff23e67da0fbf21b02ef (diff)
downloadserenity-16cbfd3f4eebf522d431a52685065a8474fff3a0.zip
Taskbar: Clicking a window button now toggles minimized state.
Diffstat (limited to 'Applications')
-rw-r--r--Applications/Taskbar/WindowList.cpp9
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);