diff options
author | Liang Qi <liang.qi@qt.io> | 2021-09-08 15:45:50 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2021-10-07 12:13:01 +0200 |
commit | 99a6eb7b79471114705d7c68b0d5b388ea16ac03 (patch) | |
tree | 483af2a9ca42b298c7846081f9b94f0f854fa56f /src/compositor/extensions/qwaylandtextinputmanager.cpp | |
parent | a572df8ac61d6009a1863ac7216e6abdd24df3cd (diff) |
Support different text input protocols
from clients and one compositor at same time.
For compositor side, just need to have TextInputManager and
QtTextInputMethodManager together.
For client side, set QT_WAYLAND_TEXT_INPUT_PROTOCOL env to choose:
* If the env is unset(empty) or invalid, it will search
qt_text_input_method_v1 and zwp_text_input_v2 in order
* Set as "qt_text_input_method_v1" or "zwp_text_input_v2" if compositor
supports
* Set as "zwp_text_input_v2;qt_text_input_method_v1"
Change-Id: Ieec293ff412bf2d3e5ca9c69a951bfe1899cc808
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/compositor/extensions/qwaylandtextinputmanager.cpp')
-rw-r--r-- | src/compositor/extensions/qwaylandtextinputmanager.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compositor/extensions/qwaylandtextinputmanager.cpp b/src/compositor/extensions/qwaylandtextinputmanager.cpp index ae95b9659..15d68c977 100644 --- a/src/compositor/extensions/qwaylandtextinputmanager.cpp +++ b/src/compositor/extensions/qwaylandtextinputmanager.cpp @@ -47,10 +47,12 @@ void QWaylandTextInputManagerPrivate::zwp_text_input_manager_v2_get_text_input(R QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer()); QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource); QWaylandTextInput *textInput = QWaylandTextInput::findIn(seat); - if (!textInput) { + if (!textInput) textInput = new QWaylandTextInput(seat, compositor); - } textInput->add(resource->client(), id, wl_resource_get_version(resource->handle)); + QWaylandClient *client = QWaylandClient::fromWlClient(compositor, resource->client()); + QWaylandClient::TextInputProtocols p = client->textInputProtocols(); + client->setTextInputProtocols(p.setFlag(QWaylandClient::TextInputProtocol::TextInputV2)); if (!textInput->isInitialized()) textInput->initialize(); } |