mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 14:25:06 +00:00
Plumb menu item activation events from WindowServer to clients.
GMenu now has an "on_item_activation" callback that fires whenever one of its items are activated. The menu item identifier is used to distinguish between items. Use this to implement font switching in Terminal. :^)
This commit is contained in:
parent
9c1c885483
commit
db98327bdc
10 changed files with 93 additions and 3 deletions
|
@ -137,7 +137,18 @@ void WSMenu::did_activate(WSMenuItem& item)
|
|||
{
|
||||
if (on_item_activation)
|
||||
on_item_activation(item);
|
||||
|
||||
close();
|
||||
|
||||
GUI_Event gui_event;
|
||||
gui_event.type = GUI_Event::Type::MenuItemActivated;
|
||||
gui_event.menu.menu_id = m_menu_id;
|
||||
gui_event.menu.identifier = item.identifier();
|
||||
|
||||
if (!m_process)
|
||||
return;
|
||||
LOCKER(m_process->gui_events_lock());
|
||||
m_process->gui_events().append(move(gui_event));
|
||||
}
|
||||
|
||||
WSMenuItem* WSMenu::item_at(const Point& position)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue