diff --git a/input.h b/input.h --- a/input.h +++ b/input.h @@ -164,6 +164,8 @@ return m_touch; } + bool hasAlphaNumericKeyboard(); + Q_SIGNALS: /** * @brief Emitted when the global pointer position changed @@ -203,6 +205,8 @@ */ void keyStateChanged(quint32 keyCode, InputRedirection::KeyboardKeyState state); + void hasAlphaNumericKeyboardChanged(bool set); + private: void setupLibInput(); void setupLibInputWithScreens(); diff --git a/input.cpp b/input.cpp --- a/input.cpp +++ b/input.cpp @@ -1157,15 +1157,17 @@ connect(kwinApp(), &Application::screensCreated, this, &InputRedirection::setupLibInputWithScreens); } if (auto s = findSeat()) { - s->setHasKeyboard(conn->hasAlphaNumericKeyboard()); + // Workaround for QTBUG-54371: if there is no real keyboard Qt doesn't request virtual keyboard + s->setHasKeyboard(true); s->setHasPointer(conn->hasPointer()); s->setHasTouch(conn->hasTouch()); connect(conn, &LibInput::Connection::hasAlphaNumericKeyboardChanged, this, - [this, s] (bool set) { + [this] (bool set) { if (m_libInput->isSuspended()) { return; } - s->setHasKeyboard(set); + // TODO: this should update the seat, only workaround for QTBUG-54371 + emit hasAlphaNumericKeyboardChanged(set); } ); connect(conn, &LibInput::Connection::hasPointerChanged, this, @@ -1196,6 +1198,16 @@ #endif } +bool InputRedirection::hasAlphaNumericKeyboard() +{ +#if HAVE_INPUT + if (m_libInput) { + return m_libInput->hasAlphaNumericKeyboard(); + } +#endif + return true; +} + void InputRedirection::setupLibInputWithScreens() { #if HAVE_INPUT diff --git a/virtualkeyboard.cpp b/virtualkeyboard.cpp --- a/virtualkeyboard.cpp +++ b/virtualkeyboard.cpp @@ -18,6 +18,7 @@ along with this program. If not, see . *********************************************************************/ #include "virtualkeyboard.h" +#include "input.h" #include "utils.h" #include "screens.h" #include "wayland_server.h" @@ -78,10 +79,10 @@ m_inputWindow->setProperty("__kwin_input_method", true); if (waylandServer()) { - m_enabled = !waylandServer()->seat()->hasKeyboard(); - connect(waylandServer()->seat(), &KWayland::Server::SeatInterface::hasKeyboardChanged, this, - [this] { - setEnabled(!waylandServer()->seat()->hasKeyboard()); + m_enabled = !input()->hasAlphaNumericKeyboard(); + connect(input(), &InputRedirection::hasAlphaNumericKeyboardChanged, this, + [this] (bool set) { + setEnabled(!set); } ); }