1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:27:46 +00:00

WindowServer: Support Alt+Character menu shortcuts :^)

This patch adds support for opening menus via keyboard shortcuts.
Use an ampersand in a menu name to automatically create a keyboard
shortcut (Alt + the character following the ampersand.)

Menus with an Alt shortcut have a small underline under the shortcut
character for discoverability.
This commit is contained in:
Andreas Kling 2021-04-05 23:03:55 +02:00
parent 89bc655765
commit d80fb6d9c0
6 changed files with 56 additions and 19 deletions

View file

@ -41,6 +41,7 @@ namespace WindowServer {
class ClientConnection;
class Cursor;
class KeyEvent;
class Menu;
class MenuBar;
class MenuItem;
@ -339,6 +340,7 @@ public:
private:
virtual void event(Core::Event&) override;
void handle_mouse_event(const MouseEvent&);
void handle_keydown_event(const KeyEvent&);
void update_menu_item_text(PopupMenuItem item);
void update_menu_item_enabled(PopupMenuItem item);
void add_child_window(Window&);