summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-04-11 14:36:12 +0200
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-04-15 13:42:00 +0000
commit455f5df5412cd0dcbf2b7985df74be0a066b634e (patch)
treedb6cbaf71405e532f879f3b49734da314ddc8ecb /src/plugins
parentd229ed77dbb3b97690d3839e901ca51670eaae75 (diff)
Fix gesture processing on OS X 10.11
Starting from 10.11 beginGestureWithEvent/endGestureWithEvent never gets called, we must test event.phase instead (magnify/rotate gestures). For a magnify/rotate gesture, we'll first test phase (on 10.11) and manually call our begin/endGestureWithEvent. Task-number: QTBUG-48666 Change-Id: I69752b3c6578360b98607ceea2cffb5c166bb7c9 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 7e9b9aa839..4ac34b01ff 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -47,6 +47,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <QtGui/QTextFormat>
#include <QtCore/QDebug>
+#include <QtCore/qsysinfo.h>
#include <private/qguiapplication_p.h>
#include "qcocoabackingstore.h"
#ifndef QT_NO_OPENGL
@@ -1252,8 +1253,29 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
}
#ifndef QT_NO_GESTURES
+
+- (bool)handleGestureAsBeginEnd:(NSEvent *)event
+{
+ if (QSysInfo::QSysInfo::MacintoshVersion < QSysInfo::MV_10_11)
+ return false;
+
+ if ([event phase] == NSEventPhaseBegan) {
+ [self beginGestureWithEvent:event];
+ return true;
+ }
+
+ if ([event phase] == NSEventPhaseEnded) {
+ [self endGestureWithEvent:event];
+ return true;
+ }
+
+ return false;
+}
- (void)magnifyWithEvent:(NSEvent *)event
{
+ if ([self handleGestureAsBeginEnd:event])
+ return;
+
qCDebug(lcQpaGestures) << "magnifyWithEvent" << [event magnification];
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
@@ -1280,7 +1302,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void)rotateWithEvent:(NSEvent *)event
{
- qCDebug(lcQpaGestures) << "rotateWithEvent" << [event rotation];
+ if ([self handleGestureAsBeginEnd:event])
+ return;
+
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;