From 399d1ff96188df74cc5c40f7e9afada7f808a488 Mon Sep 17 00:00:00 2001 From: Maciej Date: Sun, 30 Jan 2022 19:13:39 +0100 Subject: LibGUI: Allow only one CommandPalette at once to be opened Previously it was possible to open CommandPalette for a CommandPalette :^) --- Userland/Libraries/LibGUI/WindowServerConnection.cpp | 3 ++- Userland/Libraries/LibGUI/WindowServerConnection.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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; }; -- cgit v1.2.3