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
qwaylandtextinputmanager.cpp
Go to the documentation of this file.
1// Copyright (C) 2017-2016 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
7
8#include <QtWaylandCompositor/QWaylandCompositor>
9#include <QtWaylandCompositor/QWaylandSeat>
10
12
14
15QWaylandTextInputManagerPrivate::QWaylandTextInputManagerPrivate()
16{
17}
18
19void QWaylandTextInputManagerPrivate::zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource)
20{
21 Q_Q(QWaylandTextInputManager);
22 QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer());
23 QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource);
24 QWaylandTextInput *textInput = QWaylandTextInput::findIn(seat);
25 if (!textInput)
26 textInput = new QWaylandTextInput(seat, compositor);
27 textInput->add(resource->client(), id, wl_resource_get_version(resource->handle));
28 QWaylandClient *client = QWaylandClient::fromWlClient(compositor, resource->client());
29 QWaylandClient::TextInputProtocols p = client->textInputProtocols();
30 client->setTextInputProtocols(p.setFlag(QWaylandClient::TextInputProtocol::TextInputV2));
31 if (!textInput->isInitialized())
32 textInput->initialize();
33}
34
35/*!
36 \qmltype TextInputManager
37 \nativetype QWaylandTextInputManager
38 \inqmlmodule QtWayland.Compositor
39 \brief Provides access to input methods in the compositor.
40
41 The \c TextInputManager corresponds to the \c zwp_text_input_manager_v2 interface
42 in the \c text_input_unstable_v2 extension protocol.
43
44 Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
45 to the client. If a client binds to it, then it will be used to communciate text input to
46 that client.
47*/
48
49/*!
50 \class QWaylandTextInputManager
51 \inmodule QtWaylandCompositor
52 \brief Provides access to input methods in the compositor.
53
54 The \c QWaylandTextInputManager corresponds to the \c zwp_text_input_manager_v2 interface
55 in the \c text_input_unstable_v2 extension protocol.
56
57 Instantiating this as child of a \l WaylandCompositor adds it to the list of interfaces available
58 to the client. If a client binds to it, then it will be used to communciate text input to
59 that client.
60*/
61
62QWaylandTextInputManager::QWaylandTextInputManager()
63 : QWaylandCompositorExtensionTemplate<QWaylandTextInputManager>(*new QWaylandTextInputManagerPrivate)
64{
65}
66
67QWaylandTextInputManager::QWaylandTextInputManager(QWaylandCompositor *compositor)
68 : QWaylandCompositorExtensionTemplate<QWaylandTextInputManager>(compositor, *new QWaylandTextInputManagerPrivate)
69{
70}
71
72void QWaylandTextInputManager::initialize()
73{
74 Q_D(QWaylandTextInputManager);
75
76 QWaylandCompositorExtensionTemplate::initialize();
77 QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
78 if (!compositor) {
79 qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandTextInputManager";
80 return;
81 }
82 d->init(compositor->display(), 1);
83}
84
85const wl_interface *QWaylandTextInputManager::interface()
86{
87 return QWaylandTextInputManagerPrivate::interface();
88}
89
90QByteArray QWaylandTextInputManager::interfaceName()
91{
92 return QWaylandTextInputManagerPrivate::interfaceName();
93}
94
95QT_END_NAMESPACE
96
97#include "moc_qwaylandtextinputmanager.cpp"
Combined button and popup list for selecting options.