summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES5
-rw-r--r--src/Fl.cxx8
-rw-r--r--src/Fl_Group.cxx13
3 files changed, 23 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 239d42191..4cb2f5646 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #648, STR #692)
+ - FL_MOUSEWHEEL events are now sent first to the widget
+ under the mouse pointer and then to the first widget
+ which accepts them. This is similar to the way
+ shortcut events are handled and is consistent with the
+ way the mouse wheel is handled by other toolkits.
- Fl::wait() could block on WIN32 if the window was
deleted via Fl::delete_widget() (STR #679)
- Fl_Preferences::RootNode did not find the user's home
diff --git a/src/Fl.cxx b/src/Fl.cxx
index d90600402..58a55aac0 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -757,9 +757,11 @@ int Fl::handle(int e, Fl_Window* window)
case FL_MOUSEWHEEL:
fl_xfocus = window; // this should not happen! But maybe it does:
- // Try it as keystroke, sending it to focus and all parents:
- for (wi = grab() ? grab() : focus(); wi; wi = wi->parent())
- if (send(FL_MOUSEWHEEL, wi, window)) return 1;
+ // Try sending it to the grab and then the window:
+ if (grab()) {
+ if (send(FL_MOUSEWHEEL, grab(), window)) return 1;
+ }
+ if (send(FL_MOUSEWHEEL, window, window)) return 1;
default:
break;
}
diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx
index 8655d53fe..289aa12c8 100644
--- a/src/Fl_Group.cxx
+++ b/src/Fl_Group.cxx
@@ -213,6 +213,19 @@ int Fl_Group::handle(int event) {
}
return 0;
+ case FL_MOUSEWHEEL:
+ for (i = children(); i--;) {
+ o = a[i];
+ if (o->takesevents() && Fl::event_inside(o) && send(o,FL_MOUSEWHEEL))
+ return 1;
+ }
+ for (i = children(); i--;) {
+ o = a[i];
+ if (o->takesevents() && !Fl::event_inside(o) && send(o,FL_MOUSEWHEEL))
+ return 1;
+ }
+ return 0;
+
case FL_DEACTIVATE:
case FL_ACTIVATE:
for (i = children(); i--;) {