aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer/Viewport.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2013-04-16 11:56:29 +0000
committerPierre Ossman <ossman@cendio.se>2013-04-16 11:56:29 +0000
commit7e8ace1ca7b1f6347ae47e2080951b8058bc91d1 (patch)
treef0e3e6fadb54b520f8f5ec66c9136d23c5056728 /vncviewer/Viewport.cxx
parent02ef70b211e49aadfab3b8f645a7a6bd29695155 (diff)
downloadtigervnc-7e8ace1ca7b1f6347ae47e2080951b8058bc91d1.tar.gz
tigervnc-7e8ace1ca7b1f6347ae47e2080951b8058bc91d1.zip
Work around Windows poor handling of the numpad decimal key.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5083 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer/Viewport.cxx')
-rw-r--r--vncviewer/Viewport.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 43b39d4f..25c41103 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -594,6 +594,26 @@ rdr::U32 Viewport::translateKeyEvent(int keyCode, int origKeyCode, const char *k
}
#endif
+#ifdef WIN32
+ // X11 fairly consistently uses XK_KP_Separator for comma and
+ // XK_KP_Decimal for period. Windows unfortunately is terribly
+ // inconcistent, and is not something that's likely to change:
+ // http://blogs.msdn.com/michkap/archive/2006/09/13/752377.aspx
+ // To work around this we look at what character the key generates
+ // and try to follow X11 behaviour.
+ if ((keyCode == (FL_KP + ',')) || (keyCode == (FL_KP + '.'))) {
+ switch (keyText[0]) {
+ case ',':
+ return XK_KP_Separator;
+ case '.':
+ return XK_KP_Decimal;
+ default:
+ vlog.error(_("Unknown decimal separator: '%s'"), keyText);
+ return XK_KP_Decimal;
+ }
+ }
+#endif
+
// Then other special keys
switch (keyCode) {
case FL_BackSpace: