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