summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2023-07-11 13:13:47 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2023-12-13 07:29:51 +0000
commit59ae054ded4d74db53281d8087576cd05b979cd9 (patch)
treeb5ceca08b455770e7c359541fd7807fe2ae3838b /src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
parent9c9f66a73dae53937af3f756fdbecc715fd3bbbb (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/compositor/compositor_api/qwaylandinputmethodcontrol.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp64
1 files changed, 21 insertions, 43 deletions
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"