xwayland: Send to xwayland even when no window is focussed
In the codepath to keep xwayland notified of key presses we have to check the focussed window is not already an xwayland client. To avoid a null dereference a guard is added that the focussed window is not null, however the current code incorrectly returns early intead of skipping just the relevant check. BUG: 478705
This commit is contained in:
parent
53a61dfac0
commit
2025bf4c6b
1 changed files with 25 additions and 24 deletions
|
@ -375,26 +375,27 @@ public:
|
|||
|
||||
auto keyboard = waylandServer()->seat()->keyboard();
|
||||
auto surface = keyboard->focusedSurface();
|
||||
if (!surface) {
|
||||
ClientConnection *xwaylandClient = waylandServer()->xWaylandConnection();
|
||||
|
||||
if (surface) {
|
||||
ClientConnection *client = surface->client();
|
||||
if (xwaylandClient && xwaylandClient == client) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
KeyboardKeyState state{event->type() == QEvent::KeyPress};
|
||||
if (!updateKey(event->nativeScanCode(), state)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ClientConnection *client = surface->client();
|
||||
ClientConnection *xwaylandClient = waylandServer()->xWaylandConnection();
|
||||
if (xwaylandClient && xwaylandClient != client) {
|
||||
KeyboardKeyState state{event->type() == QEvent::KeyPress};
|
||||
if (!updateKey(event->nativeScanCode(), state)) {
|
||||
return;
|
||||
}
|
||||
auto xkb = input()->keyboard()->xkb();
|
||||
keyboard->sendModifiers(xkb->modifierState().depressed,
|
||||
xkb->modifierState().latched,
|
||||
xkb->modifierState().locked,
|
||||
xkb->currentLayout());
|
||||
|
||||
auto xkb = input()->keyboard()->xkb();
|
||||
keyboard->sendModifiers(xkb->modifierState().depressed,
|
||||
xkb->modifierState().latched,
|
||||
xkb->modifierState().locked,
|
||||
xkb->currentLayout());
|
||||
|
||||
keyboard->sendKey(event->nativeScanCode(), state, xwaylandClient);
|
||||
}
|
||||
keyboard->sendKey(event->nativeScanCode(), state, xwaylandClient);
|
||||
}
|
||||
|
||||
void pointerEvent(KWin::MouseEvent *event) override
|
||||
|
@ -406,17 +407,17 @@ public:
|
|||
|
||||
auto pointer = waylandServer()->seat()->pointer();
|
||||
auto surface = pointer->focusedSurface();
|
||||
if (!surface) {
|
||||
return;
|
||||
}
|
||||
|
||||
ClientConnection *client = surface->client();
|
||||
ClientConnection *xwaylandClient = waylandServer()->xWaylandConnection();
|
||||
if (xwaylandClient && xwaylandClient != client) {
|
||||
PointerButtonState state{event->type() == QEvent::MouseButtonPress};
|
||||
|
||||
pointer->sendButton(event->nativeButton(), state, xwaylandClient);
|
||||
if (surface) {
|
||||
ClientConnection *client = surface->client();
|
||||
if (xwaylandClient && xwaylandClient == client) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PointerButtonState state{event->type() == QEvent::MouseButtonPress};
|
||||
pointer->sendButton(event->nativeButton(), state, xwaylandClient);
|
||||
}
|
||||
|
||||
bool updateKey(quint32 key, KeyboardKeyState state)
|
||||
|
|
Loading…
Reference in a new issue