diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2005-11-26 00:47:45 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2005-11-26 00:47:45 +0000 |
| commit | ae6ea393c038e941c9e2de2782986397832583b0 (patch) | |
| tree | 082869518c1d97637a37e0ca1040e1a554c68bb0 /src | |
| parent | f2019a54cbbe53b8a5535a6dfdd14b1f19d83f77 (diff) | |
Mousewheel fixes.
src/Fl_mac.cxx:
- Disable MightyMouse code for the moment - it is crashing on
my PowerBook...
src/Fl_Scrollbar.cxx:
- Fl_Scrollbar::handle() should only return 1 for mousewheel
events that it uses.
test/sudoku.cxx:
- More tweaking.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4654 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Scrollbar.cxx | 4 | ||||
| -rw-r--r-- | src/Fl_mac.cxx | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/Fl_Scrollbar.cxx b/src/Fl_Scrollbar.cxx index 370162a16..66547b469 100644 --- a/src/Fl_Scrollbar.cxx +++ b/src/Fl_Scrollbar.cxx @@ -132,11 +132,13 @@ int Fl_Scrollbar::handle(int event) { if (horizontal()) { if (Fl::e_dx==0) return 0; handle_drag(clamp(value() + linesize_ * Fl::e_dx)); + return 1; } else { if (Fl::e_dy==0) return 0; handle_drag(clamp(value() + linesize_ * Fl::e_dy)); + return 1; } - return 1; + break; case FL_SHORTCUT: case FL_KEYBOARD: { int v = value(); diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index a8f13cb34..b5779e4f1 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -799,15 +799,20 @@ static pascal OSStatus carbonMousewheelHandler( EventHandlerCallRef nextHandler, // to me why Apple changed the API on this even though the current API // supports two wheels just fine. Matthias, EventRef event; +// fprintf(stderr, "carbonMousewheelHandler: GetEventKind(ev=%p) = %d\n", ev, +// GetEventKind(ev)); if (GetEventKind(ev)==11) { // if this is a "MightyMouse" event, we need to convert it into a regular // MouseWheel event +// fputs("MightyMouse event!\n", stderr); GetEventParameter( ev, kEventParamEventRef, typeEventRef, NULL, sizeof( EventRef ), NULL, &event ); } else { // otherwise, we simply copy the event... event = ev; } +// fprintf(stderr, "event=%p!\n", event); + fl_lock_function(); fl_os_event = event; @@ -817,6 +822,7 @@ static pascal OSStatus carbonMousewheelHandler( EventHandlerCallRef nextHandler, GetEventParameter( event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(EventMouseWheelAxis), NULL, &axis ); long delta; GetEventParameter( event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(long), NULL, &delta ); +// fprintf(stderr, "axis=%d, delta=%d\n", axis, delta); if ( axis == kEventMouseWheelAxisX ) { Fl::e_dx = delta; if ( Fl::e_dx) Fl::handle( FL_MOUSEWHEEL, window ); @@ -1778,9 +1784,11 @@ void Fl_X::make(Fl_Window* w) OSStatus ret; EventHandlerUPP mousewheelHandler = NewEventHandlerUPP( carbonMousewheelHandler ); // will not be disposed by Carbon... static EventTypeSpec mousewheelEvents[] = { - { kEventClassMouse, 11 }, // "11" is the yet unlabled "MightyMouse" wheel event - sigh! +// { kEventClassMouse, 11 }, // "11" is the yet unlabled "MightyMouse" wheel event - sigh! { kEventClassMouse, kEventMouseWheelMoved } }; - ret = InstallWindowEventHandler( x->xid, mousewheelHandler, 2, mousewheelEvents, w, 0L ); + ret = InstallWindowEventHandler( x->xid, mousewheelHandler, + (int)(sizeof(mousewheelEvents)/sizeof(mousewheelEvents[0])), + mousewheelEvents, w, 0L ); EventHandlerUPP mouseHandler = NewEventHandlerUPP( carbonMouseHandler ); // will not be disposed by Carbon... static EventTypeSpec mouseEvents[] = { { kEventClassMouse, kEventMouseDown }, |
