summaryrefslogtreecommitdiffstats
path: root/src/core/render_widget_host_view_qt.cpp
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2020-05-08 14:05:06 +0200
committerPeter Varga <pvarga@inf.u-szeged.hu>2020-05-20 09:34:26 +0000
commit6eadb2f2588b240b5fcda38e1f68a49a4690eb6b (patch)
treec8f578a6498d6a5482f6069bc91c296eba42752d /src/core/render_widget_host_view_qt.cpp
parent0891ac9c05b96471a0858011ef4f84b353337d16 (diff)
Fix scrollbar when releasing mouse button outside of window on Windows
When releasing mouse button outside of window on Windows, an extra QEvent::Leave is sent before the QEvent::MouseButtonRelease. This extra Leave event resets the pointer to the last interacted scrollbar (last_scrollbar_under_mouse_) in Chromium. Leave events should not be sent until the last mouse button is released. Fixes: QTBUG-70437 Pick-to: 5.15 Change-Id: Ibf28b3ca0fd82feb5abf91ec851d92db0a8657f0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r--src/core/render_widget_host_view_qt.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index c4d6200b7..2eeb09b2e 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -1170,8 +1170,12 @@ bool RenderWidgetHostViewQt::forwardEvent(QEvent *event)
case QEvent::InputMethodQuery:
handleInputMethodQueryEvent(static_cast<QInputMethodQueryEvent*>(event));
break;
- case QEvent::HoverLeave:
case QEvent::Leave:
+#ifdef Q_OS_WIN
+ if (m_mouseButtonPressed > 0)
+ return false;
+#endif
+ case QEvent::HoverLeave:
host()->ForwardMouseEvent(WebEventFactory::toWebMouseEvent(event));
break;
default:
@@ -1284,6 +1288,11 @@ bool RenderWidgetHostViewQt::IsPopup() const
void RenderWidgetHostViewQt::handleMouseEvent(QMouseEvent* event)
{
+ if (event->type() == QEvent::MouseButtonPress)
+ m_mouseButtonPressed++;
+ if (event->type() == QEvent::MouseButtonRelease)
+ m_mouseButtonPressed--;
+
// 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