1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:17:35 +00:00

LibGUI+WindowServer: Add new WMEvent Super+Space

To make Assistant useful we need a way to quickly trigger it. I've
added a new specialized event coming from the window server for when a
user is holding down 'Super' and hits 'Space'.

The Taskbar will be able to listen for this event and spawn a new
instance of the Assistant if it's not already running.
This commit is contained in:
Spencer Dixon 2021-06-21 19:32:46 -04:00 committed by Andreas Kling
parent 66c13edb98
commit 4f11138e8e
7 changed files with 38 additions and 0 deletions

View file

@ -63,6 +63,7 @@ public:
WM_WindowIconBitmapChanged,
WM_AppletAreaSizeChanged,
WM_SuperKeyPressed,
WM_SuperSpaceKeyPressed,
__End_WM_Events,
};
@ -102,6 +103,14 @@ public:
}
};
class WMSuperSpaceKeyPressedEvent : public WMEvent {
public:
explicit WMSuperSpaceKeyPressedEvent(int client_id)
: WMEvent(Event::Type::WM_SuperSpaceKeyPressed, client_id, 0)
{
}
};
class WMAppletAreaSizeChangedEvent : public WMEvent {
public:
explicit WMAppletAreaSizeChangedEvent(const Gfx::IntSize& size)

View file

@ -57,4 +57,10 @@ void WindowManagerServerConnection::super_key_pressed(i32 wm_id)
if (auto* window = Window::from_window_id(wm_id))
Core::EventLoop::current().post_event(*window, make<WMSuperKeyPressedEvent>(wm_id));
}
void WindowManagerServerConnection::super_space_key_pressed(i32 wm_id)
{
if (auto* window = Window::from_window_id(wm_id))
Core::EventLoop::current().post_event(*window, make<WMSuperSpaceKeyPressedEvent>(wm_id));
}
}

View file

@ -32,6 +32,7 @@ private:
virtual void window_rect_changed(i32, i32, i32, Gfx::IntRect const&) override;
virtual void applet_area_size_changed(i32, Gfx::IntSize const&) override;
virtual void super_key_pressed(i32) override;
virtual void super_space_key_pressed(i32) override;
};
}