Browse Source

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
pull/168/head
Michael R Sweet 21 years ago
parent
commit
ca116a1b6c
  1. 1
      CHANGES
  2. 8
      src/Fl_mac.cxx
  3. 7
      src/Fl_win32.cxx
  4. 17
      src/Fl_x.cxx

1
CHANGES

@ -1,6 +1,7 @@
CHANGES IN FLTK 1.1.5rc2 CHANGES IN FLTK 1.1.5rc2
- Documentation updates (STR #365) - Documentation updates (STR #365)
- FLTK now honors the numlock key state (STR #369)
- The Fl_Text_Display widget did not redraw selections - The Fl_Text_Display widget did not redraw selections
when focus changed (STR #390) when focus changed (STR #390)
- The plastic background image is now less contrasty - The plastic background image is now less contrasty

8
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). // MacOS specific code for the Fast Light Tool Kit (FLTK).
// //
@ -997,7 +997,9 @@ pascal OSStatus carbonKeyboardHandler( EventHandlerCallRef nextHandler, EventRef
sym = macKeyLookUp[ keyCode & 0x7f ]; sym = macKeyLookUp[ keyCode & 0x7f ];
Fl::e_keysym = sym; Fl::e_keysym = sym;
if ( keyCode==0x4c ) key=0x0d; 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; buffer[0] = key;
Fl::e_length = 1; Fl::e_length = 1;
} else { } 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 $".
// //

7
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). // 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) { if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) {
buffer[0] = char(wParam); buffer[0] = char(wParam);
Fl::e_length = 1; 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; buffer[0] = Fl::e_keysym-FL_KP;
Fl::e_length = 1; Fl::e_length = 1;
} else { } 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 $".
// //

17
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). // 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 // not produced on Windoze and thus case statements tend not to check
// for them. There are 15 of these in the range 0xff91 ... 0xff9f // for them. There are 15 of these in the range 0xff91 ... 0xff9f
if (keysym >= 0xff91 && keysym <= 0xff9f) { if (keysym >= 0xff91 && keysym <= 0xff9f) {
// Try to make them turn into FL_KP+'c' so that NumLock is // Map keypad keysym to character or keysym depending on
// irrelevant, by looking at the shifted code. This matches the // numlock state...
// behavior of the translator in Fl_win32.cxx, and IMHO is the
// user-friendly result:
unsigned long keysym1 = XKeycodeToKeysym(fl_display, keycode, 1); 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; keysym = keysym1 | FL_KP;
buffer[0] = char(keysym1) & 0x7F; buffer[0] = char(keysym1) & 0x7F;
len = 1; len = 1;
} else { } else {
// If that failed to work, just translate them to the matching // Map keypad to special key...
// normal function keys:
static const unsigned short table[15] = { static const unsigned short table[15] = {
FL_F+1, FL_F+2, FL_F+3, FL_F+4, FL_F+1, FL_F+2, FL_F+3, FL_F+4,
FL_Home, FL_Left, FL_Up, FL_Right, FL_Home, FL_Left, FL_Up, FL_Right,
@ -1280,5 +1279,5 @@ void Fl_Window::make_current() {
#endif #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 $".
// //

Loading…
Cancel
Save