15#include <QtGui/QInputMethodEvent>
17QWaylandInputMethodControl::QWaylandInputMethodControl(QWaylandSurface *surface)
18 : QObject(*
new QWaylandInputMethodControlPrivate(surface), surface)
20 connect(d_func()->compositor, &QWaylandCompositor::defaultSeatChanged,
21 this, &QWaylandInputMethodControl::defaultSeatChanged);
25 QWaylandTextInputV3 *textInputV3 = d_func()->textInputV3();
27 connect(textInputV3, &QWaylandTextInputV3::surfaceEnabled,
this, &QWaylandInputMethodControl::surfaceEnabled);
28 connect(textInputV3, &QWaylandTextInputV3::surfaceDisabled,
this, &QWaylandInputMethodControl::surfaceDisabled);
29 connect(textInputV3, &QWaylandTextInputV3::updateInputMethod,
this, &QWaylandInputMethodControl::updateInputMethod);
32 QWaylandQtTextInputMethod *textInputMethod = d_func()->textInputMethod();
33 if (textInputMethod) {
34 connect(textInputMethod, &QWaylandQtTextInputMethod::surfaceEnabled,
this, &QWaylandInputMethodControl::surfaceEnabled);
35 connect(textInputMethod, &QWaylandQtTextInputMethod::surfaceDisabled,
this, &QWaylandInputMethodControl::surfaceDisabled);
36 connect(textInputMethod, &QWaylandQtTextInputMethod::updateInputMethod,
this, &QWaylandInputMethodControl::updateInputMethod);
42 Q_D(
const QWaylandInputMethodControl);
45 if (textInput !=
nullptr && textInput->focus() == d->surface)
46 return textInput->inputMethodQuery(query, argument);
49 if (textInputV3 !=
nullptr && textInputV3->focus() == d->surface)
50 return textInputV3->inputMethodQuery(query, argument);
53 if (textInputMethod && textInputMethod->focusedSurface() == d->surface)
54 return textInputMethod->inputMethodQuery(query, argument);
61 Q_D(QWaylandInputMethodControl);
75
76
77
78
79
80
81
82
85 Q_D(
const QWaylandInputMethodControl);
92 Q_D(QWaylandInputMethodControl);
94 if (d->enabled == enabled)
98 emit enabledChanged(enabled);
99 emit updateInputMethod(Qt::ImQueryInput);
104 Q_D(QWaylandInputMethodControl);
106 if (surface == d->surface)
112 Q_D(QWaylandInputMethodControl);
114 if (surface == d->surface)
120 Q_D(QWaylandInputMethodControl);
122 if (d->surface == surface)
125 d->surface = surface;
142 connect(textInput, &QWaylandTextInput::updateInputMethod,
this, &QWaylandInputMethodControl::updateInputMethod, Qt::UniqueConnection);
148 Q_D(QWaylandInputMethodControl);
150 disconnect(d->textInput(),
nullptr,
this,
nullptr);
151 disconnect(d->textInputV3(),
nullptr,
this,
nullptr);
152 disconnect(d->textInputMethod(),
nullptr,
this,
nullptr);
154 d->seat = d->compositor->defaultSeat();
169 if (textInputMethod) {
179QWaylandInputMethodControlPrivate::QWaylandInputMethodControlPrivate(QWaylandSurface *surface)
180 : compositor(surface->compositor())
181 , seat(compositor->defaultSeat())
186QWaylandQtTextInputMethod *QWaylandInputMethodControlPrivate::textInputMethod()
const
188 if (!surface->client() || !surface->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::QtTextInputMethodV1))
190 return QWaylandQtTextInputMethod::findIn(seat);
193QWaylandTextInput *QWaylandInputMethodControlPrivate::textInput()
const
195 if (!surface->client() || !surface->client()->textInputProtocols().testFlag(QWaylandClient::TextInputProtocol::TextInputV2))
197 return QWaylandTextInput::findIn(seat);
200QWaylandTextInputV3 *QWaylandInputMethodControlPrivate::textInputV3()
const
202 return QWaylandTextInputV3::findIn(seat);
205#include "moc_qwaylandinputmethodcontrol.cpp"
bool isSurfaceEnabled(QWaylandSurface *surface) const
void surfaceEnabled(QWaylandSurface *surface)
void sendInputMethodEvent(QInputMethodEvent *event)
void surfaceDisabled(QWaylandSurface *surface)
void surfaceEnabled(QWaylandSurface *surface)
void sendInputMethodEvent(QInputMethodEvent *event)
void surfaceDisabled(QWaylandSurface *surface)
bool isSurfaceEnabled(QWaylandSurface *surface) const
void sendInputMethodEvent(QInputMethodEvent *event)
void surfaceDisabled(QWaylandSurface *surface)
bool isSurfaceEnabled(QWaylandSurface *surface) const
void surfaceEnabled(QWaylandSurface *surface)