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
This commit is contained in:
Michael R Sweet 2004-06-01 01:08:50 +00:00
parent 888ca55da6
commit ca116a1b6c
4 changed files with 18 additions and 15 deletions

View File

@ -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

View File

@ -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 $".
//

View File

@ -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 $".
//

View File

@ -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 $".
//