8#include <QtGui/QGuiApplication>
9#include <QtGui/QTextCharFormat>
10#include <QtGui/QWindow>
11#include <QtCore/QVarLengthArray>
17#if QT_CONFIG(xkbcommon)
23Q_LOGGING_CATEGORY(qLcQpaInputMethods,
"qt.qpa.input.methods")
38 return mDisplay->textInputManagerv2() !=
nullptr || mDisplay->textInputManagerv1() !=
nullptr || mDisplay->textInputManagerv3() !=
nullptr;
43 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
44#if QT_CONFIG(xkbcommon)
46 xkb_compose_state_reset(m_composeState);
49 QPlatformInputContext::reset();
60 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
71 if (!window || !window->handle())
74 auto *waylandWindow =
static_cast<QWaylandWindow *>(window->handle());
75 return waylandWindow->wlSurface();
80 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO << queries;
83 if (!QGuiApplication::focusObject() || !inputInterface)
86 auto *currentSurface = surfaceForWindow(mCurrentWindow);
88 if (currentSurface && !inputMethodAccepted()) {
90 mCurrentWindow.clear();
91 }
else if (!currentSurface && inputMethodAccepted()) {
92 QWindow *window = QGuiApplication::focusWindow();
93 if (
auto *focusSurface = surfaceForWindow(window)) {
95 mCurrentWindow = window;
108 if (action == QInputMethod::Click)
114 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
125 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
136 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
140 return QPlatformInputContext::isInputPanelVisible();
147 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
151 return QPlatformInputContext::keyboardRect();
153 return inputInterface->keyboardRect();
158 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
162 return QPlatformInputContext::locale();
164 return inputInterface->locale();
169 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
173 return QPlatformInputContext::inputDirection();
175 return inputInterface->inputDirection();
180 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
181#if QT_CONFIG(xkbcommon)
182 m_focusObject = object;
191 QWindow *window = QGuiApplication::focusWindow();
193 if (window && window->handle()) {
194 if (mCurrentWindow.data() != window) {
195 if (!inputMethodAccepted()) {
196 auto *surface =
static_cast<QWaylandWindow *>(window->handle())->wlSurface();
199 mCurrentWindow.clear();
201 auto *surface =
static_cast<QWaylandWindow *>(window->handle())->wlSurface();
204 mCurrentWindow = window;
206 mCurrentWindow.clear();
216 mCurrentWindow.clear();
221 return mDisplay->defaultInputDevice() ? mDisplay->defaultInputDevice()->textInput() :
nullptr;
224#if QT_CONFIG(xkbcommon)
311#include "moc_qwaylandinputcontext_p.cpp"
void hideInputPanel() override
Request to hide input panel.
QRectF keyboardRect() const override
This function can be reimplemented to return virtual keyboard rectangle in currently active window co...
void reset() override
Method to be called when input method needs to be reset.
~QWaylandInputContext() override
void showInputPanel() override
Request to show input panel.
Qt::LayoutDirection inputDirection() const override
void invokeAction(QInputMethod::Action, int cursorPosition) override
Called when the word currently being composed in the input item is tapped by the user.
void setFocusObject(QObject *object) override
This virtual method gets called to notify updated focus to object.
bool isValid() const override
Returns input context validity.
bool isInputPanelVisible() const override
Returns input panel visibility status.
void update(Qt::InputMethodQueries) override
Notification on editor updates.
QLocale locale() const override
virtual void enableSurface(::wl_surface *surface)=0
virtual bool isInputPanelVisible() const =0
virtual void hideInputPanel()
virtual void setCursorInsidePreedit(int cursor)=0
virtual void showInputPanel()
virtual void disableSurface(::wl_surface *surface)=0
Combined button and popup list for selecting options.
::wl_surface * surfaceForWindow(QWindow *window)