diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2020-08-14 09:51:07 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2020-08-26 08:49:12 +0200 |
commit | f7885bb4eb2660ff4e287996061c9c1d987e5c60 (patch) | |
tree | 0474204dab9a896a3bb2f5ccae0bd62794c42739 /src/client/qwaylanddisplay.cpp | |
parent | 0a4ce63b6177538a9abed89daefc43cc47247fc1 (diff) | |
download | qtwayland-f7885bb4eb2660ff4e287996061c9c1d987e5c60.tar.gz |
New input method protocol for use with Qt clients
We introduce an alternative input-method protocol, which
is a one-to-one mapping to Qt's input method API. Input
methods such as the virtual keyboard's hunspell
integration is quite sensitive to the inner workings of
the input method handling, both in terms of when state
is updated and which updates are delivered when.
With a one-to-one mapping we are able to match these
expectations and keep a well-synchronized state.
Task-number: QTBUG-85135
Task-number: QTBUG-85134
Change-Id: Id69c22a7b0885ea59f39fdcc8d663749af56c7ce
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/client/qwaylanddisplay.cpp')
-rw-r--r-- | src/client/qwaylanddisplay.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 9e535935..e39f9128 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -61,6 +61,7 @@ #endif #include "qwaylandhardwareintegration_p.h" #include "qwaylandinputcontext_p.h" +#include "qwaylandinputmethodcontext_p.h" #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandshellintegration_p.h" @@ -74,6 +75,7 @@ #include <QtWaylandClient/private/qwayland-text-input-unstable-v2.h> #include <QtWaylandClient/private/qwayland-wp-primary-selection-unstable-v1.h> +#include <QtWaylandClient/private/qwayland-qt-text-input-method-unstable-v1.h> #include <QtCore/private/qcore_unix_p.h> @@ -339,6 +341,11 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin } else if (interface == QStringLiteral("zwp_primary_selection_device_manager_v1")) { mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); #endif + } else if (interface == QStringLiteral("qt_text_input_method_manager_v1") && !mClientSideInputContextRequested) { + mTextInputMethodManager.reset(new QtWayland::qt_text_input_method_manager_v1(registry, id, 1)); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInputMethod(new QWaylandTextInputMethod(this, mTextInputMethodManager->get_text_input_method(inputDevice->wl_seat()))); + mWaylandIntegration->reconfigureInputContext(); } else if (interface == QStringLiteral("zwp_text_input_manager_v2") && !mClientSideInputContextRequested) { mTextInputManager.reset(new QtWayland::zwp_text_input_manager_v2(registry, id, 1)); for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) @@ -396,6 +403,12 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } + if (global.interface == QStringLiteral("qt_text_input_method_manager_v1")) { + mTextInputMethodManager.reset(); + for (QWaylandInputDevice *inputDevice : qAsConst(mInputDevices)) + inputDevice->setTextInputMethod(nullptr); + mWaylandIntegration->reconfigureInputContext(); + } mGlobals.removeAt(i); break; } |