1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibGUI: Remove Window::set_blocks_command_palette()

Since the logic to open the command palette is now in the form of an
action, its keybinding is only bound when the window active. Thus, when
a combo box or the emoji input dialog is active, the window isn't, and
the command palette doesn't show up, without requiring special checks.
This commit is contained in:
demostanis 2022-10-14 20:31:22 +02:00 committed by Linus Groh
parent 6bb512d0b2
commit 28c1d7011f
5 changed files with 0 additions and 25 deletions

View file

@ -115,7 +115,6 @@ ComboBox::ComboBox()
m_list_window = add<Window>(window()); m_list_window = add<Window>(window());
m_list_window->set_frameless(true); m_list_window->set_frameless(true);
m_list_window->set_window_mode(WindowMode::CaptureInput); m_list_window->set_window_mode(WindowMode::CaptureInput);
m_list_window->set_blocks_command_palette(true);
m_list_window->on_active_input_change = [this](bool is_active_input) { m_list_window->on_active_input_change = [this](bool is_active_input) {
if (!is_active_input) { if (!is_active_input) {
m_open_button->set_enabled(false); m_open_button->set_enabled(false);

View file

@ -176,7 +176,6 @@ CommandPalette::CommandPalette(GUI::Window& parent_window, ScreenPosition screen
: GUI::Dialog(&parent_window, screen_position) : GUI::Dialog(&parent_window, screen_position)
{ {
set_frameless(true); set_frameless(true);
set_blocks_command_palette(true);
set_blocks_emoji_input(true); set_blocks_emoji_input(true);
resize(450, 300); resize(450, 300);

View file

@ -202,24 +202,6 @@ void ConnectionToWindowServer::key_down(i32 window_id, u32 code_point, u32 key,
return; return;
} }
bool accepts_command_palette = !window->blocks_command_palette();
if (accepts_command_palette && window->focused_widget())
accepts_command_palette = window->focused_widget()->accepts_command_palette();
// 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::CaptureInput);
TemporaryChange change { m_in_command_palette, true };
if (command_palette->exec() != GUI::Dialog::ExecResult::OK)
return;
auto* action = command_palette->selected_action();
VERIFY(action);
action->flash_menubar_menu(*window);
action->activate();
return;
}
Core::EventLoop::current().post_event(*window, move(key_event)); Core::EventLoop::current().post_event(*window, move(key_event));
} }

View file

@ -99,7 +99,6 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window)
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
set_frameless(true); set_frameless(true);
set_blocks_command_palette(true);
set_blocks_emoji_input(true); set_blocks_emoji_input(true);
set_window_mode(GUI::WindowMode::CaptureInput); set_window_mode(GUI::WindowMode::CaptureInput);
resize(400, 300); resize(400, 300);

View file

@ -226,9 +226,6 @@ public:
Menubar& menubar() { return *m_menubar; } Menubar& menubar() { return *m_menubar; }
Menubar const& menubar() const { return *m_menubar; } Menubar const& menubar() const { return *m_menubar; }
void set_blocks_command_palette(bool b) { m_blocks_command_palette = b; }
bool blocks_command_palette() const { return m_blocks_command_palette; }
void set_blocks_emoji_input(bool b) { m_blocks_emoji_input = b; } void set_blocks_emoji_input(bool b) { m_blocks_emoji_input = b; }
bool blocks_emoji_input() const { return m_blocks_emoji_input; } bool blocks_emoji_input() const { return m_blocks_emoji_input; }
@ -316,7 +313,6 @@ private:
bool m_visible_for_timer_purposes { true }; bool m_visible_for_timer_purposes { true };
bool m_visible { false }; bool m_visible { false };
bool m_moved_by_client { false }; bool m_moved_by_client { false };
bool m_blocks_command_palette { false };
bool m_blocks_emoji_input { false }; bool m_blocks_emoji_input { false };
}; };