summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer
diff options
context:
space:
mode:
authorSpencer Dixon <spencercdixon@gmail.com>2021-06-21 19:32:46 -0400
committerAndreas Kling <kling@serenityos.org>2021-06-28 16:29:02 +0200
commit4f11138e8eb7b03161a5d85dfc31e7a43902f79d (patch)
tree1d2d8b6d2a8a260c1532121f90abec343e953500 /Userland/Services/WindowServer
parent66c13edb984ca811e1d38713748b282afb561bbf (diff)
downloadserenity-4f11138e8eb7b03161a5d85dfc31e7a43902f79d.zip
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.
Diffstat (limited to 'Userland/Services/WindowServer')
-rw-r--r--Userland/Services/WindowServer/WindowManager.cpp16
-rw-r--r--Userland/Services/WindowServer/WindowManager.h1
-rw-r--r--Userland/Services/WindowServer/WindowManagerClient.ipc1
3 files changed, 18 insertions, 0 deletions
diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp
index 5be6385478..1229672f86 100644
--- a/Userland/Services/WindowServer/WindowManager.cpp
+++ b/Userland/Services/WindowServer/WindowManager.cpp
@@ -376,6 +376,17 @@ void WindowManager::tell_wms_super_key_pressed()
});
}
+void WindowManager::tell_wms_super_space_key_pressed()
+{
+ for_each_window_manager([](WMClientConnection& conn) {
+ if (conn.window_id() < 0)
+ return IterationDecision::Continue;
+
+ conn.async_super_space_key_pressed(conn.window_id());
+ return IterationDecision::Continue;
+ });
+}
+
static bool window_type_has_title(WindowType type)
{
return type == WindowType::Normal || type == WindowType::ToolWindow;
@@ -1247,6 +1258,11 @@ void WindowManager::process_key_event(KeyEvent& event)
tell_wms_super_key_pressed();
return;
}
+
+ if (event.type() == Event::KeyDown && event.key() == Key_Space) {
+ tell_wms_super_space_key_pressed();
+ return;
+ }
}
if (MenuManager::the().current_menu() && event.key() != Key_Super) {
diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h
index b3f21dd71a..3dfa0b6ab6 100644
--- a/Userland/Services/WindowServer/WindowManager.h
+++ b/Userland/Services/WindowServer/WindowManager.h
@@ -156,6 +156,7 @@ public:
void tell_wms_window_rect_changed(Window&);
void tell_wms_applet_area_size_changed(Gfx::IntSize const&);
void tell_wms_super_key_pressed();
+ void tell_wms_super_space_key_pressed();
bool is_active_window_or_accessory(Window&) const;
diff --git a/Userland/Services/WindowServer/WindowManagerClient.ipc b/Userland/Services/WindowServer/WindowManagerClient.ipc
index b56aa24ca2..bd7317c6f1 100644
--- a/Userland/Services/WindowServer/WindowManagerClient.ipc
+++ b/Userland/Services/WindowServer/WindowManagerClient.ipc
@@ -6,4 +6,5 @@ endpoint WindowManagerClient
window_rect_changed(i32 wm_id, i32 client_id, i32 window_id, Gfx::IntRect rect) =|
applet_area_size_changed(i32 wm_id, Gfx::IntSize size) =|
super_key_pressed(i32 wm_id) =|
+ super_space_key_pressed(i32 wm_id) =|
}