diff --git a/Userland/Libraries/LibGUI/CommandPalette.cpp b/Userland/Libraries/LibGUI/CommandPalette.cpp index 2a0d63a2c08..000d6e2ad85 100644 --- a/Userland/Libraries/LibGUI/CommandPalette.cpp +++ b/Userland/Libraries/LibGUI/CommandPalette.cpp @@ -223,8 +223,8 @@ CommandPalette::CommandPalette(GUI::Window& parent_window, ScreenPosition screen m_text_box->set_focus(true); - on_active_window_change = [this](bool is_active_window) { - if (!is_active_window) + on_active_input_change = [this](bool is_active_input) { + if (!is_active_input) close(); }; diff --git a/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp b/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp index 7ceca0e2779..6ff79764588 100644 --- a/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp +++ b/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp @@ -164,7 +164,7 @@ static Action* action_for_shortcut(Window& window, Shortcut const& shortcut) } // NOTE: Application-global shortcuts are ignored while a blocking modal window is up. - if (!window.is_blocking()) { + if (!window.is_blocking() && !window.is_capturing_input()) { if (auto* action = Application::the()->action_for_shortcut(shortcut)) { dbgln_if(KEYBOARD_SHORTCUTS_DEBUG, " > Asked application, got action: {} {} (enabled: {}, shortcut: {}, alt-shortcut: {})", action, action->text(), action->is_enabled(), action->shortcut().to_string(), action->alternate_shortcut().to_string()); return action; @@ -214,7 +214,7 @@ void ConnectionToWindowServer::key_down(i32 window_id, u32 code_point, u32 key, // FIXME: This shortcut should be configurable. if (accepts_command_palette && !m_in_command_palette && modifiers == (Mod_Ctrl | Mod_Shift) && key == Key_A) { auto command_palette = CommandPalette::construct(*window); - command_palette->set_window_mode(GUI::WindowMode::Passive); + command_palette->set_window_mode(GUI::WindowMode::CaptureInput); TemporaryChange change { m_in_command_palette, true }; if (command_palette->exec() != GUI::Dialog::ExecResult::OK) return; diff --git a/Userland/Libraries/LibGUI/Window.h b/Userland/Libraries/LibGUI/Window.h index cab90738b9d..9cefef31363 100644 --- a/Userland/Libraries/LibGUI/Window.h +++ b/Userland/Libraries/LibGUI/Window.h @@ -36,6 +36,7 @@ public: bool is_modal() const { return m_window_mode != WindowMode::Modeless; } bool is_blocking() const { return m_window_mode == WindowMode::Blocking; } + bool is_capturing_input() const { return m_window_mode == WindowMode::CaptureInput; } bool is_fullscreen() const { return m_fullscreen; } void set_fullscreen(bool);