diff --git a/Userland/Libraries/LibGUI/Event.h b/Userland/Libraries/LibGUI/Event.h index edbf4ad2c9..92035a8d05 100644 --- a/Userland/Libraries/LibGUI/Event.h +++ b/Userland/Libraries/LibGUI/Event.h @@ -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) diff --git a/Userland/Libraries/LibGUI/WindowManagerServerConnection.cpp b/Userland/Libraries/LibGUI/WindowManagerServerConnection.cpp index 681e52489e..b3bc301624 100644 --- a/Userland/Libraries/LibGUI/WindowManagerServerConnection.cpp +++ b/Userland/Libraries/LibGUI/WindowManagerServerConnection.cpp @@ -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(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(wm_id)); +} } diff --git a/Userland/Libraries/LibGUI/WindowManagerServerConnection.h b/Userland/Libraries/LibGUI/WindowManagerServerConnection.h index eddeaf25e5..990dbd1841 100644 --- a/Userland/Libraries/LibGUI/WindowManagerServerConnection.h +++ b/Userland/Libraries/LibGUI/WindowManagerServerConnection.h @@ -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; }; } diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index f2498e63ed..e17cdff06c 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -328,6 +328,10 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) } break; } + case GUI::Event::WM_SuperSpaceKeyPressed: { + dbgln("super and space was pressed down"); + break; + } default: break; } 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) =| }