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
qwaylandtextinput_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:critical reason:network-protocol
4
5#ifndef QWAYLANDTEXTINPUT_P_H
6#define QWAYLANDTEXTINPUT_P_H
7
8#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h>
9#include <QtWaylandCompositor/private/qwayland-server-text-input-unstable-v2.h>
10#include <QtWaylandCompositor/QWaylandDestroyListener>
11
12#include <QtCore/QObject>
13#include <QtCore/QMap>
14#include <QtCore/QHash>
15#include <QtCore/QRect>
16#include <QtGui/QInputMethod>
17#include <QtWaylandCompositor/QWaylandSurface>
18
19//
20// W A R N I N G
21// -------------
22//
23// This file is not part of the Qt API. It exists purely as an
24// implementation detail. This header file may change from version to
25// version without notice, or even be removed.
26//
27// We mean it.
28//
29
31
32class QInputMethodEvent;
33class QKeyEvent;
34class QWaylandCompositor;
35class QWaylandView;
36
53
54class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandTextInputPrivate : public QWaylandCompositorExtensionPrivate, public QtWaylandServer::zwp_text_input_v2
55{
56 Q_DECLARE_PUBLIC(QWaylandTextInput)
57public:
58 explicit QWaylandTextInputPrivate(QWaylandCompositor *compositor);
59
60 void sendInputMethodEvent(QInputMethodEvent *event);
61 void sendKeyEvent(QKeyEvent *event);
62 void sendInputPanelState();
63 void sendTextDirection();
64 void sendLocale();
65 void sendModifiersMap(const QByteArray &modifiersMap);
66
67 QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const;
68
69 void setFocus(QWaylandSurface *surface);
70
71 QWaylandCompositor *compositor = nullptr;
72
73 QWaylandSurface *focus = nullptr;
74 Resource *focusResource = nullptr;
75 QWaylandDestroyListener focusDestroyListener;
76
77 bool inputPanelVisible = false;
78
79 std::unique_ptr<QWaylandTextInputClientState> currentState;
80 std::unique_ptr<QWaylandTextInputClientState> pendingState;
81
82 uint32_t serial = 0;
83
84 QHash<Resource *, QWaylandSurface*> enabledSurfaces;
85
86protected:
87 void zwp_text_input_v2_bind_resource(Resource *resource) override;
88 void zwp_text_input_v2_destroy_resource(Resource *resource) override;
89
90 void zwp_text_input_v2_destroy(Resource *resource) override;
91 void zwp_text_input_v2_enable(Resource *resource, wl_resource *surface) override;
92 void zwp_text_input_v2_disable(Resource *resource, wl_resource *surface) override;
93 void zwp_text_input_v2_show_input_panel(Resource *resource) override;
94 void zwp_text_input_v2_hide_input_panel(Resource *resource) override;
95 void zwp_text_input_v2_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) override;
96 void zwp_text_input_v2_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) override;
97 void zwp_text_input_v2_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override;
98 void zwp_text_input_v2_set_preferred_language(Resource *resource, const QString &language) override;
99 void zwp_text_input_v2_update_state(Resource *resource, uint32_t serial, uint32_t flags) override;
100
101private:
102 quint32 shiftModifierMask = 1;
103 quint32 controlModifierMask = 2;
104 quint32 altModifierMask = 4;
105 quint32 metaModifierMask = 8;
106};
107
108QT_END_NAMESPACE
109
110#endif // QWAYLANDTEXTINPUT_P_H
Qt::InputMethodQueries updatedQueries(const QWaylandTextInputClientState &other) const
Qt::InputMethodQueries changedState
Qt::InputMethodQueries mergeChanged(const QWaylandTextInputClientState &other)
void sendInputMethodEvent(QInputMethodEvent *event)
void sendModifiersMap(const QByteArray &modifiersMap)
QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const
void setFocus(QWaylandSurface *surface)
bool isSurfaceEnabled(QWaylandSurface *surface) const
void add(::wl_client *client, uint32_t id, int version)
QWaylandSurface * focus() const
static const struct wl_interface * interface()
void sendKeyEvent(QKeyEvent *event)
Combined button and popup list for selecting options.