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
qwaylandtextinputv3_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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 QWAYLANDTEXTINPUTV3_P_H
5#define QWAYLANDTEXTINPUTV3_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
19#include <QtWaylandClient/private/qwayland-text-input-unstable-v3.h>
21#include <QLoggingCategory>
22
23struct wl_callback;
24struct wl_callback_listener;
25
27
28Q_DECLARE_LOGGING_CATEGORY(qLcQpaWaylandTextInput)
29
30namespace QtWaylandClient {
31
32class QWaylandDisplay;
33
34class QWaylandTextInputv3 : public QtWayland::zwp_text_input_v3, public QWaylandTextInputInterface
35{
36public:
37 QWaylandTextInputv3(QWaylandDisplay *display, struct ::zwp_text_input_v3 *text_input);
38 ~QWaylandTextInputv3() override;
39
40 void reset() override;
41 void commit() override;
42 void updateState(Qt::InputMethodQueries queries, uint32_t flags) override;
43 // TODO: not supported yet
44 void setCursorInsidePreedit(int cursor) override;
45
46 bool isInputPanelVisible() const override;
47 QRectF keyboardRect() const override;
48
49 QLocale locale() const override;
50 Qt::LayoutDirection inputDirection() const override;
51
52 // doing nothing in zwp_text_input_v3.
53 // enter() and leave() takes the role to enable/disable the surface
54 void enableSurface(::wl_surface *) override {};
55 void disableSurface(::wl_surface *) override {};
56
57protected:
58 void zwp_text_input_v3_enter(struct ::wl_surface *surface) override;
59 void zwp_text_input_v3_leave(struct ::wl_surface *surface) override;
60 void zwp_text_input_v3_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override;
61 void zwp_text_input_v3_commit_string(const QString &text) override;
62 void zwp_text_input_v3_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override;
63 void zwp_text_input_v3_done(uint32_t serial) override;
64
65private:
67
68 ::wl_surface *m_surface = nullptr; // ### Here for debugging purposes
69
70 struct PreeditInfo {
71 QString text;
72 int cursorBegin = 0;
73 int cursorEnd = 0;
74
75 void clear() {
76 text.clear();
77 cursorBegin = 0;
78 cursorEnd = 0;
79 }
80 };
81
82 PreeditInfo m_pendingPreeditString;
83 PreeditInfo m_currentPreeditString;
84 QString m_pendingCommitString;
85 uint m_pendingDeleteBeforeText = 0;
86 uint m_pendingDeleteAfterText = 0;
87
88 QString m_surroundingText;
89 int m_cursor; // cursor position in QString
90 int m_cursorPos; // cursor position in wayland index
91 int m_anchorPos; // anchor position in wayland index
92 uint32_t m_contentHint = 0;
93 uint32_t m_contentPurpose = 0;
94 QRect m_cursorRect;
95
96 uint m_currentSerial = 0;
97
98 bool m_condReselection = false;
99};
100
101}
102
104
105#endif // QWAYLANDTEXTINPUTV3_P_H
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore\reentrant
Definition qrect.h:30
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
void clear()
Clears the contents of the string and makes it null.
Definition qstring.h:1252
QWaylandTextInputv3(QWaylandDisplay *display, struct ::zwp_text_input_v3 *text_input)
void disableSurface(::wl_surface *) override
void zwp_text_input_v3_commit_string(const QString &text) override
Qt::LayoutDirection inputDirection() const override
void updateState(Qt::InputMethodQueries queries, uint32_t flags) override
void zwp_text_input_v3_enter(struct ::wl_surface *surface) override
void zwp_text_input_v3_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override
void zwp_text_input_v3_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override
void zwp_text_input_v3_leave(struct ::wl_surface *surface) override
void enableSurface(::wl_surface *) override
void setCursorInsidePreedit(int cursor) override
void zwp_text_input_v3_done(uint32_t serial) override
QString text
QCursor cursor
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
LayoutDirection
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLbitfield flags
unsigned int uint
Definition qtypes.h:34