pick up the target window for a mouse event when none is specified
[profile/ivi/qtbase.git] / src / gui / kernel / qguiapplication.cpp
index 7ab098e..d5e08e1 100644 (file)
@@ -546,9 +546,6 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
 
 void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e)
 {
-    if (!e->window)
-        return;
-
     QEvent::Type type;
     // move first
     Qt::MouseButtons stateChange = e->buttons ^ buttons;
@@ -561,6 +558,9 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
 
     QWindow *window = e->window.data();
 
+    if (!window)
+        window = QGuiApplication::topLevelAt(e->globalPos.toPoint());
+
     QPointF localPoint = e->localPos;
     QPointF globalPoint = e->globalPos;