diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-08-22 15:09:54 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-08-22 15:09:54 +0200 |
commit | 13a809a6baca9572ab4a9cb992121fbc4e4ffba6 (patch) | |
tree | ee7d7fda57fc082d7044e7f393ee6609c5870b88 /vncviewer | |
parent | 25188c448cef7c802b8e27e13d643a7c95aaa840 (diff) | |
download | tigervnc-13a809a6baca9572ab4a9cb992121fbc4e4ffba6.tar.gz tigervnc-13a809a6baca9572ab4a9cb992121fbc4e4ffba6.zip |
Attempt to handle Ctrl+key
Hacky attempt to try to figure out the actual key pressed when
FLTK is giving us control codes.
Diffstat (limited to 'vncviewer')
-rw-r--r-- | vncviewer/Viewport.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index 2209fe58..16b34e6c 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -30,6 +30,7 @@ // FLTK can pull in the X11 headers on some systems #ifndef XK_VoidSymbol +#define XK_LATIN1 #define XK_MISCELLANY #define XK_XKB_KEYS #include <rfb/keysymdef.h> @@ -821,11 +822,26 @@ rdr::U32 Viewport::translateKeyEvent(void) } // Unknown special key? - if (keyText[0] == '\0') { + if (keyTextLen == 0) { vlog.error(_("Unknown FLTK key code %d (0x%04x)"), keyCode, keyCode); return NoSymbol; } + // Control character? + if ((keyTextLen == 1) && ((keyText[0] < 0x20) | (keyText[0] == 0x7f))) { + if (keyText[0] == 0x00) + return XK_2; + else if (keyText[0] < 0x1b) { + if (!!Fl::event_state(FL_SHIFT) != !!Fl::event_state(FL_CAPS_LOCK)) + return keyText[0] + XK_A - 0x01; + else + return keyText[0] + XK_a - 0x01; + } else if (keyText[0] < 0x20) + return keyText[0] + XK_3 - 0x1b; + else + return XK_8; + } + // Look up the symbol the key produces and translate that from Unicode // to a X11 keysym. if (fl_utf_nb_char((const unsigned char*)keyText, strlen(keyText)) != 1) { |