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

LibGUI: Allow activation of CommandPalette without a focused widget

Previously we required there to be a focused widget so it would have
been able to opt out. In case the isn't a focused widget there is no way
for it to opt out anyways, so let's allow CommandPalette to work in this
case :^)
This commit is contained in:
networkException 2022-02-13 11:42:46 +01:00 committed by Andreas Kling
parent 6858066e20
commit daf2ebca3b

View file

@ -195,9 +195,12 @@ void WindowServerConnection::key_down(i32 window_id, u32 code_point, u32 key, u3
key_event->m_code_point = emoji_code_point;
}
bool accepts_command_palette = true;
if (window->focused_widget())
accepts_command_palette = window->focused_widget()->accepts_command_palette();
// FIXME: This shortcut should be configurable.
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) {
if (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)