diff --git a/input.cpp b/input.cpp index 69deb308c8..17312c595a 100644 --- a/input.cpp +++ b/input.cpp @@ -1157,15 +1157,17 @@ void InputRedirection::setupLibInput() 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 @@ void InputRedirection::setupLibInput() #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/input.h b/input.h index 896aec2484..2829344a12 100644 --- a/input.h +++ b/input.h @@ -164,6 +164,8 @@ public: return m_touch; } + bool hasAlphaNumericKeyboard(); + Q_SIGNALS: /** * @brief Emitted when the global pointer position changed @@ -203,6 +205,8 @@ Q_SIGNALS: */ void keyStateChanged(quint32 keyCode, InputRedirection::KeyboardKeyState state); + void hasAlphaNumericKeyboardChanged(bool set); + private: void setupLibInput(); void setupLibInputWithScreens(); diff --git a/virtualkeyboard.cpp b/virtualkeyboard.cpp index a18a36c402..3ae3e12f91 100644 --- a/virtualkeyboard.cpp +++ b/virtualkeyboard.cpp @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License 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 @@ void VirtualKeyboard::init() 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); } ); }