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 <shawn.rutledge@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
bb10
Laszlo Agocs 2013-10-10 10:47:51 +02:00 committed by The Qt Project
parent d004af667d
commit 99b20ce0b9
1 changed files with 5 additions and 3 deletions

View File

@ -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) {