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-12 13:04:09 +0200 |
commit | ff54ccc82fdba26cf16b9a64b387e3b428fb3038 (patch) | |
tree | d315bbaef3aa2fb18e324012935fefab74bec986 | |
parent | f6f8f258be09fef90585b0228bd82a9708ef34a6 (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
Pick-to: 6.2 5.15
Change-Id: Ic8fe5bee933b5e0fbc8f5ba6234363a0a625648d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | src/core/render_widget_host_view_qt_delegate_client.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_delegate_client.cpp b/src/core/render_widget_host_view_qt_delegate_client.cpp index 01691fd8b..d28e789ee 100644 --- a/src/core/render_widget_host_view_qt_delegate_client.cpp +++ b/src/core/render_widget_host_view_qt_delegate_client.cpp @@ -717,7 +717,8 @@ void RenderWidgetHostViewQtDelegateClient::handleGestureEvent(QNativeGestureEven { const Qt::NativeGestureType type = event->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) { auto *hostDelegate = m_rwhv->host()->delegate(); if (hostDelegate && hostDelegate->GetInputEventRouter()) { auto webEvent = WebEventFactory::toWebGestureEvent(event); diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index b82877bac..d7dceb30c 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -1542,7 +1542,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: |