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
qwaylandnativeinterface.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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
15#include <QtCore/qbytearrayview.h>
16#include <QtCore/private/qnativeinterface_p.h>
17#include <QtGui/private/qguiapplication_p.h>
18#include <QtGui/QScreen>
19#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
20#if QT_CONFIG(vulkan)
21#include <QtWaylandClient/private/qwaylandvulkanwindow_p.h>
22#endif
23
25
26namespace QtWaylandClient {
27
28static bool equalsIgnoringCase(QByteArrayView lhs, QByteArrayView rhs)
29{
30 return lhs.compare(rhs, Qt::CaseInsensitive) == 0;
31}
32
37
39{
41 || equalsIgnoringCase(resourceString, "wl_display")
42 || equalsIgnoringCase(resourceString, "nativedisplay")) {
43 return m_integration->display()->wl_display();
44 }
45 if (equalsIgnoringCase(resourceString, "compositor")) {
47 return compositor->object();
48 }
49 if (equalsIgnoringCase(resourceString, "server_buffer_integration"))
51
54
55 if (equalsIgnoringCase(resourceString, "wl_seat"))
57 if (equalsIgnoringCase(resourceString, "wl_keyboard")) {
59 if (keyboard)
60 return keyboard->wl_keyboard();
61 return nullptr;
62 }
63 if (equalsIgnoringCase(resourceString, "wl_pointer")) {
65 if (pointer)
66 return pointer->wl_pointer();
67 return nullptr;
68 }
69 if (equalsIgnoringCase(resourceString, "wl_touch")) {
71 if (touch)
72 return touch->wl_touch();
73 return nullptr;
74 }
75#if QT_CONFIG(xkbcommon)
76 if (equalsIgnoringCase(resourceString, "xkb_context")) {
77 return m_integration->display()->xkbContext();
78 }
79#endif
81 return reinterpret_cast<void *>(quintptr(m_integration->display()->defaultInputDevice()->serial()));
82
83 return nullptr;
84}
85
90
92{
94 return compositor->object();
95 return nullptr;
96}
97
99{
101 return inputDevice->wl_seat();
102 }
103 return nullptr;
104}
105
107{
109 if (auto keyboard = inputDevice->keyboard())
110 return keyboard->wl_keyboard();
111 return nullptr;
112}
113
115{
117 if (auto pointer = inputDevice->pointer())
118 return pointer->wl_pointer();
119 return nullptr;
120}
121
123{
125 if (auto touch = inputDevice->touch())
126 return touch->wl_touch();
127 return nullptr;
128}
129
134
136{
138 return inputDevice->wl_seat();
139 return nullptr;
140}
141
142#if QT_CONFIG(xkbcommon)
144{
145 return m_integration->display()->xkbContext();
146}
147#endif
148
150{
151 if (equalsIgnoringCase(resourceString, "display"))
152 return m_integration->display()->wl_display();
153 if (equalsIgnoringCase(resourceString, "compositor")) {
155 return compositor->object();
156 }
157 if (equalsIgnoringCase(resourceString, "surface")) {
158 QWaylandWindow *w = static_cast<QWaylandWindow*>(window->handle());
159 return w ? w->wlSurface() : nullptr;
160 }
161
164
165#if QT_CONFIG(vulkan)
166 if (equalsIgnoringCase(resourceString, "vksurface")) {
168 // return a pointer to the VkSurfaceKHR value, not the value itself
169 return static_cast<QWaylandVulkanWindow *>(window->handle())->vkSurface();
170 }
171 }
172#endif
173
177
178 return nullptr;
179}
180
182{
184 return ((QWaylandScreen *) screen->handle())->output();
185
186 return nullptr;
187}
188
189#if QT_CONFIG(opengl)
191{
192#if QT_CONFIG(opengl)
195
198
201#endif
202
203 return nullptr;
204}
205#endif // opengl
206
215
221
227
233
239
244
246{
249}
250
251}
252
253QT_END_NAMESPACE
Combined button and popup list for selecting options.
static bool equalsIgnoringCase(QByteArrayView lhs, QByteArrayView rhs)