7#include <QtGui/QGuiApplication>
8#include <QtGui/QTextCharFormat>
9#include <QtGui/QWindow>
10#include <QtCore/QVarLengthArray>
16#if QT_CONFIG(xkbcommon)
22Q_LOGGING_CATEGORY(qLcQpaInputMethods,
"qt.qpa.input.methods")
37 return mDisplay->textInputManagerv2() !=
nullptr || mDisplay->textInputManagerv1() !=
nullptr || mDisplay->textInputManagerv3() !=
nullptr;
42 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
43#if QT_CONFIG(xkbcommon)
45 xkb_compose_state_reset(m_composeState);
48 QPlatformInputContext::reset();
59 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
70 if (!window || !window->handle())
73 auto *waylandWindow =
static_cast<QWaylandWindow *>(window->handle());
74 return waylandWindow->wlSurface();
79 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO << queries;
82 if (!QGuiApplication::focusObject() || !inputInterface)
85 auto *currentSurface = surfaceForWindow(mCurrentWindow);
87 if (currentSurface && !inputMethodAccepted()) {
89 mCurrentWindow.clear();
90 }
else if (!currentSurface && inputMethodAccepted()) {
91 QWindow *window = QGuiApplication::focusWindow();
92 if (
auto *focusSurface = surfaceForWindow(window)) {
94 mCurrentWindow = window;
107 if (action == QInputMethod::Click)
113 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
124 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
135 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
139 return QPlatformInputContext::isInputPanelVisible();
146 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
150 return QPlatformInputContext::keyboardRect();
152 return inputInterface->keyboardRect();
157 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
161 return QPlatformInputContext::locale();
163 return inputInterface->locale();
168 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
172 return QPlatformInputContext::inputDirection();
174 return inputInterface->inputDirection();
179 qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO;
180#if QT_CONFIG(xkbcommon)
181 m_focusObject = object;
190 QWindow *window = QGuiApplication::focusWindow();
192 if (window && window->handle()) {
193 if (mCurrentWindow.data() != window) {
194 if (!inputMethodAccepted()) {
195 auto *surface =
static_cast<QWaylandWindow *>(window->handle())->wlSurface();
198 mCurrentWindow.clear();
200 auto *surface =
static_cast<QWaylandWindow *>(window->handle())->wlSurface();
203 mCurrentWindow = window;
205 mCurrentWindow.clear();
210 inputInterface->updateState(Qt::ImQueryAll, QWaylandTextInputInterface::update_state_enter);
215 mCurrentWindow.clear();
220 return mDisplay->defaultInputDevice() ? mDisplay->defaultInputDevice()->textInput() :
nullptr;
223#if QT_CONFIG(xkbcommon)
310#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)