diff --git a/src/xwayland/xwayland.cpp b/src/xwayland/xwayland.cpp index d7951c5f5e..47dc83d0c8 100644 --- a/src/xwayland/xwayland.cpp +++ b/src/xwayland/xwayland.cpp @@ -157,8 +157,9 @@ public: return; } - auto client = surface->client(); - if (waylandServer()->xWaylandConnection() != client) { + KWaylandServer::ClientConnection *client = surface->client(); + KWaylandServer::ClientConnection *xwaylandClient = waylandServer()->xWaylandConnection(); + if (xwaylandClient && xwaylandClient != client) { KWaylandServer::KeyboardKeyState state{event->type() == QEvent::KeyPress}; if (!updateKey(event->nativeScanCode(), state)) { return; @@ -170,7 +171,7 @@ public: xkb->modifierState().locked, xkb->currentLayout()); - waylandServer()->seat()->keyboard()->sendKey(event->nativeScanCode(), state, waylandServer()->xWaylandConnection()); + waylandServer()->seat()->keyboard()->sendKey(event->nativeScanCode(), state, xwaylandClient); } }