summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp57
1 files changed, 53 insertions, 4 deletions
diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
index 9c52f6469..be019b5b0 100644
--- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
+++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp
@@ -35,6 +35,9 @@
#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 "qwaylandqttextinputmethod.h"
#include <QtGui/QInputMethodEvent>
@@ -51,6 +54,15 @@ QWaylandInputMethodControl::QWaylandInputMethodControl(QWaylandSurface *surface)
connect(textInput, &QWaylandTextInput::updateInputMethod, this, &QWaylandInputMethodControl::updateInputMethod);
}
+#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);
+ }
+#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP
+
QWaylandQtTextInputMethod *textInputMethod = d_func()->textInputMethod();
if (textInputMethod) {
connect(textInputMethod, &QWaylandQtTextInputMethod::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
@@ -67,6 +79,12 @@ 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
+
QWaylandQtTextInputMethod *textInputMethod = d_func()->textInputMethod();
if (textInputMethod && textInputMethod->focusedSurface() == d->surface)
return textInputMethod->inputMethodQuery(query, argument);
@@ -78,11 +96,13 @@ void QWaylandInputMethodControl::inputMethodEvent(QInputMethodEvent *event)
{
Q_D(QWaylandInputMethodControl);
- QWaylandTextInput *textInput = d->textInput();
- QWaylandQtTextInputMethod *textInputMethod = d->textInputMethod();
- if (textInput) {
+ if (QWaylandTextInput *textInput = d->textInput()) {
textInput->sendInputMethodEvent(event);
- } else if (textInputMethod) {
+#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 (QWaylandQtTextInputMethod *textInputMethod = d->textInputMethod()) {
textInputMethod->sendInputMethodEvent(event);
} else {
event->ignore();
@@ -134,8 +154,14 @@ 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
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
|| (textInputMethod && textInputMethod->isSurfaceEnabled(d->surface)));
}
@@ -144,10 +170,16 @@ 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->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
QWaylandQtTextInputMethod *textInputMethod = d->textInputMethod();
if (textInput) {
@@ -155,12 +187,22 @@ 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);
+ }
+#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP
+
if (textInputMethod) {
connect(textInputMethod, &QWaylandQtTextInputMethod::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled);
connect(textInputMethod, &QWaylandQtTextInputMethod::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled);
}
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
|| (textInputMethod && textInputMethod->isSurfaceEnabled(d->surface)));
}
@@ -185,4 +227,11 @@ QWaylandTextInput *QWaylandInputMethodControlPrivate::textInput() const
return QWaylandTextInput::findIn(seat);
}
+#if QT_WAYLAND_TEXT_INPUT_V4_WIP
+QWaylandTextInputV4 *QWaylandInputMethodControlPrivate::textInputV4() const
+{
+ return QWaylandTextInputV4::findIn(seat);
+}
+#endif // QT_WAYLAND_TEXT_INPUT_V4_WIP
+
#include "moc_qwaylandinputmethodcontrol.cpp"