summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--src/Fl_win32.cxx9
-rw-r--r--src/Fl_x.cxx47
3 files changed, 32 insertions, 25 deletions
diff --git a/CHANGES b/CHANGES
index f96617608..e6ca1ad54 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,7 @@ CHANGES IN FLTK 1.1.0b5
those boxtypes causing them to be reset.
- Fl_Help_Func now takes a Fl_Widget pointer as well as
a pathname.
+ - Added code to support FL_KEYUP events.
CHANGES IN FLTK 1.1.0b4
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 2b6ba8061..f9724d7c4 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.4 2001/09/30 12:42:32 easysw Exp $"
+// "$Id: Fl_win32.cxx,v 1.33.2.37.2.5 2001/10/27 03:45:29 easysw Exp $"
//
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
//
@@ -576,7 +576,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
}
if (GetKeyState(VK_SCROLL)) state |= FL_SCROLL_LOCK;
Fl::e_state = state;
- if (lParam & (1<<31)) goto DEFAULT; // ignore up events after fixing shift
+ if (lParam & (1<<31)) { // key up events.
+ if (Fl::handle(FL_KEYUP, window)) return 0;
+ break;
+ }
static char buffer[2];
if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) {
buffer[0] = char(wParam);
@@ -998,5 +1001,5 @@ void Fl_Window::make_current() {
}
//
-// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.4 2001/09/30 12:42:32 easysw Exp $".
+// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.5 2001/10/27 03:45:29 easysw Exp $".
//
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 900d08428..c69238cb5 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.3 2001/10/18 18:53:20 easysw Exp $"
+// "$Id: Fl_x.cxx,v 1.24.2.24.2.4 2001/10/27 03:45:29 easysw Exp $"
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
@@ -487,19 +487,33 @@ int fl_handle(const XEvent& xevent)
event = FL_UNFOCUS;
break;
- case KeyPress: {
+ case KeyPress:
+ case KeyRelease: {
int keycode = xevent.xkey.keycode;
fl_key_vector[keycode/8] |= (1 << (keycode%8));
static char buffer[21];
+ int len;
KeySym keysym;
- //static XComposeStatus compose;
- int len = XLookupString((XKeyEvent*)&(xevent.xkey),
- buffer, 20, &keysym, 0/*&compose*/);
- if (keysym && keysym < 0x400) { // a character in latin-1,2,3,4 sets
- // force it to type a character (not sure if this ever is needed):
- if (!len) {buffer[0] = char(keysym); len = 1;}
- // ignore all effects of shift on the keysyms, which makes it a lot
- // easier to program shortcuts and is Windoze-compatable:
+ if (xevent.type == KeyPress) {
+ event = FL_KEYDOWN;
+ //static XComposeStatus compose;
+ len = XLookupString((XKeyEvent*)&(xevent.xkey),
+ buffer, 20, &keysym, 0/*&compose*/);
+ if (keysym && keysym < 0x400) { // a character in latin-1,2,3,4 sets
+ // force it to type a character (not sure if this ever is needed):
+ if (!len) {buffer[0] = char(keysym); len = 1;}
+ // ignore all effects of shift on the keysyms, which makes it a lot
+ // easier to program shortcuts and is Windoze-compatable:
+ keysym = XKeycodeToKeysym(fl_display, keycode, 0);
+ }
+ if (Fl::event_state(FL_CTRL) && keysym == '-') buffer[0] = 0x1f; // ^_
+ buffer[len] = 0;
+ Fl::e_text = buffer;
+ Fl::e_length = len;
+ } else {
+ event = FL_KEYUP;
+ fl_key_vector[keycode/8] &= ~(1 << (keycode%8));
+ // keyup events just get the unshifted keysym:
keysym = XKeycodeToKeysym(fl_display, keycode, 0);
}
#ifdef __sgi
@@ -545,22 +559,11 @@ int fl_handle(const XEvent& xevent)
keysym = table[keysym-0xff91];
}
}
- buffer[len] = 0;
Fl::e_keysym = int(keysym);
- Fl::e_text = buffer;
- Fl::e_length = len;
set_event_xy();
Fl::e_is_click = 0;
- if (Fl::event_state(FL_CTRL) && keysym == '-') buffer[0] = 0x1f; // ^_
- event = FL_KEYBOARD;
break;}
- case KeyRelease: {
- int keycode = xevent.xkey.keycode;
- fl_key_vector[keycode/8] &= ~(1 << (keycode%8));
- set_event_xy();}
- break;
-
case EnterNotify:
if (xevent.xcrossing.detail == NotifyInferior) break;
// XInstallColormap(fl_display, Fl_X::i(window)->colormap);
@@ -931,5 +934,5 @@ void Fl_Window::make_current() {
#endif
//
-// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.3 2001/10/18 18:53:20 easysw Exp $".
+// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.4 2001/10/27 03:45:29 easysw Exp $".
//