From a685a4910e0bbd528b6e76026f8832397835c991 Mon Sep 17 00:00:00 2001 From: Bertrand Lacost Date: Wed, 7 Nov 2018 15:59:26 +0100 Subject: [PATCH] Add detection of the Meta/Super key press Differential Revision: https://phabricator.kde.org/D10379 --- plugins/mousepad/windowsremoteinput.cpp | 8 ++++++++ plugins/mousepad/x11remoteinput.cpp | 3 +++ 2 files changed, 11 insertions(+) diff --git a/plugins/mousepad/windowsremoteinput.cpp b/plugins/mousepad/windowsremoteinput.cpp index 3d892a908..f713440f6 100644 --- a/plugins/mousepad/windowsremoteinput.cpp +++ b/plugins/mousepad/windowsremoteinput.cpp @@ -151,6 +151,10 @@ bool WindowsRemoteInput::handlePacket(const NetworkPacket& np) input.ki.wVk = VK_LSHIFT; ::SendInput(1,&input,sizeof(INPUT)); } + if (super) { + input.ki.wVk = VK_LWIN; + ::SendInput(1,&input,sizeof(INPUT)); + } if (specialKey) { @@ -236,6 +240,10 @@ bool WindowsRemoteInput::handlePacket(const NetworkPacket& np) input.ki.wVk = VK_LSHIFT; ::SendInput(1,&input,sizeof(INPUT)); } + if (super) { + input.ki.wVk = VK_LWIN; + ::SendInput(1,&input,sizeof(INPUT)); + } } diff --git a/plugins/mousepad/x11remoteinput.cpp b/plugins/mousepad/x11remoteinput.cpp index 4f4bc9714..41a40a38e 100644 --- a/plugins/mousepad/x11remoteinput.cpp +++ b/plugins/mousepad/x11remoteinput.cpp @@ -164,10 +164,12 @@ bool X11RemoteInput::handlePacket(const NetworkPacket& np) bool ctrl = np.get(QStringLiteral("ctrl"), false); bool alt = np.get(QStringLiteral("alt"), false); bool shift = np.get(QStringLiteral("shift"), false); + bool super = np.get(QStringLiteral("super"), false); if (ctrl) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Control_L), True, 0); if (alt) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Alt_L), True, 0); if (shift) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Shift_L), True, 0); + if (super) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Super_L), True, 0); if (specialKey) { @@ -202,6 +204,7 @@ bool X11RemoteInput::handlePacket(const NetworkPacket& np) if (ctrl) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Control_L), False, 0); if (alt) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Alt_L), False, 0); if (shift) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Shift_L), False, 0); + if (super) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Super_L), False, 0); }