diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-12 10:08:35 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-12 10:08:35 +0100 |
commit | db98327bdc24b3306961cde5036ea73e766008c3 (patch) | |
tree | 3980dd4690778151318bc28e7d5ae85aeecda28e /WindowServer/WSMenu.cpp | |
parent | 9c1c8854831005cee601d73bba3a0737f350c236 (diff) | |
download | serenity-db98327bdc24b3306961cde5036ea73e766008c3.zip |
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. :^)
Diffstat (limited to 'WindowServer/WSMenu.cpp')
-rw-r--r-- | WindowServer/WSMenu.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/WindowServer/WSMenu.cpp b/WindowServer/WSMenu.cpp index e8bd9361ae..0e93ab893d 100644 --- a/WindowServer/WSMenu.cpp +++ b/WindowServer/WSMenu.cpp @@ -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) |