mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 23:25:20 +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:
committed by
Andreas Kling
parent
6858066e20
commit
daf2ebca3b
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user