diff options
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | src/Fl_mac.cxx | 8 | ||||
| -rw-r--r-- | src/Fl_win32.cxx | 7 | ||||
| -rw-r--r-- | src/Fl_x.cxx | 17 |
4 files changed, 18 insertions, 15 deletions
@@ -1,6 +1,7 @@ CHANGES IN FLTK 1.1.5rc2 - Documentation updates (STR #365) + - FLTK now honors the numlock key state (STR #369) - The Fl_Text_Display widget did not redraw selections when focus changed (STR #390) - The plastic background image is now less contrasty diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index 4a18aeb7c..b869b41cc 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_mac.cxx,v 1.1.2.54 2004/04/11 04:38:59 easysw Exp $" +// "$Id: Fl_mac.cxx,v 1.1.2.55 2004/06/01 01:08:50 easysw Exp $" // // MacOS specific code for the Fast Light Tool Kit (FLTK). // @@ -997,7 +997,9 @@ pascal OSStatus carbonKeyboardHandler( EventHandlerCallRef nextHandler, EventRef sym = macKeyLookUp[ keyCode & 0x7f ]; Fl::e_keysym = sym; if ( keyCode==0x4c ) key=0x0d; - if ( ( (sym>=FL_KP) && (sym<=FL_KP_Last) ) || ((sym&0xff00)==0) || (sym==FL_Tab) || (sym==FL_Enter) ) { + if ((Fl::e_state & FL_NUM_LOCK) && + ((sym >= FL_KP && sym <= FL_KP_Last) || !(sym & 0xff00) || + sym == FL_Tab || sym == FL_Enter)) { buffer[0] = key; Fl::e_length = 1; } else { @@ -1920,6 +1922,6 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) { // -// End of "$Id: Fl_mac.cxx,v 1.1.2.54 2004/04/11 04:38:59 easysw Exp $". +// End of "$Id: Fl_mac.cxx,v 1.1.2.55 2004/06/01 01:08:50 easysw Exp $". // diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index ecd4651c4..d05427622 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_win32.cxx,v 1.33.2.37.2.48 2004/04/11 04:38:59 easysw Exp $" +// "$Id: Fl_win32.cxx,v 1.33.2.37.2.49 2004/06/01 01:08:50 easysw Exp $" // // WIN32-specific code for the Fast Light Tool Kit (FLTK). // @@ -726,7 +726,8 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) { buffer[0] = char(wParam); Fl::e_length = 1; - } else if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last) { + } else if (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last && + (state & FL_NUM_LOCK)) { buffer[0] = Fl::e_keysym-FL_KP; Fl::e_length = 1; } else { @@ -1195,5 +1196,5 @@ void Fl_Window::make_current() { } // -// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.48 2004/04/11 04:38:59 easysw Exp $". +// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.49 2004/06/01 01:08:50 easysw Exp $". // 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 $". // |
