Commit 9fc09b9a authored by Bhushan Shah's avatar Bhushan Shah 📱 Committed by Bhushan Shah
Browse files

virtualkeyboard: update the input panel state when textinput requests it

v1, v2 and v3 protocols supports the update/commit state methods for the
text-input protocol, use it to commit the input method state
parent f93af913
......@@ -133,6 +133,7 @@ void VirtualKeyboard::init()
disconnect(m_waylandSurroundingTextConnection);
disconnect(m_waylandResetConnection);
disconnect(m_waylandEnabledConnection);
disconnect(m_waylandStateCommittedConnection);
if (auto t = waylandServer()->seat()->focusedTextInput()) {
m_waylandShowConnection = connect(t, &TextInputInterface::requestShowInputPanel, this, &VirtualKeyboard::show);
m_waylandHideConnection = connect(t, &TextInputInterface::requestHideInputPanel, this, &VirtualKeyboard::hide);
......@@ -176,6 +177,13 @@ void VirtualKeyboard::init()
hide();
}
});
m_waylandStateCommittedConnection = connect(t, &TextInputInterface::stateCommitted, this, [t](uint32_t serial) {
auto inputContext = waylandServer()->inputMethod()->context();
if (!inputContext) {
return;
}
inputContext->sendCommitState(serial);
});
auto newClient = waylandServer()->findClient(waylandServer()->seat()->focusedTextInputSurface());
// Reset the old client virtual keybaord geom if necessary
......@@ -194,6 +202,7 @@ void VirtualKeyboard::init()
m_waylandSurroundingTextConnection = QMetaObject::Connection();
m_waylandResetConnection = QMetaObject::Connection();
m_waylandEnabledConnection = QMetaObject::Connection();
m_waylandStateCommittedConnection = QMetaObject::Connection();
}
}
);
......@@ -316,6 +325,7 @@ void VirtualKeyboard::adoptInputMethodContext()
inputContext->sendSurroundingText(QString::fromUtf8(ti->surroundingText()), ti->surroundingTextCursorPosition(), ti->surroundingTextSelectionAnchor());
inputContext->sendPreferredLanguage(QString::fromUtf8(ti->preferredLanguage()));
inputContext->sendContentType(ti->contentHints(), ti->contentPurpose());
connect(inputContext, &KWaylandServer::InputMethodContextV1Interface::keysym, waylandServer(), &keysymReceived);
connect(inputContext, &KWaylandServer::InputMethodContextV1Interface::commitString, waylandServer(), &commitString);
......
......@@ -56,6 +56,8 @@ private:
QMetaObject::Connection m_waylandSurroundingTextConnection;
QMetaObject::Connection m_waylandResetConnection;
QMetaObject::Connection m_waylandEnabledConnection;
QMetaObject::Connection m_waylandStateCommittedConnection;
KWIN_SINGLETON(VirtualKeyboard)
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment