Fix wheel events when the decorations are enabled
We must offset the wheel events' position, as we do with the other types of mouse events. Change-Id: If85e93ffe95304c7dee4c2a3ff195a73243a8182 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
parent
58f3c602f0
commit
7d54e5527e
@ -494,6 +494,15 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WheelEvent : public QWaylandPointerEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WheelEvent(ulong t, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad)
|
||||||
|
: QWaylandPointerEvent(QWaylandPointerEvent::Wheel, t, l, g, pd, ad)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value)
|
void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value)
|
||||||
{
|
{
|
||||||
QWaylandWindow *window = mFocus;
|
QWaylandWindow *window = mFocus;
|
||||||
@ -517,10 +526,8 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in
|
|||||||
angleDelta.setY(valueDelta);
|
angleDelta.setY(valueDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWindowSystemInterface::handleWheelEvent(window->window(),
|
WheelEvent e(time, mSurfacePos, mGlobalPos, pixelDelta, angleDelta);
|
||||||
time, mSurfacePos,
|
window->handleMouse(mParent, e);
|
||||||
mGlobalPos, pixelDelta,
|
|
||||||
angleDelta);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_WAYLAND_XKB
|
#ifndef QT_NO_WAYLAND_XKB
|
||||||
|
@ -259,7 +259,8 @@ class QWaylandPointerEvent
|
|||||||
public:
|
public:
|
||||||
enum Type {
|
enum Type {
|
||||||
Enter,
|
Enter,
|
||||||
Motion
|
Motion,
|
||||||
|
Wheel
|
||||||
};
|
};
|
||||||
inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, Qt::MouseButtons b, Qt::KeyboardModifiers m)
|
inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, Qt::MouseButtons b, Qt::KeyboardModifiers m)
|
||||||
: type(t)
|
: type(t)
|
||||||
@ -269,6 +270,14 @@ public:
|
|||||||
, buttons(b)
|
, buttons(b)
|
||||||
, modifiers(m)
|
, modifiers(m)
|
||||||
{}
|
{}
|
||||||
|
inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad)
|
||||||
|
: type(t)
|
||||||
|
, timestamp(ts)
|
||||||
|
, local(l)
|
||||||
|
, global(g)
|
||||||
|
, pixelDelta(pd)
|
||||||
|
, angleDelta(ad)
|
||||||
|
{}
|
||||||
|
|
||||||
Type type;
|
Type type;
|
||||||
ulong timestamp;
|
ulong timestamp;
|
||||||
@ -276,6 +285,8 @@ public:
|
|||||||
QPointF global;
|
QPointF global;
|
||||||
Qt::MouseButtons buttons;
|
Qt::MouseButtons buttons;
|
||||||
Qt::KeyboardModifiers modifiers;
|
Qt::KeyboardModifiers modifiers;
|
||||||
|
QPoint pixelDelta;
|
||||||
|
QPoint angleDelta;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -625,6 +625,9 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan
|
|||||||
case QWaylandPointerEvent::Motion:
|
case QWaylandPointerEvent::Motion:
|
||||||
QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers);
|
QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers);
|
||||||
break;
|
break;
|
||||||
|
case QWaylandPointerEvent::Wheel:
|
||||||
|
QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, e.pixelDelta, e.angleDelta);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,6 +687,9 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe
|
|||||||
case QWaylandPointerEvent::Motion:
|
case QWaylandPointerEvent::Motion:
|
||||||
QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers);
|
QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers);
|
||||||
break;
|
break;
|
||||||
|
case QWaylandPointerEvent::Wheel:
|
||||||
|
QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mMouseEventsInContentArea = true;
|
mMouseEventsInContentArea = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user