diff options
27 files changed, 325 insertions, 425 deletions
diff --git a/src/3rdparty/protocol/qt_attribution.json b/src/3rdparty/protocol/qt_attribution.json index e30cb1b69..33a4f17c4 100644 --- a/src/3rdparty/protocol/qt_attribution.json +++ b/src/3rdparty/protocol/qt_attribution.json @@ -119,17 +119,18 @@ }, { - "Id": "wayland-text-input-unstable-v4-wip", + "Id": "wayland-text-input-unstable-v3", "Name": "Wayland Text Input Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": "text-input-unstable-v4-wip.xml", + "Files": "text-input-unstable-v3.xml", "Description": "Adds support for compositors to act as input methods and send text to applications.", "Homepage": "https://wayland.freedesktop.org", - "Version": "unstable v4, WIP", - "LicenseId": "HPND", - "License": "HPND License", - "LicenseFile": "HPND_LICENSE.txt", + "Version": "unstable v3", + "DownloadLocation": "https://cgit.freedesktop.org/wayland/wayland-protocols/plain/unstable/text-input/text-input-unstable-v3.xml", + "LicenseId": "MIT", + "License": "MIT License", + "LicenseFile": "MIT_LICENSE.txt", "Copyright": "Copyright © 2012, 2013 Intel Corporation\nCopyright © 2015, 2016 Jan Arne Petersen\nCopyright © 2017, 2018 Red Hat, Inc.\nCopyright © 2018 Purism SPC" }, diff --git a/src/3rdparty/protocol/text-input-unstable-v4-wip.xml b/src/3rdparty/protocol/text-input-unstable-v3.xml index 1041e6f74..1fae54d7b 100644 --- a/src/3rdparty/protocol/text-input-unstable-v4-wip.xml +++ b/src/3rdparty/protocol/text-input-unstable-v3.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<protocol name="text_input_unstable_v4_wip"> +<protocol name="text_input_unstable_v3"> <copyright> Copyright © 2012, 2013 Intel Corporation Copyright © 2015, 2016 Jan Arne Petersen @@ -47,9 +47,9 @@ interface version number is reset. </description> - <interface name="zwp_text_input_v4" version="1"> + <interface name="zwp_text_input_v3" version="1"> <description summary="text input"> - The zwp_text_input_v4 interface represents text input and input methods + The zwp_text_input_v3 interface represents text input and input methods associated with a seat. It provides enter/leave events to follow the text input focus for a seat. @@ -64,9 +64,9 @@ Lengths must be measured between two valid indices. Focus moving throughout surfaces will result in the emission of - zwp_text_input_v4.enter and zwp_text_input_v4.leave events. The focused - surface must commit zwp_text_input_v4.enable and - zwp_text_input_v4.disable requests as the keyboard focus moves across + zwp_text_input_v3.enter and zwp_text_input_v3.leave events. The focused + surface must commit zwp_text_input_v3.enable and + zwp_text_input_v3.disable requests as the keyboard focus moves across editable and non-editable elements of the UI. Those two requests are not expected to be paired with each other, the compositor must be able to handle consecutive series of the same request. @@ -91,9 +91,15 @@ This request must be issued every time the active text input changes to a new one, including within the current surface. Use - zwp_text_input_v4.disable when there is no longer any input focus on + zwp_text_input_v3.disable when there is no longer any input focus on the current surface. + Clients must not enable more than one text input on the single seat + and should disable the current text input before enabling the new one. + At most one instance of text input may be in enabled state per instance, + Requests to enable the another text input when some text input is active + must be ignored by compositor. + This request resets all state associated with previous enable, disable, set_surrounding_text, set_text_change_cause, set_content_type, and set_cursor_rectangle requests, as well as the state associated with @@ -104,11 +110,11 @@ functionality. State set with this request is double-buffered. It will get applied on - the next zwp_text_input_v4.commit request, and stay valid until the + the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The changes must be applied by the compositor after issuing a - zwp_text_input_v4.commit request. + zwp_text_input_v3.commit request. </description> </request> @@ -118,7 +124,7 @@ there is no focus on any text entry inside the surface). State set with this request is double-buffered. It will get applied on - the next zwp_text_input_v4.commit request. + the next zwp_text_input_v3.commit request. </description> </request> @@ -149,7 +155,7 @@ purpose of this event. Values set with this request are double-buffered. They will get applied - on the next zwp_text_input_v4.commit request, and stay valid until the + on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial state for affected fields is empty, meaning that the text @@ -182,7 +188,7 @@ cause describes the source of the change. The value set with this request is double-buffered. It must be applied - and reset to initial at the next zwp_text_input_v4.commit request. + and reset to initial at the next zwp_text_input_v3.commit request. The initial value of cause is input_method. </description> @@ -238,7 +244,7 @@ the behavior. Values set with this request are double-buffered. They will get applied - on the next zwp_text_input_v4.commit request. + on the next zwp_text_input_v3.commit request. Subsequent attempts to update them may have no effect. The values remain valid until the next committed enable or disable request. @@ -261,7 +267,7 @@ issue this request, to signify lack of support to the compositor. Values set with this request are double-buffered. They will get applied - on the next zwp_text_input_v4.commit request, and stay valid until the + on the next zwp_text_input_v3.commit request, and stay valid until the next committed enable or disable request. The initial values describing a cursor rectangle are empty. That means @@ -298,7 +304,7 @@ Neither current nor pending state are modified unless noted otherwise. The compositor must count the number of commit requests coming from - each zwp_text_input_v4 object and use the count as the serial in done + each zwp_text_input_v3 object and use the count as the serial in done events. </description> </request> @@ -307,6 +313,9 @@ <description summary="enter event"> Notification that this seat's text-input focus is on a certain surface. + If client has created multiple text input objects, compositor must send + this event to all of them. + When the seat has the keyboard capability the text-input focus follows the keyboard focus. This event sets the current surface for the text-input object. @@ -321,7 +330,9 @@ set. The leave notification clears the current surface. It is sent before - the enter notification for the new focus. + the enter notification for the new focus. After leave event, compositor + must ignore requests from any text input instances until next enter + event. When the seat has the keyboard capability the text-input focus follows the keyboard focus. @@ -345,7 +356,7 @@ the same, or as a text highlight otherwise. Values set with this event are double-buffered. They must be applied - and reset to initial on the next zwp_text_input_v4.done event. + and reset to initial on the next zwp_text_input_v3.done event. The initial value of text is an empty string, and cursor_begin, cursor_end and cursor_hidden are all 0. @@ -362,7 +373,7 @@ result of some composing (pre-edit). Values set with this event are double-buffered. They must be applied - and reset to initial on the next zwp_text_input_v4.done event. + and reset to initial on the next zwp_text_input_v3.done event. The initial value of text is an empty string. </description> @@ -382,7 +393,7 @@ sequence). Values set with this event are double-buffered. They must be applied - and reset to initial on the next zwp_text_input_v4.done event. + and reset to initial on the next zwp_text_input_v3.done event. The initial values of both before_length and after_length are 0. </description> @@ -408,44 +419,23 @@ 5. Insert new preedit text in cursor position. 6. Place cursor inside preedit text. - The serial number reflects the last state of the zwp_text_input_v4 + The serial number reflects the last state of the zwp_text_input_v3 object known to the compositor. The value of the serial argument must be equal to the number of commit requests already issued on that object. + When the client receives a done event with a serial different than the - number of past commit requests, it must proceed as normal, except it - should not change the current state of the zwp_text_input_v4 object. + number of past commit requests, it must proceed with evaluating and + applying the changes as normal, except it should not change the current + state of the zwp_text_input_v3 object. All pending state requests + (set_surrounding_text, set_content_type and set_cursor_rectangle) on + the zwp_text_input_v3 object should be sent and committed after + receiving a zwp_text_input_v3.done event with a matching serial. </description> <arg name="serial" type="uint"/> </event> - - <enum name="commit_mode"> - <description summary="focus commit mode"> - Pre-edit commit mode when the focus widget or the cursor position - is changed. - </description> - <entry name="clear" value="0" summary="pre-edit text is cleared"/> - <entry name="commit" value="1" summary="pre-edit text is committed"/> - </enum> - - <event name="preedit_commit_mode"> - <description summary="pre-edit commit mode"> - Specify how the visible preedit should be handled - when switching the focus widget or changing the cursor position, - whether to commit the preedit text or clear the preedit text. - - This is usually used together with the preedit_string event. - - The commit behavior is the same for focus switch and - cursor position change. - - The parameter mode selects the desired behavior and - its value is one from the commit mode enum. - </description> - <arg name="mode" type="uint" enum="commit_mode"/> - </event> </interface> - <interface name="zwp_text_input_manager_v4" version="1"> + <interface name="zwp_text_input_manager_v3" version="1"> <description summary="text input manager"> A factory for text-input objects. This object is a global singleton. </description> @@ -460,7 +450,7 @@ <description summary="create a new text input object"> Creates a new text-input object for a given seat. </description> - <arg name="id" type="new_id" interface="zwp_text_input_v4"/> + <arg name="id" type="new_id" interface="zwp_text_input_v3"/> <arg name="seat" type="object" interface="wl_seat"/> </request> </interface> diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index 4fab5b319..67ee5c865 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -36,6 +36,7 @@ qt_internal_add_module(WaylandClient qwaylandinputcontext.cpp qwaylandinputcontext_p.h qwaylandtextinputv1.cpp qwaylandtextinputv1_p.h qwaylandtextinputv2.cpp qwaylandtextinputv2_p.h + qwaylandtextinputv3.cpp qwaylandtextinputv3_p.h qwaylandtextinputinterface.cpp qwaylandtextinputinterface_p.h qwaylandinputdevice.cpp qwaylandinputdevice_p.h qwaylandinputmethodcontext.cpp qwaylandinputmethodcontext_p.h @@ -87,7 +88,7 @@ qt6_generate_wayland_protocol_client_sources(WaylandClient ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/tablet-unstable-v2.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v4-wip.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v3.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wp-primary-selection-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml @@ -126,13 +127,6 @@ qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_tabletevent qwaylandtabletv2.cpp qwaylandtabletv2_p.h ) -qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_wayland_text_input_v4_wip - SOURCES - qwaylandtextinputv4.cpp qwaylandtextinputv4_p.h - DEFINES - QT_WAYLAND_TEXT_INPUT_V4_WIP=1 -) - qt_internal_extend_target(WaylandClient CONDITION QT_FEATURE_clipboard SOURCES qwaylandclipboard.cpp qwaylandclipboard_p.h 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)) diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 62ef71bd0..74c9aede4 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -49,7 +49,7 @@ namespace QtWayland { class qt_surface_extension; class zwp_text_input_manager_v1; class zwp_text_input_manager_v2; - class zwp_text_input_manager_v4; + class zwp_text_input_manager_v3; class qt_text_input_method_manager_v1; class wp_cursor_shape_manager_v1; class wp_fractional_scale_manager_v1; @@ -176,9 +176,9 @@ public: { return mGlobals.textInputManagerv2.get(); } - QtWayland::zwp_text_input_manager_v4 *textInputManagerv4() const + QtWayland::zwp_text_input_manager_v3 *textInputManagerv3() const { - return mGlobals.textInputManagerv4.get(); + return mGlobals.textInputManagerv3.get(); } QWaylandHardwareIntegration *hardwareIntegration() const { @@ -205,6 +205,7 @@ public: return mGlobals.xdgToplevelDragManager.get(); } + struct RegistryGlobal { uint32_t id; QString interface; @@ -329,7 +330,7 @@ private: std::unique_ptr<QtWayland::qt_text_input_method_manager_v1> textInputMethodManager; std::unique_ptr<QtWayland::zwp_text_input_manager_v1> textInputManagerv1; std::unique_ptr<QtWayland::zwp_text_input_manager_v2> textInputManagerv2; - std::unique_ptr<QtWayland::zwp_text_input_manager_v4> textInputManagerv4; + std::unique_ptr<QtWayland::zwp_text_input_manager_v3> textInputManagerv3; std::unique_ptr<QWaylandHardwareIntegration> hardwareIntegration; std::unique_ptr<QWaylandXdgOutputManagerV1> xdgOutputManager; std::unique_ptr<QtWayland::wp_viewporter> viewporter; @@ -337,7 +338,6 @@ private: std::unique_ptr<QtWayland::wp_cursor_shape_manager_v1> cursorShapeManager; std::unique_ptr<QtWayland::qt_toplevel_drag_manager_v1> xdgToplevelDragManager; } mGlobals; - int mFd = -1; int mWritableNotificationFd = -1; QList<RegistryGlobal> mRegistryGlobals; diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp index 369a4e5c2..4b6a34c6b 100644 --- a/src/client/qwaylandinputcontext.cpp +++ b/src/client/qwaylandinputcontext.cpp @@ -35,11 +35,7 @@ QWaylandInputContext::~QWaylandInputContext() bool QWaylandInputContext::isValid() const { -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - return mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv4() != nullptr; -#else // QT_WAYLAND_TEXT_INPUT_V4_WIP - return mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv1() != nullptr; -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + return mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv3() != nullptr; } void QWaylandInputContext::reset() diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 0446dff49..f52789fdc 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -4,6 +4,7 @@ #include "qwaylandinputdevice_p.h" #include "qwaylandintegration_p.h" +#include "qwaylandtextinputv3_p.h" #include "qwaylandwindow_p.h" #include "qwaylandsurface_p.h" #include "qwaylandbuffer_p.h" @@ -25,9 +26,6 @@ #include "qwaylandshmbackingstore_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 "qwaylandtextinputinterface_p.h" #include "qwaylandinputcontext_p.h" #include "qwaylandinputmethodcontext_p.h" @@ -408,10 +406,8 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, if (mQDisplay->textInputManagerv2()) mTextInput.reset(new QWaylandTextInputv2(mQDisplay, mQDisplay->textInputManagerv2()->get_text_input(wl_seat()))); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - if (mQDisplay->textInputManagerv4()) - mTextInput.reset(new QWaylandTextInputv4(mQDisplay, mQDisplay->textInputManagerv4()->get_text_input(wl_seat()))); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + if (mQDisplay->textInputManagerv3()) + mTextInput.reset(new QWaylandTextInputv3(mQDisplay, mQDisplay->textInputManagerv3()->get_text_input(wl_seat()))); if (mQDisplay->textInputMethodManager()) mTextInputMethod.reset(new QWaylandTextInputMethod(mQDisplay, mQDisplay->textInputMethodManager()->get_text_input_method(wl_seat()))); diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 88a2fa7e1..846556d4e 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -470,11 +470,7 @@ void QWaylandIntegration::reconfigureInputContext() if (!mDisplay->isClientSideInputContextRequested()) { if (mDisplay->textInputMethodManager() != nullptr) mInputContext.reset(new QWaylandInputMethodContext(mDisplay.data())); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - else if (mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv4() != nullptr) -#else // QT_WAYLAND_TEXT_INPUT_V4_WIP - else if (mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv2() != nullptr) -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + else if (mDisplay->textInputManagerv1() != nullptr || mDisplay->textInputManagerv2() != nullptr || mDisplay->textInputManagerv3() != nullptr) mInputContext.reset(new QWaylandInputContext(mDisplay.data())); } else { mInputContext.reset(QPlatformInputContextFactory::create(requested)); diff --git a/src/client/qwaylandtextinputv4.cpp b/src/client/qwaylandtextinputv3.cpp index 6cf01613f..a369cac67 100644 --- a/src/client/qwaylandtextinputv4.cpp +++ b/src/client/qwaylandtextinputv3.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#include "qwaylandtextinputv4_p.h" +#include "qwaylandtextinputv3_p.h" #include "qwaylandwindow_p.h" #include "qwaylandinputmethodeventbuilder_p.h" @@ -18,20 +18,20 @@ Q_LOGGING_CATEGORY(qLcQpaWaylandTextInput, "qt.qpa.wayland.textinput") namespace QtWaylandClient { -QWaylandTextInputv4::QWaylandTextInputv4(QWaylandDisplay *display, - struct ::zwp_text_input_v4 *text_input) - : QtWayland::zwp_text_input_v4(text_input) +QWaylandTextInputv3::QWaylandTextInputv3(QWaylandDisplay *display, + struct ::zwp_text_input_v3 *text_input) + : QtWayland::zwp_text_input_v3(text_input) , m_display(display) { } -QWaylandTextInputv4::~QWaylandTextInputv4() +QWaylandTextInputv3::~QWaylandTextInputv3() { } namespace { -const Qt::InputMethodQueries supportedQueries4 = Qt::ImEnabled | +const Qt::InputMethodQueries supportedQueries3 = Qt::ImEnabled | Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition | @@ -39,7 +39,7 @@ const Qt::InputMethodQueries supportedQueries4 = Qt::ImEnabled | Qt::ImCursorRectangle; } -void QWaylandTextInputv4::zwp_text_input_v4_enter(struct ::wl_surface *surface) +void QWaylandTextInputv3::zwp_text_input_v3_enter(struct ::wl_surface *surface) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; @@ -51,10 +51,10 @@ void QWaylandTextInputv4::zwp_text_input_v4_enter(struct ::wl_surface *surface) m_pendingDeleteAfterText = 0; enable(); - updateState(supportedQueries4, update_state_enter); + updateState(supportedQueries3, update_state_enter); } -void QWaylandTextInputv4::zwp_text_input_v4_leave(struct ::wl_surface *surface) +void QWaylandTextInputv3::zwp_text_input_v3_leave(struct ::wl_surface *surface) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; @@ -63,10 +63,6 @@ void QWaylandTextInputv4::zwp_text_input_v4_leave(struct ::wl_surface *surface) return; } - // QTBUG-97248: check commit_mode - // Currently text-input-unstable-v4-wip is implemented with preedit_commit_mode - // 'commit' - m_currentPreeditString.clear(); m_surface = nullptr; @@ -76,7 +72,7 @@ void QWaylandTextInputv4::zwp_text_input_v4_leave(struct ::wl_surface *surface) qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Done"; } -void QWaylandTextInputv4::zwp_text_input_v4_preedit_string(const QString &text, int32_t cursorBegin, int32_t cursorEnd) +void QWaylandTextInputv3::zwp_text_input_v3_preedit_string(const QString &text, int32_t cursorBegin, int32_t cursorEnd) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << text << cursorBegin << cursorEnd; @@ -88,7 +84,7 @@ void QWaylandTextInputv4::zwp_text_input_v4_preedit_string(const QString &text, m_pendingPreeditString.cursorEnd = cursorEnd; } -void QWaylandTextInputv4::zwp_text_input_v4_commit_string(const QString &text) +void QWaylandTextInputv3::zwp_text_input_v3_commit_string(const QString &text) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << text; @@ -98,7 +94,7 @@ void QWaylandTextInputv4::zwp_text_input_v4_commit_string(const QString &text) m_pendingCommitString = text; } -void QWaylandTextInputv4::zwp_text_input_v4_delete_surrounding_text(uint32_t beforeText, uint32_t afterText) +void QWaylandTextInputv3::zwp_text_input_v3_delete_surrounding_text(uint32_t beforeText, uint32_t afterText) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << beforeText << afterText; @@ -109,12 +105,12 @@ void QWaylandTextInputv4::zwp_text_input_v4_delete_surrounding_text(uint32_t bef m_pendingDeleteAfterText = QWaylandInputMethodEventBuilder::indexFromWayland(m_surroundingText, afterText); } -void QWaylandTextInputv4::zwp_text_input_v4_done(uint32_t serial) +void QWaylandTextInputv3::zwp_text_input_v3_done(uint32_t serial) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "with serial" << serial << m_currentSerial; // This is a case of double click. - // text_input_v4 will ignore this done signal and just keep the selection of the clicked word. + // text_input_v3 will ignore this done signal and just keep the selection of the clicked word. if (m_cursorPos != m_anchorPos && (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0)) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "Ignore done"; m_pendingDeleteBeforeText = 0; @@ -177,22 +173,22 @@ void QWaylandTextInputv4::zwp_text_input_v4_done(uint32_t serial) QCoreApplication::sendEvent(focusObject, &event); if (serial == m_currentSerial) - updateState(supportedQueries4, update_state_full); + updateState(supportedQueries3, update_state_full); } -void QWaylandTextInputv4::reset() +void QWaylandTextInputv3::reset() { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; m_pendingPreeditString.clear(); } -void QWaylandTextInputv4::enableSurface(::wl_surface *) +void QWaylandTextInputv3::enableSurface(::wl_surface *) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; } -void QWaylandTextInputv4::disableSurface(::wl_surface *surface) +void QWaylandTextInputv3::disableSurface(::wl_surface *surface) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; @@ -202,15 +198,15 @@ void QWaylandTextInputv4::disableSurface(::wl_surface *surface) } } -void QWaylandTextInputv4::commit() +void QWaylandTextInputv3::commit() { m_currentSerial = (m_currentSerial < UINT_MAX) ? m_currentSerial + 1U: 0U; qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "with serial" << m_currentSerial; - QtWayland::zwp_text_input_v4::commit(); + QtWayland::zwp_text_input_v3::commit(); } -void QWaylandTextInputv4::updateState(Qt::InputMethodQueries queries, uint32_t flags) +void QWaylandTextInputv3::updateState(Qt::InputMethodQueries queries, uint32_t flags) { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << queries << flags; @@ -225,7 +221,7 @@ void QWaylandTextInputv4::updateState(Qt::InputMethodQueries queries, uint32_t f if (!surface || (surface != m_surface)) return; - queries &= supportedQueries4; + queries &= supportedQueries3; bool needsCommit = false; QInputMethodQueryEvent event(queries); @@ -319,7 +315,7 @@ void QWaylandTextInputv4::updateState(Qt::InputMethodQueries queries, uint32_t f } if (queries & Qt::ImHints) { - QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convertV4(static_cast<Qt::InputMethodHints>(event.value(Qt::ImHints).toInt())); + QWaylandInputMethodContentType contentType = QWaylandInputMethodContentType::convertV3(static_cast<Qt::InputMethodHints>(event.value(Qt::ImHints).toInt())); qCDebug(qLcQpaWaylandTextInput) << m_contentHint << contentType.hint; qCDebug(qLcQpaWaylandTextInput) << m_contentPurpose << contentType.purpose; @@ -338,33 +334,33 @@ void QWaylandTextInputv4::updateState(Qt::InputMethodQueries queries, uint32_t f commit(); } -void QWaylandTextInputv4::setCursorInsidePreedit(int cursor) +void QWaylandTextInputv3::setCursorInsidePreedit(int cursor) { Q_UNUSED(cursor); - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support setting cursor inside preedit. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support setting cursor inside preedit. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; } -bool QWaylandTextInputv4::isInputPanelVisible() const +bool QWaylandTextInputv3::isInputPanelVisible() const { - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support querying input method visibility. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support querying input method visibility. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; return false; } -QRectF QWaylandTextInputv4::keyboardRect() const +QRectF QWaylandTextInputv3::keyboardRect() const { qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO; return m_cursorRect; } -QLocale QWaylandTextInputv4::locale() const +QLocale QWaylandTextInputv3::locale() const { - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support querying input language. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support querying input language. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; return QLocale(); } -Qt::LayoutDirection QWaylandTextInputv4::inputDirection() const +Qt::LayoutDirection QWaylandTextInputv3::inputDirection() const { - qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV4: Input protocol \"text-input-unstable-v4-wip\" does not support querying input direction. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; + qCWarning(qLcQpaWaylandTextInput) << "QWaylandTextInputV3: Input protocol \"text-input-unstable-v3\" does not support querying input direction. Use qt-text-input-method-unstable-v1 instead for full support of Qt input method events."; return Qt::LeftToRight; } diff --git a/src/client/qwaylandtextinputv4_p.h b/src/client/qwaylandtextinputv3_p.h index 2f4263eba..8c5b93b9b 100644 --- a/src/client/qwaylandtextinputv4_p.h +++ b/src/client/qwaylandtextinputv3_p.h @@ -1,8 +1,8 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef QWAYLANDTEXTINPUTV4_P_H -#define QWAYLANDTEXTINPUTV4_P_H +#ifndef QWAYLANDTEXTINPUTV3_P_H +#define QWAYLANDTEXTINPUTV3_P_H // // W A R N I N G @@ -16,7 +16,7 @@ // #include "qwaylandtextinputinterface_p.h" -#include <QtWaylandClient/private/qwayland-text-input-unstable-v4-wip.h> +#include <QtWaylandClient/private/qwayland-text-input-unstable-v3.h> #include <qwaylandinputmethodeventbuilder_p.h> #include <QLoggingCategory> @@ -31,11 +31,11 @@ namespace QtWaylandClient { class QWaylandDisplay; -class QWaylandTextInputv4 : public QtWayland::zwp_text_input_v4, public QWaylandTextInputInterface +class QWaylandTextInputv3 : public QtWayland::zwp_text_input_v3, public QWaylandTextInputInterface { public: - QWaylandTextInputv4(QWaylandDisplay *display, struct ::zwp_text_input_v4 *text_input); - ~QWaylandTextInputv4() override; + QWaylandTextInputv3(QWaylandDisplay *display, struct ::zwp_text_input_v3 *text_input); + ~QWaylandTextInputv3() override; void reset() override; void commit() override; @@ -53,12 +53,12 @@ public: void disableSurface(::wl_surface *surface) override; protected: - void zwp_text_input_v4_enter(struct ::wl_surface *surface) override; - void zwp_text_input_v4_leave(struct ::wl_surface *surface) override; - void zwp_text_input_v4_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override; - void zwp_text_input_v4_commit_string(const QString &text) override; - void zwp_text_input_v4_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override; - void zwp_text_input_v4_done(uint32_t serial) override; + void zwp_text_input_v3_enter(struct ::wl_surface *surface) override; + void zwp_text_input_v3_leave(struct ::wl_surface *surface) override; + void zwp_text_input_v3_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override; + void zwp_text_input_v3_commit_string(const QString &text) override; + void zwp_text_input_v3_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override; + void zwp_text_input_v3_done(uint32_t serial) override; private: QWaylandDisplay *m_display; @@ -101,4 +101,4 @@ private: QT_END_NAMESPACE -#endif // QWAYLANDTEXTINPUTV4_P_H +#endif // QWAYLANDTEXTINPUTV3_P_H diff --git a/src/compositor/CMakeLists.txt b/src/compositor/CMakeLists.txt index 434411d0e..525644381 100644 --- a/src/compositor/CMakeLists.txt +++ b/src/compositor/CMakeLists.txt @@ -39,6 +39,8 @@ qt_internal_add_module(WaylandCompositor extensions/qwaylandshellsurface.cpp extensions/qwaylandshellsurface.h extensions/qwaylandtextinput.cpp extensions/qwaylandtextinput.h extensions/qwaylandtextinput_p.h extensions/qwaylandtextinputmanager.cpp extensions/qwaylandtextinputmanager.h extensions/qwaylandtextinputmanager_p.h + extensions/qwaylandtextinputv3.cpp extensions/qwaylandtextinputv3.h extensions/qwaylandtextinputv3_p.h + extensions/qwaylandtextinputmanagerv3.cpp extensions/qwaylandtextinputmanagerv3.h extensions/qwaylandtextinputmanagerv3_p.h extensions/qwaylandviewporter.cpp extensions/qwaylandviewporter.h extensions/qwaylandviewporter_p.h extensions/qwaylandwlshell.cpp extensions/qwaylandwlshell.h extensions/qwaylandwlshell_p.h extensions/qwaylandxdgdecorationv1.cpp extensions/qwaylandxdgdecorationv1.h extensions/qwaylandxdgdecorationv1_p.h @@ -110,7 +112,7 @@ qt6_generate_wayland_protocol_server_sources(WaylandCompositor ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/presentation-time.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/scaler.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v4-wip.xml + ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/text-input-unstable-v3.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/viewporter.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-decoration-unstable-v1.xml @@ -131,14 +133,6 @@ qt6_generate_wayland_protocol_server_sources(WaylandCompositor ## Scopes: ##################################################################### -qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_wayland_text_input_v4_wip - SOURCES - extensions/qwaylandtextinputv4.cpp extensions/qwaylandtextinputv4.h extensions/qwaylandtextinputv4_p.h - extensions/qwaylandtextinputmanagerv4.cpp extensions/qwaylandtextinputmanagerv4.h extensions/qwaylandtextinputmanagerv4_p.h - DEFINES - QT_WAYLAND_TEXT_INPUT_V4_WIP=1 -) - qt_internal_extend_target(WaylandCompositor CONDITION QT_FEATURE_opengl SOURCES hardware_integration/qwlclientbufferintegrationfactory.cpp hardware_integration/qwlclientbufferintegrationfactory_p.h diff --git a/src/compositor/compositor_api/qwaylandclient.h b/src/compositor/compositor_api/qwaylandclient.h index 3dae70693..22898eb3d 100644 --- a/src/compositor/compositor_api/qwaylandclient.h +++ b/src/compositor/compositor_api/qwaylandclient.h @@ -39,7 +39,7 @@ public: NoProtocol = 0, QtTextInputMethodV1 = 1, TextInputV2 = 2, - TextInputV4 = 4, + TextInputV3 = 4, QtTextInputMethod = QtTextInputMethodV1, TextInput = TextInputV2 diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index c8d4d80eb..28809f1c2 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -62,9 +62,7 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(qLcWaylandCompositor, "qt.waylandcompositor") Q_LOGGING_CATEGORY(qLcWaylandCompositorHardwareIntegration, "qt.waylandcompositor.hardwareintegration") Q_LOGGING_CATEGORY(qLcWaylandCompositorInputMethods, "qt.waylandcompositor.inputmethods") -#if QT_WAYLAND_TEXT_INPUT_V4_WIP Q_LOGGING_CATEGORY(qLcWaylandCompositorTextInput, "qt.waylandcompositor.textinput") -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP namespace QtWayland { diff --git a/src/compositor/compositor_api/qwaylandcompositorquickextensions_p.h b/src/compositor/compositor_api/qwaylandcompositorquickextensions_p.h index fe400d3f9..3150f90ae 100644 --- a/src/compositor/compositor_api/qwaylandcompositorquickextensions_p.h +++ b/src/compositor/compositor_api/qwaylandcompositorquickextensions_p.h @@ -24,9 +24,7 @@ #include <QtWaylandCompositor/qwaylandqtwindowmanager.h> #include <QtWaylandCompositor/qwaylandtextinputmanager.h> #include <QtCore/private/qglobal_p.h> -#if QT_WAYLAND_TEXT_INPUT_V4_WIP -#include <QtWaylandCompositor/qwaylandtextinputmanagerv4.h> -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP +#include <QtWaylandCompositor/qwaylandtextinputmanagerv3.h> #include <QtWaylandCompositor/qwaylandqttextinputmethodmanager.h> #include <QtWaylandCompositor/qwaylandidleinhibitv1.h> @@ -85,9 +83,7 @@ private: Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(QWaylandQtWindowManager, QtWindowManager) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(QWaylandIdleInhibitManagerV1, IdleInhibitManagerV1) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(QWaylandTextInputManager, TextInputManager) -#if QT_WAYLAND_TEXT_INPUT_V4_WIP -Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(QWaylandTextInputManagerV4, TextInputManagerV4) -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP +Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(QWaylandTextInputManagerV3, TextInputManagerV3) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_CLASS(QWaylandQtTextInputMethodManager, QtTextInputMethodManager) QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp index 1070faa2f..e9a962d28 100644 --- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp +++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp @@ -9,9 +9,7 @@ #include "qwaylandsurface.h" #include "qwaylandview.h" #include "qwaylandtextinput.h" -#if QT_WAYLAND_TEXT_INPUT_V4_WIP -#include "qwaylandtextinputv4.h" -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP +#include "qwaylandtextinputv3.h" #include "qwaylandqttextinputmethod.h" #include <QtGui/QInputMethodEvent> @@ -24,14 +22,12 @@ QWaylandInputMethodControl::QWaylandInputMethodControl(QWaylandSurface *surface) updateTextInput(); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - QWaylandTextInputV4 *textInputV4 = d_func()->textInputV4(); - if (textInputV4) { - connect(textInputV4, &QWaylandTextInputV4::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled); - connect(textInputV4, &QWaylandTextInputV4::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled); - connect(textInputV4, &QWaylandTextInputV4::updateInputMethod, this, &QWaylandInputMethodControl::updateInputMethod); + QWaylandTextInputV3 *textInputV3 = d_func()->textInputV3(); + if (textInputV3) { + connect(textInputV3, &QWaylandTextInputV3::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled); + connect(textInputV3, &QWaylandTextInputV3::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled); + connect(textInputV3, &QWaylandTextInputV3::updateInputMethod, this, &QWaylandInputMethodControl::updateInputMethod); } -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP QWaylandQtTextInputMethod *textInputMethod = d_func()->textInputMethod(); if (textInputMethod) { @@ -49,11 +45,9 @@ QVariant QWaylandInputMethodControl::inputMethodQuery(Qt::InputMethodQuery query if (textInput != nullptr && textInput->focus() == d->surface) return textInput->inputMethodQuery(query, argument); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - QWaylandTextInputV4 *textInputV4 = d->textInputV4(); - if (textInputV4 != nullptr && textInputV4->focus() == d->surface) - return textInputV4->inputMethodQuery(query, argument); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + QWaylandTextInputV3 *textInputV3 = d->textInputV3(); + if (textInputV3 != nullptr && textInputV3->focus() == d->surface) + return textInputV3->inputMethodQuery(query, argument); QWaylandQtTextInputMethod *textInputMethod = d_func()->textInputMethod(); if (textInputMethod && textInputMethod->focusedSurface() == d->surface) @@ -68,10 +62,8 @@ void QWaylandInputMethodControl::inputMethodEvent(QInputMethodEvent *event) if (QWaylandTextInput *textInput = d->textInput()) { textInput->sendInputMethodEvent(event); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - } else if (QWaylandTextInputV4 *textInputV4 = d->textInputV4()) { - textInputV4->sendInputMethodEvent(event); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + } else if (QWaylandTextInputV3 *textInputV3 = d->textInputV3()) { + textInputV3->sendInputMethodEvent(event); } else if (QWaylandQtTextInputMethod *textInputMethod = d->textInputMethod()) { textInputMethod->sendInputMethodEvent(event); } else { @@ -124,14 +116,10 @@ void QWaylandInputMethodControl::setSurface(QWaylandSurface *surface) d->surface = surface; QWaylandTextInput *textInput = d->textInput(); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - QWaylandTextInputV4 *textInputV4 = d->textInputV4(); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + QWaylandTextInputV3 *textInputV3 = d->textInputV3(); QWaylandQtTextInputMethod *textInputMethod = d->textInputMethod(); setEnabled((textInput && textInput->isSurfaceEnabled(d->surface)) -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - || (textInputV4 && textInputV4->isSurfaceEnabled(d->surface)) -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + || (textInputV3 && textInputV3->isSurfaceEnabled(d->surface)) || (textInputMethod && textInputMethod->isSurfaceEnabled(d->surface))); } @@ -151,16 +139,12 @@ void QWaylandInputMethodControl::defaultSeatChanged() Q_D(QWaylandInputMethodControl); disconnect(d->textInput(), nullptr, this, nullptr); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - disconnect(d->textInputV4(), nullptr, this, nullptr); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + disconnect(d->textInputV3(), nullptr, this, nullptr); disconnect(d->textInputMethod(), nullptr, this, nullptr); d->seat = d->compositor->defaultSeat(); QWaylandTextInput *textInput = d->textInput(); -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - QWaylandTextInputV4 *textInputV4 = d->textInputV4(); -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + QWaylandTextInputV3 *textInputV3 = d->textInputV3(); QWaylandQtTextInputMethod *textInputMethod = d->textInputMethod(); if (textInput) { @@ -168,12 +152,10 @@ void QWaylandInputMethodControl::defaultSeatChanged() connect(textInput, &QWaylandTextInput::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled); } -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - if (textInputV4) { - connect(textInputV4, &QWaylandTextInputV4::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled); - connect(textInputV4, &QWaylandTextInputV4::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled); + if (textInputV3) { + connect(textInputV3, &QWaylandTextInputV3::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled); + connect(textInputV3, &QWaylandTextInputV3::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled); } -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP if (textInputMethod) { connect(textInputMethod, &QWaylandQtTextInputMethod::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled); @@ -181,9 +163,7 @@ void QWaylandInputMethodControl::defaultSeatChanged() } setEnabled((textInput && textInput->isSurfaceEnabled(d->surface)) -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - || (textInputV4 && textInputV4->isSurfaceEnabled(d->surface)) -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + || (textInputV3 && textInputV3->isSurfaceEnabled(d->surface)) || (textInputMethod && textInputMethod->isSurfaceEnabled(d->surface))); } @@ -208,11 +188,9 @@ QWaylandTextInput *QWaylandInputMethodControlPrivate::textInput() const return QWaylandTextInput::findIn(seat); } -#if QT_WAYLAND_TEXT_INPUT_V4_WIP -QWaylandTextInputV4 *QWaylandInputMethodControlPrivate::textInputV4() const +QWaylandTextInputV3 *QWaylandInputMethodControlPrivate::textInputV3() const { - return QWaylandTextInputV4::findIn(seat); + return QWaylandTextInputV3::findIn(seat); } -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP #include "moc_qwaylandinputmethodcontrol.cpp" diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h b/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h index 9f9fc3949..36a0db0c4 100644 --- a/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h +++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h @@ -26,9 +26,7 @@ class QWaylandCompositor; class QWaylandSeat; class QWaylandSurface; class QWaylandTextInput; -#if QT_WAYLAND_TEXT_INPUT_V4_WIP -class QWaylandTextInputV4; -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP +class QWaylandTextInputV3; class QWaylandQtTextInputMethod; class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandInputMethodControlPrivate : public QObjectPrivate @@ -39,9 +37,7 @@ public: explicit QWaylandInputMethodControlPrivate(QWaylandSurface *surface); QWaylandTextInput *textInput() const; -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - QWaylandTextInputV4 *textInputV4() const; -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP + QWaylandTextInputV3 *textInputV3() const; QWaylandQtTextInputMethod *textInputMethod() const; QWaylandCompositor *compositor = nullptr; diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 58db89139..348260fed 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -6,9 +6,7 @@ #include "qwaylandquicksurface.h" #include "qwaylandinputmethodcontrol.h" #include "qwaylandtextinput.h" -#if QT_WAYLAND_TEXT_INPUT_V4_WIP -#include "qwaylandtextinputv4.h" -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP +#include "qwaylandtextinputv3.h" #include "qwaylandqttextinputmethod.h" #include "qwaylandquickoutput.h" #include <QtWaylandCompositor/qwaylandcompositor.h> @@ -1119,13 +1117,11 @@ void QWaylandQuickItem::takeFocus(QWaylandSeat *device) textInput->setFocus(surface()); } -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - if (surface()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV4)) { - QWaylandTextInputV4 *textInputV4 = QWaylandTextInputV4::findIn(target); - if (textInputV4) - textInputV4->setFocus(surface()); + if (surface()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV3)) { + QWaylandTextInputV3 *textInputV3 = QWaylandTextInputV3::findIn(target); + if (textInputV3) + textInputV3->setFocus(surface()); } -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP if (surface()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::QtTextInputMethodV1)) { QWaylandQtTextInputMethod *textInputMethod = QWaylandQtTextInputMethod::findIn(target); diff --git a/src/compositor/compositor_api/qwaylandseat.cpp b/src/compositor/compositor_api/qwaylandseat.cpp index b366a12c2..6468a2b1f 100644 --- a/src/compositor/compositor_api/qwaylandseat.cpp +++ b/src/compositor/compositor_api/qwaylandseat.cpp @@ -23,9 +23,7 @@ #include "extensions/qwlqtkey_p.h" #include "extensions/qwaylandtextinput.h" -#if QT_WAYLAND_TEXT_INPUT_V4_WIP -#include "extensions/qwaylandtextinputv4.h" -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP +#include "extensions/qwaylandtextinputv3.h" #include "extensions/qwaylandqttextinputmethod.h" QT_BEGIN_NAMESPACE @@ -468,17 +466,15 @@ void QWaylandSeat::sendFullKeyEvent(QKeyEvent *event) } } -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - if (keyboardFocus()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV4)) { - QWaylandTextInputV4 *textInputV4 = QWaylandTextInputV4::findIn(this); - if (textInputV4 && !event->text().isEmpty()) { - // it will just commit the text for text-input-unstable-v4-wip when keyPress + if (keyboardFocus()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV3)) { + QWaylandTextInputV3 *textInputV3 = QWaylandTextInputV3::findIn(this); + if (textInputV3 && !event->text().isEmpty()) { + // it will just commit the text for text-input-unstable-v3 when keyPress if (event->type() == QEvent::KeyPress) - textInputV4->sendKeyEvent(event); + textInputV3->sendKeyEvent(event); return; } } -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP } #endif @@ -592,17 +588,15 @@ void QWaylandSeat::sendUnicodeKeyEvent(uint unicode, bool pressed) } } -#if QT_WAYLAND_TEXT_INPUT_V4_WIP - if (keyboardFocus()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV4)) { - QWaylandTextInputV4 *textInputV4 = QWaylandTextInputV4::findIn(this); - if (textInputV4 && !text.isEmpty()) { - // it will just commit the text for text-input-unstable-v4-wip when keyPress + if (keyboardFocus()->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV3)) { + QWaylandTextInputV3 *textInputV3 = QWaylandTextInputV3::findIn(this); + if (textInputV3 && !text.isEmpty()) { + // it will just commit the text for text-input-unstable-v3 when keyPress if (eventType == QEvent::KeyPress) - textInputV4->sendKeyEvent(&event); + textInputV3->sendKeyEvent(&event); return; } } -#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP #else Q_UNUSED(keysym); Q_UNUSED(pressed); diff --git a/src/compositor/extensions/qwaylandtextinputmanagerv4.cpp b/src/compositor/extensions/qwaylandtextinputmanagerv3.cpp index d77cae220..5dbc78459 100644 --- a/src/compositor/extensions/qwaylandtextinputmanagerv4.cpp +++ b/src/compositor/extensions/qwaylandtextinputmanagerv3.cpp @@ -1,35 +1,35 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#include "qwaylandtextinputmanagerv4.h" -#include "qwaylandtextinputmanagerv4_p.h" +#include "qwaylandtextinputmanagerv3.h" +#include "qwaylandtextinputmanagerv3_p.h" #include <QtWaylandCompositor/QWaylandCompositor> #include <QtWaylandCompositor/QWaylandSeat> -#include "qwaylandtextinputv4.h" +#include "qwaylandtextinputv3.h" QT_BEGIN_NAMESPACE -QWaylandTextInputManagerV4Private::QWaylandTextInputManagerV4Private() +QWaylandTextInputManagerV3Private::QWaylandTextInputManagerV3Private() { } -void QWaylandTextInputManagerV4Private::zwp_text_input_manager_v4_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) +void QWaylandTextInputManagerV3Private::zwp_text_input_manager_v3_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; - Q_Q(QWaylandTextInputManagerV4); + Q_Q(QWaylandTextInputManagerV3); QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer()); QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource); - QWaylandTextInputV4 *textInput = QWaylandTextInputV4::findIn(seat); + QWaylandTextInputV3 *textInput = QWaylandTextInputV3::findIn(seat); if (!textInput) { - textInput = new QWaylandTextInputV4(seat, compositor); + textInput = new QWaylandTextInputV3(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::TextInputV4)); + client->setTextInputProtocols(p.setFlag(QWaylandClient::TextInputProtocol::TextInputV3)); if (!textInput->isInitialized()) textInput->initialize(); } @@ -38,13 +38,13 @@ void QWaylandTextInputManagerV4Private::zwp_text_input_manager_v4_get_text_input \internal \preliminary - \qmltype TextInputManagerV4 - \instantiates QWaylandTextInputManagerV4 + \qmltype TextInputManagerV3 + \instantiates QWaylandTextInputManagerV3 \inqmlmodule QtWayland.Compositor \brief Provides access to input methods in the compositor. - The \c TextInputManagerV4 corresponds to the \c zwp_text_input_manager_v4 interface - in the \c text_input_unstable_v4 extension protocol. + The \c TextInputManagerV3 corresponds to the \c zwp_text_input_manager_v3 interface + in the \c text_input_unstable_v3 extension protocol. Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available to the client. If a client binds to it, then it will be used to communciate text input to @@ -56,12 +56,12 @@ void QWaylandTextInputManagerV4Private::zwp_text_input_manager_v4_get_text_input /*! \internal \preliminary - \class QWaylandTextInputManagerV4 + \class QWaylandTextInputManagerV3 \inmodule QtWaylandCompositor \brief Provides access to input methods in the compositor. - The \c QWaylandTextInputManagerV4 corresponds to the \c zwp_text_input_manager_v4 interface - in the \c text_input_unstable_v4 extension protocol. + The \c QWaylandTextInputManagerV3 corresponds to the \c zwp_text_input_manager_v3 interface + in the \c text_input_unstable_v3 extension protocol. Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available to the client. If a client binds to it, then it will be used to communciate text input to @@ -69,43 +69,43 @@ void QWaylandTextInputManagerV4Private::zwp_text_input_manager_v4_get_text_input \note This protocol is currently a work-in-progress and only exists in Qt for validation purposes. It may change at any time. */ -QWaylandTextInputManagerV4::QWaylandTextInputManagerV4() - : QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV4>(*new QWaylandTextInputManagerV4Private) +QWaylandTextInputManagerV3::QWaylandTextInputManagerV3() + : QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV3>(*new QWaylandTextInputManagerV3Private) { } -QWaylandTextInputManagerV4::QWaylandTextInputManagerV4(QWaylandCompositor *compositor) - : QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV4>(compositor, *new QWaylandTextInputManagerV4Private) +QWaylandTextInputManagerV3::QWaylandTextInputManagerV3(QWaylandCompositor *compositor) + : QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV3>(compositor, *new QWaylandTextInputManagerV3Private) { } -QWaylandTextInputManagerV4::~QWaylandTextInputManagerV4() +QWaylandTextInputManagerV3::~QWaylandTextInputManagerV3() { } -void QWaylandTextInputManagerV4::initialize() +void QWaylandTextInputManagerV3::initialize() { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; - Q_D(QWaylandTextInputManagerV4); + Q_D(QWaylandTextInputManagerV3); QWaylandCompositorExtensionTemplate::initialize(); QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer()); if (!compositor) { - qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandTextInputManagerV4"; + qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandTextInputManagerV3"; return; } d->init(compositor->display(), 1); } -const wl_interface *QWaylandTextInputManagerV4::interface() +const wl_interface *QWaylandTextInputManagerV3::interface() { - return QWaylandTextInputManagerV4Private::interface(); + return QWaylandTextInputManagerV3Private::interface(); } -QByteArray QWaylandTextInputManagerV4::interfaceName() +QByteArray QWaylandTextInputManagerV3::interfaceName() { - return QWaylandTextInputManagerV4Private::interfaceName(); + return QWaylandTextInputManagerV3Private::interfaceName(); } QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandtextinputmanagerv4.h b/src/compositor/extensions/qwaylandtextinputmanagerv3.h index 6ad0b0900..1f3051446 100644 --- a/src/compositor/extensions/qwaylandtextinputmanagerv4.h +++ b/src/compositor/extensions/qwaylandtextinputmanagerv3.h @@ -1,8 +1,8 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef QWAYLANDTEXTINPUTMANAGERV4_H -#define QWAYLANDTEXTINPUTMANAGERV4_H +#ifndef QWAYLANDTEXTINPUTMANAGERV3_H +#define QWAYLANDTEXTINPUTMANAGERV3_H #include <QtWaylandCompositor/QWaylandCompositorExtension> @@ -10,16 +10,16 @@ QT_BEGIN_NAMESPACE -class QWaylandTextInputManagerV4Private; +class QWaylandTextInputManagerV3Private; -class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputManagerV4 : public QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV4> +class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputManagerV3 : public QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV3> { Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandTextInputManagerV4) + Q_DECLARE_PRIVATE(QWaylandTextInputManagerV3) public: - QWaylandTextInputManagerV4(); - explicit QWaylandTextInputManagerV4(QWaylandCompositor *compositor); - ~QWaylandTextInputManagerV4() override; + QWaylandTextInputManagerV3(); + explicit QWaylandTextInputManagerV3(QWaylandCompositor *compositor); + ~QWaylandTextInputManagerV3() override; void initialize() override; @@ -29,4 +29,4 @@ public: QT_END_NAMESPACE -#endif // QWAYLANDTEXTINPUTMANAGERV4_H +#endif // QWAYLANDTEXTINPUTMANAGERV3_H diff --git a/src/compositor/extensions/qwaylandtextinputmanagerv4_p.h b/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h index 00aa150c7..c35b19b90 100644 --- a/src/compositor/extensions/qwaylandtextinputmanagerv4_p.h +++ b/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h @@ -1,12 +1,12 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef QWAYLANDTEXTINPUTMANAGERV4_P_H -#define QWAYLANDTEXTINPUTMANAGERV4_P_H +#ifndef QWAYLANDTEXTINPUTMANAGERV3_P_H +#define QWAYLANDTEXTINPUTMANAGERV3_P_H #include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> -#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v4-wip.h> +#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v3.h> // // W A R N I N G @@ -21,16 +21,16 @@ QT_BEGIN_NAMESPACE -class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputManagerV4Private : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_manager_v4 +class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputManagerV3Private : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_manager_v3 { - Q_DECLARE_PUBLIC(QWaylandTextInputManagerV4) + Q_DECLARE_PUBLIC(QWaylandTextInputManagerV3) public: - QWaylandTextInputManagerV4Private(); + QWaylandTextInputManagerV3Private(); protected: - void zwp_text_input_manager_v4_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) override; + void zwp_text_input_manager_v3_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) override; }; QT_END_NAMESPACE -#endif // QWAYLANDTEXTINPUTMANAGERV4_P_H +#endif // QWAYLANDTEXTINPUTMANAGERV3_P_H diff --git a/src/compositor/extensions/qwaylandtextinputv4.cpp b/src/compositor/extensions/qwaylandtextinputv3.cpp index d7e19360b..74ec57954 100644 --- a/src/compositor/extensions/qwaylandtextinputv4.cpp +++ b/src/compositor/extensions/qwaylandtextinputv3.cpp @@ -1,8 +1,8 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#include "qwaylandtextinputv4.h" -#include "qwaylandtextinputv4_p.h" +#include "qwaylandtextinputv3.h" +#include "qwaylandtextinputv3_p.h" #include <QtWaylandCompositor/QWaylandCompositor> #include <QtWaylandCompositor/private/qwaylandseat_p.h> @@ -23,11 +23,11 @@ QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(qLcWaylandCompositorTextInput) -QWaylandTextInputV4ClientState::QWaylandTextInputV4ClientState() +QWaylandTextInputV3ClientState::QWaylandTextInputV3ClientState() { } -Qt::InputMethodQueries QWaylandTextInputV4ClientState::updatedQueries(const QWaylandTextInputV4ClientState &other) const +Qt::InputMethodQueries QWaylandTextInputV3ClientState::updatedQueries(const QWaylandTextInputV3ClientState &other) const { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; @@ -47,7 +47,7 @@ Qt::InputMethodQueries QWaylandTextInputV4ClientState::updatedQueries(const QWay return queries; } -Qt::InputMethodQueries QWaylandTextInputV4ClientState::mergeChanged(const QWaylandTextInputV4ClientState &other) { +Qt::InputMethodQueries QWaylandTextInputV3ClientState::mergeChanged(const QWaylandTextInputV3ClientState &other) { Qt::InputMethodQueries queries; @@ -79,16 +79,16 @@ Qt::InputMethodQueries QWaylandTextInputV4ClientState::mergeChanged(const QWayla return queries; } -QWaylandTextInputV4Private::QWaylandTextInputV4Private(QWaylandCompositor *compositor) +QWaylandTextInputV3Private::QWaylandTextInputV3Private(QWaylandCompositor *compositor) : compositor(compositor) - , currentState(new QWaylandTextInputV4ClientState) - , pendingState(new QWaylandTextInputV4ClientState) + , currentState(new QWaylandTextInputV3ClientState) + , pendingState(new QWaylandTextInputV3ClientState) { } -void QWaylandTextInputV4Private::sendInputMethodEvent(QInputMethodEvent *event) +void QWaylandTextInputV3Private::sendInputMethodEvent(QInputMethodEvent *event) { - Q_Q(QWaylandTextInputV4); + Q_Q(QWaylandTextInputV3); qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; if (!focusResource || !focusResource->handle) @@ -131,11 +131,11 @@ void QWaylandTextInputV4Private::sendInputMethodEvent(QInputMethodEvent *event) } -void QWaylandTextInputV4Private::sendKeyEvent(QKeyEvent *event) +void QWaylandTextInputV3Private::sendKeyEvent(QKeyEvent *event) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; - Q_Q(QWaylandTextInputV4); + Q_Q(QWaylandTextInputV3); if (!focusResource || !focusResource->handle) return; @@ -145,7 +145,7 @@ void QWaylandTextInputV4Private::sendKeyEvent(QKeyEvent *event) send_done(focusResource->handle, serial); } -QVariant QWaylandTextInputV4Private::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const +QVariant QWaylandTextInputV3Private::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << property; @@ -189,10 +189,10 @@ QVariant QWaylandTextInputV4Private::inputMethodQuery(Qt::InputMethodQuery prope } } -void QWaylandTextInputV4Private::setFocus(QWaylandSurface *surface) +void QWaylandTextInputV3Private::setFocus(QWaylandSurface *surface) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; - Q_Q(QWaylandTextInputV4); + Q_Q(QWaylandTextInputV3); if (focusResource && focus) { // sync before leave @@ -225,14 +225,14 @@ void QWaylandTextInputV4Private::setFocus(QWaylandSurface *surface) focusResource = resource; } -void QWaylandTextInputV4Private::zwp_text_input_v4_bind_resource(Resource *resource) +void QWaylandTextInputV3Private::zwp_text_input_v3_bind_resource(Resource *resource) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; Q_UNUSED(resource); } -void QWaylandTextInputV4Private::zwp_text_input_v4_destroy_resource(Resource *resource) +void QWaylandTextInputV3Private::zwp_text_input_v3_destroy_resource(Resource *resource) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; @@ -240,20 +240,20 @@ void QWaylandTextInputV4Private::zwp_text_input_v4_destroy_resource(Resource *re focusResource = nullptr; } -void QWaylandTextInputV4Private::zwp_text_input_v4_destroy(Resource *resource) +void QWaylandTextInputV3Private::zwp_text_input_v3_destroy(Resource *resource) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; wl_resource_destroy(resource->handle); } -void QWaylandTextInputV4Private::zwp_text_input_v4_enable(Resource *resource) +void QWaylandTextInputV3Private::zwp_text_input_v3_enable(Resource *resource) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; - Q_Q(QWaylandTextInputV4); + Q_Q(QWaylandTextInputV3); - pendingState.reset(new QWaylandTextInputV4ClientState); + pendingState.reset(new QWaylandTextInputV3ClientState); enabledSurfaces.insert(resource, focus); emit q->surfaceEnabled(focus); @@ -263,11 +263,11 @@ void QWaylandTextInputV4Private::zwp_text_input_v4_enable(Resource *resource) qApp->inputMethod()->show(); } -void QWaylandTextInputV4Private::zwp_text_input_v4_disable(QtWaylandServer::zwp_text_input_v4::Resource *resource) +void QWaylandTextInputV3Private::zwp_text_input_v3_disable(QtWaylandServer::zwp_text_input_v3::Resource *resource) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; - Q_Q(QWaylandTextInputV4); + Q_Q(QWaylandTextInputV3); QWaylandSurface *s = enabledSurfaces.take(resource); emit q->surfaceDisabled(s); @@ -278,14 +278,14 @@ void QWaylandTextInputV4Private::zwp_text_input_v4_disable(QtWaylandServer::zwp_ qApp->inputMethod()->commit(); } qApp->inputMethod()->reset(); - pendingState.reset(new QWaylandTextInputV4ClientState); + pendingState.reset(new QWaylandTextInputV3ClientState); } -void QWaylandTextInputV4Private::zwp_text_input_v4_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) +void QWaylandTextInputV3Private::zwp_text_input_v3_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << x << y << width << height; - Q_Q(QWaylandTextInputV4); + Q_Q(QWaylandTextInputV3); if (resource != focusResource) return; @@ -295,11 +295,11 @@ void QWaylandTextInputV4Private::zwp_text_input_v4_set_cursor_rectangle(Resource pendingState->changedState |= Qt::ImCursorRectangle; } -void QWaylandTextInputV4Private::zwp_text_input_v4_commit(Resource *resource) +void QWaylandTextInputV3Private::zwp_text_input_v3_commit(Resource *resource) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; - Q_Q(QWaylandTextInputV4); + Q_Q(QWaylandTextInputV3); if (resource != focusResource) { qCDebug(qLcWaylandCompositorTextInput) << "OBS: Disabled surface!!"; @@ -327,7 +327,7 @@ void QWaylandTextInputV4Private::zwp_text_input_v4_commit(Resource *resource) qApp->inputMethod()->invokeAction(QInputMethod::Click, pendingState->cursorPosition); Qt::InputMethodQueries queries = currentState->mergeChanged(*pendingState.data()); - pendingState.reset(new QWaylandTextInputV4ClientState); + pendingState.reset(new QWaylandTextInputV3ClientState); if (queries) { qCDebug(qLcWaylandCompositorTextInput) << "QInputMethod::update() after commit with" << queries; @@ -336,7 +336,7 @@ void QWaylandTextInputV4Private::zwp_text_input_v4_commit(Resource *resource) } } -void QWaylandTextInputV4Private::zwp_text_input_v4_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) +void QWaylandTextInputV3Private::zwp_text_input_v3_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << hint << purpose; @@ -405,7 +405,7 @@ void QWaylandTextInputV4Private::zwp_text_input_v4_set_content_type(Resource *re pendingState->changedState |= Qt::ImHints; } -void QWaylandTextInputV4Private::zwp_text_input_v4_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) +void QWaylandTextInputV3Private::zwp_text_input_v3_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO << text << cursor << anchor; @@ -419,7 +419,7 @@ void QWaylandTextInputV4Private::zwp_text_input_v4_set_surrounding_text(Resource pendingState->changedState |= Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition; } -void QWaylandTextInputV4Private::zwp_text_input_v4_set_text_change_cause(Resource *resource, uint32_t cause) +void QWaylandTextInputV3Private::zwp_text_input_v3_set_text_change_cause(Resource *resource, uint32_t cause) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; @@ -427,57 +427,57 @@ void QWaylandTextInputV4Private::zwp_text_input_v4_set_text_change_cause(Resourc Q_UNUSED(cause); } -QWaylandTextInputV4::QWaylandTextInputV4(QWaylandObject *container, QWaylandCompositor *compositor) - : QWaylandCompositorExtensionTemplate(container, *new QWaylandTextInputV4Private(compositor)) +QWaylandTextInputV3::QWaylandTextInputV3(QWaylandObject *container, QWaylandCompositor *compositor) + : QWaylandCompositorExtensionTemplate(container, *new QWaylandTextInputV3Private(compositor)) { connect(&d_func()->focusDestroyListener, &QWaylandDestroyListener::fired, - this, &QWaylandTextInputV4::focusSurfaceDestroyed); + this, &QWaylandTextInputV3::focusSurfaceDestroyed); } -QWaylandTextInputV4::~QWaylandTextInputV4() +QWaylandTextInputV3::~QWaylandTextInputV3() { } -void QWaylandTextInputV4::sendInputMethodEvent(QInputMethodEvent *event) +void QWaylandTextInputV3::sendInputMethodEvent(QInputMethodEvent *event) { - Q_D(QWaylandTextInputV4); + Q_D(QWaylandTextInputV3); d->sendInputMethodEvent(event); } -void QWaylandTextInputV4::sendKeyEvent(QKeyEvent *event) +void QWaylandTextInputV3::sendKeyEvent(QKeyEvent *event) { - Q_D(QWaylandTextInputV4); + Q_D(QWaylandTextInputV3); d->sendKeyEvent(event); } -QVariant QWaylandTextInputV4::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const +QVariant QWaylandTextInputV3::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const { - const Q_D(QWaylandTextInputV4); + const Q_D(QWaylandTextInputV3); return d->inputMethodQuery(property, argument); } -QWaylandSurface *QWaylandTextInputV4::focus() const +QWaylandSurface *QWaylandTextInputV3::focus() const { - const Q_D(QWaylandTextInputV4); + const Q_D(QWaylandTextInputV3); return d->focus; } -void QWaylandTextInputV4::setFocus(QWaylandSurface *surface) +void QWaylandTextInputV3::setFocus(QWaylandSurface *surface) { - Q_D(QWaylandTextInputV4); + Q_D(QWaylandTextInputV3); d->setFocus(surface); } -void QWaylandTextInputV4::focusSurfaceDestroyed(void *) +void QWaylandTextInputV3::focusSurfaceDestroyed(void *) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; - Q_D(QWaylandTextInputV4); + Q_D(QWaylandTextInputV3); d->focusDestroyListener.reset(); @@ -485,32 +485,32 @@ void QWaylandTextInputV4::focusSurfaceDestroyed(void *) d->focusResource = nullptr; } -bool QWaylandTextInputV4::isSurfaceEnabled(QWaylandSurface *surface) const +bool QWaylandTextInputV3::isSurfaceEnabled(QWaylandSurface *surface) const { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; - const Q_D(QWaylandTextInputV4); + const Q_D(QWaylandTextInputV3); return d->enabledSurfaces.values().contains(surface); } -void QWaylandTextInputV4::add(::wl_client *client, uint32_t id, int version) +void QWaylandTextInputV3::add(::wl_client *client, uint32_t id, int version) { qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO; - Q_D(QWaylandTextInputV4); + Q_D(QWaylandTextInputV3); d->add(client, id, version); } -const wl_interface *QWaylandTextInputV4::interface() +const wl_interface *QWaylandTextInputV3::interface() { - return QWaylandTextInputV4Private::interface(); + return QWaylandTextInputV3Private::interface(); } -QByteArray QWaylandTextInputV4::interfaceName() +QByteArray QWaylandTextInputV3::interfaceName() { - return QWaylandTextInputV4Private::interfaceName(); + return QWaylandTextInputV3Private::interfaceName(); } QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandtextinputv4.h b/src/compositor/extensions/qwaylandtextinputv3.h index 4b4d8fa4d..1305bddfb 100644 --- a/src/compositor/extensions/qwaylandtextinputv4.h +++ b/src/compositor/extensions/qwaylandtextinputv3.h @@ -1,8 +1,8 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef QWAYLANDTEXTINPUTV4_H -#define QWAYLANDTEXTINPUTV4_H +#ifndef QWAYLANDTEXTINPUTV3_H +#define QWAYLANDTEXTINPUTV3_H #include <QtWaylandCompositor/QWaylandCompositorExtension> @@ -10,19 +10,19 @@ struct wl_client; QT_BEGIN_NAMESPACE -class QWaylandTextInputV4Private; +class QWaylandTextInputV3Private; class QInputMethodEvent; class QKeyEvent; class QWaylandSurface; -class QWaylandTextInputV4 : public QWaylandCompositorExtensionTemplate<QWaylandTextInputV4> +class QWaylandTextInputV3 : public QWaylandCompositorExtensionTemplate<QWaylandTextInputV3> { Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandTextInputV4) + Q_DECLARE_PRIVATE(QWaylandTextInputV3) public: - explicit QWaylandTextInputV4(QWaylandObject *container, QWaylandCompositor *compositor); - ~QWaylandTextInputV4() override; + explicit QWaylandTextInputV3(QWaylandObject *container, QWaylandCompositor *compositor); + ~QWaylandTextInputV3() override; void sendInputMethodEvent(QInputMethodEvent *event); void sendKeyEvent(QKeyEvent *event); @@ -49,4 +49,4 @@ private: QT_END_NAMESPACE -#endif // QWAYLANDTEXTINPUTV4_H +#endif // QWAYLANDTEXTINPUTV3_H diff --git a/src/compositor/extensions/qwaylandtextinputv4_p.h b/src/compositor/extensions/qwaylandtextinputv3_p.h index 0e29e62c1..ff03c82d5 100644 --- a/src/compositor/extensions/qwaylandtextinputv4_p.h +++ b/src/compositor/extensions/qwaylandtextinputv3_p.h @@ -1,11 +1,11 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef QWAYLANDTEXTINPUTV4_P_H -#define QWAYLANDTEXTINPUTV4_P_H +#ifndef QWAYLANDTEXTINPUTV3_P_H +#define QWAYLANDTEXTINPUTV3_P_H #include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> -#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v4-wip.h> +#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v3.h> #include <QtWaylandCompositor/QWaylandDestroyListener> #include <QtCore/QObject> @@ -31,12 +31,12 @@ class QKeyEvent; class QWaylandCompositor; class QWaylandView; -class QWaylandTextInputV4ClientState { +class QWaylandTextInputV3ClientState { public: - QWaylandTextInputV4ClientState(); + QWaylandTextInputV3ClientState(); - Qt::InputMethodQueries updatedQueries(const QWaylandTextInputV4ClientState &other) const; - Qt::InputMethodQueries mergeChanged(const QWaylandTextInputV4ClientState &other); + Qt::InputMethodQueries updatedQueries(const QWaylandTextInputV3ClientState &other) const; + Qt::InputMethodQueries mergeChanged(const QWaylandTextInputV3ClientState &other); Qt::InputMethodHints hints = Qt::ImhNone; QRect cursorRectangle; @@ -47,11 +47,11 @@ public: Qt::InputMethodQueries changedState; }; -class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputV4Private : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_v4 +class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputV3Private : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_v3 { - Q_DECLARE_PUBLIC(QWaylandTextInputV4) + Q_DECLARE_PUBLIC(QWaylandTextInputV3) public: - explicit QWaylandTextInputV4Private(QWaylandCompositor *compositor); + explicit QWaylandTextInputV3Private(QWaylandCompositor *compositor); void sendInputMethodEvent(QInputMethodEvent *event); void sendKeyEvent(QKeyEvent *event); @@ -70,27 +70,27 @@ public: QString currentPreeditString; - QScopedPointer<QWaylandTextInputV4ClientState> currentState; - QScopedPointer<QWaylandTextInputV4ClientState> pendingState; + QScopedPointer<QWaylandTextInputV3ClientState> currentState; + QScopedPointer<QWaylandTextInputV3ClientState> pendingState; uint32_t serial = 0; QHash<Resource *, QWaylandSurface*> enabledSurfaces; protected: - void zwp_text_input_v4_bind_resource(Resource *resource) override; - void zwp_text_input_v4_destroy_resource(Resource *resource) override; - - void zwp_text_input_v4_destroy(Resource *resource) override; - void zwp_text_input_v4_enable(Resource *resource) override; - void zwp_text_input_v4_disable(Resource *resource) override; - void zwp_text_input_v4_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) override; - void zwp_text_input_v4_set_text_change_cause(Resource *resource, uint32_t cause) override; - void zwp_text_input_v4_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) override; - void zwp_text_input_v4_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; - void zwp_text_input_v4_commit(Resource *resource) override; + void zwp_text_input_v3_bind_resource(Resource *resource) override; + void zwp_text_input_v3_destroy_resource(Resource *resource) override; + + void zwp_text_input_v3_destroy(Resource *resource) override; + void zwp_text_input_v3_enable(Resource *resource) override; + void zwp_text_input_v3_disable(Resource *resource) override; + void zwp_text_input_v3_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) override; + void zwp_text_input_v3_set_text_change_cause(Resource *resource, uint32_t cause) override; + void zwp_text_input_v3_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) override; + void zwp_text_input_v3_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; + void zwp_text_input_v3_commit(Resource *resource) override; }; QT_END_NAMESPACE -#endif // QWAYLANDTEXTINPUTV4_P_H +#endif // QWAYLANDTEXTINPUTV3_P_H diff --git a/src/configure.cmake b/src/configure.cmake index 4769441e5..eda1f0850 100644 --- a/src/configure.cmake +++ b/src/configure.cmake @@ -4,9 +4,6 @@ # configure.cmake for the QtWaylandGlobalPrivate module #### Inputs -set(INPUT_wayland_text_input_v4_wip OFF CACHE BOOL "") - - #### Libraries @@ -248,12 +245,7 @@ qt_feature("wayland-vulkan-server-buffer" PRIVATE qt_feature("wayland-datadevice" PRIVATE CONDITION QT_FEATURE_draganddrop OR QT_FEATURE_clipboard ) -qt_feature("wayland-text-input-v4-wip" PRIVATE - LABEL "Qt Wayland TextInput Protocol V4(WIP)" - PURPOSE "Enables wayland_text_input_unstable_v4(wip)" -) -qt_configure_add_summary_entry(ARGS "wayland-text-input-v4-wip") qt_configure_add_summary_entry(ARGS "wayland-client") qt_configure_add_summary_entry(ARGS "wayland-server") qt_configure_add_summary_section(NAME "Qt Wayland Drivers") diff --git a/src/shared/qwaylandinputmethodeventbuilder.cpp b/src/shared/qwaylandinputmethodeventbuilder.cpp index f0758bf70..0f07a6958 100644 --- a/src/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/shared/qwaylandinputmethodeventbuilder.cpp @@ -11,10 +11,10 @@ #ifdef QT_BUILD_WAYLANDCOMPOSITOR_LIB #include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v2.h> -#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v4-wip.h> +#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v3.h> #else #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> #endif QT_BEGIN_NAMESPACE @@ -218,55 +218,55 @@ QWaylandInputMethodContentType QWaylandInputMethodContentType::convert(Qt::Input return QWaylandInputMethodContentType{hint, purpose}; } -QWaylandInputMethodContentType QWaylandInputMethodContentType::convertV4(Qt::InputMethodHints hints) +QWaylandInputMethodContentType QWaylandInputMethodContentType::convertV3(Qt::InputMethodHints hints) { - uint32_t hint = ZWP_TEXT_INPUT_V4_CONTENT_HINT_NONE; - uint32_t purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_NORMAL; + uint32_t hint = ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE; + uint32_t purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; if (hints & Qt::ImhHiddenText) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_HIDDEN_TEXT; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_HIDDEN_TEXT; if (hints & Qt::ImhSensitiveData) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_SENSITIVE_DATA; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_SENSITIVE_DATA; if ((hints & Qt::ImhNoAutoUppercase) == 0) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_AUTO_CAPITALIZATION; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_AUTO_CAPITALIZATION; if (hints & Qt::ImhPreferNumbers) { // Nothing yet } if (hints & Qt::ImhPreferUppercase) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_UPPERCASE; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_UPPERCASE; if (hints & Qt::ImhPreferLowercase) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LOWERCASE; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LOWERCASE; if ((hints & Qt::ImhNoPredictiveText) == 0) { - hint |= (ZWP_TEXT_INPUT_V4_CONTENT_HINT_COMPLETION - | ZWP_TEXT_INPUT_V4_CONTENT_HINT_SPELLCHECK); + hint |= (ZWP_TEXT_INPUT_V3_CONTENT_HINT_COMPLETION + | ZWP_TEXT_INPUT_V3_CONTENT_HINT_SPELLCHECK); } if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime) == 0) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_DATE; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATE; else if ((hints & Qt::ImhDate) && (hints & Qt::ImhTime)) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_DATETIME; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATETIME; else if ((hints & Qt::ImhDate) == 0 && (hints & Qt::ImhTime)) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_TIME; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TIME; if (hints & Qt::ImhPreferLatin) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LATIN; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LATIN; if (hints & Qt::ImhMultiLine) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_MULTILINE; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_MULTILINE; if (hints & Qt::ImhDigitsOnly) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_DIGITS; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DIGITS; if (hints & Qt::ImhFormattedNumbersOnly) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_NUMBER; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NUMBER; if (hints & Qt::ImhUppercaseOnly) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_UPPERCASE; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_UPPERCASE; if (hints & Qt::ImhLowercaseOnly) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LOWERCASE; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LOWERCASE; if (hints & Qt::ImhDialableCharactersOnly) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_PHONE; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PHONE; if (hints & Qt::ImhEmailCharactersOnly) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_EMAIL; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_EMAIL; if (hints & Qt::ImhUrlCharactersOnly) - purpose = ZWP_TEXT_INPUT_V4_CONTENT_PURPOSE_URL; + purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_URL; if (hints & Qt::ImhLatinOnly) - hint |= ZWP_TEXT_INPUT_V4_CONTENT_HINT_LATIN; + hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_LATIN; return QWaylandInputMethodContentType{hint, purpose}; } diff --git a/src/shared/qwaylandinputmethodeventbuilder_p.h b/src/shared/qwaylandinputmethodeventbuilder_p.h index 1ccfa11a2..6926dac56 100644 --- a/src/shared/qwaylandinputmethodeventbuilder_p.h +++ b/src/shared/qwaylandinputmethodeventbuilder_p.h @@ -47,7 +47,7 @@ struct QWaylandInputMethodContentType { uint32_t purpose = 0; static QWaylandInputMethodContentType convert(Qt::InputMethodHints hints); - static QWaylandInputMethodContentType convertV4(Qt::InputMethodHints hints); + static QWaylandInputMethodContentType convertV3(Qt::InputMethodHints hints); }; |