summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-12-02 10:39:46 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-12-02 16:56:16 (GMT)
commit3efae3272151f0abf55af742c2618be2a35455a5 (patch)
tree3dffdebf46f2264ea28867ea153a965012979c85 /src/gui
parent592390c1a8d8d5664fc34893da586412b6a1bcf3 (diff)
downloadQt-3efae3272151f0abf55af742c2618be2a35455a5.zip
Qt-3efae3272151f0abf55af742c2618be2a35455a5.tar.gz
Qt-3efae3272151f0abf55af742c2618be2a35455a5.tar.bz2
Do not emulate mouse event out of touch pad events
If the touch event comes from a touchpad it doesn't seem necessary to send fake mouse events. At least on the platform that actually supports touchpad events (i.e. Mac) native apps don't do that and the current implementation breaks popup handling - since touch events are only sent by default if two or more fingers touch the touchpad, we send fake MouseButtonPress when second finger is pressed and MouseButtonRelease when the second finger is released - i.e. at the same time when the system send scrollWheel events. This causes the active popup to close when using two-finger scroll gesture. Reviewed-by: Brad
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qwidget.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index b389054..da3ef92 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -8374,9 +8374,10 @@ bool QWidget::event(QEvent *event)
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
{
+#ifndef Q_WS_MAC
QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event);
const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().first();
- if (touchPoint.isPrimary())
+ if (touchPoint.isPrimary() || touchEvent->deviceType() == QTouchEvent::TouchPad)
break;
// fake a mouse event!
@@ -8405,6 +8406,7 @@ bool QWidget::event(QEvent *event)
Qt::LeftButton,
touchEvent->modifiers());
(void) QApplication::sendEvent(this, &mouseEvent);
+#endif // Q_WS_MAC
break;
}
case QEvent::Gesture: