diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2016-06-14 12:46:23 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@theqtcompany.com> | 2016-06-14 11:51:46 +0000 |
commit | cf8bc1899abbce736a29841a10119fc0ca8b8b42 (patch) | |
tree | 5f2fcac27311fc75711ae69758848d48fd9f94f0 /src/core/render_widget_host_view_qt.cpp | |
parent | 31d568295a2d8dcfe12ff62348aa768c75d2dfe7 (diff) |
Stop forwarding OS synthesized touch-to-mouse events.
Before the change, chromium would process an onclick handler twice,
once due to a touch event, and another time due to the OS synthesized
mouse event.
Patch makes sure only the touch events are forwarded to Chromium. This
is consistent with mainline Chrome behavior.
Task-number: QTBUG-53201
Change-Id: I16f46b94890c2f6fa9a9089f7c721ec79e0bc96b
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index cc0510666..5183f6732 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -878,6 +878,13 @@ bool RenderWidgetHostViewQt::IsPopup() const void RenderWidgetHostViewQt::handleMouseEvent(QMouseEvent* event) { + // Don't forward mouse events synthesized by the system, which are caused by genuine touch + // events. Chromium would then process for e.g. a mouse click handler twice, once due to the + // system synthesized mouse event, and another time due to a touch-to-gesture-to-mouse + // transformation done by Chromium. + if (event->source() == Qt::MouseEventSynthesizedBySystem) + return; + blink::WebMouseEvent webEvent = WebEventFactory::toWebMouseEvent(event, dpiScale()); if (event->type() == QMouseEvent::MouseButtonPress) { if (event->button() != m_clickHelper.lastPressButton |