mirror of
https://github.com/RGBCube/serenity
synced 2025-05-21 20:25:07 +00:00
LibGUI: Flash menubar when using command palette
This commit is contained in:
parent
048ed64c26
commit
c20f1e06c0
3 changed files with 6 additions and 7 deletions
|
@ -135,12 +135,10 @@ void Action::activate(Core::Object* activator)
|
||||||
m_activator = nullptr;
|
m_activator = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Action::flash_menubar_menu()
|
void Action::flash_menubar_menu(GUI::Window& window)
|
||||||
{
|
{
|
||||||
if (auto* app = Application::the())
|
|
||||||
if (auto* window = app->active_window())
|
|
||||||
for (auto& menu_item : m_menu_items)
|
for (auto& menu_item : m_menu_items)
|
||||||
window->flash_menubar_menu_for(*menu_item);
|
window.flash_menubar_menu_for(*menu_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Action::register_button(Badge<Button>, Button& button)
|
void Action::register_button(Badge<Button>, Button& button)
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
Function<void(Action&)> on_activation;
|
Function<void(Action&)> on_activation;
|
||||||
|
|
||||||
void activate(Core::Object* activator = nullptr);
|
void activate(Core::Object* activator = nullptr);
|
||||||
void flash_menubar_menu();
|
void flash_menubar_menu(GUI::Window& window);
|
||||||
|
|
||||||
bool is_enabled() const { return m_enabled; }
|
bool is_enabled() const { return m_enabled; }
|
||||||
void set_enabled(bool);
|
void set_enabled(bool);
|
||||||
|
|
|
@ -173,7 +173,7 @@ void WindowServerConnection::key_down(i32 window_id, u32 code_point, u32 key, u3
|
||||||
|
|
||||||
if (auto* action = action_for_key_event(*window, *key_event)) {
|
if (auto* action = action_for_key_event(*window, *key_event)) {
|
||||||
if (action->is_enabled()) {
|
if (action->is_enabled()) {
|
||||||
action->flash_menubar_menu();
|
action->flash_menubar_menu(*window);
|
||||||
action->activate();
|
action->activate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -202,6 +202,7 @@ void WindowServerConnection::key_down(i32 window_id, u32 code_point, u32 key, u3
|
||||||
return;
|
return;
|
||||||
auto* action = command_palette->selected_action();
|
auto* action = command_palette->selected_action();
|
||||||
VERIFY(action);
|
VERIFY(action);
|
||||||
|
action->flash_menubar_menu(*window);
|
||||||
action->activate();
|
action->activate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue