Cocoa platform plugin: Reduce multitouch area to be one pixel.
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>
Mon, 19 Sep 2011 16:47:20 +0000 (18:47 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 19 Sep 2011 16:56:32 +0000 (18:56 +0200)
Mac only support multitouch points, hence width/height 1. Also add
comment about performance related to multitouch events.

Change-Id: I307261492366e361e17f9edf446f456c07c87a22
Reviewed-on: http://codereview.qt-project.org/5162
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Bjørn Erik Nilsen <bjorn.nilsen@nokia.com>
src/plugins/platforms/cocoa/qcocoawindow.mm
src/plugins/platforms/cocoa/qmultitouch_mac.mm

index 00016cb..0c0a3ea 100644 (file)
@@ -90,7 +90,9 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
 
     m_contentView = [[QNSView alloc] initWithQWindow:tlw];
 
-    // Accept touch events by default.
+    // ### Accept touch events by default.
+    // Beware that enabling touch events has a negative impact on the overall performance.
+    // We probably need a QWindowSystemInterface API to enable/disable touch events.
     [m_contentView setAcceptsTouchEvents:YES];
 
     setGeometry(tlw->geometry());
index 33ca282..f44c6a3 100644 (file)
@@ -91,7 +91,8 @@ void QCocoaTouch::updateTouchData(NSTouch *nstouch, NSTouchPhase phase)
     float ppiX = (qnpos.x() - _trackpadReferencePos.x()) * dsize.width;
     float ppiY = (qnpos.y() - _trackpadReferencePos.y()) * dsize.height;
     QPointF relativePos = _trackpadReferencePos - QPointF(ppiX, ppiY);
-    _touchPoint.area = QRectF(_screenReferencePos - relativePos, QSize(dsize.width, dsize.height));
+    // Mac does not support area touch, only points, hence set width/height to 1.
+    _touchPoint.area = QRectF(_screenReferencePos - relativePos, QSize(1, 1));
 }
 
 QCocoaTouch *QCocoaTouch::findQCocoaTouch(NSTouch *nstouch)