summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2005-02-20 00:23:36 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2005-02-20 00:23:36 +0000
commit5b0aae2e871fac79f58572b7e8f68a5bbd3d0914 (patch)
tree8975bd086e37e7752e350932ae92c6aee9da5eb1 /src
parent452c17f8fbfe51eaba2eddeda2197db7f0a95ce2 (diff)
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. src/Fl.cxx: - Fl::handle(): Send FL_MOUSEWHEEL events to grab() or current window instead of focus widget. src/Fl_Group.cxx: - Fl_Group::handle(): Send FL_MOUSEWHEEL events first to an event_inside() widget, then to the first non-inside widget that accepts them. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4045 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx8
-rw-r--r--src/Fl_Group.cxx13
2 files changed, 18 insertions, 3 deletions
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--;) {