diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2021-10-06 09:38:04 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2021-10-19 13:32:05 +0200 |
commit | 03b3df668088d0750af6a59410ee4d0d00ba88ae (patch) | |
tree | 4abe79245fb81db4f9a85da89d0cd964cff5c63a | |
parent | 5f6a292bc53b9adf14c0e45a7de226a56449dbca (diff) |
Fix pinch gesture
Pinch gesture on a touchpad is expected to zoom-in and zoom-out. It has
been broken since the pinch gestures are routed because for routing the
event target has to be found. The event target is only tried to be found
on a pinch begin gesture.
As a fix, handle Qt::BeginNativeGesture and Qt::EndNativeGesture events
too.
Fixes: QTBUG-96930
Change-Id: Ic8fe5bee933b5e0fbc8f5ba6234363a0a625648d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit ff54ccc82fdba26cf16b9a64b387e3b428fb3038)
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 3 | ||||
-rw-r--r-- | src/core/web_event_factory.cpp | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index bee3c4ca4..b6cac85ce 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -1662,7 +1662,8 @@ void RenderWidgetHostViewQt::handleGestureEvent(QNativeGestureEvent *ev) { const Qt::NativeGestureType type = ev->gestureType(); // These are the only supported gestures by Chromium so far. - if (type == Qt::ZoomNativeGesture || type == Qt::SmartZoomNativeGesture) { + if (type == Qt::ZoomNativeGesture || type == Qt::SmartZoomNativeGesture + || type == Qt::BeginNativeGesture || type == Qt::EndNativeGesture) { if (host()->delegate() && host()->delegate()->GetInputEventRouter()) { auto webEvent = WebEventFactory::toWebGestureEvent(ev); host()->delegate()->GetInputEventRouter()->RouteGestureEvent(this, &webEvent, ui::LatencyInfo()); diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index dcfa3dc39..b6ca70294 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -1540,7 +1540,13 @@ WebGestureEvent WebEventFactory::toWebGestureEvent(QNativeGestureEvent *ev) webKitEvent.data.tap.tap_count = 1; break; case Qt::BeginNativeGesture: + webKitEvent.SetType(WebInputEvent::Type::kGesturePinchBegin); + webKitEvent.SetNeedsWheelEvent(true); + break; case Qt::EndNativeGesture: + webKitEvent.SetType(WebInputEvent::Type::kGesturePinchEnd); + webKitEvent.SetNeedsWheelEvent(true); + break; case Qt::RotateNativeGesture: case Qt::PanNativeGesture: case Qt::SwipeNativeGesture: |