diff options
author | Maciej <sppmacd@pm.me> | 2022-01-30 19:13:39 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-01 10:32:24 +0100 |
commit | 399d1ff96188df74cc5c40f7e9afada7f808a488 (patch) | |
tree | 15d9b3edddc524f647b3e4eb5c4e457d26f027b8 | |
parent | daec52101064a41edf5191e6b97c933e26c3cc02 (diff) | |
download | serenity-399d1ff96188df74cc5c40f7e9afada7f808a488.zip |
LibGUI: Allow only one CommandPalette at once to be opened
Previously it was possible to open CommandPalette for
a CommandPalette :^)
-rw-r--r-- | Userland/Libraries/LibGUI/WindowServerConnection.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/WindowServerConnection.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp index f5ad28a42d..2cf836458a 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp @@ -196,8 +196,9 @@ void WindowServerConnection::key_down(i32 window_id, u32 code_point, u32 key, u3 } // FIXME: This shortcut should be configurable. - if (modifiers == (Mod_Ctrl | Mod_Shift) && key == Key_A) { + if (!m_in_command_palette && modifiers == (Mod_Ctrl | Mod_Shift) && key == Key_A) { auto command_palette = CommandPalette::construct(*window); + TemporaryChange change { m_in_command_palette, true }; if (command_palette->exec() != GUI::Dialog::ExecOK) return; auto* action = command_palette->selected_action(); diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.h b/Userland/Libraries/LibGUI/WindowServerConnection.h index e5a9b79901..065f28f01d 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.h +++ b/Userland/Libraries/LibGUI/WindowServerConnection.h @@ -58,6 +58,7 @@ private: virtual void track_mouse_move(Gfx::IntPoint const&) override; virtual void ping() override; + bool m_in_command_palette { false }; bool m_display_link_notification_pending { false }; i32 m_client_id; }; |