summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Volkov <a.volkov@rusbitech.ru>2014-09-17 17:22:27 +0400
committerAlexander Volkov <a.volkov@rusbitech.ru>2014-09-19 23:31:30 +0200
commit34de989a9405152ad635d9d9404f026c96f371cc (patch)
tree7d7b93e582153eef0e1701c1e08dc9c9292c9e43
parentba46c0eef5aee5063e7bfc294b044c4a79233f1d (diff)
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 <laszlo.agocs@digia.com>
-rw-r--r--src/gui/kernel/qguiapplication.cpp3
-rw-r--r--src/widgets/kernel/qapplication.cpp1
2 files changed, 3 insertions, 1 deletions
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) {