7#include <QLoggingCategory>
8#include <QtGui/QGuiApplication>
9#include <QtGui/QTextCharFormat>
10#include <QtGui/QWindow>
11#include <QtCore/QVarLengthArray>
17#if QT_CONFIG(xkbcommon)
38#if QT_WAYLAND_TEXT_INPUT_V4_WIP
48#if QT_CONFIG(xkbcommon)
50 xkb_compose_state_reset(m_composeState);
91 mCurrentWindow.
clear();
159 return textInput()->
locale();
175#if QT_CONFIG(xkbcommon)
186 if (mCurrentWindow && mCurrentWindow->handle()) {
188 auto *surface =
static_cast<QWaylandWindow *
>(mCurrentWindow->handle())->wlSurface();
191 mCurrentWindow.
clear();
212#if QT_CONFIG(xkbcommon)
214void QWaylandInputContext::ensureInitialized()
220 qCWarning(qLcQpaInputMethods) <<
"error: xkb context has not been set on" <<
metaObject()->className();
224 m_initialized =
true;
225 const char *
const locale = setlocale(LC_CTYPE,
nullptr);
226 qCDebug(qLcQpaInputMethods) <<
"detected locale (LC_CTYPE):" <<
locale;
228 m_composeTable = xkb_compose_table_new_from_locale(m_XkbContext,
locale, XKB_COMPOSE_COMPILE_NO_FLAGS);
230 m_composeState = xkb_compose_state_new(m_composeTable, XKB_COMPOSE_STATE_NO_FLAGS);
232 if (!m_composeTable) {
233 qCWarning(qLcQpaInputMethods,
"failed to create compose table");
236 if (!m_composeState) {
237 qCWarning(qLcQpaInputMethods,
"failed to create compose state");
254 if (!m_composeTable || !m_composeState)
257 xkb_compose_state_feed(m_composeState, keyEvent->nativeVirtualKey());
259 switch (xkb_compose_state_get_status(m_composeState)) {
260 case XKB_COMPOSE_COMPOSING:
262 case XKB_COMPOSE_CANCELLED:
265 case XKB_COMPOSE_COMPOSED:
267 const int size = xkb_compose_state_get_utf8(m_composeState,
nullptr, 0);
269 xkb_compose_state_get_utf8(m_composeState,
buffer.data(),
buffer.size());
273 event.setCommitString(composedText);
275 if (!m_focusObject &&
qApp)
276 m_focusObject =
qApp->focusObject();
281 qCWarning(qLcQpaInputMethods,
"no focus object");
286 case XKB_COMPOSE_NOTHING:
289 Q_UNREACHABLE_RETURN(
false);
299#include "moc_qwaylandinputcontext_p.cpp"
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static QObject * focusObject()
Returns the QObject in currently active window that will be final receiver of events tied to focus,...
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
The QKeyEvent class describes a key event.
virtual bool isInputPanelVisible() const
Returns input panel visibility status.
bool inputMethodAccepted() const
Returns true if current focus object supports input method events.
virtual QLocale locale() const
virtual bool filterEvent(const QEvent *event)
This function can be reimplemented to filter input events.
virtual void reset()
Method to be called when input method needs to be reset.
virtual Qt::LayoutDirection inputDirection() const
virtual QRectF keyboardRect() const
This function can be reimplemented to return virtual keyboard rectangle in currently active window co...
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QtWayland::zwp_text_input_manager_v4 * textInputManagerv4() const
QtWayland::zwp_text_input_manager_v1 * textInputManagerv1() const
QWaylandInputDevice * defaultInputDevice() const
QtWayland::zwp_text_input_manager_v2 * textInputManagerv2() const
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 QRectF keyboardRect() const =0
virtual void hideInputPanel()
virtual void setCursorInsidePreedit(int cursor)=0
virtual void showInputPanel()
virtual QLocale locale() const =0
virtual void disableSurface(::wl_surface *surface)=0
virtual Qt::LayoutDirection inputDirection() const =0
virtual void updateState(Qt::InputMethodQueries queries, uint32_t flags)=0
::wl_surface * wlSurface()
struct wl_display * display
Combined button and popup list for selecting options.
::wl_surface * surfaceForWindow(QWindow *window)
#define Q_LOGGING_CATEGORY(name,...)
#define qCWarning(category,...)
#define qCDebug(category,...)
static void ensureInitialized()
GLenum GLuint GLintptr GLsizeiptr size
[1]
obj metaObject() -> className()