Browse Source

Attempt to handle Ctrl+key

Hacky attempt to try to figure out the actual key pressed when
FLTK is giving us control codes.
tags/v1.3.90
Pierre Ossman 9 years ago
parent
commit
13a809a6ba
1 changed files with 17 additions and 1 deletions
  1. 17
    1
      vncviewer/Viewport.cxx

+ 17
- 1
vncviewer/Viewport.cxx View File



// FLTK can pull in the X11 headers on some systems // FLTK can pull in the X11 headers on some systems
#ifndef XK_VoidSymbol #ifndef XK_VoidSymbol
#define XK_LATIN1
#define XK_MISCELLANY #define XK_MISCELLANY
#define XK_XKB_KEYS #define XK_XKB_KEYS
#include <rfb/keysymdef.h> #include <rfb/keysymdef.h>
} }


// Unknown special key? // Unknown special key?
if (keyText[0] == '\0') {
if (keyTextLen == 0) {
vlog.error(_("Unknown FLTK key code %d (0x%04x)"), keyCode, keyCode); vlog.error(_("Unknown FLTK key code %d (0x%04x)"), keyCode, keyCode);
return NoSymbol; 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 // Look up the symbol the key produces and translate that from Unicode
// to a X11 keysym. // to a X11 keysym.
if (fl_utf_nb_char((const unsigned char*)keyText, strlen(keyText)) != 1) { if (fl_utf_nb_char((const unsigned char*)keyText, strlen(keyText)) != 1) {

Loading…
Cancel
Save