From 34de989a9405152ad635d9d9404f026c96f371cc Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 17 Sep 2014 17:22:27 +0400 Subject: Keep a source of propagated mouse events Synthesized mouse events should not cause mouse events which look like they were obtained from the system. So set the source of generated events from the original event. Change-Id: I862829446ac6ef664e1b8e4a5b54ed11926a1d4b Reviewed-by: Laszlo Agocs --- src/gui/kernel/qguiapplication.cpp | 3 ++- src/widgets/kernel/qapplication.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 70b48ad9ee..6f688c09aa 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1712,7 +1712,8 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo // with the current event, we fake a move-only event that we recurse and process first. This // will update the global mouse position and cause the second event to be a button only event. QWindowSystemInterfacePrivate::MouseEvent moveEvent(e->window.data(), - e->timestamp, e->type, e->localPos, e->globalPos, buttons, e->modifiers); + e->timestamp, e->type, e->localPos, e->globalPos, buttons, e->modifiers, e->source); + moveEvent.synthetic = e->synthetic; processMouseEvent(&moveEvent); Q_ASSERT(e->globalPos == QGuiApplicationPrivate::lastCursorPosition); // continue with processing mouse button change event diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 3486396f54..c0579da7e5 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3266,6 +3266,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) me.spont = mouse->spontaneous(); me.setTimestamp(mouse->timestamp()); QGuiApplicationPrivate::setMouseEventFlags(&me, mouse->flags()); + QGuiApplicationPrivate::setMouseEventSource(&me, mouse->source()); // throw away any mouse-tracking-only mouse events if (!w->hasMouseTracking() && mouse->type() == QEvent::MouseMove && mouse->buttons() == 0) { -- cgit v1.2.3