wayland: Release all keys upon keyboard leaving
Biggest most annoying symptom was that the window was rendered unusable after alt+tab, but any other combination is also problematic.
This commit is contained in:
parent
82be16df29
commit
3d2a3de07e
2 changed files with 10 additions and 0 deletions
|
@ -51,6 +51,12 @@ WaylandInputDevice::WaylandInputDevice(KWayland::Client::Keyboard *keyboard, Way
|
|||
: m_seat(seat)
|
||||
, m_keyboard(keyboard)
|
||||
{
|
||||
connect(keyboard, &Keyboard::left, this, [this](quint32 time) {
|
||||
for (quint32 key : std::as_const(m_pressedKeys)) {
|
||||
Q_EMIT keyChanged(key, InputRedirection::KeyboardKeyReleased, std::chrono::milliseconds(time), this);
|
||||
}
|
||||
m_pressedKeys.clear();
|
||||
});
|
||||
connect(keyboard, &Keyboard::keyChanged, this, [this](quint32 key, Keyboard::KeyState nativeState, quint32 time) {
|
||||
InputRedirection::KeyboardKeyState state;
|
||||
switch (nativeState) {
|
||||
|
@ -59,8 +65,10 @@ WaylandInputDevice::WaylandInputDevice(KWayland::Client::Keyboard *keyboard, Way
|
|||
m_seat->backend()->togglePointerLock();
|
||||
}
|
||||
state = InputRedirection::KeyboardKeyPressed;
|
||||
m_pressedKeys.insert(key);
|
||||
break;
|
||||
case Keyboard::KeyState::Released:
|
||||
m_pressedKeys.remove(key);
|
||||
state = InputRedirection::KeyboardKeyReleased;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -97,6 +97,8 @@ private:
|
|||
std::unique_ptr<KWayland::Client::Pointer> m_pointer;
|
||||
std::unique_ptr<KWayland::Client::PointerPinchGesture> m_pinchGesture;
|
||||
std::unique_ptr<KWayland::Client::PointerSwipeGesture> m_swipeGesture;
|
||||
|
||||
QSet<quint32> m_pressedKeys;
|
||||
};
|
||||
|
||||
class WaylandInputBackend : public InputBackend
|
||||
|
|
Loading…
Reference in a new issue