From: Pierre Ossman Date: Tue, 6 Nov 2018 16:31:11 +0000 (+0100) Subject: Fixed handling of AltGr from Windows' touch keyboard X-Git-Tag: v1.9.90~67 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=42d0f5dd74fa0fe3bf3f26a92ecc5846db17895b;p=tigervnc.git Fixed handling of AltGr from Windows' touch keyboard We need to test this always in order to catch Ctrl+AltGr, and to handle release of the key properly. Hopefully there isn't any other case where VK_MENU is sent without a scan code. --- diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 165560cb..18ed69e7 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -936,6 +936,13 @@ int Viewport::handleSystemEvent(void *event, void *data) keyCode = ((msg->lParam >> 16) & 0xff); + // Windows' touch keyboard doesn't set a scan code for the Alt + // portion of the AltGr sequence, so we need to help it out + if (!isExtended && (keyCode == 0x00) && (vKey == VK_MENU)) { + isExtended = true; + keyCode = 0x38; + } + // Windows doesn't have a proper AltGr, but handles it using fake // Ctrl+Alt. However the remote end might not be Windows, so we need // to merge those in to a single AltGr event. We detect this case @@ -945,13 +952,6 @@ int Viewport::handleSystemEvent(void *event, void *data) self->altGrArmed = false; Fl::remove_timeout(handleAltGrTimeout); - // Windows' touch keyboard doesn't set a scan code for the Alt - // portion of the AltGr sequence, so we need to help it out - if (!isExtended && (keyCode == 0x00)) { - isExtended = true; - keyCode = 0x38; - } - if (isExtended && (keyCode == 0x38) && (vKey == VK_MENU) && ((msg->time - self->altGrCtrlTime) < 50)) { // Alt seen, so this is an AltGr sequence @@ -1047,6 +1047,12 @@ int Viewport::handleSystemEvent(void *event, void *data) keyCode = ((msg->lParam >> 16) & 0xff); + // Touch keyboard AltGr (see above) + if (!isExtended && (keyCode == 0x00) && (vKey == VK_MENU)) { + isExtended = true; + keyCode = 0x38; + } + // We can't get a release in the middle of an AltGr sequence, so // abort that detection if (self->altGrArmed) {