From d5e3dca8c56f60e0da5d707dbbe0c424b75c947a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 29 Sep 2016 12:16:11 +0200 Subject: [PATCH] =?UTF-8?q?Cocoa:=20Don=E2=80=99t=20send=20tablet=20events?= =?UTF-8?q?=20as=20mouse=20events?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Re-apply change 6e850af09dd595b3b0e87135a1e68755c35f8964, the code for which has gone missing. This prevents sending tablet events as both mouse and tablet events, which confuses the double-click detection code in QGuiApplication::processMouseEvent() when tablet->mouse event synthesis is enabled. Task-number: QTBUG-54399 Task-number: QTBUG-51617 Task-number: QTBUG-47007 Change-Id: I6183906d4ce2b8cdc617d34e22a9dcf999eef51d Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qnsview.mm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index d29272a88f..51a69be759 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -759,7 +759,10 @@ QT_WARNING_POP - (void)handleMouseEvent:(NSEvent *)theEvent { - bool isTabletEvent = [self handleTabletEvent: theEvent]; + // Tablet events may come in via the mouse event handlers, + // check if this is a valid tablet event first. + if ([self handleTabletEvent: theEvent]) + return; QPointF qtWindowPoint; QPointF qtScreenPoint; @@ -788,8 +791,8 @@ QT_WARNING_POP nativeDrag->setLastMouseEvent(theEvent, self); Qt::KeyboardModifiers keyboardModifiers = [QNSView convertKeyModifiers:[theEvent modifierFlags]]; - QWindowSystemInterface::handleMouseEvent(targetView->m_window, timestamp, qtWindowPoint, qtScreenPoint, m_buttons, keyboardModifiers, - isTabletEvent ? Qt::MouseEventSynthesizedByQt : Qt::MouseEventNotSynthesized); + QWindowSystemInterface::handleMouseEvent(targetView->m_window, timestamp, qtWindowPoint, qtScreenPoint, + m_buttons, keyboardModifiers, Qt::MouseEventNotSynthesized); } - (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent