From c8ca4b74a8ad7469c3597ec9412cf175b1ef6fcc Mon Sep 17 00:00:00 2001
From: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Date: Thu, 2 Feb 2012 18:03:10 +0200
Subject: [PATCH] Fix mouse handling in qml-compositor.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The pointer focus must be set in pressed. We cannot rely on
the implicit mouse tracking behavior of QWindow for QML stuff
because the WaylandSurfaceItems will not get mouse moves outside
of a press-release sequence.

Change-Id: Ic2cf2a7497cac7397bcfa26440dd05cded6182dc
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
---
 src/compositor/compositor_api/waylandsurfaceitem.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compositor/compositor_api/waylandsurfaceitem.cpp b/src/compositor/compositor_api/waylandsurfaceitem.cpp
index 605e950e..a080f836 100644
--- a/src/compositor/compositor_api/waylandsurfaceitem.cpp
+++ b/src/compositor/compositor_api/waylandsurfaceitem.cpp
@@ -149,6 +149,8 @@ void WaylandSurfaceItem::mousePressEvent(QMouseEvent *event)
 {
     if (m_surface) {
         WaylandInputDevice *inputDevice = m_surface->compositor()->defaultInputDevice();
+        if (inputDevice->mouseFocus() != m_surface)
+            inputDevice->setMouseFocus(m_surface, event->pos(), event->globalPos());
         inputDevice->sendMousePressEvent(event->button(), toSurface(event->pos()));
     }
 }
-- 
GitLab