diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp index 2ef522e1cb..bd73934484 100644 --- a/src/inputmethod.cpp +++ b/src/inputmethod.cpp @@ -130,7 +130,7 @@ void InputMethod::hide() inputContext->sendReset(); } -bool InputMethod::touchEventTriggered() const +bool InputMethod::shouldShowOnActive() const { return input()->touch() && input()->touch()->lastEventTime() > input()->keyboard()->lastEventTime() @@ -263,7 +263,7 @@ void InputMethod::textInputInterfaceV2StateUpdated(quint32 serial, KWaylandServe if (!t2 || !t2->isEnabled()) { return; } - if (m_inputClient && touchEventTriggered()) { + if (m_inputClient && shouldShowOnActive()) { m_inputClient->allow(); } switch (reason) { @@ -608,7 +608,7 @@ void InputMethod::updateInputPanelState() return; } - if (m_inputClient && touchEventTriggered()) { + if (m_inputClient && shouldShowOnActive()) { m_inputClient->allow(); } diff --git a/src/inputmethod.h b/src/inputmethod.h index c2c00fc260..a5d5d32f0e 100644 --- a/src/inputmethod.h +++ b/src/inputmethod.h @@ -61,6 +61,7 @@ public: void setInputMethodCommand(const QString &path); KWaylandServer::InputMethodGrabV1 *keyboardGrab(); + bool shouldShowOnActive() const; Q_SIGNALS: void activeChanged(bool active); diff --git a/src/virtualkeyboard_dbus.cpp b/src/virtualkeyboard_dbus.cpp index cfd7b3f393..447748706f 100644 --- a/src/virtualkeyboard_dbus.cpp +++ b/src/virtualkeyboard_dbus.cpp @@ -58,4 +58,9 @@ bool VirtualKeyboardDBus::isAvailable() const return m_inputMethod->isAvailable(); } +bool VirtualKeyboardDBus::willShowOnActive() const +{ + return isAvailable() && isEnabled() && m_inputMethod->shouldShowOnActive(); +} + } diff --git a/src/virtualkeyboard_dbus.h b/src/virtualkeyboard_dbus.h index a5f2a98072..94dfcd423c 100644 --- a/src/virtualkeyboard_dbus.h +++ b/src/virtualkeyboard_dbus.h @@ -33,6 +33,8 @@ public: void setEnabled(bool enabled); void setActive(bool active); + Q_SCRIPTABLE bool willShowOnActive() const; + Q_SIGNALS: Q_SCRIPTABLE void enabledChanged(); Q_SCRIPTABLE void activeChanged();