diff options
author | David Edmundson <davidedmundson@kde.org> | 2023-07-11 13:13:47 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2023-12-13 07:29:51 +0000 |
commit | 59ae054ded4d74db53281d8087576cd05b979cd9 (patch) | |
tree | b5ceca08b455770e7c359541fd7807fe2ae3838b /src/client/qwaylanddisplay.cpp | |
parent | 9c9f66a73dae53937af3f756fdbecc715fd3bbbb (diff) |
Support TextInput V3 over v4-wip
Support for v4-wip was not added into any desktop linux compositors, nor
was it ever enabled into the default Qt client builds for clients or
compositor.
TextInputV3 has become the most widely deployed. Whilst changes are
needed, they do not need to be breaking changes. A second iteration of
V3 can add the features we need. This is now in motion upstream.
For cases where QtWaylandCompositor is used, the custom Qt text input
method is preferred to work with the Qt virtual keyboard.
Pick-to: 6.7
Change-Id: I01e2686c67846804c0069f1495952b530547f91c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/client/qwaylanddisplay.cpp')
-rw-r--r-- | src/client/qwaylanddisplay.cpp | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index c9de99828..0c73fdc37 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -26,9 +26,7 @@ #include "qwaylandhardwareintegration_p.h" #include "qwaylandtextinputv1_p.h" #include "qwaylandtextinputv2_p.h" -#if QT_WAYLAND_TEXT_INPUT_V4_WIP -#include "qwaylandtextinputv4_p.h" -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP +#include "qwaylandtextinputv3_p.h" #include "qwaylandinputcontext_p.h" #include "qwaylandinputmethodcontext_p.h" @@ -47,7 +45,7 @@ #include <QtWaylandClient/private/qwayland-text-input-unstable-v1.h> #include <QtWaylandClient/private/qwayland-text-input-unstable-v2.h> -#include <QtWaylandClient/private/qwayland-text-input-unstable-v4-wip.h> +#include <QtWaylandClient/private/qwayland-text-input-unstable-v3.h> #include <QtWaylandClient/private/qwayland-wp-primary-selection-unstable-v1.h> #include <QtWaylandClient/private/qwayland-qt-text-input-method-unstable-v1.h> #include <QtWaylandClient/private/qwayland-fractional-scale-v1.h> @@ -556,15 +554,13 @@ void QWaylandDisplay::checkTextInputProtocol() { QStringList tips, timps; // for text input protocols and text input manager protocols tips << QLatin1String(QtWayland::qt_text_input_method_v1::interface()->name) + << QLatin1String(QtWayland::zwp_text_input_v3::interface()->name) << QLatin1String(QtWayland::zwp_text_input_v2::interface()->name) << QLatin1String(QtWayland::zwp_text_input_v1::interface()->name); timps << QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name) + << QLatin1String(QtWayland::zwp_text_input_manager_v3::interface()->name) << QLatin1String(QtWayland::zwp_text_input_manager_v2::interface()->name) << QLatin1String(QtWayland::zwp_text_input_manager_v1::interface()->name); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - tips << QLatin1String(QtWayland::zwp_text_input_v4::interface()->name); - timps << QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP QString tiProtocols = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_TEXT_INPUT_PROTOCOL")); qCDebug(lcQpaWayland) << "QT_WAYLAND_TEXT_INPUT_PROTOCOL=" << tiProtocols; @@ -656,9 +652,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (mTextInputManagerIndex < INT_MAX) { mGlobals.textInputManagerv1.reset(); mGlobals.textInputManagerv2.reset(); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - mGlobals.textInputManagerv4.reset(); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + mGlobals.textInputManagerv3.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); } @@ -678,9 +672,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (mTextInputManagerIndex < INT_MAX) { mGlobals.textInputMethodManager.reset(); mGlobals.textInputManagerv2.reset(); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - mGlobals.textInputManagerv4.reset(); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + mGlobals.textInputManagerv3.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } @@ -702,9 +694,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin if (mTextInputManagerIndex < INT_MAX) { mGlobals.textInputMethodManager.reset(); mGlobals.textInputManagerv1.reset(); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - mGlobals.textInputManagerv4.reset(); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + mGlobals.textInputManagerv3.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInputMethod(nullptr); } @@ -716,10 +706,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin this, mGlobals.textInputManagerv2->get_text_input(inputDevice->wl_seat()))); mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name) + } else if (interface == QLatin1String(QtWayland::zwp_text_input_manager_v3::interface()->name) && (mTextInputManagerList.contains(interface) && mTextInputManagerList.indexOf(interface) < mTextInputManagerIndex)) { - qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v4"; + qCDebug(lcQpaWayland) << "text input: register zwp_text_input_v3"; if (mTextInputManagerIndex < INT_MAX) { mGlobals.textInputMethodManager.reset(); mGlobals.textInputManagerv2.reset(); @@ -727,15 +716,15 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin inputDevice->setTextInputMethod(nullptr); } - mGlobals.textInputManagerv4.reset( - new QtWayland::zwp_text_input_manager_v4(registry, id, 1)); + mGlobals.textInputManagerv3.reset( + new QtWayland::zwp_text_input_manager_v3(registry, id, 1)); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) - inputDevice->setTextInput(new QWaylandTextInputv4( - this, mGlobals.textInputManagerv4->get_text_input(inputDevice->wl_seat()))); + inputDevice->setTextInput(new QWaylandTextInputv3( + this, mGlobals.textInputManagerv3->get_text_input(inputDevice->wl_seat()))); + mWaylandIntegration->reconfigureInputContext(); mTextInputManagerIndex = mTextInputManagerList.indexOf(interface); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP - } else if (interface == QLatin1String(QWaylandHardwareIntegration::interface()->name)) { + }else if (interface == QLatin1String(QWaylandHardwareIntegration::interface()->name)) { bool disableHardwareIntegration = qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_HW_INTEGRATION"); if (!disableHardwareIntegration) { mGlobals.hardwareIntegration.reset(new QWaylandHardwareIntegration(registry, id)); @@ -805,14 +794,12 @@ void QWaylandDisplay::registry_global_remove(uint32_t id) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v4::interface()->name)) { - mGlobals.textInputManagerv4.reset(); + if (global.interface == QLatin1String(QtWayland::zwp_text_input_manager_v3::interface()->name)) { + mGlobals.textInputManagerv3.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) inputDevice->setTextInput(nullptr); mWaylandIntegration->reconfigureInputContext(); } -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP if (global.interface == QLatin1String(QtWayland::qt_text_input_method_manager_v1::interface()->name)) { mGlobals.textInputMethodManager.reset(); for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) |