wayland: Switch to new keyboard event notify methods in SeatInterface

This commit is contained in:
Vlad Zahorodnii 2021-03-24 12:07:09 +02:00
parent 57aec19744
commit 6fdfd8be5f
4 changed files with 16 additions and 13 deletions

View file

@ -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;

View file

@ -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;
}
}

View file

@ -11,7 +11,6 @@
#include "wayland_server.h"
#include "workspace.h"
#include <KWaylandServer/keyboard_interface.h>
#include <KWaylandServer/seat_interface.h>
#include <QMouseEvent>
@ -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;

View file

@ -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