diff options
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 0c98c9e21..8d79a1869 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -80,6 +80,7 @@ #include <QFocusEvent> #include <QGuiApplication> #include <QInputMethodEvent> +#include <QLoggingCategory> #include <QTextFormat> #include <QKeyEvent> #include <QMouseEvent> @@ -919,11 +920,11 @@ bool RenderWidgetHostViewQt::forwardEvent(QEvent *event) case QEvent::TouchCancel: handleTouchEvent(static_cast<QTouchEvent*>(event)); break; +#ifndef QT_NO_GESTURES case QEvent::NativeGesture: handleGestureEvent(static_cast<QNativeGestureEvent *>(event)); break; - case QEvent::HoverEnter: - case QEvent::HoverLeave: +#endif // QT_NO_GESTURES case QEvent::HoverMove: handleHoverEvent(static_cast<QHoverEvent*>(event)); break; @@ -1316,6 +1317,7 @@ void RenderWidgetHostViewQt::clearPreviousTouchMotionState() m_touchMotionStarted = false; } +#ifndef QT_NO_GESTURES void RenderWidgetHostViewQt::handleGestureEvent(QNativeGestureEvent *ev) { const Qt::NativeGestureType type = ev->gestureType(); @@ -1326,12 +1328,22 @@ void RenderWidgetHostViewQt::handleGestureEvent(QNativeGestureEvent *ev) static_cast<double>(dpiScale()))); } } +#endif + +Q_DECLARE_LOGGING_CATEGORY(QWEBENGINE_TOUCH_HANDLING); +Q_LOGGING_CATEGORY(QWEBENGINE_TOUCH_HANDLING, "qt.webengine.touch"); void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev) { // On macOS instead of handling touch events, we use the OS provided QNativeGestureEvents. #ifdef Q_OS_MACOS - return; + if (ev->spontaneous()) { + return; + } else { + qCWarning(QWEBENGINE_TOUCH_HANDLING) + << "Sending simulated touch events to Chromium does not work properly on macOS. " + "Consider using QNativeGestureEvents or QMouseEvents."; + } #endif // Chromium expects the touch event timestamps to be comparable to base::TimeTicks::Now(). |