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
This commit is contained in:
Michael R Sweet 2005-02-20 00:23:36 +00:00
parent 452c17f8fb
commit 5b0aae2e87
3 changed files with 23 additions and 3 deletions

View File

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

View File

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

View File

@ -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--;) {