Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandtextinputv1_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// Qt-Security score:significant reason:default
4
5
6#ifndef QWAYLANDTEXTINPUTV1_H
7#define QWAYLANDTEXTINPUTV1_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
21#include <QtWaylandClient/private/qwayland-text-input-unstable-v1.h>
22#include <qwaylandinputmethodeventbuilder_p.h>
23
24struct wl_callback;
25struct wl_callback_listener;
26
27QT_BEGIN_NAMESPACE
28
29namespace QtWaylandClient {
30
31class QWaylandDisplay;
32
34{
35public:
36 QWaylandTextInputv1(QWaylandDisplay *display, struct ::zwp_text_input_v1 *text_input);
37 ~QWaylandTextInputv1() override;
38
39 void setSeat(struct ::wl_seat *seat) { m_seat = seat; }
40
41 void reset() override;
42 void commit() override;
43 void updateState(Qt::InputMethodQueries queries, uint32_t flags) override;
44
45 void setCursorInsidePreedit(int cursor) override;
46
47 bool isInputPanelVisible() const override;
48 QRectF keyboardRect() const override;
49
50 QLocale locale() const override;
51 Qt::LayoutDirection inputDirection() const override;
52
53 void showInputPanel() override
54 {
55 show_input_panel();
56 }
57 void hideInputPanel() override
58 {
59 hide_input_panel();
60 }
61 void enableSurface(::wl_surface *surface) override
62 {
63 activate(m_seat, surface);
64 }
65 void disableSurface(::wl_surface *surface) override
66 {
67 Q_UNUSED(surface);
68 deactivate(m_seat);
69 }
70
71protected:
72 void zwp_text_input_v1_enter(struct ::wl_surface *surface) override;
74 void zwp_text_input_v1_modifiers_map(wl_array *map) override;
75 void zwp_text_input_v1_input_panel_state(uint32_t state) override;
76 void zwp_text_input_v1_preedit_string(uint32_t serial, const QString &text, const QString &commit) override;
77 void zwp_text_input_v1_preedit_styling(uint32_t index, uint32_t length, uint32_t style) override;
78 void zwp_text_input_v1_preedit_cursor(int32_t index) override;
79 void zwp_text_input_v1_commit_string(uint32_t serial, const QString &text) override;
80 void zwp_text_input_v1_cursor_position(int32_t index, int32_t anchor) override;
81 void zwp_text_input_v1_delete_surrounding_text(int32_t before_length, uint32_t after_length) override;
82 void zwp_text_input_v1_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) override;
83 void zwp_text_input_v1_language(uint32_t serial, const QString &language) override;
84 void zwp_text_input_v1_text_direction(uint32_t serial, uint32_t direction) override;
85
86private:
87 Qt::KeyboardModifiers modifiersToQtModifiers(uint32_t modifiers);
88
89 QWaylandInputMethodEventBuilder m_builder;
90
91 QList<Qt::KeyboardModifier> m_modifiersMap;
92
93 uint32_t m_serial = 0;
94 struct ::wl_surface *m_surface = nullptr;
95 struct ::wl_seat *m_seat = nullptr;
96
97 QString m_preeditCommit;
98
99 bool m_inputPanelVisible = false;
100 QRectF m_keyboardRectangle;
101 QLocale m_locale;
102 Qt::LayoutDirection m_inputDirection = Qt::LayoutDirectionAuto;
103
104 struct ::wl_callback *m_resetCallback = nullptr;
105 static const wl_callback_listener callbackListener;
106 static void resetCallback(void *data, struct wl_callback *wl_callback, uint32_t time);
107};
108
109}
110
111QT_END_NAMESPACE
112#endif // QWAYLANDTEXTINPUTV1_H
void zwp_text_input_v1_language(uint32_t serial, const QString &language) override
void zwp_text_input_v1_keysym(uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) override
void zwp_text_input_v1_enter(struct ::wl_surface *surface) override
void zwp_text_input_v1_input_panel_state(uint32_t state) override
Qt::LayoutDirection inputDirection() const override
void disableSurface(::wl_surface *surface) override
void zwp_text_input_v1_cursor_position(int32_t index, int32_t anchor) override
void zwp_text_input_v1_modifiers_map(wl_array *map) override
void zwp_text_input_v1_preedit_string(uint32_t serial, const QString &text, const QString &commit) override
void enableSurface(::wl_surface *surface) override
void zwp_text_input_v1_commit_string(uint32_t serial, const QString &text) override
void zwp_text_input_v1_delete_surrounding_text(int32_t before_length, uint32_t after_length) override
void updateState(Qt::InputMethodQueries queries, uint32_t flags) override
void zwp_text_input_v1_preedit_cursor(int32_t index) override
void zwp_text_input_v1_text_direction(uint32_t serial, uint32_t direction) override
void zwp_text_input_v1_preedit_styling(uint32_t index, uint32_t length, uint32_t style) override
void setCursorInsidePreedit(int cursor) override
Combined button and popup list for selecting options.
Q_LOGGING_CATEGORY(lcQpaWayland, "qt.qpa.wayland")