Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbnativeinterface.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||
2 | ** | - | ||||||
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||
4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||
5 | ** | - | ||||||
6 | ** This file is part of the plugins of the Qt Toolkit. | - | ||||||
7 | ** | - | ||||||
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||
9 | ** Commercial License Usage | - | ||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||
15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||
16 | ** | - | ||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
19 | ** General Public License version 3 as published by the Free Software | - | ||||||
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||
21 | ** packaging of this file. Please review the following information to | - | ||||||
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||
24 | ** | - | ||||||
25 | ** GNU General Public License Usage | - | ||||||
26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||
27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||
28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||
29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||
31 | ** included in the packaging of this file. Please review the following | - | ||||||
32 | ** information to ensure the GNU General Public License requirements will | - | ||||||
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||
35 | ** | - | ||||||
36 | ** $QT_END_LICENSE$ | - | ||||||
37 | ** | - | ||||||
38 | ****************************************************************************/ | - | ||||||
39 | - | |||||||
40 | #include "qxcbnativeinterface.h" | - | ||||||
41 | - | |||||||
42 | #include "qxcbcursor.h" | - | ||||||
43 | #include "qxcbscreen.h" | - | ||||||
44 | #include "qxcbwindow.h" | - | ||||||
45 | #include "qxcbintegration.h" | - | ||||||
46 | #include "qxcbsystemtraytracker.h" | - | ||||||
47 | - | |||||||
48 | #include <private/qguiapplication_p.h> | - | ||||||
49 | #include <QtCore/QMap> | - | ||||||
50 | - | |||||||
51 | #include <QtCore/QDebug> | - | ||||||
52 | - | |||||||
53 | #include <QtGui/qopenglcontext.h> | - | ||||||
54 | #include <QtGui/qscreen.h> | - | ||||||
55 | - | |||||||
56 | #include <QtPlatformHeaders/qxcbwindowfunctions.h> | - | ||||||
57 | #include <QtPlatformHeaders/qxcbintegrationfunctions.h> | - | ||||||
58 | #include <QtPlatformHeaders/qxcbscreenfunctions.h> | - | ||||||
59 | - | |||||||
60 | #ifndef QT_NO_DBUS | - | ||||||
61 | #include "QtPlatformSupport/private/qdbusmenuconnection_p.h" | - | ||||||
62 | #endif | - | ||||||
63 | - | |||||||
64 | #ifdef XCB_USE_XLIB | - | ||||||
65 | # include <X11/Xlib.h> | - | ||||||
66 | #else | - | ||||||
67 | # include <stdio.h> | - | ||||||
68 | #endif | - | ||||||
69 | - | |||||||
70 | #include <algorithm> | - | ||||||
71 | - | |||||||
72 | #include "qxcbnativeinterfacehandler.h" | - | ||||||
73 | - | |||||||
74 | QT_BEGIN_NAMESPACE | - | ||||||
75 | - | |||||||
76 | // return QXcbNativeInterface::ResourceType for the key. | - | ||||||
77 | static int resourceType(const QByteArray &key) | - | ||||||
78 | { | - | ||||||
79 | static const QByteArray names[] = { // match QXcbNativeInterface::ResourceType | - | ||||||
80 | QByteArrayLiteral("display"), | - | ||||||
81 | QByteArrayLiteral("connection"), QByteArrayLiteral("screen"), | - | ||||||
82 | QByteArrayLiteral("apptime"), | - | ||||||
83 | QByteArrayLiteral("appusertime"), QByteArrayLiteral("hintstyle"), | - | ||||||
84 | QByteArrayLiteral("startupid"), QByteArrayLiteral("traywindow"), | - | ||||||
85 | QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen"), | - | ||||||
86 | QByteArrayLiteral("rootwindow"), | - | ||||||
87 | QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingenabled"), | - | ||||||
88 | QByteArrayLiteral("nofonthinting"), | - | ||||||
89 | QByteArrayLiteral("atspibus"), | - | ||||||
90 | QByteArrayLiteral("compositingenabled") | - | ||||||
91 | }; | - | ||||||
92 | const QByteArray *end = names + sizeof(names) / sizeof(names[0]); | - | ||||||
93 | const QByteArray *result = std::find(names, end, key); | - | ||||||
94 | return int(result - names); executed 186 times by 128 tests: return int(result - names); Executed by:
| 186 | ||||||
95 | } | - | ||||||
96 | - | |||||||
97 | QXcbNativeInterface::QXcbNativeInterface() : | - | ||||||
98 | m_genericEventFilterType(QByteArrayLiteral("xcb_generic_event_t")), | - | ||||||
99 | m_sysTraySelectionAtom(XCB_ATOM_NONE) | - | ||||||
100 | { | - | ||||||
101 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||
102 | - | |||||||
103 | static inline QXcbSystemTrayTracker *systemTrayTracker(const QScreen *s) | - | ||||||
104 | { | - | ||||||
105 | if (!s)
| 0-6 | ||||||
106 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
107 | - | |||||||
108 | return static_cast<const QXcbScreen *>(s->handle())->connection()->systemTrayTracker(); executed 6 times by 1 test: return static_cast<const QXcbScreen *>(s->handle())->connection()->systemTrayTracker(); Executed by:
| 6 | ||||||
109 | } | - | ||||||
110 | - | |||||||
111 | bool QXcbNativeInterface::systemTrayAvailable(const QScreen *screen) const | - | ||||||
112 | { | - | ||||||
113 | return systemTrayTracker(screen); never executed: return systemTrayTracker(screen); | 0 | ||||||
114 | } | - | ||||||
115 | - | |||||||
116 | bool QXcbNativeInterface::requestSystemTrayWindowDock(const QWindow *window) | - | ||||||
117 | { | - | ||||||
118 | return QXcbWindow::requestSystemTrayWindowDockStatic(window); never executed: return QXcbWindow::requestSystemTrayWindowDockStatic(window); | 0 | ||||||
119 | } | - | ||||||
120 | - | |||||||
121 | QRect QXcbNativeInterface::systemTrayWindowGlobalGeometry(const QWindow *window) | - | ||||||
122 | { | - | ||||||
123 | return QXcbWindow::systemTrayWindowGlobalGeometryStatic(window); never executed: return QXcbWindow::systemTrayWindowGlobalGeometryStatic(window); | 0 | ||||||
124 | } | - | ||||||
125 | - | |||||||
126 | xcb_window_t QXcbNativeInterface::locateSystemTray(xcb_connection_t *conn, const QXcbScreen *screen) | - | ||||||
127 | { | - | ||||||
128 | if (m_sysTraySelectionAtom == XCB_ATOM_NONE) {
| 0 | ||||||
129 | const QByteArray net_sys_tray = QString::fromLatin1("_NET_SYSTEM_TRAY_S%1").arg(screen->screenNumber()).toLatin1(); | - | ||||||
130 | xcb_intern_atom_cookie_t intern_c = | - | ||||||
131 | xcb_intern_atom_unchecked(conn, true, net_sys_tray.length(), net_sys_tray); | - | ||||||
132 | - | |||||||
133 | xcb_intern_atom_reply_t *intern_r = xcb_intern_atom_reply(conn, intern_c, 0); | - | ||||||
134 | - | |||||||
135 | if (!intern_r)
| 0 | ||||||
136 | return XCB_WINDOW_NONE; never executed: return XCB_WINDOW_NONE; | 0 | ||||||
137 | - | |||||||
138 | m_sysTraySelectionAtom = intern_r->atom; | - | ||||||
139 | free(intern_r); | - | ||||||
140 | } never executed: end of block | 0 | ||||||
141 | - | |||||||
142 | xcb_get_selection_owner_cookie_t sel_owner_c = xcb_get_selection_owner_unchecked(conn, m_sysTraySelectionAtom); | - | ||||||
143 | xcb_get_selection_owner_reply_t *sel_owner_r = xcb_get_selection_owner_reply(conn, sel_owner_c, 0); | - | ||||||
144 | - | |||||||
145 | if (!sel_owner_r)
| 0 | ||||||
146 | return XCB_WINDOW_NONE; never executed: return XCB_WINDOW_NONE; | 0 | ||||||
147 | - | |||||||
148 | xcb_window_t selection_window = sel_owner_r->owner; | - | ||||||
149 | free(sel_owner_r); | - | ||||||
150 | - | |||||||
151 | return selection_window; never executed: return selection_window; | 0 | ||||||
152 | } | - | ||||||
153 | - | |||||||
154 | bool QXcbNativeInterface::systrayVisualHasAlphaChannel() | - | ||||||
155 | { | - | ||||||
156 | return QXcbConnection::xEmbedSystemTrayVisualHasAlphaChannel(); never executed: return QXcbConnection::xEmbedSystemTrayVisualHasAlphaChannel(); | 0 | ||||||
157 | } | - | ||||||
158 | - | |||||||
159 | void QXcbNativeInterface::setParentRelativeBackPixmap(QWindow *window) | - | ||||||
160 | { | - | ||||||
161 | QXcbWindow::setParentRelativeBackPixmapStatic(window); | - | ||||||
162 | } never executed: end of block | 0 | ||||||
163 | - | |||||||
164 | void *QXcbNativeInterface::nativeResourceForIntegration(const QByteArray &resourceString) | - | ||||||
165 | { | - | ||||||
166 | QByteArray lowerCaseResource = resourceString.toLower(); | - | ||||||
167 | void *result = handlerNativeResourceForIntegration(lowerCaseResource); | - | ||||||
168 | if (result)
| 0-180 | ||||||
169 | return result; never executed: return result; | 0 | ||||||
170 | - | |||||||
171 | switch (resourceType(lowerCaseResource)) { | - | ||||||
172 | case StartupId: never executed: case StartupId: | 0 | ||||||
173 | result = startupId(); | - | ||||||
174 | break; never executed: break; | 0 | ||||||
175 | case X11Screen: never executed: case X11Screen: | 0 | ||||||
176 | result = x11Screen(); | - | ||||||
177 | break; never executed: break; | 0 | ||||||
178 | case RootWindow: never executed: case RootWindow: | 0 | ||||||
179 | result = rootWindow(); | - | ||||||
180 | break; never executed: break; | 0 | ||||||
181 | case Display: never executed: case Display: | 0 | ||||||
182 | result = display(); | - | ||||||
183 | break; never executed: break; | 0 | ||||||
184 | case AtspiBus: executed 180 times by 128 tests: case AtspiBus: Executed by:
| 180 | ||||||
185 | result = atspiBus(); | - | ||||||
186 | break; executed 180 times by 128 tests: break; Executed by:
| 180 | ||||||
187 | case Connection: never executed: case Connection: | 0 | ||||||
188 | result = connection(); | - | ||||||
189 | break; never executed: break; | 0 | ||||||
190 | default: never executed: default: | 0 | ||||||
191 | break; never executed: break; | 0 | ||||||
192 | } | - | ||||||
193 | - | |||||||
194 | return result; executed 180 times by 128 tests: return result; Executed by:
| 180 | ||||||
195 | } | - | ||||||
196 | - | |||||||
197 | void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) | - | ||||||
198 | { | - | ||||||
199 | QByteArray lowerCaseResource = resourceString.toLower(); | - | ||||||
200 | void *result = handlerNativeResourceForContext(lowerCaseResource, context); | - | ||||||
201 | return result; never executed: return result; | 0 | ||||||
202 | } | - | ||||||
203 | - | |||||||
204 | void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceString, QScreen *screen) | - | ||||||
205 | { | - | ||||||
206 | if (!screen) {
| 0-6 | ||||||
207 | qWarning("nativeResourceForScreen: null screen"); | - | ||||||
208 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
209 | } | - | ||||||
210 | - | |||||||
211 | QByteArray lowerCaseResource = resourceString.toLower(); | - | ||||||
212 | void *result = handlerNativeResourceForScreen(lowerCaseResource, screen); | - | ||||||
213 | if (result)
| 0-6 | ||||||
214 | return result; never executed: return result; | 0 | ||||||
215 | - | |||||||
216 | const QXcbScreen *xcbScreen = static_cast<QXcbScreen *>(screen->handle()); | - | ||||||
217 | switch (resourceType(lowerCaseResource)) { | - | ||||||
218 | case Display: never executed: case Display: | 0 | ||||||
219 | #ifdef XCB_USE_XLIB | - | ||||||
220 | result = xcbScreen->connection()->xlib_display(); | - | ||||||
221 | #endif | - | ||||||
222 | break; never executed: break; | 0 | ||||||
223 | case AppTime: never executed: case AppTime: | 0 | ||||||
224 | result = appTime(xcbScreen); | - | ||||||
225 | break; never executed: break; | 0 | ||||||
226 | case AppUserTime: never executed: case AppUserTime: | 0 | ||||||
227 | result = appUserTime(xcbScreen); | - | ||||||
228 | break; never executed: break; | 0 | ||||||
229 | case ScreenHintStyle: never executed: case ScreenHintStyle: | 0 | ||||||
230 | result = reinterpret_cast<void *>(xcbScreen->hintStyle() + 1); | - | ||||||
231 | break; never executed: break; | 0 | ||||||
232 | case ScreenSubpixelType: never executed: case ScreenSubpixelType: | 0 | ||||||
233 | result = reinterpret_cast<void *>(xcbScreen->subpixelType() + 1); | - | ||||||
234 | break; never executed: break; | 0 | ||||||
235 | case ScreenAntialiasingEnabled: never executed: case ScreenAntialiasingEnabled: | 0 | ||||||
236 | result = reinterpret_cast<void *>(xcbScreen->antialiasingEnabled() + 1); | - | ||||||
237 | break; never executed: break; | 0 | ||||||
238 | case TrayWindow: executed 6 times by 1 test: case TrayWindow: Executed by:
| 6 | ||||||
239 | if (QXcbSystemTrayTracker *s = systemTrayTracker(screen))
| 0-6 | ||||||
240 | result = (void *)quintptr(s->trayWindow()); executed 6 times by 1 test: result = (void *)quintptr(s->trayWindow()); Executed by:
| 6 | ||||||
241 | break; executed 6 times by 1 test: break; Executed by:
| 6 | ||||||
242 | case GetTimestamp: never executed: case GetTimestamp: | 0 | ||||||
243 | result = getTimestamp(xcbScreen); | - | ||||||
244 | break; never executed: break; | 0 | ||||||
245 | case NoFontHinting: never executed: case NoFontHinting: | 0 | ||||||
246 | result = xcbScreen->noFontHinting() ? this : 0; //qboolptr...
| 0 | ||||||
247 | break; never executed: break; | 0 | ||||||
248 | case RootWindow: never executed: case RootWindow: | 0 | ||||||
249 | result = reinterpret_cast<void *>(xcbScreen->root()); | - | ||||||
250 | break; never executed: break; | 0 | ||||||
251 | case CompositingEnabled: never executed: case CompositingEnabled: | 0 | ||||||
252 | if (QXcbVirtualDesktop *vd = xcbScreen->virtualDesktop())
| 0 | ||||||
253 | result = vd->compositingActive() ? this : Q_NULLPTR; never executed: result = vd->compositingActive() ? this : nullptr;
| 0 | ||||||
254 | break; never executed: break; | 0 | ||||||
255 | default: never executed: default: | 0 | ||||||
256 | break; never executed: break; | 0 | ||||||
257 | } | - | ||||||
258 | return result; executed 6 times by 1 test: return result; Executed by:
| 6 | ||||||
259 | } | - | ||||||
260 | - | |||||||
261 | void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) | - | ||||||
262 | { | - | ||||||
263 | QByteArray lowerCaseResource = resourceString.toLower(); | - | ||||||
264 | void *result = handlerNativeResourceForWindow(lowerCaseResource, window); | - | ||||||
265 | if (result)
| 0 | ||||||
266 | return result; never executed: return result; | 0 | ||||||
267 | - | |||||||
268 | switch (resourceType(lowerCaseResource)) { | - | ||||||
269 | case Display: never executed: case Display: | 0 | ||||||
270 | result = displayForWindow(window); | - | ||||||
271 | break; never executed: break; | 0 | ||||||
272 | case Connection: never executed: case Connection: | 0 | ||||||
273 | result = connectionForWindow(window); | - | ||||||
274 | break; never executed: break; | 0 | ||||||
275 | case Screen: never executed: case Screen: | 0 | ||||||
276 | result = screenForWindow(window); | - | ||||||
277 | break; never executed: break; | 0 | ||||||
278 | default: never executed: default: | 0 | ||||||
279 | break; never executed: break; | 0 | ||||||
280 | } | - | ||||||
281 | - | |||||||
282 | return result; never executed: return result; | 0 | ||||||
283 | } | - | ||||||
284 | - | |||||||
285 | void *QXcbNativeInterface::nativeResourceForBackingStore(const QByteArray &resourceString, QBackingStore *backingStore) | - | ||||||
286 | { | - | ||||||
287 | const QByteArray lowerCaseResource = resourceString.toLower(); | - | ||||||
288 | void *result = handlerNativeResourceForBackingStore(lowerCaseResource,backingStore); | - | ||||||
289 | return result; never executed: return result; | 0 | ||||||
290 | } | - | ||||||
291 | - | |||||||
292 | #ifndef QT_NO_CURSOR | - | ||||||
293 | void *QXcbNativeInterface::nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) | - | ||||||
294 | { | - | ||||||
295 | if (resource == QByteArrayLiteral("xcbcursor")) { never executed: return ba;
| 0 | ||||||
296 | if (const QScreen *primaryScreen = QGuiApplication::primaryScreen()) {
| 0 | ||||||
297 | if (const QPlatformCursor *pCursor= primaryScreen->handle()->cursor()) {
| 0 | ||||||
298 | xcb_cursor_t xcbCursor = static_cast<const QXcbCursor *>(pCursor)->xcbCursor(cursor); | - | ||||||
299 | return reinterpret_cast<void *>(quintptr(xcbCursor)); never executed: return reinterpret_cast<void *>(quintptr(xcbCursor)); | 0 | ||||||
300 | } | - | ||||||
301 | } never executed: end of block | 0 | ||||||
302 | } never executed: end of block | 0 | ||||||
303 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
304 | } | - | ||||||
305 | #endif // !QT_NO_CURSOR | - | ||||||
306 | - | |||||||
307 | QPlatformNativeInterface::NativeResourceForIntegrationFunction QXcbNativeInterface::nativeResourceFunctionForIntegration(const QByteArray &resource) | - | ||||||
308 | { | - | ||||||
309 | const QByteArray lowerCaseResource = resource.toLower(); | - | ||||||
310 | QPlatformNativeInterface::NativeResourceForIntegrationFunction func = handlerNativeResourceFunctionForIntegration(lowerCaseResource); | - | ||||||
311 | if (func)
| 0 | ||||||
312 | return func; never executed: return func; | 0 | ||||||
313 | - | |||||||
314 | if (lowerCaseResource == "setstartupid")
| 0 | ||||||
315 | return NativeResourceForIntegrationFunction(setStartupId); never executed: return NativeResourceForIntegrationFunction(setStartupId); | 0 | ||||||
316 | return 0; never executed: return 0; | 0 | ||||||
317 | } | - | ||||||
318 | - | |||||||
319 | QPlatformNativeInterface::NativeResourceForContextFunction QXcbNativeInterface::nativeResourceFunctionForContext(const QByteArray &resource) | - | ||||||
320 | { | - | ||||||
321 | const QByteArray lowerCaseResource = resource.toLower(); | - | ||||||
322 | QPlatformNativeInterface::NativeResourceForContextFunction func = handlerNativeResourceFunctionForContext(lowerCaseResource); | - | ||||||
323 | if (func)
| 0 | ||||||
324 | return func; never executed: return func; | 0 | ||||||
325 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
326 | } | - | ||||||
327 | - | |||||||
328 | QPlatformNativeInterface::NativeResourceForScreenFunction QXcbNativeInterface::nativeResourceFunctionForScreen(const QByteArray &resource) | - | ||||||
329 | { | - | ||||||
330 | const QByteArray lowerCaseResource = resource.toLower(); | - | ||||||
331 | NativeResourceForScreenFunction func = handlerNativeResourceFunctionForScreen(lowerCaseResource); | - | ||||||
332 | if (func)
| 0 | ||||||
333 | return func; never executed: return func; | 0 | ||||||
334 | - | |||||||
335 | if (lowerCaseResource == "setapptime")
| 0 | ||||||
336 | return NativeResourceForScreenFunction(setAppTime); never executed: return NativeResourceForScreenFunction(setAppTime); | 0 | ||||||
337 | else if (lowerCaseResource == "setappusertime")
| 0 | ||||||
338 | return NativeResourceForScreenFunction(setAppUserTime); never executed: return NativeResourceForScreenFunction(setAppUserTime); | 0 | ||||||
339 | return 0; never executed: return 0; | 0 | ||||||
340 | } | - | ||||||
341 | - | |||||||
342 | QPlatformNativeInterface::NativeResourceForWindowFunction QXcbNativeInterface::nativeResourceFunctionForWindow(const QByteArray &resource) | - | ||||||
343 | { | - | ||||||
344 | const QByteArray lowerCaseResource = resource.toLower(); | - | ||||||
345 | NativeResourceForWindowFunction func = handlerNativeResourceFunctionForWindow(lowerCaseResource); | - | ||||||
346 | return func; never executed: return func; | 0 | ||||||
347 | } | - | ||||||
348 | - | |||||||
349 | QPlatformNativeInterface::NativeResourceForBackingStoreFunction QXcbNativeInterface::nativeResourceFunctionForBackingStore(const QByteArray &resource) | - | ||||||
350 | { | - | ||||||
351 | const QByteArray lowerCaseResource = resource.toLower(); | - | ||||||
352 | NativeResourceForBackingStoreFunction func = handlerNativeResourceFunctionForBackingStore(resource); | - | ||||||
353 | return func; never executed: return func; | 0 | ||||||
354 | } | - | ||||||
355 | - | |||||||
356 | QFunctionPointer QXcbNativeInterface::platformFunction(const QByteArray &function) const | - | ||||||
357 | { | - | ||||||
358 | const QByteArray lowerCaseFunction = function.toLower(); | - | ||||||
359 | QFunctionPointer func = handlerPlatformFunction(lowerCaseFunction); | - | ||||||
360 | if (func)
| 0-4671 | ||||||
361 | return func; never executed: return func; | 0 | ||||||
362 | - | |||||||
363 | //case sensitive | - | ||||||
364 | if (function == QXcbWindowFunctions::setWmWindowTypeIdentifier())
| 154-4517 | ||||||
365 | return QFunctionPointer(QXcbWindowFunctions::SetWmWindowType(QXcbWindow::setWmWindowTypeStatic)); executed 154 times by 23 tests: return QFunctionPointer(QXcbWindowFunctions::SetWmWindowType(QXcbWindow::setWmWindowTypeStatic)); Executed by:
| 154 | ||||||
366 | - | |||||||
367 | if (function == QXcbWindowFunctions::setWmWindowRoleIdentifier())
| 0-4517 | ||||||
368 | return QFunctionPointer(QXcbWindowFunctions::SetWmWindowRole(QXcbWindow::setWmWindowRoleStatic)); never executed: return QFunctionPointer(QXcbWindowFunctions::SetWmWindowRole(QXcbWindow::setWmWindowRoleStatic)); | 0 | ||||||
369 | - | |||||||
370 | if (function == QXcbWindowFunctions::setWmWindowIconTextIdentifier())
| 10-4507 | ||||||
371 | return QFunctionPointer(QXcbWindowFunctions::SetWmWindowIconText(QXcbWindow::setWindowIconTextStatic)); executed 4507 times by 117 tests: return QFunctionPointer(QXcbWindowFunctions::SetWmWindowIconText(QXcbWindow::setWindowIconTextStatic)); Executed by:
| 4507 | ||||||
372 | - | |||||||
373 | if (function == QXcbWindowFunctions::setParentRelativeBackPixmapIdentifier())
| 0-10 | ||||||
374 | return QFunctionPointer(QXcbWindowFunctions::SetParentRelativeBackPixmap(QXcbWindow::setParentRelativeBackPixmapStatic)); never executed: return QFunctionPointer(QXcbWindowFunctions::SetParentRelativeBackPixmap(QXcbWindow::setParentRelativeBackPixmapStatic)); | 0 | ||||||
375 | - | |||||||
376 | if (function == QXcbWindowFunctions::requestSystemTrayWindowDockIdentifier())
| 3-7 | ||||||
377 | return QFunctionPointer(QXcbWindowFunctions::RequestSystemTrayWindowDock(QXcbWindow::requestSystemTrayWindowDockStatic)); executed 3 times by 1 test: return QFunctionPointer(QXcbWindowFunctions::RequestSystemTrayWindowDock(QXcbWindow::requestSystemTrayWindowDockStatic)); Executed by:
| 3 | ||||||
378 | - | |||||||
379 | if (function == QXcbWindowFunctions::systemTrayWindowGlobalGeometryIdentifier())
| 3-4 | ||||||
380 | return QFunctionPointer(QXcbWindowFunctions::SystemTrayWindowGlobalGeometry(QXcbWindow::systemTrayWindowGlobalGeometryStatic)); executed 4 times by 1 test: return QFunctionPointer(QXcbWindowFunctions::SystemTrayWindowGlobalGeometry(QXcbWindow::systemTrayWindowGlobalGeometryStatic)); Executed by:
| 4 | ||||||
381 | - | |||||||
382 | if (function == QXcbIntegrationFunctions::xEmbedSystemTrayVisualHasAlphaChannelIdentifier())
| 0-3 | ||||||
383 | return QFunctionPointer(QXcbIntegrationFunctions::XEmbedSystemTrayVisualHasAlphaChannel(QXcbConnection::xEmbedSystemTrayVisualHasAlphaChannel)); executed 3 times by 1 test: return QFunctionPointer(QXcbIntegrationFunctions::XEmbedSystemTrayVisualHasAlphaChannel(QXcbConnection::xEmbedSystemTrayVisualHasAlphaChannel)); Executed by:
| 3 | ||||||
384 | - | |||||||
385 | if (function == QXcbWindowFunctions::visualIdIdentifier()) {
| 0 | ||||||
386 | return QFunctionPointer(QXcbWindowFunctions::VisualId(QXcbWindow::visualIdStatic)); never executed: return QFunctionPointer(QXcbWindowFunctions::VisualId(QXcbWindow::visualIdStatic)); | 0 | ||||||
387 | } | - | ||||||
388 | - | |||||||
389 | if (function == QXcbScreenFunctions::virtualDesktopNumberIdentifier())
| 0 | ||||||
390 | return QFunctionPointer(QXcbScreenFunctions::VirtualDesktopNumber(QXcbScreen::virtualDesktopNumberStatic)); never executed: return QFunctionPointer(QXcbScreenFunctions::VirtualDesktopNumber(QXcbScreen::virtualDesktopNumberStatic)); | 0 | ||||||
391 | - | |||||||
392 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
393 | } | - | ||||||
394 | - | |||||||
395 | void *QXcbNativeInterface::appTime(const QXcbScreen *screen) | - | ||||||
396 | { | - | ||||||
397 | if (!screen)
| 0 | ||||||
398 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
399 | - | |||||||
400 | return reinterpret_cast<void *>(quintptr(screen->connection()->time())); never executed: return reinterpret_cast<void *>(quintptr(screen->connection()->time())); | 0 | ||||||
401 | } | - | ||||||
402 | - | |||||||
403 | void *QXcbNativeInterface::appUserTime(const QXcbScreen *screen) | - | ||||||
404 | { | - | ||||||
405 | if (!screen)
| 0 | ||||||
406 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
407 | - | |||||||
408 | return reinterpret_cast<void *>(quintptr(screen->connection()->netWmUserTime())); never executed: return reinterpret_cast<void *>(quintptr(screen->connection()->netWmUserTime())); | 0 | ||||||
409 | } | - | ||||||
410 | - | |||||||
411 | void *QXcbNativeInterface::getTimestamp(const QXcbScreen *screen) | - | ||||||
412 | { | - | ||||||
413 | if (!screen)
| 0 | ||||||
414 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
415 | - | |||||||
416 | return reinterpret_cast<void *>(quintptr(screen->connection()->getTimestamp())); never executed: return reinterpret_cast<void *>(quintptr(screen->connection()->getTimestamp())); | 0 | ||||||
417 | } | - | ||||||
418 | - | |||||||
419 | void *QXcbNativeInterface::startupId() | - | ||||||
420 | { | - | ||||||
421 | QXcbIntegration* integration = QXcbIntegration::instance(); | - | ||||||
422 | QXcbConnection *defaultConnection = integration->defaultConnection(); | - | ||||||
423 | if (defaultConnection)
| 0 | ||||||
424 | return reinterpret_cast<void *>(const_cast<char *>(defaultConnection->startupId().constData())); never executed: return reinterpret_cast<void *>(const_cast<char *>(defaultConnection->startupId().constData())); | 0 | ||||||
425 | return 0; never executed: return 0; | 0 | ||||||
426 | } | - | ||||||
427 | - | |||||||
428 | void *QXcbNativeInterface::x11Screen() | - | ||||||
429 | { | - | ||||||
430 | QXcbIntegration *integration = QXcbIntegration::instance(); | - | ||||||
431 | QXcbConnection *defaultConnection = integration->defaultConnection(); | - | ||||||
432 | if (defaultConnection)
| 0 | ||||||
433 | return reinterpret_cast<void *>(defaultConnection->primaryScreenNumber()); never executed: return reinterpret_cast<void *>(defaultConnection->primaryScreenNumber()); | 0 | ||||||
434 | return 0; never executed: return 0; | 0 | ||||||
435 | } | - | ||||||
436 | - | |||||||
437 | void *QXcbNativeInterface::rootWindow() | - | ||||||
438 | { | - | ||||||
439 | QXcbIntegration *integration = QXcbIntegration::instance(); | - | ||||||
440 | QXcbConnection *defaultConnection = integration->defaultConnection(); | - | ||||||
441 | if (defaultConnection)
| 0 | ||||||
442 | return reinterpret_cast<void *>(defaultConnection->rootWindow()); never executed: return reinterpret_cast<void *>(defaultConnection->rootWindow()); | 0 | ||||||
443 | return 0; never executed: return 0; | 0 | ||||||
444 | } | - | ||||||
445 | - | |||||||
446 | void *QXcbNativeInterface::display() | - | ||||||
447 | { | - | ||||||
448 | #ifdef XCB_USE_XLIB | - | ||||||
449 | QXcbIntegration *integration = QXcbIntegration::instance(); | - | ||||||
450 | QXcbConnection *defaultConnection = integration->defaultConnection(); | - | ||||||
451 | if (defaultConnection)
| 0 | ||||||
452 | return defaultConnection->xlib_display(); never executed: return defaultConnection->xlib_display(); | 0 | ||||||
453 | #endif | - | ||||||
454 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
455 | } | - | ||||||
456 | - | |||||||
457 | void *QXcbNativeInterface::connection() | - | ||||||
458 | { | - | ||||||
459 | QXcbIntegration *integration = QXcbIntegration::instance(); | - | ||||||
460 | return integration->defaultConnection()->xcb_connection(); never executed: return integration->defaultConnection()->xcb_connection(); | 0 | ||||||
461 | } | - | ||||||
462 | - | |||||||
463 | void *QXcbNativeInterface::atspiBus() | - | ||||||
464 | { | - | ||||||
465 | QXcbIntegration *integration = static_cast<QXcbIntegration *>(QGuiApplicationPrivate::platformIntegration()); | - | ||||||
466 | QXcbConnection *defaultConnection = integration->defaultConnection(); | - | ||||||
467 | if (defaultConnection) {
| 0-180 | ||||||
468 | xcb_atom_t atspiBusAtom = defaultConnection->internAtom("AT_SPI_BUS"); | - | ||||||
469 | xcb_get_property_cookie_t cookie = Q_XCB_CALL2(xcb_get_property( | - | ||||||
470 | defaultConnection->xcb_connection(), | - | ||||||
471 | false, defaultConnection->rootWindow(), | - | ||||||
472 | atspiBusAtom, XCB_ATOM_STRING, 0, 128), | - | ||||||
473 | defaultConnection); | - | ||||||
474 | xcb_get_property_reply_t *reply = Q_XCB_CALL2(xcb_get_property_reply( | - | ||||||
475 | defaultConnection->xcb_connection(), | - | ||||||
476 | cookie, 0), | - | ||||||
477 | defaultConnection); | - | ||||||
478 | Q_ASSERT(!reply->bytes_after); | - | ||||||
479 | char *data = (char *)xcb_get_property_value(reply); | - | ||||||
480 | int length = xcb_get_property_value_length(reply); | - | ||||||
481 | QByteArray *busAddress = new QByteArray(data, length); | - | ||||||
482 | free(reply); | - | ||||||
483 | return busAddress; executed 180 times by 128 tests: return busAddress; Executed by:
| 180 | ||||||
484 | } | - | ||||||
485 | return 0; never executed: return 0; | 0 | ||||||
486 | } | - | ||||||
487 | - | |||||||
488 | void QXcbNativeInterface::setAppTime(QScreen* screen, xcb_timestamp_t time) | - | ||||||
489 | { | - | ||||||
490 | if (screen) {
| 0 | ||||||
491 | static_cast<QXcbScreen *>(screen->handle())->connection()->setTime(time); | - | ||||||
492 | } never executed: end of block | 0 | ||||||
493 | } never executed: end of block | 0 | ||||||
494 | - | |||||||
495 | void QXcbNativeInterface::setAppUserTime(QScreen* screen, xcb_timestamp_t time) | - | ||||||
496 | { | - | ||||||
497 | if (screen) {
| 0 | ||||||
498 | static_cast<QXcbScreen *>(screen->handle())->connection()->setNetWmUserTime(time); | - | ||||||
499 | } never executed: end of block | 0 | ||||||
500 | } never executed: end of block | 0 | ||||||
501 | - | |||||||
502 | void QXcbNativeInterface::setStartupId(const char *data) | - | ||||||
503 | { | - | ||||||
504 | QByteArray startupId(data); | - | ||||||
505 | QXcbIntegration *integration = QXcbIntegration::instance(); | - | ||||||
506 | QXcbConnection *defaultConnection = integration->defaultConnection(); | - | ||||||
507 | if (defaultConnection)
| 0 | ||||||
508 | defaultConnection->setStartupId(startupId); never executed: defaultConnection->setStartupId(startupId); | 0 | ||||||
509 | } never executed: end of block | 0 | ||||||
510 | - | |||||||
511 | QXcbScreen *QXcbNativeInterface::qPlatformScreenForWindow(QWindow *window) | - | ||||||
512 | { | - | ||||||
513 | QXcbScreen *screen; | - | ||||||
514 | if (window) {
| 0 | ||||||
515 | QScreen *qs = window->screen(); | - | ||||||
516 | screen = static_cast<QXcbScreen *>(qs ? qs->handle() : Q_NULLPTR); | - | ||||||
517 | } else { never executed: end of block | 0 | ||||||
518 | QScreen *qs = QGuiApplication::primaryScreen(); | - | ||||||
519 | screen = static_cast<QXcbScreen *>(qs ? qs->handle() : Q_NULLPTR); | - | ||||||
520 | } never executed: end of block | 0 | ||||||
521 | return screen; never executed: return screen; | 0 | ||||||
522 | } | - | ||||||
523 | - | |||||||
524 | void *QXcbNativeInterface::displayForWindow(QWindow *window) | - | ||||||
525 | { | - | ||||||
526 | #if defined(XCB_USE_XLIB) | - | ||||||
527 | QXcbScreen *screen = qPlatformScreenForWindow(window); | - | ||||||
528 | return screen ? screen->connection()->xlib_display() : Q_NULLPTR; never executed: return screen ? screen->connection()->xlib_display() : nullptr; | 0 | ||||||
529 | #else | - | ||||||
530 | Q_UNUSED(window); | - | ||||||
531 | return Q_NULLPTR; | - | ||||||
532 | #endif | - | ||||||
533 | } | - | ||||||
534 | - | |||||||
535 | void *QXcbNativeInterface::connectionForWindow(QWindow *window) | - | ||||||
536 | { | - | ||||||
537 | QXcbScreen *screen = qPlatformScreenForWindow(window); | - | ||||||
538 | return screen ? screen->xcb_connection() : Q_NULLPTR; never executed: return screen ? screen->xcb_connection() : nullptr; | 0 | ||||||
539 | } | - | ||||||
540 | - | |||||||
541 | void *QXcbNativeInterface::screenForWindow(QWindow *window) | - | ||||||
542 | { | - | ||||||
543 | QXcbScreen *screen = qPlatformScreenForWindow(window); | - | ||||||
544 | return screen ? screen->screen() : Q_NULLPTR; never executed: return screen ? screen->screen() : nullptr; | 0 | ||||||
545 | } | - | ||||||
546 | - | |||||||
547 | void QXcbNativeInterface::addHandler(QXcbNativeInterfaceHandler *handler) | - | ||||||
548 | { | - | ||||||
549 | m_handlers.removeAll(handler); | - | ||||||
550 | m_handlers.prepend(handler); | - | ||||||
551 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||
552 | - | |||||||
553 | void QXcbNativeInterface::removeHandler(QXcbNativeInterfaceHandler *handler) | - | ||||||
554 | { | - | ||||||
555 | m_handlers.removeAll(handler); | - | ||||||
556 | } executed 347 times by 219 tests: end of block Executed by:
| 347 | ||||||
557 | - | |||||||
558 | QPlatformNativeInterface::NativeResourceForIntegrationFunction QXcbNativeInterface::handlerNativeResourceFunctionForIntegration(const QByteArray &resource) const | - | ||||||
559 | { | - | ||||||
560 | for (int i = 0; i < m_handlers.size(); i++) {
| 180 | ||||||
561 | QXcbNativeInterfaceHandler *handler = m_handlers.at(i); | - | ||||||
562 | NativeResourceForIntegrationFunction result = handler->nativeResourceFunctionForIntegration(resource); | - | ||||||
563 | if (result)
| 0-180 | ||||||
564 | return result; never executed: return result; | 0 | ||||||
565 | } executed 180 times by 128 tests: end of block Executed by:
| 180 | ||||||
566 | return Q_NULLPTR; executed 180 times by 128 tests: return nullptr; Executed by:
| 180 | ||||||
567 | } | - | ||||||
568 | - | |||||||
569 | QPlatformNativeInterface::NativeResourceForContextFunction QXcbNativeInterface::handlerNativeResourceFunctionForContext(const QByteArray &resource) const | - | ||||||
570 | { | - | ||||||
571 | for (int i = 0; i < m_handlers.size(); i++) {
| 0 | ||||||
572 | QXcbNativeInterfaceHandler *handler = m_handlers.at(i); | - | ||||||
573 | NativeResourceForContextFunction result = handler->nativeResourceFunctionForContext(resource); | - | ||||||
574 | if (result)
| 0 | ||||||
575 | return result; never executed: return result; | 0 | ||||||
576 | } never executed: end of block | 0 | ||||||
577 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
578 | } | - | ||||||
579 | - | |||||||
580 | QPlatformNativeInterface::NativeResourceForScreenFunction QXcbNativeInterface::handlerNativeResourceFunctionForScreen(const QByteArray &resource) const | - | ||||||
581 | { | - | ||||||
582 | for (int i = 0; i < m_handlers.size(); i++) {
| 6 | ||||||
583 | QXcbNativeInterfaceHandler *handler = m_handlers.at(i); | - | ||||||
584 | NativeResourceForScreenFunction result = handler->nativeResourceFunctionForScreen(resource); | - | ||||||
585 | if (result)
| 0-6 | ||||||
586 | return result; never executed: return result; | 0 | ||||||
587 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||
588 | return Q_NULLPTR; executed 6 times by 1 test: return nullptr; Executed by:
| 6 | ||||||
589 | } | - | ||||||
590 | - | |||||||
591 | QPlatformNativeInterface::NativeResourceForWindowFunction QXcbNativeInterface::handlerNativeResourceFunctionForWindow(const QByteArray &resource) const | - | ||||||
592 | { | - | ||||||
593 | for (int i = 0; i < m_handlers.size(); i++) {
| 0 | ||||||
594 | QXcbNativeInterfaceHandler *handler = m_handlers.at(i); | - | ||||||
595 | NativeResourceForWindowFunction result = handler->nativeResourceFunctionForWindow(resource); | - | ||||||
596 | if (result)
| 0 | ||||||
597 | return result; never executed: return result; | 0 | ||||||
598 | } never executed: end of block | 0 | ||||||
599 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
600 | } | - | ||||||
601 | - | |||||||
602 | QPlatformNativeInterface::NativeResourceForBackingStoreFunction QXcbNativeInterface::handlerNativeResourceFunctionForBackingStore(const QByteArray &resource) const | - | ||||||
603 | { | - | ||||||
604 | for (int i = 0; i < m_handlers.size(); i++) {
| 0 | ||||||
605 | QXcbNativeInterfaceHandler *handler = m_handlers.at(i); | - | ||||||
606 | NativeResourceForBackingStoreFunction result = handler->nativeResourceFunctionForBackingStore(resource); | - | ||||||
607 | if (result)
| 0 | ||||||
608 | return result; never executed: return result; | 0 | ||||||
609 | } never executed: end of block | 0 | ||||||
610 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
611 | } | - | ||||||
612 | - | |||||||
613 | QFunctionPointer QXcbNativeInterface::handlerPlatformFunction(const QByteArray &function) const | - | ||||||
614 | { | - | ||||||
615 | for (int i = 0; i < m_handlers.size(); i++) {
| 4671 | ||||||
616 | QXcbNativeInterfaceHandler *handler = m_handlers.at(i); | - | ||||||
617 | QFunctionPointer func = handler->platformFunction(function); | - | ||||||
618 | if (func)
| 0-4671 | ||||||
619 | return func; never executed: return func; | 0 | ||||||
620 | } executed 4671 times by 117 tests: end of block Executed by:
| 4671 | ||||||
621 | return Q_NULLPTR; executed 4671 times by 117 tests: return nullptr; Executed by:
| 4671 | ||||||
622 | } | - | ||||||
623 | - | |||||||
624 | void *QXcbNativeInterface::handlerNativeResourceForIntegration(const QByteArray &resource) const | - | ||||||
625 | { | - | ||||||
626 | NativeResourceForIntegrationFunction func = handlerNativeResourceFunctionForIntegration(resource); | - | ||||||
627 | if (func)
| 0-180 | ||||||
628 | return func(); never executed: return func(); | 0 | ||||||
629 | return Q_NULLPTR; executed 180 times by 128 tests: return nullptr; Executed by:
| 180 | ||||||
630 | } | - | ||||||
631 | - | |||||||
632 | void *QXcbNativeInterface::handlerNativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) const | - | ||||||
633 | { | - | ||||||
634 | NativeResourceForContextFunction func = handlerNativeResourceFunctionForContext(resource); | - | ||||||
635 | if (func)
| 0 | ||||||
636 | return func(context); never executed: return func(context); | 0 | ||||||
637 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
638 | } | - | ||||||
639 | - | |||||||
640 | void *QXcbNativeInterface::handlerNativeResourceForScreen(const QByteArray &resource, QScreen *screen) const | - | ||||||
641 | { | - | ||||||
642 | NativeResourceForScreenFunction func = handlerNativeResourceFunctionForScreen(resource); | - | ||||||
643 | if (func)
| 0-6 | ||||||
644 | return func(screen); never executed: return func(screen); | 0 | ||||||
645 | return Q_NULLPTR; executed 6 times by 1 test: return nullptr; Executed by:
| 6 | ||||||
646 | } | - | ||||||
647 | - | |||||||
648 | void *QXcbNativeInterface::handlerNativeResourceForWindow(const QByteArray &resource, QWindow *window) const | - | ||||||
649 | { | - | ||||||
650 | NativeResourceForWindowFunction func = handlerNativeResourceFunctionForWindow(resource); | - | ||||||
651 | if (func)
| 0 | ||||||
652 | return func(window); never executed: return func(window); | 0 | ||||||
653 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
654 | } | - | ||||||
655 | - | |||||||
656 | void *QXcbNativeInterface::handlerNativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) const | - | ||||||
657 | { | - | ||||||
658 | NativeResourceForBackingStoreFunction func = handlerNativeResourceFunctionForBackingStore(resource); | - | ||||||
659 | if (func)
| 0 | ||||||
660 | return func(backingStore); never executed: return func(backingStore); | 0 | ||||||
661 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||
662 | } | - | ||||||
663 | - | |||||||
664 | QT_END_NAMESPACE | - | ||||||
Source code | Switch to Preprocessed file |