From 99b20ce0b9316dae0668d71b718bd23eaddbca09 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 10 Oct 2013 10:47:51 +0200 Subject: Update QPA cursor only for non-synthetic mouse events Unhandled touch events cause QGuiApplication to generate synthetic mouse event by default. This is good but on embedded systems, where there is no windowing system and thus the platform cursor implementation relies solely on QGuiApplication pushing position updates via pointerEvent(), this causes odd behavior when there is both a touchscreen and a mouse present. The patch changes QGuiApplication to call pointerEvent() only when the event is not synthetic. This will prevent the mouse cursor from jumping to the position of the touch when using the touchscreen. It is needed also because moving the mouse later would make the cursor jump back to its previous, "real" mouse position anyhow which is extremely annoying. This is now avoided. Change-Id: I807a173bff7e2afa7eb66961a7ecc88b2c0430ca Reviewed-by: Shawn Rutledge Reviewed-by: Gunnar Sletta --- src/gui/kernel/qguiapplication.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 542b95f58f..1e3ea3092f 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1566,9 +1566,11 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, e->modifiers); ev.setTimestamp(e->timestamp); #ifndef QT_NO_CURSOR - if (const QScreen *screen = window->screen()) - if (QPlatformCursor *cursor = screen->handle()->cursor()) - cursor->pointerEvent(ev); + if (!e->synthetic) { + if (const QScreen *screen = window->screen()) + if (QPlatformCursor *cursor = screen->handle()->cursor()) + cursor->pointerEvent(ev); + } #endif if (window->d_func()->blockedByModalWindow) { -- cgit v1.2.3