diff options
| -rw-r--r-- | src/Fl_Scrollbar.cxx | 4 | ||||
| -rw-r--r-- | src/Fl_mac.cxx | 12 | ||||
| -rw-r--r-- | test/sudoku.cxx | 6 |
3 files changed, 16 insertions, 6 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 }, diff --git a/test/sudoku.cxx b/test/sudoku.cxx index a8ad1f0d6..8606d1a34 100644 --- a/test/sudoku.cxx +++ b/test/sudoku.cxx @@ -162,12 +162,12 @@ SudokuCell::handle(int event) { case FL_KEYDOWN : int key = Fl::event_key() - '0'; - if (key >= 0 && key <= 9) { + if (key > 0 && key <= 9) { if (Fl::event_state() & FL_SHIFT) { int i; for (i = 0; i < 4; i ++) { - if (!test_value_[i]) break; + if (!test_value_[i] || test_value_[i] == key) break; } if (i >= 4) { @@ -182,7 +182,7 @@ SudokuCell::handle(int event) { do_callback(); } return 1; - } else if (Fl::event_key() == FL_BackSpace || + } else if (key == 0 || Fl::event_key() == FL_BackSpace || Fl::event_key() == FL_Delete) { value(0); do_callback(); |
