From 6fdfd8be5fdb3df8022d6d137fc26c22309f0cb6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 24 Mar 2021 12:07:09 +0200 Subject: [PATCH] wayland: Switch to new keyboard event notify methods in SeatInterface --- src/input.cpp | 10 ++++++---- src/inputmethod.cpp | 6 ++++-- src/popup_input_filter.cpp | 5 ++--- src/xkb.cpp | 8 ++++---- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index d22a95e5ce..3304cb634e 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -233,12 +233,14 @@ void InputEventFilter::passToWaylandServer(QKeyEvent *event) if (event->isAutoRepeat()) { return; } + + KWaylandServer::SeatInterface *seat = waylandServer()->seat(); switch (event->type()) { case QEvent::KeyPress: - waylandServer()->seat()->keyboard()->keyPressed(event->nativeScanCode()); + seat->notifyKeyboardKey(event->nativeScanCode(), KWaylandServer::KeyboardKeyState::Pressed); break; case QEvent::KeyRelease: - waylandServer()->seat()->keyboard()->keyReleased(event->nativeScanCode()); + seat->notifyKeyboardKey(event->nativeScanCode(), KWaylandServer::KeyboardKeyState::Released); break; default: break; @@ -343,10 +345,10 @@ public: } switch (event->type()) { case QEvent::KeyPress: - seat->keyboard()->keyPressed(event->nativeScanCode()); + seat->notifyKeyboardKey(event->nativeScanCode(), KWaylandServer::KeyboardKeyState::Pressed); break; case QEvent::KeyRelease: - seat->keyboard()->keyReleased(event->nativeScanCode()); + seat->notifyKeyboardKey(event->nativeScanCode(), KWaylandServer::KeyboardKeyState::Released); break; default: break; diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp index c13c90a2be..73ae52d7a7 100644 --- a/src/inputmethod.cpp +++ b/src/inputmethod.cpp @@ -364,11 +364,13 @@ void InputMethod::keysymReceived(quint32 serial, quint32 time, quint32 sym, bool } auto t3 = waylandServer()->seat()->textInputV3(); if (t3 && t3->isEnabled()) { + KWaylandServer::KeyboardKeyState state; if (pressed) { - waylandServer()->seat()->keyboard()->keyPressed(keysymToKeycode(sym)); + state = KWaylandServer::KeyboardKeyState::Pressed; } else { - waylandServer()->seat()->keyboard()->keyReleased(keysymToKeycode(sym)); + state = KWaylandServer::KeyboardKeyState::Released; } + waylandServer()->seat()->notifyKeyboardKey(keysymToKeycode(sym), state); return; } } diff --git a/src/popup_input_filter.cpp b/src/popup_input_filter.cpp index cd1a0fbb37..1646e1b123 100644 --- a/src/popup_input_filter.cpp +++ b/src/popup_input_filter.cpp @@ -11,7 +11,6 @@ #include "wayland_server.h" #include "workspace.h" -#include #include #include @@ -84,10 +83,10 @@ bool PopupInputFilter::keyEvent(QKeyEvent *event) seat->setFocusedKeyboardSurface(last->surface()); switch (event->type()) { case QEvent::KeyPress: - seat->keyboard()->keyPressed(event->nativeScanCode()); + seat->notifyKeyboardKey(event->nativeScanCode(), KWaylandServer::KeyboardKeyState::Pressed); break; case QEvent::KeyRelease: - seat->keyboard()->keyReleased(event->nativeScanCode()); + seat->notifyKeyboardKey(event->nativeScanCode(), KWaylandServer::KeyboardKeyState::Released); break; default: break; diff --git a/src/xkb.cpp b/src/xkb.cpp index 31421d8e2b..e7034a632c 100644 --- a/src/xkb.cpp +++ b/src/xkb.cpp @@ -385,10 +385,10 @@ void Xkb::forwardModifiers() if (!m_seat || !m_seat->keyboard()) { return; } - m_seat->keyboard()->updateModifiers(m_modifierState.depressed, - m_modifierState.latched, - m_modifierState.locked, - m_currentLayout); + m_seat->notifyKeyboardModifiers(m_modifierState.depressed, + m_modifierState.latched, + m_modifierState.locked, + m_currentLayout); } QString Xkb::layoutName(xkb_layout_index_t index) const