'Mouse.FullDelta' is a new boolean property that returns TRUE each time the user has scrolled the mouse wheel at least 15° during a mouse wheel event.

[GB.GTK]
* NEW: 'Mouse.FullDelta' is a new boolean property that returns TRUE each time the user has scrolled the mouse wheel at least 15° during a mouse wheel event.
  At the moment this property always returns TRUE on GTK.

[GB.GTK3]
* NEW: 'Mouse.FullDelta' is a new boolean property that returns TRUE each time the user has scrolled the mouse wheel at least 15° during a mouse wheel event.
  At the moment this property always returns TRUE on GTK.

[GB.QT4]
* NEW: 'Mouse.FullDelta' is a new boolean property that returns TRUE each time the user has scrolled the mouse wheel at least 15° during a mouse wheel event.

[GB.QT5]
* NEW: 'Mouse.FullDelta' is a new boolean property that returns TRUE each time the user has scrolled the mouse wheel at least 15° during a mouse wheel event.
This commit is contained in:
Benoît Minisini 2023-10-02 23:17:52 +02:00
parent ee81ba602a
commit 0c9ac1d884
4 changed files with 44 additions and 1 deletions

View File

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

View File

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

View File

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

View File

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