inputmethod: Expose VirtualKeyboard.willShowOnActive on dbus
It can help clients predict how KWin will react. Sometimes, the noise of seeing a virtual keyboard pop up is reason enough not to focus an input field.
This commit is contained in:
parent
6a99bfd2f4
commit
13b85d77fc
4 changed files with 11 additions and 3 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
void setInputMethodCommand(const QString &path);
|
||||
|
||||
KWaylandServer::InputMethodGrabV1 *keyboardGrab();
|
||||
bool shouldShowOnActive() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void activeChanged(bool active);
|
||||
|
|
|
@ -58,4 +58,9 @@ bool VirtualKeyboardDBus::isAvailable() const
|
|||
return m_inputMethod->isAvailable();
|
||||
}
|
||||
|
||||
bool VirtualKeyboardDBus::willShowOnActive() const
|
||||
{
|
||||
return isAvailable() && isEnabled() && m_inputMethod->shouldShowOnActive();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue