qpa: Return accepted state from mouse, touch and wheel handlers

Return the value from handleWindowSystemEvent so platform plugins can
detect whether it was accepted or not.

Change-Id: I53ffb713afc8e0ec1789107c912433133cfaa11a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Lorn Potter 2018-09-10 15:43:56 +10:00 committed by Morten Johan Sørvig
parent 9133bdcf26
commit 7ddbd179a1
2 changed files with 79 additions and 77 deletions

View File

@ -368,41 +368,41 @@ QT_DEFINE_QPA_EVENT_HANDLER(bool, handleCloseEvent, QWindow *window)
*/ */
#if QT_DEPRECATED_SINCE(5, 11) #if QT_DEPRECATED_SINCE(5, 11)
QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source) Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{ {
handleMouseEvent<Delivery>(window, local, global, b, Qt::NoButton, QEvent::None, mods, source); return handleMouseEvent<Delivery>(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
} }
QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source) Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{ {
handleMouseEvent<Delivery>(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source); return handleMouseEvent<Delivery>(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
} }
void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source) Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{ {
handleFrameStrutMouseEvent(window, local, global, b, Qt::NoButton, QEvent::None, mods, source); return handleFrameStrutMouseEvent(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
} }
void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source) Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{ {
handleFrameStrutMouseEvent(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source); return handleFrameStrutMouseEvent(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
} }
#endif // QT_DEPRECATED_SINCE(5, 11) #endif // QT_DEPRECATED_SINCE(5, 11)
QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window,
const QPointF &local, const QPointF &global, Qt::MouseButtons state, const QPointF &local, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods, Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
Qt::MouseEventSource source) Qt::MouseEventSource source)
{ {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source); return handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source);
} }
QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp, QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp,
const QPointF &local, const QPointF &global, Qt::MouseButtons state, const QPointF &local, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods, Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
Qt::MouseEventSource source) Qt::MouseEventSource source)
@ -416,10 +416,10 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong times
QWindowSystemInterfacePrivate::MouseEvent *e = QWindowSystemInterfacePrivate::MouseEvent *e =
new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos, new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos,
state, mods, button, type, source); state, mods, button, type, source);
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
} }
void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window,
const QPointF &local, const QPointF &global, const QPointF &local, const QPointF &global,
Qt::MouseButtons state, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::MouseButton button, QEvent::Type type,
@ -427,10 +427,10 @@ void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window,
Qt::MouseEventSource source) Qt::MouseEventSource source)
{ {
const unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); const unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleFrameStrutMouseEvent(window, time, local, global, state, button, type, mods, source); return handleFrameStrutMouseEvent(window, time, local, global, state, button, type, mods, source);
} }
void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp,
const QPointF &local, const QPointF &global, const QPointF &local, const QPointF &global,
Qt::MouseButtons state, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::MouseButton button, QEvent::Type type,
@ -443,7 +443,7 @@ void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong t
QWindowSystemInterfacePrivate::MouseEvent *e = QWindowSystemInterfacePrivate::MouseEvent *e =
new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos, new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos,
state, mods, button, type, source, true); state, mods, button, type, source, true);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
} }
bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestamp, int keyCode, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestamp, int keyCode, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode,
@ -549,28 +549,28 @@ QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *window, ulong tim
} }
#if QT_DEPRECATED_SINCE(5, 10) #if QT_DEPRECATED_SINCE(5, 10)
void QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) { bool QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_DEPRECATED
handleWheelEvent(window, time, local, global, d, o, mods); return handleWheelEvent(window, time, local, global, d, o, mods);
QT_WARNING_POP QT_WARNING_POP
} }
void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods)
{ {
QPoint point = (o == Qt::Vertical) ? QPoint(0, d) : QPoint(d, 0); QPoint point = (o == Qt::Vertical) ? QPoint(0, d) : QPoint(d, 0);
handleWheelEvent(window, timestamp, local, global, QPoint(), point, mods); return handleWheelEvent(window, timestamp, local, global, QPoint(), point, mods);
} }
#endif // QT_DEPRECATED_SINCE(5, 10) #endif // QT_DEPRECATED_SINCE(5, 10)
void QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source) bool QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
{ {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleWheelEvent(window, time, local, global, pixelDelta, angleDelta, mods, phase, source); return handleWheelEvent(window, time, local, global, pixelDelta, angleDelta, mods, phase, source);
} }
void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
Qt::MouseEventSource source, bool invertedScrolling) Qt::MouseEventSource source, bool invertedScrolling)
{ {
// Qt 4 sends two separate wheel events for horizontal and vertical // Qt 4 sends two separate wheel events for horizontal and vertical
@ -585,33 +585,35 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp,
// Pass Qt::ScrollBegin and Qt::ScrollEnd through // Pass Qt::ScrollBegin and Qt::ScrollEnd through
// even if the wheel delta is null. // even if the wheel delta is null.
if (angleDelta.isNull() && phase == Qt::ScrollUpdate) if (angleDelta.isNull() && phase == Qt::ScrollUpdate)
return; return false;
// Simple case: vertical deltas only: // Simple case: vertical deltas only:
if (angleDelta.y() != 0 && angleDelta.x() == 0) { if (angleDelta.y() != 0 && angleDelta.x() == 0) {
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical,
mods, phase, source, invertedScrolling); mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return; return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
} }
// Simple case: horizontal deltas only: // Simple case: horizontal deltas only:
if (angleDelta.y() == 0 && angleDelta.x() != 0) { if (angleDelta.y() == 0 && angleDelta.x() != 0) {
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling); e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return;
} }
bool acceptVert;
bool acceptHorz;
// Both horizontal and vertical deltas: Send two wheel events. // Both horizontal and vertical deltas: Send two wheel events.
// The first event contains the Qt 5 pixel and angle delta as points, // The first event contains the Qt 5 pixel and angle delta as points,
// and in addition the Qt 4 compatibility vertical angle delta. // and in addition the Qt 4 compatibility vertical angle delta.
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling); e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); acceptVert = QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
// The second event contains null pixel and angle points and the // The second event contains null pixel and angle points and the
// Qt 4 compatibility horizontal angle delta. // Qt 4 compatibility horizontal angle delta.
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling); e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); acceptHorz = QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
return acceptVert || acceptHorz;
} }
void QWindowSystemInterface::registerTouchDevice(const QTouchDevice *device) void QWindowSystemInterface::registerTouchDevice(const QTouchDevice *device)
@ -758,21 +760,21 @@ QList<QWindowSystemInterface::TouchPoint>
return newList; return newList;
} }
QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *window, QTouchDevice *device, QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, QTouchDevice *device,
const QList<TouchPoint> &points, Qt::KeyboardModifiers mods) const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{ {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleTouchEvent<Delivery>(window, time, device, points, mods); return handleTouchEvent<Delivery>(window, time, device, points, mods);
} }
QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *window, ulong timestamp, QTouchDevice *device, QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
const QList<TouchPoint> &points, Qt::KeyboardModifiers mods) const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{ {
if (!points.size()) // Touch events must have at least one point if (!points.size()) // Touch events must have at least one point
return; return false;
if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices. if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
return; return false;
QEvent::Type type; QEvent::Type type;
QList<QTouchEvent::TouchPoint> touchPoints = QList<QTouchEvent::TouchPoint> touchPoints =
@ -780,23 +782,23 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *window, ulong times
QWindowSystemInterfacePrivate::TouchEvent *e = QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(window, timestamp, type, device, touchPoints, mods); new QWindowSystemInterfacePrivate::TouchEvent(window, timestamp, type, device, touchPoints, mods);
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
} }
QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *window, QTouchDevice *device, QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, QTouchDevice *device,
Qt::KeyboardModifiers mods) Qt::KeyboardModifiers mods)
{ {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleTouchCancelEvent<Delivery>(window, time, device, mods); return handleTouchCancelEvent<Delivery>(window, time, device, mods);
} }
QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *window, ulong timestamp, QTouchDevice *device, QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
Qt::KeyboardModifiers mods) Qt::KeyboardModifiers mods)
{ {
QWindowSystemInterfacePrivate::TouchEvent *e = QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(window, timestamp, QEvent::TouchCancel, device, new QWindowSystemInterfacePrivate::TouchEvent(window, timestamp, QEvent::TouchCancel, device,
QList<QTouchEvent::TouchPoint>(), mods); QList<QTouchEvent::TouchPoint>(), mods);
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
} }
/*! /*!
@ -970,7 +972,7 @@ void QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(boo
platformSynthesizesMouse = v; platformSynthesizesMouse = v;
} }
void QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, bool QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt, int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid, qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers) Qt::KeyboardModifiers modifiers)
@ -981,16 +983,16 @@ void QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp,
QHighDpi::fromNativePixels(global, window), QHighDpi::fromNativePixels(global, window),
device, pointerType, buttons, pressure, device, pointerType, buttons, pressure,
xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers); xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
} }
void QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global, bool QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt, int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid, qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers) Qt::KeyboardModifiers modifiers)
{ {
ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed(); ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleTabletEvent(window, time, local, global, device, pointerType, buttons, pressure, return handleTabletEvent(window, time, local, global, device, pointerType, buttons, pressure,
xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers); xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
} }
@ -1014,11 +1016,11 @@ void QWindowSystemInterface::handleTabletEvent(QWindow *window, bool down, const
} }
#endif // QT_DEPRECATED_SINCE(5, 10) #endif // QT_DEPRECATED_SINCE(5, 10)
void QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid) bool QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
{ {
QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e = QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e =
new QWindowSystemInterfacePrivate::TabletEnterProximityEvent(timestamp, device, pointerType, uid); new QWindowSystemInterfacePrivate::TabletEnterProximityEvent(timestamp, device, pointerType, uid);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
} }
void QWindowSystemInterface::handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid) void QWindowSystemInterface::handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid)
@ -1027,11 +1029,11 @@ void QWindowSystemInterface::handleTabletEnterProximityEvent(int device, int poi
handleTabletEnterProximityEvent(time, device, pointerType, uid); handleTabletEnterProximityEvent(time, device, pointerType, uid);
} }
void QWindowSystemInterface::handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid) bool QWindowSystemInterface::handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
{ {
QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e = QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e =
new QWindowSystemInterfacePrivate::TabletLeaveProximityEvent(timestamp, device, pointerType, uid); new QWindowSystemInterfacePrivate::TabletLeaveProximityEvent(timestamp, device, pointerType, uid);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
} }
void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid) void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid)
@ -1041,31 +1043,31 @@ void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int poi
} }
#ifndef QT_NO_GESTURES #ifndef QT_NO_GESTURES
void QWindowSystemInterface::handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type, bool QWindowSystemInterface::handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
QPointF &local, QPointF &global) QPointF &local, QPointF &global)
{ {
QWindowSystemInterfacePrivate::GestureEvent *e = QWindowSystemInterfacePrivate::GestureEvent *e =
new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global); new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
} }
void QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type, bool QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
qreal value, QPointF &local, QPointF &global) qreal value, QPointF &local, QPointF &global)
{ {
QWindowSystemInterfacePrivate::GestureEvent *e = QWindowSystemInterfacePrivate::GestureEvent *e =
new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global); new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
e->realValue = value; e->realValue = value;
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
} }
void QWindowSystemInterface::handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type, bool QWindowSystemInterface::handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
ulong sequenceId, quint64 value, QPointF &local, QPointF &global) ulong sequenceId, quint64 value, QPointF &local, QPointF &global)
{ {
QWindowSystemInterfacePrivate::GestureEvent *e = QWindowSystemInterfacePrivate::GestureEvent *e =
new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global); new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
e->sequenceId = sequenceId; e->sequenceId = sequenceId;
e->intValue = value; e->intValue = value;
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
} }
#endif // QT_NO_GESTURES #endif // QT_NO_GESTURES

View File

@ -78,40 +78,40 @@ public:
#if QT_DEPRECATED_SINCE(5, 11) #if QT_DEPRECATED_SINCE(5, 11)
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
QT_DEPRECATED static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, QT_DEPRECATED static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
QT_DEPRECATED static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, QT_DEPRECATED static bool handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, QT_DEPRECATED static bool handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, QT_DEPRECATED static bool handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
#endif #endif
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, static bool handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
const QPointF &global, Qt::MouseButtons state, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, static bool handleFrameStrutMouseEvent(QWindow *window, const QPointF &local,
const QPointF &global, Qt::MouseButtons state, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventSource source =
Qt::MouseEventNotSynthesized); Qt::MouseEventNotSynthesized);
static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, static bool handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
const QPointF &global, Qt::MouseButtons state, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::KeyboardModifiers mods = Qt::NoModifier,
@ -136,12 +136,12 @@ public:
quint32 nativeModifiers, quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false, const QString& text = QString(), bool autorep = false,
ushort count = 1, bool tryShortcutOverride = true); ushort count = 1, bool tryShortcutOverride = true);
static void handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, static bool handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global,
QPoint pixelDelta, QPoint angleDelta, QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::ScrollPhase phase = Qt::NoScrollPhase,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
static void handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, static bool handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
QPoint pixelDelta, QPoint angleDelta, QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::ScrollPhase phase = Qt::NoScrollPhase,
@ -149,8 +149,8 @@ public:
bool inverted = false); bool inverted = false);
#if QT_DEPRECATED_SINCE(5, 10) #if QT_DEPRECATED_SINCE(5, 10)
QT_DEPRECATED static void handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); QT_DEPRECATED static bool handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
QT_DEPRECATED static void handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); QT_DEPRECATED static bool handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
#endif #endif
struct TouchPoint { struct TouchPoint {
@ -175,15 +175,15 @@ public:
static bool isTouchDeviceRegistered(const QTouchDevice *device); static bool isTouchDeviceRegistered(const QTouchDevice *device);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchEvent(QWindow *window, QTouchDevice *device, static bool handleTouchEvent(QWindow *window, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier); const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchEvent(QWindow *window, ulong timestamp, QTouchDevice *device, static bool handleTouchEvent(QWindow *window, ulong timestamp, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier); const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchCancelEvent(QWindow *window, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier); static bool handleTouchCancelEvent(QWindow *window, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchCancelEvent(QWindow *window, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier); static bool handleTouchCancelEvent(QWindow *window, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
// rect is relative to parent // rect is relative to parent
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
@ -255,11 +255,11 @@ public:
static void handleFileOpenEvent(const QString& fileName); static void handleFileOpenEvent(const QString& fileName);
static void handleFileOpenEvent(const QUrl &url); static void handleFileOpenEvent(const QUrl &url);
static void handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, static bool handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt, int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid, qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier); Qt::KeyboardModifiers modifiers = Qt::NoModifier);
static void handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global, static bool handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt, int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid, qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier); Qt::KeyboardModifiers modifiers = Qt::NoModifier);
@ -273,17 +273,17 @@ public:
qreal tangentialPressure, qreal rotation, int z, qint64 uid, qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier); Qt::KeyboardModifiers modifiers = Qt::NoModifier);
#endif #endif
static void handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid); static bool handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
static void handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid); static void handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid);
static void handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid); static bool handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
static void handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid); static void handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid);
#ifndef QT_NO_GESTURES #ifndef QT_NO_GESTURES
static void handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type, static bool handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
QPointF &local, QPointF &global); QPointF &local, QPointF &global);
static void handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type, static bool handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
qreal value, QPointF &local, QPointF &global); qreal value, QPointF &local, QPointF &global);
static void handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp,Qt::NativeGestureType type, static bool handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp,Qt::NativeGestureType type,
ulong sequenceId, quint64 value, QPointF &local, QPointF &global); ulong sequenceId, quint64 value, QPointF &local, QPointF &global);
#endif // QT_NO_GESTURES #endif // QT_NO_GESTURES