From 66a54d38d4dfe231980dfa1e4393d62f3c559df1 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 24 Jun 2022 17:54:55 +0000 Subject: [PATCH] effects: Set timestamp for input events Set the time for mouse and touch events. This is especially important for the mouse is as the timestamp will be used to discriminate between single and double click. Previously this was always sending the double click event, making buttons work only every other click. BUG: 454275 BUG: 449907 --- .../x11/standalone/effects_mouse_interception_x11_filter.cpp | 3 +++ src/libkwineffects/kwinoffscreenquickview.cpp | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backends/x11/standalone/effects_mouse_interception_x11_filter.cpp b/src/backends/x11/standalone/effects_mouse_interception_x11_filter.cpp index 7ef57b3644..b2901734ed 100644 --- a/src/backends/x11/standalone/effects_mouse_interception_x11_filter.cpp +++ b/src/backends/x11/standalone/effects_mouse_interception_x11_filter.cpp @@ -63,6 +63,7 @@ bool EffectsMouseInterceptionX11Filter::event(xcb_generic_event_t *event) } QWheelEvent ev(QPoint(me->event_x, me->event_y), QCursor::pos(), QPoint(), angleDelta, buttons, modifiers, Qt::NoScrollPhase, false); + ev.setTimestamp(me->time); return m_effects->checkInputWindowEvent(&ev); } const Qt::MouseButton button = x11ToQtMouseButton(me->detail); @@ -75,6 +76,7 @@ bool EffectsMouseInterceptionX11Filter::event(xcb_generic_event_t *event) } QMouseEvent ev(type, QPoint(me->event_x, me->event_y), QPoint(me->root_x, me->root_y), button, buttons, x11ToQtKeyboardModifiers(me->state)); + ev.setTimestamp(me->time); return m_effects->checkInputWindowEvent(&ev); } } else if (eventType == XCB_MOTION_NOTIFY) { @@ -82,6 +84,7 @@ bool EffectsMouseInterceptionX11Filter::event(xcb_generic_event_t *event) if (m_window == me->event) { QMouseEvent ev(QEvent::MouseMove, QPoint(me->event_x, me->event_y), QPoint(me->root_x, me->root_y), Qt::NoButton, x11ToQtMouseButtons(me->state), x11ToQtKeyboardModifiers(me->state)); + ev.setTimestamp(me->time); return m_effects->checkInputWindowEvent(&ev); } } diff --git a/src/libkwineffects/kwinoffscreenquickview.cpp b/src/libkwineffects/kwinoffscreenquickview.cpp index 14baa08085..ffc15e0d74 100644 --- a/src/libkwineffects/kwinoffscreenquickview.cpp +++ b/src/libkwineffects/kwinoffscreenquickview.cpp @@ -369,8 +369,6 @@ void OffscreenQuickView::forwardKeyEvent(QKeyEvent *keyEvent) bool OffscreenQuickView::forwardTouchDown(qint32 id, const QPointF &pos, quint32 time) { - Q_UNUSED(time) - d->updateTouchState(Qt::TouchPointPressed, id, pos); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) @@ -378,6 +376,7 @@ bool OffscreenQuickView::forwardTouchDown(qint32 id, const QPointF &pos, quint32 #else QTouchEvent event(QEvent::TouchBegin, d->touchDevice, Qt::NoModifier, d->touchPoints); #endif + event.setTimestamp(time); QCoreApplication::sendEvent(d->m_view, &event); return event.isAccepted();