1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:57:46 +00:00

LibGUI+WindowServer: Add WM_SuperKeyPressed event

This commit adds an event called WM_SuperKeyPressed which is sent to all
windows via WindowManagerServerConnection.
The event is fired from WindowManager when the super key is pressed,
which is the windows key on most keyboards :)
This commit is contained in:
Conor Byrne 2021-04-17 23:21:24 +01:00 committed by Andreas Kling
parent ec3596545a
commit 88ecfa164a
6 changed files with 45 additions and 1 deletions

View file

@ -82,6 +82,7 @@ public:
WM_WindowRectChanged,
WM_WindowIconBitmapChanged,
WM_AppletAreaSizeChanged,
WM_SuperKeyPressed,
__End_WM_Events,
};
@ -113,6 +114,14 @@ private:
int m_window_id { -1 };
};
class WMSuperKeyPressedEvent : public WMEvent {
public:
explicit WMSuperKeyPressedEvent(int client_id)
: WMEvent(Event::Type::WM_SuperKeyPressed, client_id, 0)
{
}
};
class WMAppletAreaSizeChangedEvent : public WMEvent {
public:
explicit WMAppletAreaSizeChangedEvent(const Gfx::IntSize& size)

View file

@ -74,4 +74,10 @@ void WindowManagerServerConnection::handle(const Messages::WindowManagerClient::
if (auto* window = Window::from_window_id(message.wm_id()))
Core::EventLoop::current().post_event(*window, make<WMWindowRemovedEvent>(message.client_id(), message.window_id()));
}
void WindowManagerServerConnection::handle(const Messages::WindowManagerClient::SuperKeyPressed& message)
{
if (auto* window = Window::from_window_id(message.wm_id()))
Core::EventLoop::current().post_event(*window, make<WMSuperKeyPressedEvent>(message.wm_id()));
}
}

View file

@ -52,6 +52,7 @@ private:
virtual void handle(const Messages::WindowManagerClient::WindowIconBitmapChanged&) override;
virtual void handle(const Messages::WindowManagerClient::WindowRectChanged&) override;
virtual void handle(const Messages::WindowManagerClient::AppletAreaSizeChanged&) override;
virtual void handle(const Messages::WindowManagerClient::SuperKeyPressed&) override;
};
}