From 67f49277e68693dde6fd9ad0dd5b58885c33599c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 25 Jul 2017 14:00:58 +0200 Subject: [macOS] Warn about sending simulated touch events not working on macOS Chromium itself does not really support processing touch events on macOS, but rather uses native gestures sent by the OS. Warn the user in case they send simulated QTouchEvents. Task-number: QTBUG-62130 Change-Id: If47f25bc06f3d6f99ba70164a585182354ed9b5a Reviewed-by: Allan Sandfeld Jensen --- src/core/render_widget_host_view_qt.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 958ff91e1..728357e14 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -80,6 +80,7 @@ #include #include #include +#include #include #include #include @@ -1346,11 +1347,20 @@ void RenderWidgetHostViewQt::handleGestureEvent(QNativeGestureEvent *ev) } } +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(). -- cgit v1.2.3