Commit 66a54d38 authored by Marco Martin's avatar Marco Martin Committed by Nate Graham
Browse files

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
parent 66d12787
Pipeline #194968 passed with stage
in 12 minutes and 46 seconds
......@@ -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);
}
}
......
......@@ -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();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment