aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer/Viewport.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2017-11-13 09:06:03 +0100
committerPierre Ossman <ossman@cendio.se>2017-11-13 15:55:51 +0100
commitf73214c9ea5ee965c8bd5d7102d761408601118a (patch)
treee3618c664759cbefe1f2f8ee2e3db8b24b198e97 /vncviewer/Viewport.cxx
parentce4722f3cdae6a3446b15dd52ade93ca6f49dca6 (diff)
downloadtigervnc-f73214c9ea5ee965c8bd5d7102d761408601118a.tar.gz
tigervnc-f73214c9ea5ee965c8bd5d7102d761408601118a.zip
Handle Windows scan code exceptions
Windows mostly follows the AT set 1 scan codes that we want, but there are a few exceptions.
Diffstat (limited to 'vncviewer/Viewport.cxx')
-rw-r--r--vncviewer/Viewport.cxx32
1 files changed, 23 insertions, 9 deletions
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 31d09a1e..960a085c 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -894,10 +894,24 @@ int Viewport::handleSystemEvent(void *event, void *data)
if (isExtended)
keyCode |= 0x80;
- // VK_SNAPSHOT sends different scan codes depending on the state of
- // Alt. This means that we can get different scan codes on press and
- // release. Force it to be something standard.
- if (vKey == VK_SNAPSHOT)
+
+ // Fortunately RFB and Windows use the same scan code set (mostly),
+ // so there is no conversion needed
+ // (as long as we encode the extended keys with the high bit)
+
+ // However Pause sends a code that conflicts with NumLock, so use
+ // the code most RFB implementations use (part of the sequence for
+ // Ctrl+Pause, i.e. Break)
+ if (keyCode == 0x45)
+ keyCode = 0xc6;
+
+ // And NumLock incorrectly has the extended bit set
+ if (keyCode == 0xc5)
+ keyCode = 0x45;
+
+ // And Alt+PrintScreen (i.e. SysRq) sends a different code than
+ // PrintScreen
+ if (keyCode == 0xb7)
keyCode = 0x54;
keySym = win32_vkey_to_keysym(vKey, isExtended);
@@ -908,10 +922,6 @@ int Viewport::handleSystemEvent(void *event, void *data)
vlog.error(_("No symbol for virtual key 0x%02x"), (int)vKey);
}
- // Fortunately RFB and Windows use the same scan code set,
- // so there is no conversion needed
- // (as long as we encode the extended keys with the high bit)
-
self->handleKeyPress(keyCode, keySym);
return 1;
@@ -934,7 +944,11 @@ int Viewport::handleSystemEvent(void *event, void *data)
keyCode = MapVirtualKey(vKey, MAPVK_VK_TO_VSC);
if (isExtended)
keyCode |= 0x80;
- if (vKey == VK_SNAPSHOT)
+ if (keyCode == 0x45)
+ keyCode = 0xc6;
+ if (keyCode == 0xc5)
+ keyCode = 0x45;
+ if (keyCode == 0xb7)
keyCode = 0x54;
self->handleKeyRelease(keyCode);