summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2007-01-18 10:40:37 +0000
committerMatthias Melcher <fltk@matthiasm.com>2007-01-18 10:40:37 +0000
commit5411396ea63dda4f103ef733cc7d35f795ffa0c0 (patch)
tree9a7ba736271312072163c990b8cd29206fc660bd /src
parentbc842ea528e7654db40f9c60571a48a6fd663804 (diff)
Fixed mousewheel event propagation (STR #1521)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5607 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 28f80225d..b6f0fe69b 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -796,6 +796,20 @@ int Fl::handle(int e, Fl_Window* window)
fl_fix_focus();
return 1;
+ case FL_KEYUP:
+ // Send the key-up to the current focus. This is not
+ // always the same widget that received the corresponding
+ // FL_KEYBOARD event because focus may have changed.
+ // Sending the KEYUP to the right KEYDOWN is possible, but
+ // would require that we track the KEYDOWN for every possible
+ // key stroke (users may hold down multiple keys!) and then
+ // make sure that the widget still exists before sending
+ // a KEYUP there. I believe that the current solution is
+ // "close enough".
+ for (wi = grab() ? grab() : focus(); wi; wi = wi->parent())
+ if (send(FL_KEYUP, wi, window)) return 1;
+ return 0;
+
case FL_KEYBOARD:
#ifdef DEBUG
printf("Fl::handle(e=%d, window=%p);\n", e, window);
@@ -872,10 +886,16 @@ int Fl::handle(int e, Fl_Window* window)
case FL_MOUSEWHEEL:
fl_xfocus = window; // this should not happen! But maybe it does:
- // Try sending it to the grab and then the window:
- if (grab()) {
+ // Try sending it to the "grab" first
+ if (grab() && grab()!=modal() && grab()!=window) {
if (send(FL_MOUSEWHEEL, grab(), window)) return 1;
}
+ // Now try sending it to the "modal" window
+ if (modal()) {
+ send(FL_MOUSEWHEEL, modal(), window);
+ return 1;
+ }
+ // Finally try sending it to the window, the event occured in
if (send(FL_MOUSEWHEEL, window, window)) return 1;
default:
break;