QWaylandDataDevice: Use internal input device keyboard modifiers

QGuiApplication::keyboardModifiers() is somewhat wonky on Wayland
because on Wayland a modifier update is sent after the key event
but Qt only updates the modifiers in response to actual key events.

While this should also be fixed, using our internal state is
an easy way to avoid this and ensure the keyboard modifiers
in a drag/drop event are correct.

Pick-to: 6.8 6.7 6.6 6.5
Change-Id: I8bf0190663d7d47ea3d261e6daa4f622ea031e82
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
Kai Uwe Broulik 2023-12-14 12:51:54 +01:00 committed by David Edmundson
parent 9425194431
commit c1e0ffd286

View File

@ -195,7 +195,7 @@ void QWaylandDataDevice::data_device_drop()
QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_dragWindow, dragData, m_dragPoint, supportedActions,
QGuiApplication::mouseButtons(),
QGuiApplication::keyboardModifiers());
m_inputDevice->modifiers());
if (drag) {
auto drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag());
drag->setDropResponse(response);
@ -230,7 +230,7 @@ void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface,
const QPlatformDragQtResponse &response = QWindowSystemInterface::handleDrag(
m_dragWindow, dragData, m_dragPoint, supportedActions, QGuiApplication::mouseButtons(),
QGuiApplication::keyboardModifiers());
m_inputDevice->modifiers());
if (drag) {
static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response);
}
@ -243,7 +243,7 @@ void QWaylandDataDevice::data_device_leave()
if (m_dragWindow)
QWindowSystemInterface::handleDrag(m_dragWindow, nullptr, QPoint(), Qt::IgnoreAction,
QGuiApplication::mouseButtons(),
QGuiApplication::keyboardModifiers());
m_inputDevice->modifiers());
QDrag *drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->currentDrag();
if (!drag) {
@ -274,7 +274,7 @@ void QWaylandDataDevice::data_device_motion(uint32_t time, wl_fixed_t x, wl_fixe
const QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_dragWindow, dragData, m_dragPoint, supportedActions,
QGuiApplication::mouseButtons(),
QGuiApplication::keyboardModifiers());
m_inputDevice->modifiers());
if (drag) {
static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag())->setResponse(response);