diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-04 14:38:53 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-04 14:38:53 +0200 |
commit | ce7341be876b59ae2bd9a0c47542b496d8e8bee5 (patch) | |
tree | b53bc7b96830da30c09a5bb351884a96831b4802 /Applications | |
parent | 8a50218190753891e29354fdca5896d7aadd5d16 (diff) | |
download | serenity-ce7341be876b59ae2bd9a0c47542b496d8e8bee5.zip |
WindowServer: Add WM_SetActiveWindow client request and use it in Taskbar.
This makes it possible for Taskbar to switch windows. :^)
Diffstat (limited to 'Applications')
-rw-r--r-- | Applications/Taskbar/WindowList.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Applications/Taskbar/WindowList.cpp b/Applications/Taskbar/WindowList.cpp index 8afed41468..2c8be5806f 100644 --- a/Applications/Taskbar/WindowList.cpp +++ b/Applications/Taskbar/WindowList.cpp @@ -1,4 +1,6 @@ #include "WindowList.h" +#include <WindowServer/WSAPITypes.h> +#include <LibGUI/GEventLoop.h> Window& WindowList::ensure_window(const WindowIdentifier& identifier) { @@ -7,6 +9,14 @@ Window& WindowList::ensure_window(const WindowIdentifier& identifier) return *it->value; auto window = make<Window>(identifier); window->set_button(aid_create_button()); + window->button()->on_click = [identifier] (GButton&) { + WSAPI_ClientMessage message; + message.type = WSAPI_ClientMessage::Type::WM_SetActiveWindow; + message.wm.client_id = identifier.client_id(); + message.wm.window_id = identifier.window_id(); + bool success = GEventLoop::post_message_to_server(message); + ASSERT(success); + }; auto& window_ref = *window; m_windows.set(identifier, move(window)); return window_ref; |