summaryrefslogtreecommitdiff
path: root/WindowServer/WSClientConnection.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-02 10:04:49 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-02 10:10:06 +0100
commit596a5ce5a4dbd9e42d99d576a05a8958f04eb920 (patch)
tree71aa7cf0544232baaedf4ea4e8a7dea7a8e7e0fd /WindowServer/WSClientConnection.cpp
parent5c0fca0a955c91c41683941a9de159fa87e98446 (diff)
downloadserenity-596a5ce5a4dbd9e42d99d576a05a8958f04eb920.zip
LibGUI+WindowServer: Add app-global keyboard shortcuts.
This patch adds a GShortcut class. Each GAction can have a GShortcut which will cause the event loop to listen for that key combination app-globally and activate the event in case it's pressed. The shortcut will also be displayed when the action is added to a menu. Use this to hook up Alt+Up with the "open parent directory" action in the FileManager app. :^)
Diffstat (limited to 'WindowServer/WSClientConnection.cpp')
-rw-r--r--WindowServer/WSClientConnection.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/WindowServer/WSClientConnection.cpp b/WindowServer/WSClientConnection.cpp
index 0cf421b0f4..71c4c8a076 100644
--- a/WindowServer/WSClientConnection.cpp
+++ b/WindowServer/WSClientConnection.cpp
@@ -210,14 +210,13 @@ void WSClientConnection::handle_request(WSAPIAddMenuItemRequest& request)
{
int menu_id = request.menu_id();
unsigned identifier = request.identifier();
- String text = request.text();
auto it = m_menus.find(menu_id);
if (it == m_menus.end()) {
post_error("Bad menu ID");
return;
}
auto& menu = *(*it).value;
- menu.add_item(make<WSMenuItem>(identifier, move(text)));
+ menu.add_item(make<WSMenuItem>(identifier, request.text(), request.shortcut_text()));
WSAPI_ServerMessage response;
response.type = WSAPI_ServerMessage::Type::DidAddMenuItem;
response.menu.menu_id = menu_id;