summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2024-05-08 08:15:05 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2024-05-08 08:15:05 +0300
commit8fbc3b59e19ebaec1343abbde2a10537bc240f84 (patch)
treee3d83d73529f25ff1c7b86b6eead3fadb5a7e8b1
parent163ea1a04d1b00c95373d69e8c907e5789082d3e (diff)
parent49b89a51b6bbc0aec0d282d545d004ad0ef66882 (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.14' into tqtc/lts-5.15-opensourcev5.15.14-lts-lgpl5.15
-rw-r--r--.qmake.conf2
-rw-r--r--src/client/configure.json3
-rw-r--r--src/client/qwaylandinputdevice.cpp2
-rw-r--r--src/client/qwaylandnativeinterface.cpp2
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp47
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard_p.h7
-rw-r--r--src/compositor/compositor_api/qwaylandseat.cpp7
-rw-r--r--src/compositor/configure.json6
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp4
9 files changed, 66 insertions, 14 deletions
diff --git a/.qmake.conf b/.qmake.conf
index b3d5a4fed..e4b7cb609 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -4,4 +4,4 @@ DEFINES += QT_NO_FOREACH
DEFINES += QT_NO_JAVA_STYLE_ITERATORS
DEFINES += QT_NO_LINKED_LIST
-MODULE_VERSION = 5.15.13
+MODULE_VERSION = 5.15.14
diff --git a/src/client/configure.json b/src/client/configure.json
index 2f4245804..73f233622 100644
--- a/src/client/configure.json
+++ b/src/client/configure.json
@@ -149,8 +149,7 @@
"#endif"
]
},
- "libs": "-ldrm",
- "use": "egl"
+ "use": "egl drm"
},
"vulkan-server-buffer": {
"label": "Vulkan Buffer Sharing",
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index b0e9692bd..346c438c6 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -846,7 +846,7 @@ void QWaylandInputDevice::Pointer::releaseButtons()
mButtons = Qt::NoButton;
if (auto *window = focusWindow()) {
- MotionEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers());
+ ReleaseEvent e(focusWindow(), mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoButton, mParent->modifiers());
window->handleMouse(mParent, e);
}
}
diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp
index bf54a1a00..9763c3123 100644
--- a/src/client/qwaylandnativeinterface.cpp
+++ b/src/client/qwaylandnativeinterface.cpp
@@ -139,7 +139,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc
{
QByteArray lowerCaseResource = resourceString.toLower();
- if (lowerCaseResource == "output")
+ if (lowerCaseResource == "output" && !screen->handle()->isPlaceholder())
return ((QWaylandScreen *) screen->handle())->output();
return nullptr;
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp
index 210b683ff..2e694bba7 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.cpp
+++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp
@@ -39,11 +39,13 @@
#include <QtCore/QFile>
#include <QtCore/QStandardPaths>
+#include <QKeyEvent>
#include <fcntl.h>
#include <unistd.h>
#if QT_CONFIG(xkbcommon)
#include <sys/mman.h>
#include <sys/types.h>
+#include <xkbcommon/xkbcommon-names.h>
#endif
QT_BEGIN_NAMESPACE
@@ -192,6 +194,10 @@ void QWaylandKeyboardPrivate::maybeUpdateXkbScanCodeTable()
scanCodesByQtKey->insert({layout, qtKey}, keycode);
}
}, &scanCodesByQtKey);
+
+ shiftIndex = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_SHIFT);
+ controlIndex = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CTRL);
+ altIndex = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_ALT);
}
}
#endif
@@ -223,6 +229,15 @@ void QWaylandKeyboardPrivate::updateModifierState(uint code, uint32_t state)
if (focusResource) {
send_modifiers(focusResource->handle, compositor()->nextSerial(), modsDepressed,
modsLatched, modsLocked, group);
+
+ Qt::KeyboardModifiers currentState = Qt::NoModifier;
+ if (xkb_state_mod_index_is_active(xkbState(), shiftIndex, XKB_STATE_MODS_EFFECTIVE) == 1)
+ currentState |= Qt::ShiftModifier;
+ if (xkb_state_mod_index_is_active(xkbState(), controlIndex, XKB_STATE_MODS_EFFECTIVE) == 1)
+ currentState |= Qt::ControlModifier;
+ if (xkb_state_mod_index_is_active(xkbState(), altIndex, XKB_STATE_MODS_EFFECTIVE) == 1)
+ currentState |= Qt::AltModifier;
+ currentModifierState = currentState;
}
#else
Q_UNUSED(code);
@@ -498,6 +513,38 @@ void QWaylandKeyboard::sendKeyReleaseEvent(uint code)
d->sendKeyEvent(code, WL_KEYBOARD_KEY_STATE_RELEASED);
}
+void QWaylandKeyboardPrivate::checkAndRepairModifierState(QKeyEvent *ke)
+{
+#if QT_CONFIG(xkbcommon)
+ if (ke->modifiers() != currentModifierState) {
+ if (focusResource && ke->key() != Qt::Key_Shift
+ && ke->key() != Qt::Key_Control && ke->key() != Qt::Key_Alt) {
+ // Only repair the state for non-modifier keys
+ // ### slightly awkward because the standard modifier handling
+ // is done by QtWayland::WindowSystemEventHandler after the
+ // key event is delivered
+ uint32_t mods = 0;
+
+ if (shiftIndex == 0 && controlIndex == 0)
+ maybeUpdateXkbScanCodeTable();
+
+ if (ke->modifiers() & Qt::ShiftModifier)
+ mods |= 1 << shiftIndex;
+ if (ke->modifiers() & Qt::ControlModifier)
+ mods |= 1 << controlIndex;
+ if (ke->modifiers() & Qt::AltModifier)
+ mods |= 1 << altIndex;
+ qCDebug(qLcWaylandCompositor) << "Keyboard modifier state mismatch detected for event" << ke << "state:" << currentModifierState << "repaired:" << Qt::hex << mods;
+ send_modifiers(focusResource->handle, compositor()->nextSerial(), mods,
+ 0, 0, group);
+ currentModifierState = ke->modifiers();
+ }
+ }
+#else
+ Q_UNUSED(ke);
+#endif
+}
+
/*!
* Returns the current repeat rate.
*/
diff --git a/src/compositor/compositor_api/qwaylandkeyboard_p.h b/src/compositor/compositor_api/qwaylandkeyboard_p.h
index 96d174310..d986c02c0 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard_p.h
+++ b/src/compositor/compositor_api/qwaylandkeyboard_p.h
@@ -88,6 +88,7 @@ public:
void keyEvent(uint code, uint32_t state);
void sendKeyEvent(uint code, uint32_t state);
void updateModifierState(uint code, uint32_t state);
+ void checkAndRepairModifierState(QKeyEvent *ke);
void maybeUpdateKeymap();
void checkFocusResource(Resource *resource);
@@ -119,6 +120,12 @@ private:
uint32_t modsLocked = 0;
uint32_t group = 0;
+ uint32_t shiftIndex = 0;
+ uint32_t controlIndex = 0;
+ uint32_t altIndex = 0;
+
+ Qt::KeyboardModifiers currentModifierState;
+
bool pendingKeymap = false;
#if QT_CONFIG(xkbcommon)
size_t keymap_size;
diff --git a/src/compositor/compositor_api/qwaylandseat.cpp b/src/compositor/compositor_api/qwaylandseat.cpp
index 1e50a1be5..b526b6bae 100644
--- a/src/compositor/compositor_api/qwaylandseat.cpp
+++ b/src/compositor/compositor_api/qwaylandseat.cpp
@@ -41,6 +41,7 @@
#include <QtWaylandCompositor/QWaylandKeymap>
#include <QtWaylandCompositor/private/qwaylandseat_p.h>
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
+#include <QtWaylandCompositor/private/qwaylandkeyboard_p.h>
#if QT_CONFIG(wayland_datadevice)
#include <QtWaylandCompositor/private/qwldatadevice_p.h>
#endif
@@ -488,10 +489,12 @@ void QWaylandSeat::sendFullKeyEvent(QKeyEvent *event)
return;
}
- if (event->type() == QEvent::KeyPress)
+ if (event->type() == QEvent::KeyPress) {
+ QWaylandKeyboardPrivate::get(d->keyboard.data())->checkAndRepairModifierState(event);
d->keyboard->sendKeyPressEvent(scanCode);
- else if (event->type() == QEvent::KeyRelease)
+ } else if (event->type() == QEvent::KeyRelease) {
d->keyboard->sendKeyReleaseEvent(scanCode);
+ }
}
}
diff --git a/src/compositor/configure.json b/src/compositor/configure.json
index bcfd5215f..c5b0f03ed 100644
--- a/src/compositor/configure.json
+++ b/src/compositor/configure.json
@@ -151,8 +151,7 @@
"#endif"
]
},
- "libs": "-ldrm",
- "use": "egl"
+ "use": "egl drm"
},
"dmabuf-client-buffer": {
"label": "Linux Client dma-buf Buffer Sharing",
@@ -176,8 +175,7 @@
"return 0;"
]
},
- "libs": "-ldrm",
- "use": "egl"
+ "use": "egl drm"
},
"vulkan-server-buffer": {
"label": "Vulkan Buffer Sharing",
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index 94ea573e3..49e9d9538 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -425,9 +425,7 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent)
positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right);
positioner->set_size(m_window->geometry().width(), m_window->geometry().height());
positioner->set_constraint_adjustment(QtWayland::xdg_positioner::constraint_adjustment_slide_x
- | QtWayland::xdg_positioner::constraint_adjustment_slide_y
- | QtWayland::xdg_positioner::constraint_adjustment_flip_x
- | QtWayland::xdg_positioner::constraint_adjustment_flip_y);
+ | QtWayland::xdg_positioner::constraint_adjustment_slide_y);
m_popup = new Popup(this, parentXdgSurface, positioner);
positioner->destroy();
delete positioner;