LibGUI: Handle Action keyboard shortcuts in Widget keydown

Widgets can now prevent shortcut Actions from being called, which
allows text input keydown handlers to override single key shortcuts.
This commit is contained in:
Zaggy1024 2022-10-24 19:05:40 -05:00 committed by Sam Atkins
commit 967dfa7956
Notes: sideshowbarker 2024-07-17 04:28:44 +09:00
6 changed files with 72 additions and 13 deletions

View file

@ -125,6 +125,22 @@ Action::~Action()
}
}
void Action::process_event(Window& window, Event& event)
{
if (is_enabled()) {
flash_menubar_menu(window);
activate();
event.accept();
return;
}
if (swallow_key_event_when_disabled()) {
event.accept();
return;
}
event.ignore();
}
void Action::activate(Core::Object* activator)
{
if (!on_activation)