diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2004-06-01 01:08:50 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2004-06-01 01:08:50 +0000 |
| commit | ca116a1b6c2e63aa9ecedd3992bd6437f076154c (patch) | |
| tree | a42c91a33a9061b547ec75880bc667e4dd943d25 /src/Fl_x.cxx | |
| parent | 888ca55da63f98ada70845420fc5aa950422b654 (diff) | |
FLTK now honors the numlock key state (STR #369)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3429 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_x.cxx')
| -rw-r--r-- | src/Fl_x.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 2418061bb..60567aa53 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_x.cxx,v 1.24.2.24.2.36 2004/05/24 01:30:45 easysw Exp $" +// "$Id: Fl_x.cxx,v 1.24.2.24.2.37 2004/06/01 01:08:50 easysw Exp $" // // X specific code for the Fast Light Tool Kit (FLTK). // @@ -800,18 +800,17 @@ int fl_handle(const XEvent& thisevent) // not produced on Windoze and thus case statements tend not to check // for them. There are 15 of these in the range 0xff91 ... 0xff9f if (keysym >= 0xff91 && keysym <= 0xff9f) { - // Try to make them turn into FL_KP+'c' so that NumLock is - // irrelevant, by looking at the shifted code. This matches the - // behavior of the translator in Fl_win32.cxx, and IMHO is the - // user-friendly result: + // Map keypad keysym to character or keysym depending on + // numlock state... unsigned long keysym1 = XKeycodeToKeysym(fl_display, keycode, 1); - if (keysym1 <= 0x7f || (keysym1 > 0xff9f && keysym1 <= FL_KP_Last)) { + if ((xevent.xkey.state & Mod2Mask) && + (keysym1 <= 0x7f || (keysym1 > 0xff9f && keysym1 <= FL_KP_Last))) { + // Store ASCII numeric keypad value... keysym = keysym1 | FL_KP; buffer[0] = char(keysym1) & 0x7F; len = 1; } else { - // If that failed to work, just translate them to the matching - // normal function keys: + // Map keypad to special key... static const unsigned short table[15] = { FL_F+1, FL_F+2, FL_F+3, FL_F+4, FL_Home, FL_Left, FL_Up, FL_Right, @@ -1280,5 +1279,5 @@ void Fl_Window::make_current() { #endif // -// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.36 2004/05/24 01:30:45 easysw Exp $". +// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.37 2004/06/01 01:08:50 easysw Exp $". // |
