diff --git a/gb.gtk/src/CMouse.cpp b/gb.gtk/src/CMouse.cpp index efe20d28a..b3a5c336e 100644 --- a/gb.gtk/src/CMouse.cpp +++ b/gb.gtk/src/CMouse.cpp @@ -197,6 +197,13 @@ BEGIN_PROPERTY(Mouse_Delta) END_PROPERTY +BEGIN_PROPERTY(Mouse_FullDelta) + + CHECK_VALID(); + GB.ReturnBoolean(TRUE); + +END_PROPERTY + BEGIN_PROPERTY(Mouse_Orientation) CHECK_VALID(); @@ -440,6 +447,7 @@ GB_DESC CMouseDesc[] = GB_STATIC_PROPERTY_READ("Normal", "b", Mouse_Normal), GB_STATIC_PROPERTY_READ("Orientation", "i", Mouse_Orientation), GB_STATIC_PROPERTY_READ("Delta", "f", Mouse_Delta), + GB_STATIC_PROPERTY_READ("FullDelta", "b", Mouse_FullDelta), GB_STATIC_PROPERTY_READ("Forward", "b", Mouse_Forward), GB_STATIC_PROPERTY_READ("Click", "i", Mouse_Click), diff --git a/gb.qt4/src/CMouse.cpp b/gb.qt4/src/CMouse.cpp index 5fb98ff3c..a1c7d94f7 100644 --- a/gb.qt4/src/CMouse.cpp +++ b/gb.qt4/src/CMouse.cpp @@ -44,6 +44,10 @@ double MOUSE_timer = 0; MOUSE_INFO MOUSE_info = { 0 }; POINTER_INFO POINTER_info = { 0 }; +int MOUSE_delta_x = 0; +int MOUSE_delta_y = 0; +void *MOUSE_wheel_on_control = NULL; + static int _dx = 0; static int _dy = 0; @@ -366,6 +370,13 @@ BEGIN_PROPERTY(Mouse_Delta) END_PROPERTY +BEGIN_PROPERTY(Mouse_FullDelta) + + CHECK_VALID(); + GB.ReturnBoolean(abs(MOUSE_info.orientation == Qt::Horizontal ? MOUSE_delta_x : MOUSE_delta_y) >= 120); + +END_PROPERTY + BEGIN_PROPERTY(Mouse_Forward) CHECK_VALID(); @@ -643,6 +654,7 @@ GB_DESC CMouseDesc[] = GB_STATIC_PROPERTY_READ("Meta", "b", Mouse_Meta), GB_STATIC_PROPERTY_READ("Normal", "b", Mouse_Normal), GB_STATIC_PROPERTY_READ("Orientation", "i", Mouse_Orientation), + GB_STATIC_PROPERTY_READ("FullDelta", "b", Mouse_FullDelta), GB_STATIC_PROPERTY_READ("Delta", "f", Mouse_Delta), GB_STATIC_PROPERTY_READ("Forward", "b", Mouse_Forward), GB_STATIC_PROPERTY_READ("Click", "i", Mouse_Click), diff --git a/gb.qt4/src/CMouse.h b/gb.qt4/src/CMouse.h index e99a3c0fe..a2ba4f77f 100644 --- a/gb.qt4/src/CMouse.h +++ b/gb.qt4/src/CMouse.h @@ -41,12 +41,12 @@ typedef Qt::MouseButton button; Qt::MouseButtons state; Qt::KeyboardModifiers modifier; - int orientation; int delta; int screenX; int screenY; int dx; int dy; + int orientation; } MOUSE_INFO; @@ -76,6 +76,10 @@ extern double MOUSE_timer; extern MOUSE_INFO MOUSE_info; extern POINTER_INFO POINTER_info; +extern int MOUSE_delta_x; +extern int MOUSE_delta_y; +extern void *MOUSE_wheel_on_control; + #else #define THIS ((CCURSOR *)_object) diff --git a/gb.qt4/src/CWidget.cpp b/gb.qt4/src/CWidget.cpp index 1fa781638..354967748 100644 --- a/gb.qt4/src/CWidget.cpp +++ b/gb.qt4/src/CWidget.cpp @@ -2299,6 +2299,7 @@ void CWidget::destroy() CLEAN_POINTER(CWIDGET_previous_control); CLEAN_POINTER(CWIDGET_hovered); CLEAN_POINTER(_old_active_control); + CLEAN_POINTER(MOUSE_wheel_on_control); #if QT5 CLEAN_POINTER(_last_entered); #endif @@ -3147,25 +3148,43 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) #endif MOUSE_info.state = ev->buttons(); MOUSE_info.modifier = ev->modifiers(); + + if (control != MOUSE_wheel_on_control) + { + MOUSE_wheel_on_control = control; + MOUSE_delta_x = MOUSE_delta_y = 0; + } #ifdef QT5 QPoint delta = ev->angleDelta(); if (delta.x()) { + MOUSE_delta_x += delta.x(); MOUSE_info.orientation = Qt::Horizontal; MOUSE_info.delta = delta.x(); cancel = GB.Raise(control, EVENT_MouseWheel, 0); + MOUSE_delta_x %= 120; } if (delta.y()) { + MOUSE_delta_y += delta.y(); MOUSE_info.orientation = Qt::Vertical; MOUSE_info.delta = delta.y(); cancel = GB.Raise(control, EVENT_MouseWheel, 0); + MOUSE_delta_y %= 120; } #else + if (ev->orientation == Qt!!Horizontal) + MOUSE_delta_x += ev->delta(); + else + MOUSE_delta_y += ev->delta(); MOUSE_info.orientation = ev->orientation(); MOUSE_info.delta = ev->delta(); cancel = GB.Raise(control, EVENT_MouseWheel, 0); + if (ev->orientation == Qt!!Horizontal) + MOUSE_delta_x %= 120; + else + MOUSE_delta_y %= 120; #endif