QCocoaDrag: consistently update the last view and event pointers
As pointed out in the qcocoadrag.h header, we need QCocoaDrag to record the original event and view when handling an event in QNSView. For that, NSView's handleMouseEvent implementation called setLastMouseEvent. This was not done for tablet or touch events, although both of those event types might initiate and participate in drag'n'drop operation. Do that consistently now, and rename the setter accordingly to setLastInputEvent. Task-number: QTBUG-116554 Pick-to: 6.5 Change-Id: I9646adbec3a2301ebca123f0f25328db63c782a8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 0a40266788021aaa2f501aeef6db2e222669c6e9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
f47c8354b1
commit
d2ee5811d0
@ -35,7 +35,7 @@ public:
|
||||
* to meet NSView dragImage:at guarantees, we need to record the original
|
||||
* event and view when handling an event in QNSView
|
||||
*/
|
||||
void setLastMouseEvent(NSEvent *event, NSView *view);
|
||||
void setLastInputEvent(NSEvent *event, NSView *view);
|
||||
|
||||
void setAcceptedAction(Qt::DropAction act);
|
||||
void exitDragLoop();
|
||||
|
@ -31,7 +31,7 @@ QCocoaDrag::~QCocoaDrag()
|
||||
[m_lastEvent release];
|
||||
}
|
||||
|
||||
void QCocoaDrag::setLastMouseEvent(NSEvent *event, NSView *view)
|
||||
void QCocoaDrag::setLastInputEvent(NSEvent *event, NSView *view)
|
||||
{
|
||||
[m_lastEvent release];
|
||||
m_lastEvent = [event copy];
|
||||
|
@ -117,7 +117,7 @@ static const QPointingDevice *pointingDeviceFor(qint64 deviceID)
|
||||
ulong timestamp = [theEvent timestamp] * 1000;
|
||||
|
||||
QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
|
||||
nativeDrag->setLastMouseEvent(theEvent, self);
|
||||
nativeDrag->setLastInputEvent(theEvent, self);
|
||||
|
||||
const auto modifiers = QAppleKeyMapper::fromCocoaModifiers(theEvent.modifierFlags);
|
||||
auto button = cocoaButton2QtButton(theEvent);
|
||||
|
@ -28,6 +28,9 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceMap, devicesInProximity)
|
||||
|
||||
ulong timestamp = [theEvent timestamp] * 1000;
|
||||
|
||||
QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
|
||||
nativeDrag->setLastInputEvent(theEvent, self);
|
||||
|
||||
QPointF windowPoint;
|
||||
QPointF screenPoint;
|
||||
[self convertFromScreen:[self screenMousePoint:theEvent] toWindowPoint: &windowPoint andScreenPoint: &screenPoint];
|
||||
|
@ -37,6 +37,10 @@ Q_LOGGING_CATEGORY(lcQpaTouch, "qt.qpa.input.touch")
|
||||
return;
|
||||
|
||||
const NSTimeInterval timestamp = [event timestamp];
|
||||
|
||||
QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
|
||||
nativeDrag->setLastInputEvent(event, self);
|
||||
|
||||
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
|
||||
qCDebug(lcQpaTouch) << "touchesMovedWithEvent" << points << "from device" << Qt::hex << [event deviceID];
|
||||
QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(
|
||||
@ -51,6 +55,10 @@ Q_LOGGING_CATEGORY(lcQpaTouch, "qt.qpa.input.touch")
|
||||
return;
|
||||
|
||||
const NSTimeInterval timestamp = [event timestamp];
|
||||
|
||||
QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
|
||||
nativeDrag->setLastInputEvent(event, self);
|
||||
|
||||
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
|
||||
qCDebug(lcQpaTouch) << "touchesEndedWithEvent" << points << "from device" << Qt::hex << [event deviceID];
|
||||
QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(
|
||||
@ -65,6 +73,10 @@ Q_LOGGING_CATEGORY(lcQpaTouch, "qt.qpa.input.touch")
|
||||
return;
|
||||
|
||||
const NSTimeInterval timestamp = [event timestamp];
|
||||
|
||||
QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
|
||||
nativeDrag->setLastInputEvent(event, self);
|
||||
|
||||
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, [self shouldSendSingleTouch]);
|
||||
qCDebug(lcQpaTouch) << "touchesCancelledWithEvent" << points << "from device" << Qt::hex << [event deviceID];
|
||||
QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(
|
||||
|
Loading…
x
Reference in New Issue
Block a user