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
qwaylandtextinputmanagerv3.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:critical reason:network-protocol
4
7
8#include <QtWaylandCompositor/QWaylandCompositor>
9#include <QtWaylandCompositor/QWaylandSeat>
10
12
14
15QWaylandTextInputManagerV3Private::QWaylandTextInputManagerV3Private()
16{
17}
18
19void QWaylandTextInputManagerV3Private::zwp_text_input_manager_v3_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource)
20{
21 qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
22
23 Q_Q(QWaylandTextInputManagerV3);
24 QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer());
25 QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
26 QWaylandTextInputV3 *textInput = QWaylandTextInputV3::findIn(seat);
27 if (!textInput) {
28 textInput = new QWaylandTextInputV3(seat, compositor);
29 }
30 textInput->add(resource->client(), id, wl_resource_get_version(resource->handle));
31 QWaylandClient *client = QWaylandClient::fromWlClient(compositor, resource->client());
32 QWaylandClient::TextInputProtocols p = client->textInputProtocols();
33 client->setTextInputProtocols(p.setFlag(QWaylandClient::TextInputProtocol::TextInputV3));
34 if (!textInput->isInitialized())
35 textInput->initialize();
36}
37
38/*!
39 \internal
40 \preliminary
41
42 \qmltype TextInputManagerV3
43 \nativetype QWaylandTextInputManagerV3
44 \inqmlmodule QtWayland.Compositor
45 \brief Provides access to input methods in the compositor.
46
47 The \c TextInputManagerV3 corresponds to the \c zwp_text_input_manager_v3 interface
48 in the \c text_input_unstable_v3 extension protocol.
49
50 Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
51 to the client. If a client binds to it, then it will be used to communciate text input to
52 that client.
53
54 \note This protocol is currently a work-in-progress and only exists in Qt for validation purposes. It may change at any time.
55*/
56
57/*!
58 \internal
59 \preliminary
60 \class QWaylandTextInputManagerV3
61 \inmodule QtWaylandCompositor
62 \brief Provides access to input methods in the compositor.
63
64 The \c QWaylandTextInputManagerV3 corresponds to the \c zwp_text_input_manager_v3 interface
65 in the \c text_input_unstable_v3 extension protocol.
66
67 Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
68 to the client. If a client binds to it, then it will be used to communciate text input to
69 that client.
70 \note This protocol is currently a work-in-progress and only exists in Qt for validation purposes. It may change at any time.
71*/
72
73QWaylandTextInputManagerV3::QWaylandTextInputManagerV3()
74 : QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV3>(*new QWaylandTextInputManagerV3Private)
75{
76}
77
78QWaylandTextInputManagerV3::QWaylandTextInputManagerV3(QWaylandCompositor *compositor)
79 : QWaylandCompositorExtensionTemplate<QWaylandTextInputManagerV3>(compositor, *new QWaylandTextInputManagerV3Private)
80{
81}
82
83QWaylandTextInputManagerV3::~QWaylandTextInputManagerV3()
84{
85}
86
87void QWaylandTextInputManagerV3::initialize()
88{
89 qCDebug(qLcWaylandCompositorTextInput) << Q_FUNC_INFO;
90
91 Q_D(QWaylandTextInputManagerV3);
92
93 QWaylandCompositorExtensionTemplate::initialize();
94 QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
95 if (!compositor) {
96 qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandTextInputManagerV3";
97 return;
98 }
99 d->init(compositor->display(), 1);
100}
101
102const wl_interface *QWaylandTextInputManagerV3::interface()
103{
104 return QWaylandTextInputManagerV3Private::interface();
105}
106
107QByteArray QWaylandTextInputManagerV3::interfaceName()
108{
109 return QWaylandTextInputManagerV3Private::interfaceName();
110}
111
112QT_END_NAMESPACE
Combined button and popup list for selecting options.