xcb: update connection time when possible
At least we try to do it with all events triggered by user. Pick-to: 5.15 6.1 6.2 Change-Id: I28b399a2517600f7da2c91a50fecdf58b9d81fb6 Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
63c1e7c4a1
commit
25feb2fe3e
@ -579,6 +579,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
|
||||
HANDLE_PLATFORM_WINDOW_EVENT(xcb_expose_event_t, window, handleExposeEvent);
|
||||
case XCB_BUTTON_PRESS: {
|
||||
auto ev = reinterpret_cast<xcb_button_press_event_t *>(event);
|
||||
setTime(ev->time);
|
||||
m_keyboard->updateXKBStateFromCore(ev->state);
|
||||
// the event explicitly contains the state of the three first buttons,
|
||||
// the rest we need to manage ourselves
|
||||
@ -591,6 +592,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
|
||||
}
|
||||
case XCB_BUTTON_RELEASE: {
|
||||
auto ev = reinterpret_cast<xcb_button_release_event_t *>(event);
|
||||
setTime(ev->time);
|
||||
if (m_duringSystemMoveResize && ev->root != XCB_NONE)
|
||||
abortSystemMoveResize(ev->root);
|
||||
m_keyboard->updateXKBStateFromCore(ev->state);
|
||||
@ -603,6 +605,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
|
||||
}
|
||||
case XCB_MOTION_NOTIFY: {
|
||||
auto ev = reinterpret_cast<xcb_motion_notify_event_t *>(event);
|
||||
setTime(ev->time);
|
||||
m_keyboard->updateXKBStateFromCore(ev->state);
|
||||
m_buttonState = (m_buttonState & ~0x7) | translateMouseButtons(ev->state);
|
||||
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
|
||||
@ -643,14 +646,19 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
|
||||
// Prefer XI2 enter (XCB_INPUT_ENTER) events over core events.
|
||||
break;
|
||||
}
|
||||
setTime(reinterpret_cast<xcb_enter_notify_event_t *>(event)->time);
|
||||
HANDLE_PLATFORM_WINDOW_EVENT(xcb_enter_notify_event_t, event, handleEnterNotifyEvent);
|
||||
case XCB_LEAVE_NOTIFY:
|
||||
{
|
||||
if (hasXInput2()) {
|
||||
// Prefer XI2 leave (XCB_INPUT_LEAVE) events over core events.
|
||||
break;
|
||||
}
|
||||
m_keyboard->updateXKBStateFromCore(reinterpret_cast<xcb_leave_notify_event_t *>(event)->state);
|
||||
auto ev = reinterpret_cast<xcb_leave_notify_event_t *>(event);
|
||||
setTime(ev->time);
|
||||
m_keyboard->updateXKBStateFromCore(ev->state);
|
||||
HANDLE_PLATFORM_WINDOW_EVENT(xcb_leave_notify_event_t, event, handleLeaveNotifyEvent);
|
||||
}
|
||||
case XCB_FOCUS_IN:
|
||||
HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_in_event_t, event, handleFocusInEvent);
|
||||
case XCB_FOCUS_OUT:
|
||||
@ -658,13 +666,18 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
|
||||
case XCB_KEY_PRESS:
|
||||
{
|
||||
auto keyPress = reinterpret_cast<xcb_key_press_event_t *>(event);
|
||||
setTime(keyPress->time);
|
||||
m_keyboard->updateXKBStateFromCore(keyPress->state);
|
||||
setTime(keyPress->time);
|
||||
HANDLE_KEYBOARD_EVENT(xcb_key_press_event_t, handleKeyPressEvent);
|
||||
}
|
||||
case XCB_KEY_RELEASE:
|
||||
m_keyboard->updateXKBStateFromCore(reinterpret_cast<xcb_key_release_event_t *>(event)->state);
|
||||
{
|
||||
auto keyRelease = reinterpret_cast<xcb_key_release_event_t *>(event);
|
||||
setTime(keyRelease->time);
|
||||
m_keyboard->updateXKBStateFromCore(keyRelease->state);
|
||||
HANDLE_KEYBOARD_EVENT(xcb_key_release_event_t, handleKeyReleaseEvent);
|
||||
}
|
||||
case XCB_MAPPING_NOTIFY:
|
||||
m_keyboard->updateKeymap(reinterpret_cast<xcb_mapping_notify_event_t *>(event));
|
||||
break;
|
||||
@ -672,6 +685,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
|
||||
{
|
||||
#if QT_CONFIG(draganddrop) || QT_CONFIG(clipboard)
|
||||
auto selectionRequest = reinterpret_cast<xcb_selection_request_event_t *>(event);
|
||||
setTime(selectionRequest->time);
|
||||
#endif
|
||||
#if QT_CONFIG(draganddrop)
|
||||
if (selectionRequest->selection == atom(QXcbAtom::XdndSelection))
|
||||
@ -696,11 +710,12 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
|
||||
break;
|
||||
case XCB_PROPERTY_NOTIFY:
|
||||
{
|
||||
auto propertyNotify = reinterpret_cast<xcb_property_notify_event_t *>(event);
|
||||
setTime(propertyNotify->time);
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
if (m_clipboard->handlePropertyNotify(event))
|
||||
break;
|
||||
#endif
|
||||
auto propertyNotify = reinterpret_cast<xcb_property_notify_event_t *>(event);
|
||||
if (propertyNotify->atom == atom(QXcbAtom::_NET_WORKAREA)) {
|
||||
QXcbVirtualDesktop *virtualDesktop = virtualDesktopForRootWindow(propertyNotify->window);
|
||||
if (virtualDesktop)
|
||||
|
@ -639,6 +639,7 @@ static inline qreal fixed1616ToReal(xcb_input_fp1616_t val)
|
||||
void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
|
||||
{
|
||||
auto *xiEvent = reinterpret_cast<qt_xcb_input_device_event_t *>(event);
|
||||
setTime(xiEvent->time);
|
||||
if (m_xiSlavePointerIds.contains(xiEvent->deviceid)) {
|
||||
if (!m_duringSystemMoveResize)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user