1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +00:00

LibGUI: Allow widgets to opt-out from showing the command palette

This commit is contained in:
Sam Atkins 2022-02-03 15:01:07 +00:00 committed by Andreas Kling
parent a4cb6a49ae
commit bf4328de52
2 changed files with 6 additions and 1 deletions

View file

@ -196,7 +196,8 @@ void WindowServerConnection::key_down(i32 window_id, u32 code_point, u32 key, u3
}
// FIXME: This shortcut should be configurable.
if (!m_in_command_palette && modifiers == (Mod_Ctrl | Mod_Shift) && key == Key_A) {
bool focused_widget_accepts_command_palette = window->focused_widget() && window->focused_widget()->accepts_command_palette();
if (focused_widget_accepts_command_palette && !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)