Fix BIC issue with QNativeGestureEvent
Problem was for 32 bit macOS, or if QT_COORD_TYPE was configured to be float. Change-Id: I0a3d3d305f2e8a0f9be7c40f4fef7eabf4643d05 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
70422449ef
commit
36af37c99c
@ -2763,12 +2763,16 @@ Qt::MouseButtons QTabletEvent::buttons() const
|
|||||||
#if QT_DEPRECATED_SINCE(5, 10)
|
#if QT_DEPRECATED_SINCE(5, 10)
|
||||||
QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos,
|
QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos,
|
||||||
const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
|
const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
|
||||||
: QInputEvent(QEvent::NativeGesture), mGestureType(type), mTouchDeviceId(255),
|
: QInputEvent(QEvent::NativeGesture), mGestureType(type),
|
||||||
mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
|
mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
|
||||||
mSequenceId(sequenceId), mIntValue(intValue)
|
mSequenceId(sequenceId), mIntValue(intValue)
|
||||||
{ }
|
{ }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef QHash<const QNativeGestureEvent*, const QTouchDevice*> NativeGestureEventDataHash;
|
||||||
|
// ### Qt6: move this to a member in QNativeGestureEvent
|
||||||
|
Q_GLOBAL_STATIC(NativeGestureEventDataHash, g_nativeGestureEventDataHash)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs a native gesture event of type \a type originating from \a device.
|
Constructs a native gesture event of type \a type originating from \a device.
|
||||||
|
|
||||||
@ -2779,13 +2783,19 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin
|
|||||||
\a realValue is the \macos event parameter, \a sequenceId and \a intValue are the Windows event parameters.
|
\a realValue is the \macos event parameter, \a sequenceId and \a intValue are the Windows event parameters.
|
||||||
\since 5.10
|
\since 5.10
|
||||||
*/
|
*/
|
||||||
QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *device, const QPointF &localPos, const QPointF &windowPos,
|
QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos,
|
||||||
const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
|
const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
|
||||||
: QInputEvent(QEvent::NativeGesture), mGestureType(type),
|
: QInputEvent(QEvent::NativeGesture), mGestureType(type),
|
||||||
mTouchDeviceId(QTouchDevicePrivate::get(const_cast<QTouchDevice *>(device))->id),
|
|
||||||
mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
|
mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
|
||||||
mSequenceId(sequenceId), mIntValue(intValue)
|
mSequenceId(sequenceId), mIntValue(intValue)
|
||||||
{ }
|
{
|
||||||
|
g_nativeGestureEventDataHash->insert(this, dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
QNativeGestureEvent::~QNativeGestureEvent()
|
||||||
|
{
|
||||||
|
g_nativeGestureEventDataHash->remove(this);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\since 5.10
|
\since 5.10
|
||||||
@ -2795,7 +2805,7 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouc
|
|||||||
|
|
||||||
const QTouchDevice *QNativeGestureEvent::device() const
|
const QTouchDevice *QNativeGestureEvent::device() const
|
||||||
{
|
{
|
||||||
return QTouchDevicePrivate::deviceById(mTouchDeviceId);
|
return g_nativeGestureEventDataHash->value(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -307,6 +307,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos,
|
QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos,
|
||||||
const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument);
|
const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument);
|
||||||
|
~QNativeGestureEvent();
|
||||||
Qt::NativeGestureType gestureType() const { return mGestureType; }
|
Qt::NativeGestureType gestureType() const { return mGestureType; }
|
||||||
qreal value() const { return mRealValue; }
|
qreal value() const { return mRealValue; }
|
||||||
|
|
||||||
@ -322,8 +323,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
Qt::NativeGestureType mGestureType;
|
Qt::NativeGestureType mGestureType;
|
||||||
quint8 mTouchDeviceId; // QTouchDevicePrivate::id
|
|
||||||
quint8 mReserved[3]; // if qreal == double clang will pad the QPointF below to a 8-byte boundary
|
|
||||||
QPointF mLocalPos;
|
QPointF mLocalPos;
|
||||||
QPointF mWindowPos;
|
QPointF mWindowPos;
|
||||||
QPointF mScreenPos;
|
QPointF mScreenPos;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user