Pass the correct window on to QWindowSystemInterface.
authorSamuel Rødal <samuel.rodal@nokia.com>
Tue, 14 Feb 2012 14:22:21 +0000 (15:22 +0100)
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>
Tue, 14 Feb 2012 14:40:51 +0000 (15:40 +0100)
Sometimes, the window's coordinate system is not bounded by
the coordinates of the QScreen (such as if the window uses a
landscape window orientation on a portrait screen).
QGuiApplication::topLevelAt() will fail to find this window, but since
we have the window already at the wayland plugin level we just use that.

We already did this for mouse events, so it's natural to do it here as
well.

Change-Id: Id086dd940aa1cf4eb4480117d243ab8a76da6cca
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
src/plugins/platforms/wayland/qwaylandtouch.cpp

index 6da9963..f66d467 100644 (file)
@@ -161,7 +161,7 @@ void QWaylandTouchExtension::sendTouchEvent()
         return;
     }
 
-    QWindowSystemInterface::handleTouchEvent(0, mTimestamp, mTouchDevice, mTouchPoints);
+    QWindowSystemInterface::handleTouchEvent(mTargetWindow, mTimestamp, mTouchDevice, mTouchPoints);
 
     Qt::TouchPointStates states = 0;
     for (int i = 0; i < mTouchPoints.count(); ++i)
@@ -178,7 +178,7 @@ void QWaylandTouchExtension::sendTouchEvent()
                 QPoint globalPoint = mLastMouseGlobal.toPoint();
                 QPointF delta = mLastMouseGlobal - globalPoint;
                 mLastMouseLocal = mTargetWindow->mapFromGlobal(globalPoint) + delta;
-                QWindowSystemInterface::handleMouseEvent(0, mTimestamp, mLastMouseLocal, mLastMouseGlobal, buttons);
+                QWindowSystemInterface::handleMouseEvent(mTargetWindow, mTimestamp, mLastMouseLocal, mLastMouseGlobal, buttons);
                 if (buttons == Qt::NoButton)
                     mMouseSourceId = -1;
                 break;