Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwaylandinputmethodcontext_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWAYLANDINPUTMETHODCONTEXT_P_H
5#define QWAYLANDINPUTMETHODCONTEXT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/qpa/qplatforminputcontext.h>
19#include <QtGui/qevent.h>
20#include <QtCore/qlocale.h>
21#include <QtCore/qpointer.h>
22#include <QtCore/qlist.h>
23#include <QtCore/qhash.h>
24
25#include <QtWaylandClient/private/qwayland-qt-text-input-method-unstable-v1.h>
26#include <QtCore/private/qglobal_p.h>
27
29
30namespace QtWaylandClient {
31 class QWaylandDisplay;
32
33class QWaylandTextInputMethod : public QtWayland::qt_text_input_method_v1
34{
35public:
36 QWaylandTextInputMethod(QWaylandDisplay *display, struct ::qt_text_input_method_v1 *textInputMethod);
37 ~QWaylandTextInputMethod() override;
38
39 void text_input_method_v1_visible_changed(int32_t visible) override;
40 void text_input_method_v1_enter(struct ::wl_surface *surface) override;
41 void text_input_method_v1_leave(struct ::wl_surface *surface) override;
42 void text_input_method_v1_locale_changed(const QString &localeName) override;
44 void text_input_method_v1_keyboard_rectangle_changed(wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) override;
45 void text_input_method_v1_key(int32_t type, int32_t key, int32_t modifiers, int32_t autoRepeat, int32_t count, int32_t nativeScanCode, int32_t nativeVirtualKey, int32_t nativeModifiers, const QString &text) override;
46 void text_input_method_v1_start_input_method_event(uint32_t serial, int32_t surrounding_text_offset) override;
47 void text_input_method_v1_end_input_method_event(uint32_t serial, const QString &commitString, const QString &preeditString, int32_t replacementStart, int32_t replacementLength) override;
48 void text_input_method_v1_input_method_event_attribute(uint32_t serial, int32_t type, int32_t start, int32_t length, const QString &value) override;
49
50 inline bool isVisible() const
51 {
52 return m_isVisible;
53 }
54
55 inline QRectF keyboardRect() const
56 {
57 return m_keyboardRect;
58 }
59
60 inline QLocale locale() const
61 {
62 return m_locale;
63 }
64
66 {
67 return m_layoutDirection;
68 }
69
70 void sendInputState(QInputMethodQueryEvent *state, Qt::InputMethodQueries queries = Qt::ImQueryInput);
71
72private:
73 QHash<int, QList<QInputMethodEvent::Attribute> > m_pendingInputMethodEvents;
74 QHash<int,int> m_offsetFromCompositor;
75
76 struct ::wl_surface *m_surface;
77
78 // Cached state
79 bool m_isVisible = false;
80 QRectF m_keyboardRect;
81 QLocale m_locale;
82 Qt::LayoutDirection m_layoutDirection;
83};
84
86{
88public:
91
92 bool isValid() const override;
93 void reset() override;
94 void commit() override;
95 void update(Qt::InputMethodQueries) override;
96 void invokeAction(QInputMethod::Action, int cursorPosition) override;
97 void showInputPanel() override;
98 void hideInputPanel() override;
99
100 bool isInputPanelVisible() const override;
101 QRectF keyboardRect() const override;
102 QLocale locale() const override;
103 Qt::LayoutDirection inputDirection() const override;
104
105 void setFocusObject(QObject *object) override;
106
107private:
108 QWaylandTextInputMethod *textInputMethod() const;
109
110 QWaylandDisplay *m_display;
111 QPointer<QWindow> m_currentWindow;
112};
113
114} // QtWaylandClient
115
117
118#endif // QWAYLANDINPUTMETHODCONTEXT_P_H
The QInputMethodQueryEvent class provides an event sent by the input context to input objects.
Definition qevent.h:679
Action
Indicates the kind of action performed by the user.
\inmodule QtCore
Definition qobject.h:103
The QPlatformInputContext class abstracts the input method dependent data and composing state.
\inmodule QtCore\reentrant
Definition qrect.h:484
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
void update(Qt::InputMethodQueries) override
Notification on editor updates.
Qt::LayoutDirection inputDirection() const override
bool isInputPanelVisible() const override
Returns input panel visibility status.
void reset() override
Method to be called when input method needs to be reset.
void setFocusObject(QObject *object) override
This virtual method gets called to notify updated focus to object.
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 showInputPanel() override
Request to show input panel.
bool isValid() const override
Returns input context validity.
void invokeAction(QInputMethod::Action, int cursorPosition) override
Called when the word currently being composed in the input item is tapped by the user.
void text_input_method_v1_start_input_method_event(uint32_t serial, int32_t surrounding_text_offset) override
void text_input_method_v1_key(int32_t type, int32_t key, int32_t modifiers, int32_t autoRepeat, int32_t count, int32_t nativeScanCode, int32_t nativeVirtualKey, int32_t nativeModifiers, const QString &text) override
void text_input_method_v1_input_method_event_attribute(uint32_t serial, int32_t type, int32_t start, int32_t length, const QString &value) override
void text_input_method_v1_leave(struct ::wl_surface *surface) override
void text_input_method_v1_end_input_method_event(uint32_t serial, const QString &commitString, const QString &preeditString, int32_t replacementStart, int32_t replacementLength) override
void sendInputState(QInputMethodQueryEvent *state, Qt::InputMethodQueries queries=Qt::ImQueryInput)
void text_input_method_v1_keyboard_rectangle_changed(wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) override
void text_input_method_v1_input_direction_changed(int32_t inputDirection) override
void text_input_method_v1_locale_changed(const QString &localeName) override
void text_input_method_v1_enter(struct ::wl_surface *surface) override
QWaylandTextInputMethod(QWaylandDisplay *display, struct ::qt_text_input_method_v1 *textInputMethod)
void text_input_method_v1_visible_changed(int32_t visible) override
EGLImageKHR int int EGLuint64KHR * modifiers
QString text
else opt state
[0]
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
@ ImQueryInput
LayoutDirection
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLint GLint GLint GLint GLint x
[0]
GLuint64 key
GLint GLsizei GLsizei height
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLsizei width
GLenum type
GLuint start
GLint y
#define Q_OBJECT