Add detection of the Meta/Super key press

Differential Revision: https://phabricator.kde.org/D10379
This commit is contained in:
Bertrand Lacost 2018-11-07 15:59:26 +01:00 committed by Albert Vaca
parent ede8f17e15
commit a685a4910e
2 changed files with 11 additions and 0 deletions

View file

@ -151,6 +151,10 @@ bool WindowsRemoteInput::handlePacket(const NetworkPacket& np)
input.ki.wVk = VK_LSHIFT; input.ki.wVk = VK_LSHIFT;
::SendInput(1,&input,sizeof(INPUT)); ::SendInput(1,&input,sizeof(INPUT));
} }
if (super) {
input.ki.wVk = VK_LWIN;
::SendInput(1,&input,sizeof(INPUT));
}
if (specialKey) if (specialKey)
{ {
@ -236,6 +240,10 @@ bool WindowsRemoteInput::handlePacket(const NetworkPacket& np)
input.ki.wVk = VK_LSHIFT; input.ki.wVk = VK_LSHIFT;
::SendInput(1,&input,sizeof(INPUT)); ::SendInput(1,&input,sizeof(INPUT));
} }
if (super) {
input.ki.wVk = VK_LWIN;
::SendInput(1,&input,sizeof(INPUT));
}
} }

View file

@ -164,10 +164,12 @@ bool X11RemoteInput::handlePacket(const NetworkPacket& np)
bool ctrl = np.get<bool>(QStringLiteral("ctrl"), false); bool ctrl = np.get<bool>(QStringLiteral("ctrl"), false);
bool alt = np.get<bool>(QStringLiteral("alt"), false); bool alt = np.get<bool>(QStringLiteral("alt"), false);
bool shift = np.get<bool>(QStringLiteral("shift"), false); bool shift = np.get<bool>(QStringLiteral("shift"), false);
bool super = np.get<bool>(QStringLiteral("super"), false);
if (ctrl) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Control_L), True, 0); if (ctrl) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Control_L), True, 0);
if (alt) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Alt_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 (shift) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Shift_L), True, 0);
if (super) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Super_L), True, 0);
if (specialKey) if (specialKey)
{ {
@ -202,6 +204,7 @@ bool X11RemoteInput::handlePacket(const NetworkPacket& np)
if (ctrl) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Control_L), False, 0); if (ctrl) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Control_L), False, 0);
if (alt) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Alt_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 (shift) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Shift_L), False, 0);
if (super) XTestFakeKeyEvent (display, XKeysymToKeycode(display, XK_Super_L), False, 0);
} }