1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

WindowServer: Add WM_SetActiveWindow client request and use it in Taskbar.

This makes it possible for Taskbar to switch windows. :^)
This commit is contained in:
Andreas Kling 2019-04-04 14:38:53 +02:00
parent 8a50218190
commit ce7341be87
7 changed files with 58 additions and 1 deletions

View file

@ -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;