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")
34#if QT_CONFIG(xkbcommon)
35 xkb_compose_state_unref(m_composeState);
36 xkb_compose_table_unref(m_composeTable);
42 return mDisplay->textInputManagerv2() !=
nullptr || mDisplay->textInputManagerv1() !=
nullptr || mDisplay->textInputManagerv3() !=
nullptr;
47 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
48#if QT_CONFIG(xkbcommon)
50 xkb_compose_state_reset(m_composeState);
53 QPlatformInputContext::reset();
64 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
75 if (!window || !window->handle())
78 auto *waylandWindow =
static_cast<QWaylandWindow *>(window->handle());
79 return waylandWindow->wlSurface();
84 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO << queries;
87 if (!QGuiApplication::focusObject() || !inputInterface)
90 auto *currentSurface = surfaceForWindow(mCurrentWindow);
92 if (currentSurface && !inputMethodAccepted()) {
94 mCurrentWindow.clear();
95 }
else if (!currentSurface && inputMethodAccepted()) {
96 QWindow *window = QGuiApplication::focusWindow();
97 if (
auto *focusSurface = surfaceForWindow(window)) {
99 mCurrentWindow = window;
112 if (action == QInputMethod::Click)
118 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
129 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
140 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
144 return QPlatformInputContext::isInputPanelVisible();
151 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
155 return QPlatformInputContext::keyboardRect();
157 return inputInterface->keyboardRect();
162 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
166 return QPlatformInputContext::locale();
168 return inputInterface->locale();
173 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
177 return QPlatformInputContext::inputDirection();
179 return inputInterface->inputDirection();
184 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
185#if QT_CONFIG(xkbcommon)
186 m_focusObject = object;
195 QWindow *window = QGuiApplication::focusWindow();
197 if (window && window->handle()) {
198 if (mCurrentWindow.data() != window) {
199 if (!inputMethodAccepted()) {
200 auto *surface =
static_cast<QWaylandWindow *>(window->handle())->wlSurface();
203 mCurrentWindow.clear();
205 auto *surface =
static_cast<QWaylandWindow *>(window->handle())->wlSurface();
208 mCurrentWindow = window;
210 mCurrentWindow.clear();
220 mCurrentWindow.clear();
225 return mDisplay->defaultInputDevice() ? mDisplay->defaultInputDevice()->textInput() :
nullptr;
228#if QT_CONFIG(xkbcommon)
315#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)