Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbconnection.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | - | |||||||||||||||||||
9 | - | |||||||||||||||||||
10 | - | |||||||||||||||||||
11 | - | |||||||||||||||||||
12 | - | |||||||||||||||||||
13 | - | |||||||||||||||||||
14 | - | |||||||||||||||||||
15 | - | |||||||||||||||||||
16 | - | |||||||||||||||||||
17 | - | |||||||||||||||||||
18 | - | |||||||||||||||||||
19 | - | |||||||||||||||||||
20 | - | |||||||||||||||||||
21 | static xcb_generic_event_t *local_xcb_poll_for_queued_event(xcb_connection_t *c) | - | ||||||||||||||||||
22 | __attribute__((weakref("xcb_poll_for_queued_event"))); | - | ||||||||||||||||||
23 | - | |||||||||||||||||||
24 | static inline void checkXcbPollForQueuedEvent() | - | ||||||||||||||||||
25 | { } | - | ||||||||||||||||||
26 | - | |||||||||||||||||||
27 | - | |||||||||||||||||||
28 | const QLoggingCategory &lcQpaXInput() { static const QLoggingCategory category("qt.qpa.input"); return category; } | - | ||||||||||||||||||
29 | const QLoggingCategory &lcQpaXInputDevices() { static const QLoggingCategory category("qt.qpa.input.devices"); return category; } | - | ||||||||||||||||||
30 | const QLoggingCategory &lcQpaXInputEvents() { static const QLoggingCategory category("qt.qpa.input.events"); return category; } | - | ||||||||||||||||||
31 | const QLoggingCategory &lcQpaScreen() { static const QLoggingCategory category("qt.qpa.screen"); return category; } | - | ||||||||||||||||||
32 | typedef struct qt_xcb_ge_event_t { | - | ||||||||||||||||||
33 | uint8_t response_type; | - | ||||||||||||||||||
34 | uint8_t extension; | - | ||||||||||||||||||
35 | uint16_t sequence; | - | ||||||||||||||||||
36 | uint32_t length; | - | ||||||||||||||||||
37 | uint16_t event_type; | - | ||||||||||||||||||
38 | } qt_xcb_ge_event_t; | - | ||||||||||||||||||
39 | - | |||||||||||||||||||
40 | static inline bool isXIEvent(xcb_generic_event_t *event, int opCode) | - | ||||||||||||||||||
41 | { | - | ||||||||||||||||||
42 | qt_xcb_ge_event_t *e = (qt_xcb_ge_event_t *)event; | - | ||||||||||||||||||
43 | return e->extension == opCode; | - | ||||||||||||||||||
44 | } | - | ||||||||||||||||||
45 | - | |||||||||||||||||||
46 | - | |||||||||||||||||||
47 | - | |||||||||||||||||||
48 | static const char * const xcbConnectionErrors[] = { | - | ||||||||||||||||||
49 | "No error", | - | ||||||||||||||||||
50 | "I/O error", | - | ||||||||||||||||||
51 | "Unsupported extension used", | - | ||||||||||||||||||
52 | "Out of memory", | - | ||||||||||||||||||
53 | "Maximum allowed requested length exceeded", | - | ||||||||||||||||||
54 | "Failed to parse display string", | - | ||||||||||||||||||
55 | "No such screen on display", | - | ||||||||||||||||||
56 | "Error during FD passing" | - | ||||||||||||||||||
57 | }; | - | ||||||||||||||||||
58 | - | |||||||||||||||||||
59 | static int nullErrorHandler(Display *, XErrorEvent *) | - | ||||||||||||||||||
60 | { | - | ||||||||||||||||||
61 | return 0; | - | ||||||||||||||||||
62 | } | - | ||||||||||||||||||
63 | - | |||||||||||||||||||
64 | static int ioErrorHandler(Display *dpy) | - | ||||||||||||||||||
65 | { | - | ||||||||||||||||||
66 | xcb_connection_t *conn = XGetXCBConnection(dpy); | - | ||||||||||||||||||
67 | if (conn != __null) { | - | ||||||||||||||||||
68 | - | |||||||||||||||||||
69 | int code = xcb_connection_has_error(conn); | - | ||||||||||||||||||
70 | const char *str = "Unknown error"; | - | ||||||||||||||||||
71 | int arrayLength = sizeof(xcbConnectionErrors) / sizeof(xcbConnectionErrors[0]); | - | ||||||||||||||||||
72 | if (code >= 0 && code < arrayLength) | - | ||||||||||||||||||
73 | str = xcbConnectionErrors[code]; | - | ||||||||||||||||||
74 | - | |||||||||||||||||||
75 | QMessageLogger(__FILE__, 161167, __PRETTY_FUNCTION__).warning("The X11 connection broke: %s (code %d)", str, code); | - | ||||||||||||||||||
76 | } | - | ||||||||||||||||||
77 | return _XDefaultIOError(dpy); | - | ||||||||||||||||||
78 | } | - | ||||||||||||||||||
79 | - | |||||||||||||||||||
80 | - | |||||||||||||||||||
81 | QXcbScreen* QXcbConnection::findScreenForCrtc(xcb_window_t rootWindow, xcb_randr_crtc_t crtc) const | - | ||||||||||||||||||
82 | { | - | ||||||||||||||||||
83 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_screens)>::type> _container_((m_screens)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (QXcbScreen *screen = *_container_.i; _container_.control; _container_.control = 0: m_screens) { | - | ||||||||||||||||||
84 | if (screen->root() == rootWindow
| 0 | ||||||||||||||||||
85 | return never executed: screen;return screen; never executed: return screen; | 0 | ||||||||||||||||||
86 | } never executed: end of block | 0 | ||||||||||||||||||
87 | - | |||||||||||||||||||
88 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
89 | } | - | ||||||||||||||||||
90 | - | |||||||||||||||||||
91 | QXcbScreen* QXcbConnection::findScreenForOutput(xcb_window_t rootWindow, xcb_randr_output_t output) const | - | ||||||||||||||||||
92 | { | - | ||||||||||||||||||
93 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_screens)>::type> _container_((m_screens)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (QXcbScreen *screen = *_container_.i; _container_.control; _container_.control = 0: m_screens) { | - | ||||||||||||||||||
94 | if (screen->root() == rootWindow
| 0 | ||||||||||||||||||
95 | return never executed: screen;return screen; never executed: return screen; | 0 | ||||||||||||||||||
96 | } never executed: end of block | 0 | ||||||||||||||||||
97 | - | |||||||||||||||||||
98 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
99 | } | - | ||||||||||||||||||
100 | - | |||||||||||||||||||
101 | QXcbVirtualDesktop* QXcbConnection::virtualDesktopForRootWindow(xcb_window_t rootWindow) const | - | ||||||||||||||||||
102 | { | - | ||||||||||||||||||
103 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_virtualDesktops)>::type> _container_((m_virtualDesktops)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (QXcbVirtualDesktop *virtualDesktop = *_container_.i; _container_.control; _container_.control = 0: m_virtualDesktops) { | - | ||||||||||||||||||
104 | if (virtualDesktop->screen()->root == rootWindow
| 0 | ||||||||||||||||||
105 | return never executed: virtualDesktop;return virtualDesktop; never executed: return virtualDesktop; | 0 | ||||||||||||||||||
106 | } never executed: end of block | 0 | ||||||||||||||||||
107 | - | |||||||||||||||||||
108 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
109 | } | - | ||||||||||||||||||
110 | - | |||||||||||||||||||
111 | - | |||||||||||||||||||
112 | - | |||||||||||||||||||
113 | - | |||||||||||||||||||
114 | void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event) | - | ||||||||||||||||||
115 | { | - | ||||||||||||||||||
116 | if (event->subCode == XCB_RANDR_NOTIFY_CRTC_CHANGE
| 0 | ||||||||||||||||||
117 | xcb_randr_crtc_change_t crtc = event->u.cc; | - | ||||||||||||||||||
118 | QXcbVirtualDesktop *virtualDesktop = virtualDesktopForRootWindow(crtc.window); | - | ||||||||||||||||||
119 | if (!virtualDesktop
| 0 | ||||||||||||||||||
120 | - | |||||||||||||||||||
121 | return; never executed: return; | 0 | ||||||||||||||||||
122 | - | |||||||||||||||||||
123 | QXcbScreen *screen = findScreenForCrtc(crtc.window, crtc.crtc); | - | ||||||||||||||||||
124 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 216, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "QXcbConnection: XCB_RANDR_NOTIFY_CRTC_CHANGE:" << crtc.crtc << "mode" << crtc.mode << "relevant screen" << screen; | 0 | ||||||||||||||||||
125 | << "mode" << crtc.mode << "relevant screen" << screen; never executed: QMessageLogger(__FILE__, 216, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "QXcbConnection: XCB_RANDR_NOTIFY_CRTC_CHANGE:" << crtc.crtc << "mode" << crtc.mode << "relevant screen" << screen; | 0 | ||||||||||||||||||
126 | - | |||||||||||||||||||
127 | - | |||||||||||||||||||
128 | - | |||||||||||||||||||
129 | if (screen
| 0 | ||||||||||||||||||
130 | if (crtc.rotation == XCB_RANDR_ROTATION_ROTATE_90
| 0 | ||||||||||||||||||
131 | crtc.rotation == XCB_RANDR_ROTATION_ROTATE_270
| 0 | ||||||||||||||||||
132 | std::swap(crtc.width, crtc.height); never executed: std::swap(crtc.width, crtc.height); | 0 | ||||||||||||||||||
133 | screen->updateGeometry(QRect(crtc.x, crtc.y, crtc.width, crtc.height), crtc.rotation); | - | ||||||||||||||||||
134 | if (screen->mode() != crtc.mode
| 0 | ||||||||||||||||||
135 | screen->updateRefreshRate(crtc.mode); never executed: screen->updateRefreshRate(crtc.mode); | 0 | ||||||||||||||||||
136 | } never executed: end of block | 0 | ||||||||||||||||||
137 | - | |||||||||||||||||||
138 | } never executed: else if (event->subCode == XCB_RANDR_NOTIFY_OUTPUT_CHANGEend of block
| 0 | ||||||||||||||||||
139 | xcb_randr_output_change_t output = event->u.oc; | - | ||||||||||||||||||
140 | QXcbVirtualDesktop *virtualDesktop = virtualDesktopForRootWindow(output.window); | - | ||||||||||||||||||
141 | if (!virtualDesktop
| 0 | ||||||||||||||||||
142 | - | |||||||||||||||||||
143 | return; never executed: return; | 0 | ||||||||||||||||||
144 | - | |||||||||||||||||||
145 | QXcbScreen *screen = findScreenForOutput(output.window, output.output); | - | ||||||||||||||||||
146 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 238, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "QXcbConnection: XCB_RANDR_NOTIFY_OUTPUT_CHANGE:" << output.output; | 0 | ||||||||||||||||||
147 | - | |||||||||||||||||||
148 | if (screen
| 0 | ||||||||||||||||||
149 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 241, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "screen" << screen->name() << "has been disconnected"; | 0 | ||||||||||||||||||
150 | destroyScreen(screen); | - | ||||||||||||||||||
151 | } never executed: else if (!screenend of block
| 0 | ||||||||||||||||||
152 | - | |||||||||||||||||||
153 | if (output.crtc != 0L
| 0 | ||||||||||||||||||
154 | xcb_randr_get_output_info_cookie_t outputInfoCookie = | - | ||||||||||||||||||
155 | xcb_randr_get_output_info(xcb_connection(), output.output, output.config_timestamp); | - | ||||||||||||||||||
156 | QScopedPointer<xcb_randr_get_output_info_reply_t, QScopedPointerPodDeleter> outputInfo( | - | ||||||||||||||||||
157 | xcb_randr_get_output_info_reply(xcb_connection(), outputInfoCookie, __null)); | - | ||||||||||||||||||
158 | - | |||||||||||||||||||
159 | - | |||||||||||||||||||
160 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(virtualDesktop->screens())>::type> _container_((const auto scrs = virtualDesktop->screens())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)(); | - | ||||||||||||||||||
161 | for (QPlatformScreen *scr = *_container_.i; _container_.control; _container_.control = 0: scrs) { | - | ||||||||||||||||||
162 | QXcbScreen *xcbScreen = (QXcbScreen *)scr; | - | ||||||||||||||||||
163 | if (xcbScreen->output() == 0L
| 0 | ||||||||||||||||||
164 | screen = xcbScreen; | - | ||||||||||||||||||
165 | break; never executed: break; | 0 | ||||||||||||||||||
166 | } | - | ||||||||||||||||||
167 | } never executed: end of block | 0 | ||||||||||||||||||
168 | - | |||||||||||||||||||
169 | if (screen
| 0 | ||||||||||||||||||
170 | QString nameWas = screen->name(); | - | ||||||||||||||||||
171 | - | |||||||||||||||||||
172 | screen->setOutput(output.output, outputInfo.data()); | - | ||||||||||||||||||
173 | updateScreen(screen, output); | - | ||||||||||||||||||
174 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 266, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "output" << screen->name() << "is connected and enabled; was fake:" << nameWas; | 0 | ||||||||||||||||||
175 | << "is connected and enabled; was fake:" << nameWas; never executed: QMessageLogger(__FILE__, 266, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "output" << screen->name() << "is connected and enabled; was fake:" << nameWas; | 0 | ||||||||||||||||||
176 | } never executed: else {end of block | 0 | ||||||||||||||||||
177 | screen = createScreen(virtualDesktop, output, outputInfo.data()); | - | ||||||||||||||||||
178 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 270, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "output" << screen->name() << "is connected and enabled"; | 0 | ||||||||||||||||||
179 | } never executed: end of block | 0 | ||||||||||||||||||
180 | QHighDpiScaling::updateHighDpiScaling(); | - | ||||||||||||||||||
181 | } never executed: end of block | 0 | ||||||||||||||||||
182 | } never executed: else if (screenend of block
| 0 | ||||||||||||||||||
183 | if (output.crtc == 0L
| 0 | ||||||||||||||||||
184 | - | |||||||||||||||||||
185 | xcb_randr_get_output_info_cookie_t outputInfoCookie = | - | ||||||||||||||||||
186 | xcb_randr_get_output_info(xcb_connection(), output.output, output.config_timestamp); | - | ||||||||||||||||||
187 | QScopedPointer<xcb_randr_get_output_info_reply_t, QScopedPointerPodDeleter> outputInfo( | - | ||||||||||||||||||
188 | xcb_randr_get_output_info_reply(xcb_connection(), outputInfoCookie, __null)); | - | ||||||||||||||||||
189 | if (outputInfo->crtc == 0L
| 0 | ||||||||||||||||||
190 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 282, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "output" << screen->name() << "has been disabled"; | 0 | ||||||||||||||||||
191 | destroyScreen(screen); | - | ||||||||||||||||||
192 | } never executed: else {end of block | 0 | ||||||||||||||||||
193 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 285, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "output" << screen->name() << "has been temporarily disabled for the mode switch"; | 0 | ||||||||||||||||||
194 | - | |||||||||||||||||||
195 | - | |||||||||||||||||||
196 | screen->setCrtc(0L); | - | ||||||||||||||||||
197 | } never executed: end of block | 0 | ||||||||||||||||||
198 | } else { | - | ||||||||||||||||||
199 | updateScreen(screen, output); | - | ||||||||||||||||||
200 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 292, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "output has changed" << screen; | 0 | ||||||||||||||||||
201 | } never executed: end of block | 0 | ||||||||||||||||||
202 | } | - | ||||||||||||||||||
203 | - | |||||||||||||||||||
204 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 296, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "primary output is" << qAsConst(m_screens).first()->name(); | 0 | ||||||||||||||||||
205 | } never executed: end of block | 0 | ||||||||||||||||||
206 | } never executed: end of block | 0 | ||||||||||||||||||
207 | - | |||||||||||||||||||
208 | bool QXcbConnection::checkOutputIsPrimary(xcb_window_t rootWindow, xcb_randr_output_t output) | - | ||||||||||||||||||
209 | { | - | ||||||||||||||||||
210 | xcb_generic_error_t *error = 0; | - | ||||||||||||||||||
211 | xcb_randr_get_output_primary_cookie_t primaryCookie = | - | ||||||||||||||||||
212 | xcb_randr_get_output_primary(xcb_connection(), rootWindow); | - | ||||||||||||||||||
213 | QScopedPointer<xcb_randr_get_output_primary_reply_t, QScopedPointerPodDeleter> primary ( | - | ||||||||||||||||||
214 | xcb_randr_get_output_primary_reply(xcb_connection(), primaryCookie, &error)); | - | ||||||||||||||||||
215 | if (!primary || error) { | - | ||||||||||||||||||
216 | QMessageLogger(__FILE__, 301308, __PRETTY_FUNCTION__).warning("failed to get the primary output of the screen"); | - | ||||||||||||||||||
217 | free(error); | - | ||||||||||||||||||
218 | error = __null; | - | ||||||||||||||||||
219 | } | - | ||||||||||||||||||
220 | const bool isPrimary = primary ? (primary->output == output) : false; | - | ||||||||||||||||||
221 | - | |||||||||||||||||||
222 | return isPrimary; | - | ||||||||||||||||||
223 | } | - | ||||||||||||||||||
224 | - | |||||||||||||||||||
225 | void QXcbConnection::updateScreen(QXcbScreen *screen, const xcb_randr_output_change_t &outputChange) | - | ||||||||||||||||||
226 | { | - | ||||||||||||||||||
227 | screen->setCrtc(outputChange.crtc); | - | ||||||||||||||||||
228 | screen->updateGeometry(outputChange.config_timestamp); | - | ||||||||||||||||||
229 | if (screen->mode() != outputChange.mode
| 0 | ||||||||||||||||||
230 | screen->updateRefreshRate(outputChange.mode); never executed: screen->updateRefreshRate(outputChange.mode); | 0 | ||||||||||||||||||
231 | - | |||||||||||||||||||
232 | if (screen->screenNumber() == m_primaryScreenNumber
| 0 | ||||||||||||||||||
233 | if (!screen->isPrimary()
| 0 | ||||||||||||||||||
234 | screen->setPrimary(true); | - | ||||||||||||||||||
235 | - | |||||||||||||||||||
236 | - | |||||||||||||||||||
237 | const int idx = m_screens.indexOf(screen); | - | ||||||||||||||||||
238 | if (idx > 0
| 0 | ||||||||||||||||||
239 | qAsConst(m_screens.).first()->setPrimary(false); | - | ||||||||||||||||||
240 | m_screens.swap(0, idx); | - | ||||||||||||||||||
241 | } never executed: end of block | 0 | ||||||||||||||||||
242 | screen->virtualDesktop()->setPrimaryScreen(screen); | - | ||||||||||||||||||
243 | QXcbIntegration::instance()->setPrimaryScreen(screen); | - | ||||||||||||||||||
244 | } never executed: end of block | 0 | ||||||||||||||||||
245 | } never executed: end of block | 0 | ||||||||||||||||||
246 | } never executed: end of block | 0 | ||||||||||||||||||
247 | - | |||||||||||||||||||
248 | QXcbScreen *QXcbConnection::createScreen(QXcbVirtualDesktop *virtualDesktop, | - | ||||||||||||||||||
249 | const xcb_randr_output_change_t &outputChange, | - | ||||||||||||||||||
250 | xcb_randr_get_output_info_reply_t *outputInfo) | - | ||||||||||||||||||
251 | { | - | ||||||||||||||||||
252 | QXcbScreen *screen = new QXcbScreen(this, virtualDesktop, outputChange.output, outputInfo); | - | ||||||||||||||||||
253 | - | |||||||||||||||||||
254 | if (screen->screenNumber() == m_primaryScreenNumber
| 0 | ||||||||||||||||||
255 | screen->setPrimary(checkOutputIsPrimary(outputChange.window, outputChange.output)); never executed: screen->setPrimary(checkOutputIsPrimary(outputChange.window, outputChange.output)); | 0 | ||||||||||||||||||
256 | - | |||||||||||||||||||
257 | if (screen->isPrimary()
| 0 | ||||||||||||||||||
258 | if (!m_screens.isEmpty()
| 0 | ||||||||||||||||||
259 | qAsConst( never executed: m_screens.).first()->setPrimary(false);qAsConst(m_screens).first()->setPrimary(false); never executed: qAsConst(m_screens).first()->setPrimary(false); | 0 | ||||||||||||||||||
260 | - | |||||||||||||||||||
261 | m_screens.prepend(screen); | - | ||||||||||||||||||
262 | } never executed: else {end of block | 0 | ||||||||||||||||||
263 | m_screens.append(screen); | - | ||||||||||||||||||
264 | } never executed: end of block | 0 | ||||||||||||||||||
265 | virtualDesktop->addScreen(screen); | - | ||||||||||||||||||
266 | QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary()); | - | ||||||||||||||||||
267 | - | |||||||||||||||||||
268 | return never executed: screen;return screen; never executed: return screen; | 0 | ||||||||||||||||||
269 | } | - | ||||||||||||||||||
270 | - | |||||||||||||||||||
271 | void QXcbConnection::destroyScreen(QXcbScreen *screen) | - | ||||||||||||||||||
272 | { | - | ||||||||||||||||||
273 | QXcbVirtualDesktop *virtualDesktop = screen->virtualDesktop(); | - | ||||||||||||||||||
274 | if (virtualDesktop->screens().count() == 1) { | - | ||||||||||||||||||
275 | - | |||||||||||||||||||
276 | - | |||||||||||||||||||
277 | const QString nameWas = screen->name(); | - | ||||||||||||||||||
278 | screen->setOutput(0L, nullptr); | - | ||||||||||||||||||
279 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled; qt_category_enabled = false) QMessageLogger(__FILE__, 364371, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "transformed" << nameWas << "to fake" << screen; | - | ||||||||||||||||||
280 | } else { | - | ||||||||||||||||||
281 | - | |||||||||||||||||||
282 | m_screens.removeOne(screen); | - | ||||||||||||||||||
283 | virtualDesktop->removeScreen(screen); | - | ||||||||||||||||||
284 | - | |||||||||||||||||||
285 | - | |||||||||||||||||||
286 | - | |||||||||||||||||||
287 | if (screen->isPrimary()) { | - | ||||||||||||||||||
288 | QXcbScreen *newPrimary = (QXcbScreen *)virtualDesktop->screens().at(0); | - | ||||||||||||||||||
289 | newPrimary->setPrimary(true); | - | ||||||||||||||||||
290 | const int idx = m_screens.indexOf(newPrimary); | - | ||||||||||||||||||
291 | if (idx > 0) | - | ||||||||||||||||||
292 | m_screens.swap(0, idx); | - | ||||||||||||||||||
293 | QXcbIntegration::instance()->setPrimaryScreen(newPrimary); | - | ||||||||||||||||||
294 | } | - | ||||||||||||||||||
295 | - | |||||||||||||||||||
296 | QXcbIntegration::instance()->destroyScreen(screen); | - | ||||||||||||||||||
297 | } | - | ||||||||||||||||||
298 | } | - | ||||||||||||||||||
299 | - | |||||||||||||||||||
300 | void QXcbConnection::initializeScreens() | - | ||||||||||||||||||
301 | { | - | ||||||||||||||||||
302 | xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); | - | ||||||||||||||||||
303 | int xcbScreenNumber = 0; | - | ||||||||||||||||||
304 | QXcbScreen *primaryScreen = nullptr; | - | ||||||||||||||||||
305 | while (it.rem
| 135 | ||||||||||||||||||
306 | - | |||||||||||||||||||
307 | - | |||||||||||||||||||
308 | - | |||||||||||||||||||
309 | - | |||||||||||||||||||
310 | xcb_screen_t *xcbScreen = it.data; | - | ||||||||||||||||||
311 | QXcbVirtualDesktop *virtualDesktop = new QXcbVirtualDesktop(this, xcbScreen, xcbScreenNumber); | - | ||||||||||||||||||
312 | m_virtualDesktops.append(virtualDesktop); | - | ||||||||||||||||||
313 | QList<QPlatformScreen *> siblings; | - | ||||||||||||||||||
314 | if (has_randr_extension
| 0-135 | ||||||||||||||||||
315 | xcb_generic_error_t *error = __null; | - | ||||||||||||||||||
316 | - | |||||||||||||||||||
317 | - | |||||||||||||||||||
318 | - | |||||||||||||||||||
319 | QScopedPointer<xcb_randr_get_screen_resources_reply_t, QScopedPointerPodDeleter> resources; | - | ||||||||||||||||||
320 | xcb_randr_get_screen_resources_current_cookie_t resourcesCookie = | - | ||||||||||||||||||
321 | xcb_randr_get_screen_resources_current(xcb_connection(), xcbScreen->root); | - | ||||||||||||||||||
322 | QScopedPointer<xcb_randr_get_screen_resources_current_reply_t, QScopedPointerPodDeleter> resources_current( | - | ||||||||||||||||||
323 | xcb_randr_get_screen_resources_current_reply(xcb_connection(), resourcesCookie, &error)); | - | ||||||||||||||||||
324 | if (!resources_current
| 0-135 | ||||||||||||||||||
325 | QMessageLogger(__FILE__, 410417, __PRETTY_FUNCTION__).warning("failed to get the current screen resources"); | - | ||||||||||||||||||
326 | free(error); | - | ||||||||||||||||||
327 | } never executed: else {end of block | 0 | ||||||||||||||||||
328 | xcb_timestamp_t timestamp; | - | ||||||||||||||||||
329 | xcb_randr_output_t *outputs = nullptr; | - | ||||||||||||||||||
330 | int outputCount = xcb_randr_get_screen_resources_current_outputs_length(resources_current.data()); | - | ||||||||||||||||||
331 | if (outputCount
| 0-135 | ||||||||||||||||||
332 | timestamp = resources_current->config_timestamp; | - | ||||||||||||||||||
333 | outputs = xcb_randr_get_screen_resources_current_outputs(resources_current.data()); | - | ||||||||||||||||||
334 | } executed 135 times by 5 tests: else {end of block Executed by:
| 135 | ||||||||||||||||||
335 | xcb_randr_get_screen_resources_cookie_t resourcesCookie = | - | ||||||||||||||||||
336 | xcb_randr_get_screen_resources(xcb_connection(), xcbScreen->root); | - | ||||||||||||||||||
337 | resources.reset(xcb_randr_get_screen_resources_reply(xcb_connection(), resourcesCookie, &error)); | - | ||||||||||||||||||
338 | if (!resources
| 0 | ||||||||||||||||||
339 | QMessageLogger(__FILE__, 424431, __PRETTY_FUNCTION__).warning("failed to get the screen resources"); | - | ||||||||||||||||||
340 | free(error); | - | ||||||||||||||||||
341 | } never executed: else {end of block | 0 | ||||||||||||||||||
342 | timestamp = resources->config_timestamp; | - | ||||||||||||||||||
343 | outputCount = xcb_randr_get_screen_resources_outputs_length(resources.data()); | - | ||||||||||||||||||
344 | outputs = xcb_randr_get_screen_resources_outputs(resources.data()); | - | ||||||||||||||||||
345 | } never executed: end of block | 0 | ||||||||||||||||||
346 | } | - | ||||||||||||||||||
347 | - | |||||||||||||||||||
348 | if (outputCount
| 0-135 | ||||||||||||||||||
349 | xcb_randr_get_output_primary_cookie_t primaryCookie = | - | ||||||||||||||||||
350 | xcb_randr_get_output_primary(xcb_connection(), xcbScreen->root); | - | ||||||||||||||||||
351 | QScopedPointer<xcb_randr_get_output_primary_reply_t, QScopedPointerPodDeleter> primary( | - | ||||||||||||||||||
352 | xcb_randr_get_output_primary_reply(xcb_connection(), primaryCookie, &error)); | - | ||||||||||||||||||
353 | if (!primary
| 0-135 | ||||||||||||||||||
354 | QMessageLogger(__FILE__, 439446, __PRETTY_FUNCTION__).warning("failed to get the primary output of the screen"); | - | ||||||||||||||||||
355 | free(error); | - | ||||||||||||||||||
356 | } never executed: else {end of block | 0 | ||||||||||||||||||
357 | for (int i = 0; i < outputCount
| 135-1080 | ||||||||||||||||||
358 | QScopedPointer<xcb_randr_get_output_info_reply_t, QScopedPointerPodDeleter> output( | - | ||||||||||||||||||
359 | xcb_randr_get_output_info_reply(xcb_connection(), | - | ||||||||||||||||||
360 | xcb_randr_get_output_info_unchecked(xcb_connection(), outputs[i], timestamp), __null)); | - | ||||||||||||||||||
361 | - | |||||||||||||||||||
362 | - | |||||||||||||||||||
363 | if (output == __null
| 0-1080 | ||||||||||||||||||
364 | continue; never executed: continue; | 0 | ||||||||||||||||||
365 | - | |||||||||||||||||||
366 | if (output->connection != XCB_RANDR_CONNECTION_CONNECTED
| 135-945 | ||||||||||||||||||
367 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 461 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not connected", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0-945 | ||||||||||||||||||
368 | 0 | |||||||||||||||||||
369 | __FILE__ never executed: QMessageLogger( __FILE__ , 461 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not connected", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0 | ||||||||||||||||||
370 | , never executed: QMessageLogger( __FILE__ , 461 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not connected", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0 | ||||||||||||||||||
371 | 0 | |||||||||||||||||||
372 | 454461 never executed: QMessageLogger( __FILE__ , 461 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not connected", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0 | ||||||||||||||||||
373 | , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not connected", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) never executed: QMessageLogger( __FILE__ , 461 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not connected", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0 | ||||||||||||||||||
374 | 0 | |||||||||||||||||||
375 | ; never executed: QMessageLogger( __FILE__ , 461 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not connected", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0 | ||||||||||||||||||
376 | continue; executed 945 times by 5 tests: continue; Executed by:
| 945 | ||||||||||||||||||
377 | } | - | ||||||||||||||||||
378 | - | |||||||||||||||||||
379 | if (output->crtc == 0L
| 0-135 | ||||||||||||||||||
380 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 468 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not enabled", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0 | ||||||||||||||||||
381 | 0 | |||||||||||||||||||
382 | __FILE__ never executed: QMessageLogger( __FILE__ , 468 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not enabled", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0 | ||||||||||||||||||
383 | , never executed: QMessageLogger( __FILE__ , 468 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not enabled", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0 | ||||||||||||||||||
384 | 0 | |||||||||||||||||||
385 | 461468 never executed: QMessageLogger( __FILE__ , 468 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not enabled", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0 | ||||||||||||||||||
386 | , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not enabled", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) never executed: QMessageLogger( __FILE__ , 468 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not enabled", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0 | ||||||||||||||||||
387 | 0 | |||||||||||||||||||
388 | ; never executed: QMessageLogger( __FILE__ , 468 , __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug("Output %s is not enabled", QString(QString::fromUtf8((const char*)xcb_randr_get_output_info_name(output.data()), xcb_randr_get_output_info_name_length(output.data()))).toLocal8Bit().constData()) ; | 0 | ||||||||||||||||||
389 | continue; never executed: continue; | 0 | ||||||||||||||||||
390 | } | - | ||||||||||||||||||
391 | - | |||||||||||||||||||
392 | QXcbScreen *screen = new QXcbScreen(this, virtualDesktop, outputs[i], output.data()); | - | ||||||||||||||||||
393 | siblings << screen; | - | ||||||||||||||||||
394 | m_screens << screen; | - | ||||||||||||||||||
395 | - | |||||||||||||||||||
396 | - | |||||||||||||||||||
397 | - | |||||||||||||||||||
398 | - | |||||||||||||||||||
399 | - | |||||||||||||||||||
400 | if (m_primaryScreenNumber == xcbScreenNumber
| 0-135 | ||||||||||||||||||
401 | if (!primaryScreen
| 0-135 | ||||||||||||||||||
402 | if (primaryScreen
| 0-135 | ||||||||||||||||||
403 | primaryScreen->setPrimary(false); never executed: primaryScreen->setPrimary(false); | 0 | ||||||||||||||||||
404 | primaryScreen = screen; | - | ||||||||||||||||||
405 | primaryScreen->setPrimary(true); | - | ||||||||||||||||||
406 | siblings.prepend(siblings.takeLast()); | - | ||||||||||||||||||
407 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
408 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
409 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
410 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
411 | } | - | ||||||||||||||||||
412 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
413 | } else if (has_xinerama_extension
| 0 | ||||||||||||||||||
414 | - | |||||||||||||||||||
415 | xcb_xinerama_query_screens_cookie_t cookie = xcb_xinerama_query_screens(m_connection); | - | ||||||||||||||||||
416 | xcb_xinerama_query_screens_reply_t *screens = xcb_xinerama_query_screens_reply(m_connection, | - | ||||||||||||||||||
417 | cookie, | - | ||||||||||||||||||
418 | nullptr); | - | ||||||||||||||||||
419 | if (screens
| 0 | ||||||||||||||||||
420 | xcb_xinerama_screen_info_iterator_t it = xcb_xinerama_query_screens_screen_info_iterator(screens); | - | ||||||||||||||||||
421 | while (it.rem
| 0 | ||||||||||||||||||
422 | xcb_xinerama_screen_info_t *screen_info = it.data; | - | ||||||||||||||||||
423 | QXcbScreen *screen = new QXcbScreen(this, virtualDesktop, | - | ||||||||||||||||||
424 | 0L, nullptr, | - | ||||||||||||||||||
425 | screen_info, it.index); | - | ||||||||||||||||||
426 | siblings << screen; | - | ||||||||||||||||||
427 | m_screens << screen; | - | ||||||||||||||||||
428 | xcb_xinerama_screen_info_next(&it); | - | ||||||||||||||||||
429 | } never executed: end of block | 0 | ||||||||||||||||||
430 | free(screens); | - | ||||||||||||||||||
431 | } never executed: end of block | 0 | ||||||||||||||||||
432 | } never executed: end of block | 0 | ||||||||||||||||||
433 | if (siblings.isEmpty()
| 0-135 | ||||||||||||||||||
434 | - | |||||||||||||||||||
435 | - | |||||||||||||||||||
436 | QXcbScreen *screen = new QXcbScreen(this, virtualDesktop, 0L, nullptr); | - | ||||||||||||||||||
437 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 517, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "created fake screen" << screen; | 0 | ||||||||||||||||||
438 | m_screens << screen; | - | ||||||||||||||||||
439 | if (m_primaryScreenNumber == xcbScreenNumber
| 0 | ||||||||||||||||||
440 | primaryScreen = screen; | - | ||||||||||||||||||
441 | primaryScreen->setPrimary(true); | - | ||||||||||||||||||
442 | } never executed: end of block | 0 | ||||||||||||||||||
443 | siblings << screen; | - | ||||||||||||||||||
444 | } never executed: end of block | 0 | ||||||||||||||||||
445 | virtualDesktop->setScreens(siblings); | - | ||||||||||||||||||
446 | xcb_screen_next(&it); | - | ||||||||||||||||||
447 | ++xcbScreenNumber; | - | ||||||||||||||||||
448 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
449 | - | |||||||||||||||||||
450 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_virtualDesktops)>::type> _container_((m_virtualDesktops)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (QXcbVirtualDesktop *virtualDesktop = *_container_.i; _container_.control; _container_.control = 0): qAsConst(m_virtualDesktops)) | - | ||||||||||||||||||
451 | virtualDesktop->subscribeToXFixesSelectionNotify(); executed 135 times by 5 tests: virtualDesktop->subscribeToXFixesSelectionNotify(); Executed by:
| 135 | ||||||||||||||||||
452 | - | |||||||||||||||||||
453 | if (m_virtualDesktops.isEmpty()
| 0-135 | ||||||||||||||||||
454 | QMessageLogger(__FILE__, 527534, __PRETTY_FUNCTION__).fatal("QXcbConnection: no screens available"); | - | ||||||||||||||||||
455 | } never executed: else {end of block | 0 | ||||||||||||||||||
456 | - | |||||||||||||||||||
457 | if (primaryScreen
| 0-135 | ||||||||||||||||||
458 | if (qAsConst
| 0-135 | ||||||||||||||||||
459 | m_screens.removeOne(primaryScreen); | - | ||||||||||||||||||
460 | m_screens.prepend(primaryScreen); | - | ||||||||||||||||||
461 | } never executed: end of block | 0 | ||||||||||||||||||
462 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
463 | - | |||||||||||||||||||
464 | - | |||||||||||||||||||
465 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_screens)>::type> _container_((m_screens)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (QXcbScreen *screen = *_container_.i; _container_.control; _container_.control = 0): qAsConst(m_screens)) { | - | ||||||||||||||||||
466 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 546, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "adding" << screen << "(Primary:" << screen->isPrimary() << ")"; | 0-135 | ||||||||||||||||||
467 | QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary()); | - | ||||||||||||||||||
468 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
469 | - | |||||||||||||||||||
470 | for (bool qt_category_enabled = lcQpaScreen().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 550, __PRETTY_FUNCTION__, lcQpaScreen().categoryName()).debug() << "primary output is" << qAsConst(m_screens).first()->name(); | 0-135 | ||||||||||||||||||
471 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
472 | } | - | ||||||||||||||||||
473 | - | |||||||||||||||||||
474 | QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, xcb_visualid_t defaultVisualId, const char *displayName) | - | ||||||||||||||||||
475 | : m_connection(0) | - | ||||||||||||||||||
476 | , m_canGrabServer(canGrabServer) | - | ||||||||||||||||||
477 | , m_defaultVisualId(defaultVisualId) | - | ||||||||||||||||||
478 | , m_primaryScreenNumber(0) | - | ||||||||||||||||||
479 | , m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) | - | ||||||||||||||||||
480 | , m_nativeInterface(nativeInterface) | - | ||||||||||||||||||
481 | - | |||||||||||||||||||
482 | , m_xlib_display(0) | - | ||||||||||||||||||
483 | - | |||||||||||||||||||
484 | , xfixes_first_event(0) | - | ||||||||||||||||||
485 | , xrandr_first_event(0) | - | ||||||||||||||||||
486 | , xkb_first_event(0) | - | ||||||||||||||||||
487 | , has_xinerama_extension(false) | - | ||||||||||||||||||
488 | , has_shape_extension(false) | - | ||||||||||||||||||
489 | , has_randr_extension(false) | - | ||||||||||||||||||
490 | , has_input_shape(false) | - | ||||||||||||||||||
491 | , has_xkb(false) | - | ||||||||||||||||||
492 | , m_buttons(0) | - | ||||||||||||||||||
493 | , m_focusWindow(0) | - | ||||||||||||||||||
494 | , m_mouseGrabber(0) | - | ||||||||||||||||||
495 | , m_mousePressWindow(0) | - | ||||||||||||||||||
496 | , m_clientLeader(0) | - | ||||||||||||||||||
497 | , m_systemTrayTracker(0) | - | ||||||||||||||||||
498 | , m_glIntegration(nullptr) | - | ||||||||||||||||||
499 | , m_xiGrab(false) | - | ||||||||||||||||||
500 | , m_qtSelectionOwner(0) | - | ||||||||||||||||||
501 | { | - | ||||||||||||||||||
502 | - | |||||||||||||||||||
503 | Display *dpy = XOpenDisplay(m_displayName.constData()); | - | ||||||||||||||||||
504 | if (dpy
| 0-135 | ||||||||||||||||||
505 | m_primaryScreenNumber = (((_XPrivDisplay)dpy)->default_screen); | - | ||||||||||||||||||
506 | m_connection = XGetXCBConnection(dpy); | - | ||||||||||||||||||
507 | XSetEventQueueOwner(dpy, XCBOwnsEventQueue); | - | ||||||||||||||||||
508 | XSetErrorHandler(nullErrorHandler); | - | ||||||||||||||||||
509 | XSetIOErrorHandler(ioErrorHandler); | - | ||||||||||||||||||
510 | m_xlib_display = dpy; | - | ||||||||||||||||||
511 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
512 | - | |||||||||||||||||||
513 | - | |||||||||||||||||||
514 | - | |||||||||||||||||||
515 | - | |||||||||||||||||||
516 | if (!(__builtin_expect(!!(!
| 0-135 | ||||||||||||||||||
517 | QMessageLogger(__FILE__, 590597, __PRETTY_FUNCTION__).fatal("QXcbConnection: Could not connect to display %s", m_displayName.constData()); never executed: QMessageLogger(__FILE__, 597, __PRETTY_FUNCTION__).fatal("QXcbConnection: Could not connect to display %s", m_displayName.constData()); | 0 | ||||||||||||||||||
518 | - | |||||||||||||||||||
519 | - | |||||||||||||||||||
520 | m_reader = new QXcbEventReader(this); | - | ||||||||||||||||||
521 | m_reader->start(); | - | ||||||||||||||||||
522 | - | |||||||||||||||||||
523 | xcb_extension_t *extensions[] = { | - | ||||||||||||||||||
524 | &xcb_shm_id, &xcb_xfixes_id, &xcb_randr_id, &xcb_shape_id, &xcb_sync_id, | - | ||||||||||||||||||
525 | - | |||||||||||||||||||
526 | &xcb_xkb_id, | - | ||||||||||||||||||
527 | - | |||||||||||||||||||
528 | - | |||||||||||||||||||
529 | &xcb_render_id, | - | ||||||||||||||||||
530 | - | |||||||||||||||||||
531 | 0 | - | ||||||||||||||||||
532 | }; | - | ||||||||||||||||||
533 | - | |||||||||||||||||||
534 | for (xcb_extension_t **ext_it = extensions; *
| 135-945 | ||||||||||||||||||
535 | xcb_prefetch_extension_data (m_connection, *ext_it); executed 945 times by 5 tests: xcb_prefetch_extension_data (m_connection, *ext_it); Executed by:
| 945 | ||||||||||||||||||
536 | - | |||||||||||||||||||
537 | m_setup = xcb_get_setup(xcb_connection()); | - | ||||||||||||||||||
538 | - | |||||||||||||||||||
539 | initializeAllAtoms(); | - | ||||||||||||||||||
540 | - | |||||||||||||||||||
541 | m_time = 0L; | - | ||||||||||||||||||
542 | m_netWmUserTime = 0L; | - | ||||||||||||||||||
543 | - | |||||||||||||||||||
544 | if (!qEnvironmentVariableIsSet("QT_XCB_NO_XRANDR")
| 0-135 | ||||||||||||||||||
545 | initializeXRandr(); executed 135 times by 5 tests: initializeXRandr(); Executed by:
| 135 | ||||||||||||||||||
546 | if (!has_randr_extension
| 0-135 | ||||||||||||||||||
547 | initializeXinerama(); never executed: initializeXinerama(); | 0 | ||||||||||||||||||
548 | initializeXFixes(); | - | ||||||||||||||||||
549 | initializeScreens(); | - | ||||||||||||||||||
550 | - | |||||||||||||||||||
551 | initializeXRender(); | - | ||||||||||||||||||
552 | - | |||||||||||||||||||
553 | m_xi2Enabled = false; | - | ||||||||||||||||||
554 | if (!qEnvironmentVariableIsSet("QT_XCB_NO_XI2"))initializeXInput2(); | - | ||||||||||||||||||
555 | - | |||||||||||||||||||
556 | initializeXShape(); | - | ||||||||||||||||||
557 | initializeXKB(); | - | ||||||||||||||||||
558 | - | |||||||||||||||||||
559 | m_wmSupport.reset(new QXcbWMSupport(this)); | - | ||||||||||||||||||
560 | m_keyboard = new QXcbKeyboard(this); | - | ||||||||||||||||||
561 | - | |||||||||||||||||||
562 | m_clipboard = new QXcbClipboard(this); | - | ||||||||||||||||||
563 | - | |||||||||||||||||||
564 | - | |||||||||||||||||||
565 | m_drag = new QXcbDrag(this); | - | ||||||||||||||||||
566 | - | |||||||||||||||||||
567 | - | |||||||||||||||||||
568 | m_startupId = qgetenv("DESKTOP_STARTUP_ID"); | - | ||||||||||||||||||
569 | if (!m_startupId.isNull()
| 0-135 | ||||||||||||||||||
570 | qunsetenv("DESKTOP_STARTUP_ID"); never executed: qunsetenv("DESKTOP_STARTUP_ID"); | 0 | ||||||||||||||||||
571 | - | |||||||||||||||||||
572 | - | |||||||||||||||||||
573 | QStringList glIntegrationNames; | - | ||||||||||||||||||
574 | glIntegrationNames << ([]() -> QString { enum { Size = sizeof(u"" "xcb_glx")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "xcb_glx" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()) << ([]() -> QString { enum { Size = sizeof(u"" "xcb_egl")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "xcb_egl" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 135 times by 5 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 135 times by 5 tests: }());return qstring_literal_temp; Executed by:
| 135 | ||||||||||||||||||
575 | QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION")); | - | ||||||||||||||||||
576 | if (!glIntegrationName.isEmpty()
| 0-135 | ||||||||||||||||||
577 | for (bool qt_category_enabled = QT_XCB_GLINTEGRATIONlcQpaGl().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 657, __PRETTY_FUNCTION__, lcQpaGl().categoryName()).debug() << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName; | 0 | ||||||||||||||||||
578 | if (glIntegrationName != QLatin1String("none")
| 0 | ||||||||||||||||||
579 | glIntegrationNames.removeAll(glIntegrationName); | - | ||||||||||||||||||
580 | glIntegrationNames.prepend(glIntegrationName); | - | ||||||||||||||||||
581 | } never executed: else {end of block | 0 | ||||||||||||||||||
582 | glIntegrationNames.clear(); | - | ||||||||||||||||||
583 | } never executed: end of block | 0 | ||||||||||||||||||
584 | } | - | ||||||||||||||||||
585 | - | |||||||||||||||||||
586 | if (!glIntegrationNames.isEmpty()
| 0-135 | ||||||||||||||||||
587 | for (bool qt_category_enabled = QT_XCB_GLINTEGRATIONlcQpaGl().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 667, __PRETTY_FUNCTION__, lcQpaGl().categoryName()).debug() << "Choosing xcb gl-integration based on following priority\n" << glIntegrationNames; | 0-135 | ||||||||||||||||||
588 | for (int i = 0; i < glIntegrationNames.size()
| 0-270 | ||||||||||||||||||
589 | m_glIntegration = QXcbGlIntegrationFactory::create(glIntegrationNames.at(i)); | - | ||||||||||||||||||
590 | if (m_glIntegration
| 0-135 | ||||||||||||||||||
591 | for (bool qt_category_enabled = QT_XCB_GLINTEGRATIONlcQpaGl().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 671, __PRETTY_FUNCTION__, lcQpaGl().categoryName()).debug() << "Failed to initialize xcb gl-integration" << glIntegrationNames.at(i); | 0 | ||||||||||||||||||
592 | delete m_glIntegration; | - | ||||||||||||||||||
593 | m_glIntegration = nullptr; | - | ||||||||||||||||||
594 | } never executed: end of block | 0 | ||||||||||||||||||
595 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
596 | if (!m_glIntegration
| 0-135 | ||||||||||||||||||
597 | for (bool qt_category_enabled = QT_XCB_GLINTEGRATIONlcQpaGl().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 677, __PRETTY_FUNCTION__, lcQpaGl().categoryName()).debug() << "Failed to create xcb gl-integration"; | 0 | ||||||||||||||||||
598 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
599 | - | |||||||||||||||||||
600 | sync(); | - | ||||||||||||||||||
601 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
602 | - | |||||||||||||||||||
603 | QXcbConnection::~QXcbConnection() | - | ||||||||||||||||||
604 | { | - | ||||||||||||||||||
605 | - | |||||||||||||||||||
606 | delete m_clipboard; | - | ||||||||||||||||||
607 | - | |||||||||||||||||||
608 | - | |||||||||||||||||||
609 | delete m_drag; | - | ||||||||||||||||||
610 | - | |||||||||||||||||||
611 | - | |||||||||||||||||||
612 | - | |||||||||||||||||||
613 | finalizeXInput2(); | - | ||||||||||||||||||
614 | - | |||||||||||||||||||
615 | - | |||||||||||||||||||
616 | if (m_reader->isRunning()) { | - | ||||||||||||||||||
617 | sendConnectionEvent(QXcbAtom::_QT_CLOSE_CONNECTION); | - | ||||||||||||||||||
618 | m_reader->wait(); | - | ||||||||||||||||||
619 | } | - | ||||||||||||||||||
620 | - | |||||||||||||||||||
621 | delete m_reader; | - | ||||||||||||||||||
622 | - | |||||||||||||||||||
623 | QXcbIntegration *integration = QXcbIntegration::instance(); | - | ||||||||||||||||||
624 | - | |||||||||||||||||||
625 | while (!m_screens.isEmpty()) | - | ||||||||||||||||||
626 | integration->destroyScreen(m_screens.takeLast()); | - | ||||||||||||||||||
627 | - | |||||||||||||||||||
628 | while (!m_virtualDesktops.isEmpty()) | - | ||||||||||||||||||
629 | delete m_virtualDesktops.takeLast(); | - | ||||||||||||||||||
630 | - | |||||||||||||||||||
631 | delete m_glIntegration; | - | ||||||||||||||||||
632 | - | |||||||||||||||||||
633 | - | |||||||||||||||||||
634 | XCloseDisplay((Display *)m_xlib_display); | - | ||||||||||||||||||
635 | - | |||||||||||||||||||
636 | - | |||||||||||||||||||
637 | - | |||||||||||||||||||
638 | - | |||||||||||||||||||
639 | delete m_keyboard; | - | ||||||||||||||||||
640 | } | - | ||||||||||||||||||
641 | - | |||||||||||||||||||
642 | QXcbScreen *QXcbConnection::primaryScreen() const | - | ||||||||||||||||||
643 | { | - | ||||||||||||||||||
644 | if (!m_screens.isEmpty()) { | - | ||||||||||||||||||
645 | ((!(m_screens.first()->screenNumber() == primaryScreenNumber())) ? qt_assert("m_screens.first()->screenNumber() == primaryScreenNumber()",__FILE__,717725) : qt_noop()); | - | ||||||||||||||||||
646 | return m_screens.first(); | - | ||||||||||||||||||
647 | } | - | ||||||||||||||||||
648 | - | |||||||||||||||||||
649 | return nullptr; | - | ||||||||||||||||||
650 | } | - | ||||||||||||||||||
651 | - | |||||||||||||||||||
652 | void QXcbConnection::addWindowEventListener(xcb_window_t id, QXcbWindowEventListener *eventListener) | - | ||||||||||||||||||
653 | { | - | ||||||||||||||||||
654 | m_mapper.insert(id, eventListener); | - | ||||||||||||||||||
655 | } | - | ||||||||||||||||||
656 | - | |||||||||||||||||||
657 | void QXcbConnection::removeWindowEventListener(xcb_window_t id) | - | ||||||||||||||||||
658 | { | - | ||||||||||||||||||
659 | m_mapper.remove(id); | - | ||||||||||||||||||
660 | } | - | ||||||||||||||||||
661 | - | |||||||||||||||||||
662 | QXcbWindowEventListener *QXcbConnection::windowEventListenerFromId(xcb_window_t id) | - | ||||||||||||||||||
663 | { | - | ||||||||||||||||||
664 | return m_mapper.value(id, 0); | - | ||||||||||||||||||
665 | } | - | ||||||||||||||||||
666 | - | |||||||||||||||||||
667 | QXcbWindow *QXcbConnection::platformWindowFromId(xcb_window_t id) | - | ||||||||||||||||||
668 | { | - | ||||||||||||||||||
669 | QXcbWindowEventListener *listener = m_mapper.value(id, 0); | - | ||||||||||||||||||
670 | if (listener) | - | ||||||||||||||||||
671 | return listener->toWindow(); | - | ||||||||||||||||||
672 | return 0; | - | ||||||||||||||||||
673 | } | - | ||||||||||||||||||
674 | void printXcbEvent(const char *message, xcb_generic_event_t *event) | - | ||||||||||||||||||
675 | { | - | ||||||||||||||||||
676 | (void)message;; | - | ||||||||||||||||||
677 | (void)event;; | - | ||||||||||||||||||
678 | - | |||||||||||||||||||
679 | } | - | ||||||||||||||||||
680 | - | |||||||||||||||||||
681 | const char *xcb_errors[] = | - | ||||||||||||||||||
682 | { | - | ||||||||||||||||||
683 | "Success", | - | ||||||||||||||||||
684 | "BadRequest", | - | ||||||||||||||||||
685 | "BadValue", | - | ||||||||||||||||||
686 | "BadWindow", | - | ||||||||||||||||||
687 | "BadPixmap", | - | ||||||||||||||||||
688 | "BadAtom", | - | ||||||||||||||||||
689 | "BadCursor", | - | ||||||||||||||||||
690 | "BadFont", | - | ||||||||||||||||||
691 | "BadMatch", | - | ||||||||||||||||||
692 | "BadDrawable", | - | ||||||||||||||||||
693 | "BadAccess", | - | ||||||||||||||||||
694 | "BadAlloc", | - | ||||||||||||||||||
695 | "BadColor", | - | ||||||||||||||||||
696 | "BadGC", | - | ||||||||||||||||||
697 | "BadIDChoice", | - | ||||||||||||||||||
698 | "BadName", | - | ||||||||||||||||||
699 | "BadLength", | - | ||||||||||||||||||
700 | "BadImplementation", | - | ||||||||||||||||||
701 | "Unknown" | - | ||||||||||||||||||
702 | }; | - | ||||||||||||||||||
703 | - | |||||||||||||||||||
704 | const char *xcb_protocol_request_codes[] = | - | ||||||||||||||||||
705 | { | - | ||||||||||||||||||
706 | "Null", | - | ||||||||||||||||||
707 | "CreateWindow", | - | ||||||||||||||||||
708 | "ChangeWindowAttributes", | - | ||||||||||||||||||
709 | "GetWindowAttributes", | - | ||||||||||||||||||
710 | "DestroyWindow", | - | ||||||||||||||||||
711 | "DestroySubwindows", | - | ||||||||||||||||||
712 | "ChangeSaveSet", | - | ||||||||||||||||||
713 | "ReparentWindow", | - | ||||||||||||||||||
714 | "MapWindow", | - | ||||||||||||||||||
715 | "MapSubwindows", | - | ||||||||||||||||||
716 | "UnmapWindow", | - | ||||||||||||||||||
717 | "UnmapSubwindows", | - | ||||||||||||||||||
718 | "ConfigureWindow", | - | ||||||||||||||||||
719 | "CirculateWindow", | - | ||||||||||||||||||
720 | "GetGeometry", | - | ||||||||||||||||||
721 | "QueryTree", | - | ||||||||||||||||||
722 | "InternAtom", | - | ||||||||||||||||||
723 | "GetAtomName", | - | ||||||||||||||||||
724 | "ChangeProperty", | - | ||||||||||||||||||
725 | "DeleteProperty", | - | ||||||||||||||||||
726 | "GetProperty", | - | ||||||||||||||||||
727 | "ListProperties", | - | ||||||||||||||||||
728 | "SetSelectionOwner", | - | ||||||||||||||||||
729 | "GetSelectionOwner", | - | ||||||||||||||||||
730 | "ConvertSelection", | - | ||||||||||||||||||
731 | "SendEvent", | - | ||||||||||||||||||
732 | "GrabPointer", | - | ||||||||||||||||||
733 | "UngrabPointer", | - | ||||||||||||||||||
734 | "GrabButton", | - | ||||||||||||||||||
735 | "UngrabButton", | - | ||||||||||||||||||
736 | "ChangeActivePointerGrab", | - | ||||||||||||||||||
737 | "GrabKeyboard", | - | ||||||||||||||||||
738 | "UngrabKeyboard", | - | ||||||||||||||||||
739 | "GrabKey", | - | ||||||||||||||||||
740 | "UngrabKey", | - | ||||||||||||||||||
741 | "AllowEvents", | - | ||||||||||||||||||
742 | "GrabServer", | - | ||||||||||||||||||
743 | "UngrabServer", | - | ||||||||||||||||||
744 | "QueryPointer", | - | ||||||||||||||||||
745 | "GetMotionEvents", | - | ||||||||||||||||||
746 | "TranslateCoords", | - | ||||||||||||||||||
747 | "WarpPointer", | - | ||||||||||||||||||
748 | "SetInputFocus", | - | ||||||||||||||||||
749 | "GetInputFocus", | - | ||||||||||||||||||
750 | "QueryKeymap", | - | ||||||||||||||||||
751 | "OpenFont", | - | ||||||||||||||||||
752 | "CloseFont", | - | ||||||||||||||||||
753 | "QueryFont", | - | ||||||||||||||||||
754 | "QueryTextExtents", | - | ||||||||||||||||||
755 | "ListFonts", | - | ||||||||||||||||||
756 | "ListFontsWithInfo", | - | ||||||||||||||||||
757 | "SetFontPath", | - | ||||||||||||||||||
758 | "GetFontPath", | - | ||||||||||||||||||
759 | "CreatePixmap", | - | ||||||||||||||||||
760 | "FreePixmap", | - | ||||||||||||||||||
761 | "CreateGC", | - | ||||||||||||||||||
762 | "ChangeGC", | - | ||||||||||||||||||
763 | "CopyGC", | - | ||||||||||||||||||
764 | "SetDashes", | - | ||||||||||||||||||
765 | "SetClipRectangles", | - | ||||||||||||||||||
766 | "FreeGC", | - | ||||||||||||||||||
767 | "ClearArea", | - | ||||||||||||||||||
768 | "CopyArea", | - | ||||||||||||||||||
769 | "CopyPlane", | - | ||||||||||||||||||
770 | "PolyPoint", | - | ||||||||||||||||||
771 | "PolyLine", | - | ||||||||||||||||||
772 | "PolySegment", | - | ||||||||||||||||||
773 | "PolyRectangle", | - | ||||||||||||||||||
774 | "PolyArc", | - | ||||||||||||||||||
775 | "FillPoly", | - | ||||||||||||||||||
776 | "PolyFillRectangle", | - | ||||||||||||||||||
777 | "PolyFillArc", | - | ||||||||||||||||||
778 | "PutImage", | - | ||||||||||||||||||
779 | "GetImage", | - | ||||||||||||||||||
780 | "PolyText8", | - | ||||||||||||||||||
781 | "PolyText16", | - | ||||||||||||||||||
782 | "ImageText8", | - | ||||||||||||||||||
783 | "ImageText16", | - | ||||||||||||||||||
784 | "CreateColormap", | - | ||||||||||||||||||
785 | "FreeColormap", | - | ||||||||||||||||||
786 | "CopyColormapAndFree", | - | ||||||||||||||||||
787 | "InstallColormap", | - | ||||||||||||||||||
788 | "UninstallColormap", | - | ||||||||||||||||||
789 | "ListInstalledColormaps", | - | ||||||||||||||||||
790 | "AllocColor", | - | ||||||||||||||||||
791 | "AllocNamedColor", | - | ||||||||||||||||||
792 | "AllocColorCells", | - | ||||||||||||||||||
793 | "AllocColorPlanes", | - | ||||||||||||||||||
794 | "FreeColors", | - | ||||||||||||||||||
795 | "StoreColors", | - | ||||||||||||||||||
796 | "StoreNamedColor", | - | ||||||||||||||||||
797 | "QueryColors", | - | ||||||||||||||||||
798 | "LookupColor", | - | ||||||||||||||||||
799 | "CreateCursor", | - | ||||||||||||||||||
800 | "CreateGlyphCursor", | - | ||||||||||||||||||
801 | "FreeCursor", | - | ||||||||||||||||||
802 | "RecolorCursor", | - | ||||||||||||||||||
803 | "QueryBestSize", | - | ||||||||||||||||||
804 | "QueryExtension", | - | ||||||||||||||||||
805 | "ListExtensions", | - | ||||||||||||||||||
806 | "ChangeKeyboardMapping", | - | ||||||||||||||||||
807 | "GetKeyboardMapping", | - | ||||||||||||||||||
808 | "ChangeKeyboardControl", | - | ||||||||||||||||||
809 | "GetKeyboardControl", | - | ||||||||||||||||||
810 | "Bell", | - | ||||||||||||||||||
811 | "ChangePointerControl", | - | ||||||||||||||||||
812 | "GetPointerControl", | - | ||||||||||||||||||
813 | "SetScreenSaver", | - | ||||||||||||||||||
814 | "GetScreenSaver", | - | ||||||||||||||||||
815 | "ChangeHosts", | - | ||||||||||||||||||
816 | "ListHosts", | - | ||||||||||||||||||
817 | "SetAccessControl", | - | ||||||||||||||||||
818 | "SetCloseDownMode", | - | ||||||||||||||||||
819 | "KillClient", | - | ||||||||||||||||||
820 | "RotateProperties", | - | ||||||||||||||||||
821 | "ForceScreenSaver", | - | ||||||||||||||||||
822 | "SetPointerMapping", | - | ||||||||||||||||||
823 | "GetPointerMapping", | - | ||||||||||||||||||
824 | "SetModifierMapping", | - | ||||||||||||||||||
825 | "GetModifierMapping", | - | ||||||||||||||||||
826 | "Unknown" | - | ||||||||||||||||||
827 | }; | - | ||||||||||||||||||
828 | void QXcbConnection::handleXcbError(xcb_generic_error_t *error) | - | ||||||||||||||||||
829 | { | - | ||||||||||||||||||
830 | long result = 0; | - | ||||||||||||||||||
831 | QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance(); | - | ||||||||||||||||||
832 | if (dispatcher
| 0 | ||||||||||||||||||
833 | return; never executed: return; | 0 | ||||||||||||||||||
834 | - | |||||||||||||||||||
835 | uint clamped_error_code = qMin<uint>(error->error_code, (sizeof(xcb_errors) / sizeof(xcb_errors[0])) - 1); | - | ||||||||||||||||||
836 | uint clamped_major_code = qMin<uint>(error->major_code, (sizeof(xcb_protocol_request_codes) / sizeof(xcb_protocol_request_codes[0])) - 1); | - | ||||||||||||||||||
837 | - | |||||||||||||||||||
838 | QMessageLogger(__FILE__, 9931001, __PRETTY_FUNCTION__).warning("QXcbConnection: XCB error: %d (%s), sequence: %d, resource id: %d, major code: %d (%s), minor code: %d", | - | ||||||||||||||||||
839 | int(error->error_code), xcb_errors[clamped_error_code], | - | ||||||||||||||||||
840 | int(error->sequence), int(error->resource_id), | - | ||||||||||||||||||
841 | int(error->major_code), xcb_protocol_request_codes[clamped_major_code], | - | ||||||||||||||||||
842 | int(error->minor_code)); | - | ||||||||||||||||||
843 | } never executed: end of block | 0 | ||||||||||||||||||
844 | - | |||||||||||||||||||
845 | static Qt::MouseButtons translateMouseButtons(int s) | - | ||||||||||||||||||
846 | { | - | ||||||||||||||||||
847 | Qt::MouseButtons ret = 0; | - | ||||||||||||||||||
848 | if (s & XCB_BUTTON_MASK_1) | - | ||||||||||||||||||
849 | ret |= Qt::LeftButton; | - | ||||||||||||||||||
850 | if (s & XCB_BUTTON_MASK_2) | - | ||||||||||||||||||
851 | ret |= Qt::MidButton; | - | ||||||||||||||||||
852 | if (s & XCB_BUTTON_MASK_3) | - | ||||||||||||||||||
853 | ret |= Qt::RightButton; | - | ||||||||||||||||||
854 | return ret; | - | ||||||||||||||||||
855 | } | - | ||||||||||||||||||
856 | - | |||||||||||||||||||
857 | Qt::MouseButton QXcbConnection::translateMouseButton(xcb_button_t s) | - | ||||||||||||||||||
858 | { | - | ||||||||||||||||||
859 | switch (s) { | - | ||||||||||||||||||
860 | case 1: return Qt::LeftButton; | - | ||||||||||||||||||
861 | case 2: return Qt::MidButton; | - | ||||||||||||||||||
862 | case 3: return Qt::RightButton; | - | ||||||||||||||||||
863 | - | |||||||||||||||||||
864 | case 8: return Qt::BackButton; | - | ||||||||||||||||||
865 | case 9: return Qt::ForwardButton; | - | ||||||||||||||||||
866 | case 10: return Qt::ExtraButton3; | - | ||||||||||||||||||
867 | case 11: return Qt::ExtraButton4; | - | ||||||||||||||||||
868 | case 12: return Qt::ExtraButton5; | - | ||||||||||||||||||
869 | case 13: return Qt::ExtraButton6; | - | ||||||||||||||||||
870 | case 14: return Qt::ExtraButton7; | - | ||||||||||||||||||
871 | case 15: return Qt::ExtraButton8; | - | ||||||||||||||||||
872 | case 16: return Qt::ExtraButton9; | - | ||||||||||||||||||
873 | case 17: return Qt::ExtraButton10; | - | ||||||||||||||||||
874 | case 18: return Qt::ExtraButton11; | - | ||||||||||||||||||
875 | case 19: return Qt::ExtraButton12; | - | ||||||||||||||||||
876 | case 20: return Qt::ExtraButton13; | - | ||||||||||||||||||
877 | case 21: return Qt::ExtraButton14; | - | ||||||||||||||||||
878 | case 22: return Qt::ExtraButton15; | - | ||||||||||||||||||
879 | case 23: return Qt::ExtraButton16; | - | ||||||||||||||||||
880 | case 24: return Qt::ExtraButton17; | - | ||||||||||||||||||
881 | case 25: return Qt::ExtraButton18; | - | ||||||||||||||||||
882 | case 26: return Qt::ExtraButton19; | - | ||||||||||||||||||
883 | case 27: return Qt::ExtraButton20; | - | ||||||||||||||||||
884 | case 28: return Qt::ExtraButton21; | - | ||||||||||||||||||
885 | case 29: return Qt::ExtraButton22; | - | ||||||||||||||||||
886 | case 30: return Qt::ExtraButton23; | - | ||||||||||||||||||
887 | case 31: return Qt::ExtraButton24; | - | ||||||||||||||||||
888 | default: return Qt::NoButton; | - | ||||||||||||||||||
889 | } | - | ||||||||||||||||||
890 | } | - | ||||||||||||||||||
891 | - | |||||||||||||||||||
892 | - | |||||||||||||||||||
893 | namespace { | - | ||||||||||||||||||
894 | typedef union { | - | ||||||||||||||||||
895 | - | |||||||||||||||||||
896 | struct { | - | ||||||||||||||||||
897 | uint8_t response_type; | - | ||||||||||||||||||
898 | uint8_t xkbType; | - | ||||||||||||||||||
899 | uint16_t sequence; | - | ||||||||||||||||||
900 | xcb_timestamp_t time; | - | ||||||||||||||||||
901 | uint8_t deviceID; | - | ||||||||||||||||||
902 | } any; | - | ||||||||||||||||||
903 | xcb_xkb_new_keyboard_notify_event_t new_keyboard_notify; | - | ||||||||||||||||||
904 | xcb_xkb_map_notify_event_t map_notify; | - | ||||||||||||||||||
905 | xcb_xkb_state_notify_event_t state_notify; | - | ||||||||||||||||||
906 | } _xkb_event; | - | ||||||||||||||||||
907 | } | - | ||||||||||||||||||
908 | - | |||||||||||||||||||
909 | - | |||||||||||||||||||
910 | void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) | - | ||||||||||||||||||
911 | { | - | ||||||||||||||||||
912 | long result = 0; | - | ||||||||||||||||||
913 | QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance(); | - | ||||||||||||||||||
914 | bool handled = dispatcher
| 0-248897 | ||||||||||||||||||
915 | - | |||||||||||||||||||
916 | uint response_type = event->response_type & ~0x80; | - | ||||||||||||||||||
917 | - | |||||||||||||||||||
918 | if (!handled
| 0-248907 | ||||||||||||||||||
919 | switch (response_type) { | - | ||||||||||||||||||
920 | case executed 2983 times by 108 tests: 12:case 12: Executed by:
executed 2983 times by 108 tests: case 12: Executed by:
| 2983 | ||||||||||||||||||
921 | { xcb_expose_event_t *e = (xcb_expose_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->window)
executed 2664 times by 104 tests: }eventListener->handleExposeEvent(e); Executed by:
executed 2664 times by 104 tests: } break;end of block Executed by:
executed 2983 times by 108 tests: ;break; Executed by:
| 0-2983 | ||||||||||||||||||
922 | - | |||||||||||||||||||
923 | - | |||||||||||||||||||
924 | case never executed: 4:case 4: never executed: {case 4: | 0 | ||||||||||||||||||
925 | xcb_button_press_event_t *ev = (xcb_button_press_event_t *)event; | - | ||||||||||||||||||
926 | m_keyboard->updateXKBStateFromCore(ev->state); | - | ||||||||||||||||||
927 | - | |||||||||||||||||||
928 | - | |||||||||||||||||||
929 | m_buttons = (m_buttons & ~0x7) | translateMouseButtons(ev->state); | - | ||||||||||||||||||
930 | m_buttons |= translateMouseButton(ev->detail); | - | ||||||||||||||||||
931 | if (__builtin_expect(!!(lcQpaXInputEvents().isDebugEnabled()), false)
| 0 | ||||||||||||||||||
932 | for (bool qt_category_enabled = lcQpaXInputEvents().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1126, __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("legacy mouse press, button %d state %X", ev->detail, static_cast<unsigned int>(m_buttons)); | 0 | ||||||||||||||||||
933 | { xcb_button_press_event_t *e = (xcb_button_press_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
never executed: }eventListener->handleButtonPressEvent(e); never executed: } break;end of block never executed: ;break; | 0 | ||||||||||||||||||
934 | } | - | ||||||||||||||||||
935 | case never executed: 5:case 5: never executed: {case 5: | 0 | ||||||||||||||||||
936 | xcb_button_release_event_t *ev = (xcb_button_release_event_t *)event; | - | ||||||||||||||||||
937 | m_keyboard->updateXKBStateFromCore(ev->state); | - | ||||||||||||||||||
938 | m_buttons = (m_buttons & ~0x7) | translateMouseButtons(ev->state); | - | ||||||||||||||||||
939 | m_buttons &= ~translateMouseButton(ev->detail); | - | ||||||||||||||||||
940 | if (__builtin_expect(!!(lcQpaXInputEvents().isDebugEnabled()), false)
| 0 | ||||||||||||||||||
941 | for (bool qt_category_enabled = lcQpaXInputEvents().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1135, __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("legacy mouse release, button %d state %X", ev->detail, static_cast<unsigned int>(m_buttons)); | 0 | ||||||||||||||||||
942 | { xcb_button_release_event_t *e = (xcb_button_release_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
never executed: }eventListener->handleButtonReleaseEvent(e); never executed: } break;end of block never executed: ;break; | 0 | ||||||||||||||||||
943 | } | - | ||||||||||||||||||
944 | case never executed: 6:case 6: never executed: {case 6: | 0 | ||||||||||||||||||
945 | xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)event; | - | ||||||||||||||||||
946 | m_keyboard->updateXKBStateFromCore(ev->state); | - | ||||||||||||||||||
947 | m_buttons = (m_buttons & ~0x7) | translateMouseButtons(ev->state); | - | ||||||||||||||||||
948 | if (__builtin_expect(!!(lcQpaXInputEvents().isDebugEnabled()), false)
| 0 | ||||||||||||||||||
949 | for (bool qt_category_enabled = lcQpaXInputEvents().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger( __FILE__ , 1144 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("legacy mouse move %d,%d button %d state %X", ev->event_x, ev->event_y, ev->detail, static_cast<unsigned int>(m_buttons)) ; | 0 | ||||||||||||||||||
950 | __FILE__ never executed: QMessageLogger( __FILE__ , 1144 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("legacy mouse move %d,%d button %d state %X", ev->event_x, ev->event_y, ev->detail, static_cast<unsigned int>(m_buttons)) ; | 0 | ||||||||||||||||||
951 | , never executed: QMessageLogger( __FILE__ , 1144 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("legacy mouse move %d,%d button %d state %X", ev->event_x, ev->event_y, ev->detail, static_cast<unsigned int>(m_buttons)) ; | 0 | ||||||||||||||||||
952 | 11331144 never executed: QMessageLogger( __FILE__ , 1144 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("legacy mouse move %d,%d button %d state %X", ev->event_x, ev->event_y, ev->detail, static_cast<unsigned int>(m_buttons)) ; | 0 | ||||||||||||||||||
953 | , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("legacy mouse move %d,%d button %d state %X", ev->event_x, ev->event_y, ev->detail, static_cast<unsigned int>(m_buttons)) never executed: QMessageLogger( __FILE__ , 1144 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("legacy mouse move %d,%d button %d state %X", ev->event_x, ev->event_y, ev->detail, static_cast<unsigned int>(m_buttons)) ; | 0 | ||||||||||||||||||
954 | ; never executed: QMessageLogger( __FILE__ , 1144 , __PRETTY_FUNCTION__, lcQpaXInputEvents().categoryName()).debug("legacy mouse move %d,%d button %d state %X", ev->event_x, ev->event_y, ev->detail, static_cast<unsigned int>(m_buttons)) ; | 0 | ||||||||||||||||||
955 | { xcb_motion_notify_event_t *e = (xcb_motion_notify_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
never executed: }eventListener->handleMotionNotifyEvent(e); never executed: } break;end of block never executed: ;break; | 0 | ||||||||||||||||||
956 | } | - | ||||||||||||||||||
957 | - | |||||||||||||||||||
958 | case executed 6597 times by 110 tests: 22:case 22: Executed by:
executed 6597 times by 110 tests: case 22: Executed by:
| 6597 | ||||||||||||||||||
959 | { xcb_configure_notify_event_t *e = (xcb_configure_notify_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
executed 5756 times by 109 tests: }eventListener->handleConfigureNotifyEvent(e); Executed by:
executed 5756 times by 109 tests: } break;end of block Executed by:
executed 6597 times by 110 tests: ;break; Executed by:
| 0-6597 | ||||||||||||||||||
960 | case executed 2708 times by 108 tests: 19:case 19: Executed by:
executed 2708 times by 108 tests: case 19: Executed by:
| 2708 | ||||||||||||||||||
961 | { xcb_map_notify_event_t *e = (xcb_map_notify_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
executed 2478 times by 104 tests: }eventListener->handleMapNotifyEvent(e); Executed by:
executed 2478 times by 104 tests: } break;end of block Executed by:
executed 2708 times by 108 tests: ;break; Executed by:
| 0-2708 | ||||||||||||||||||
962 | case executed 2545 times by 93 tests: 18:case 18: Executed by:
executed 2545 times by 93 tests: case 18: Executed by:
| 2545 | ||||||||||||||||||
963 | { xcb_unmap_notify_event_t *e = (xcb_unmap_notify_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
executed 97 times by 30 tests: }eventListener->handleUnmapNotifyEvent(e); Executed by:
executed 97 times by 30 tests: } break;end of block Executed by:
executed 2545 times by 93 tests: ;break; Executed by:
| 0-2545 | ||||||||||||||||||
964 | case executed 3713 times by 98 tests: 17:case 17: Executed by:
executed 3713 times by 98 tests: case 17: Executed by:
| 3713 | ||||||||||||||||||
965 | { xcb_destroy_notify_event_t *e = (xcb_destroy_notify_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
never executed: }eventListener->handleDestroyNotifyEvent(e); never executed: } break;end of block executed 3713 times by 98 tests: ;break; Executed by:
| 0-3713 | ||||||||||||||||||
966 | case executed 12136 times by 111 tests: 33:case 33: Executed by:
executed 12136 times by 111 tests: case 33: Executed by:
| 12136 | ||||||||||||||||||
967 | handleClientMessageEvent((xcb_client_message_event_t *)event); | - | ||||||||||||||||||
968 | break; executed 12136 times by 111 tests: break; Executed by:
| 12136 | ||||||||||||||||||
969 | case executed 855 times by 70 tests: 7:case 7: Executed by:
executed 855 times by 70 tests: case 7: Executed by:
| 855 | ||||||||||||||||||
970 | - | |||||||||||||||||||
971 | if (isAtLeastXI22()
| 0-855 | ||||||||||||||||||
972 | break; executed 855 times by 70 tests: break; Executed by:
| 855 | ||||||||||||||||||
973 | - | |||||||||||||||||||
974 | { xcb_enter_notify_event_t *e = (xcb_enter_notify_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
never executed: }eventListener->handleEnterNotifyEvent(e); never executed: } break;end of block never executed: ;break; | 0 | ||||||||||||||||||
975 | case executed 806 times by 58 tests: 8:case 8: Executed by:
executed 806 times by 58 tests: case 8: Executed by:
| 806 | ||||||||||||||||||
976 | - | |||||||||||||||||||
977 | if (isAtLeastXI22()
| 0-806 | ||||||||||||||||||
978 | break; executed 806 times by 58 tests: break; Executed by:
| 806 | ||||||||||||||||||
979 | - | |||||||||||||||||||
980 | m_keyboard->updateXKBStateFromCore(((xcb_leave_notify_event_t *)event)->state); | - | ||||||||||||||||||
981 | { xcb_leave_notify_event_t *e = (xcb_leave_notify_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
never executed: }eventListener->handleLeaveNotifyEvent(e); never executed: } break;end of block never executed: ;break; | 0 | ||||||||||||||||||
982 | case executed 3345 times by 107 tests: 9:case 9: Executed by:
executed 3345 times by 107 tests: case 9: Executed by:
| 3345 | ||||||||||||||||||
983 | { xcb_focus_in_event_t *e = (xcb_focus_in_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
executed 2580 times by 103 tests: }eventListener->handleFocusInEvent(e); Executed by:
executed 2580 times by 103 tests: } break;end of block Executed by:
executed 3345 times by 107 tests: ;break; Executed by:
| 0-3345 | ||||||||||||||||||
984 | case executed 2725 times by 91 tests: 10:case 10: Executed by:
executed 2725 times by 91 tests: case 10: Executed by:
| 2725 | ||||||||||||||||||
985 | { xcb_focus_out_event_t *e = (xcb_focus_out_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
executed 430 times by 49 tests: }eventListener->handleFocusOutEvent(e); Executed by:
executed 430 times by 49 tests: } break;end of block Executed by:
executed 2725 times by 91 tests: ;break; Executed by:
| 0-2725 | ||||||||||||||||||
986 | case never executed: 2:case 2: never executed: case 2: | 0 | ||||||||||||||||||
987 | { | - | ||||||||||||||||||
988 | xcb_key_press_event_t *kp = (xcb_key_press_event_t *)event; | - | ||||||||||||||||||
989 | m_keyboard->updateXKBStateFromCore(kp->state); | - | ||||||||||||||||||
990 | setTime(kp->time); | - | ||||||||||||||||||
991 | { xcb_key_press_event_t *e = (xcb_key_press_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
never executed: }m_keyboard->handleKeyPressEvent(e); never executed: } break;end of block never executed: ;break; | 0 | ||||||||||||||||||
992 | } | - | ||||||||||||||||||
993 | case never executed: 3:case 3: never executed: case 3: | 0 | ||||||||||||||||||
994 | m_keyboard->updateXKBStateFromCore(((xcb_key_release_event_t *)event)->state); | - | ||||||||||||||||||
995 | { xcb_key_release_event_t *e = (xcb_key_release_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)
never executed: }m_keyboard->handleKeyReleaseEvent(e); never executed: } break;end of block never executed: ;break; | 0 | ||||||||||||||||||
996 | case never executed: 34:case 34: never executed: case 34: | 0 | ||||||||||||||||||
997 | m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event); | - | ||||||||||||||||||
998 | break; never executed: break; | 0 | ||||||||||||||||||
999 | case executed 10 times by 5 tests: 30:case 30: Executed by:
executed 10 times by 5 tests: case 30: Executed by:
| 10 | ||||||||||||||||||
1000 | { | - | ||||||||||||||||||
1001 | xcb_selection_request_event_t *sr = (xcb_selection_request_event_t *)event; | - | ||||||||||||||||||
1002 | - | |||||||||||||||||||
1003 | if (sr->selection == atom(QXcbAtom::XdndSelection)
| 0-10 | ||||||||||||||||||
1004 | m_drag->handleSelectionRequest(sr); never executed: m_drag->handleSelectionRequest(sr); | 0 | ||||||||||||||||||
1005 | else | - | ||||||||||||||||||
1006 | - | |||||||||||||||||||
1007 | { | - | ||||||||||||||||||
1008 | - | |||||||||||||||||||
1009 | m_clipboard->handleSelectionRequest(sr); | - | ||||||||||||||||||
1010 | - | |||||||||||||||||||
1011 | } executed 10 times by 5 tests: end of block Executed by:
| 10 | ||||||||||||||||||
1012 | break; executed 10 times by 5 tests: break; Executed by:
| 10 | ||||||||||||||||||
1013 | } | - | ||||||||||||||||||
1014 | case executed 15 times by 3 tests: 29:case 29: Executed by:
executed 15 times by 3 tests: case 29: Executed by:
| 15 | ||||||||||||||||||
1015 | setTime(((xcb_selection_clear_event_t *)event)->time); | - | ||||||||||||||||||
1016 | - | |||||||||||||||||||
1017 | m_clipboard->handleSelectionClearRequest((xcb_selection_clear_event_t *)event); | - | ||||||||||||||||||
1018 | - | |||||||||||||||||||
1019 | handled = true; | - | ||||||||||||||||||
1020 | break; executed 15 times by 3 tests: break; Executed by:
| 15 | ||||||||||||||||||
1021 | case never executed: 31:case 31: never executed: case 31: | 0 | ||||||||||||||||||
1022 | setTime(((xcb_selection_notify_event_t *)event)->time); | - | ||||||||||||||||||
1023 | handled = false; | - | ||||||||||||||||||
1024 | break; never executed: break; | 0 | ||||||||||||||||||
1025 | case executed 205289 times by 113 tests: 28:case 28: Executed by:
executed 205289 times by 113 tests: case 28: Executed by:
| 205289 | ||||||||||||||||||
1026 | { | - | ||||||||||||||||||
1027 | xcb_property_notify_event_t *pn = (xcb_property_notify_event_t *)event; | - | ||||||||||||||||||
1028 | if (pn->atom == atom(QXcbAtom::_NET_WORKAREA)
| 0-205289 | ||||||||||||||||||
1029 | QXcbVirtualDesktop *virtualDesktop = virtualDesktopForRootWindow(pn->window); | - | ||||||||||||||||||
1030 | if (virtualDesktop
| 0 | ||||||||||||||||||
1031 | virtualDesktop->updateWorkArea(); never executed: virtualDesktop->updateWorkArea(); | 0 | ||||||||||||||||||
1032 | } never executed: else {end of block | 0 | ||||||||||||||||||
1033 | { xcb_property_notify_event_t *e = (xcb_property_notify_event_t *)event; if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->window)
executed 102151 times by 112 tests: }eventListener->handlePropertyNotifyEvent(e); Executed by:
executed 102151 times by 112 tests: } break;end of block Executed by:
executed 205289 times by 113 tests: ;break; Executed by:
| 0-205289 | ||||||||||||||||||
1034 | } | - | ||||||||||||||||||
1035 | break; never executed: break; | 0 | ||||||||||||||||||
1036 | } | - | ||||||||||||||||||
1037 | - | |||||||||||||||||||
1038 | case executed 2185 times by 70 tests: 35:case 35: Executed by:
executed 2185 times by 70 tests: case 35: Executed by:
| 2185 | ||||||||||||||||||
1039 | - | |||||||||||||||||||
1040 | if (m_xi2Enabled
| 0-2185 | ||||||||||||||||||
1041 | xi2HandleEvent(reinterpret_cast<xcb_ge_event_t *>(event)); executed 2185 times by 70 tests: xi2HandleEvent(reinterpret_cast<xcb_ge_event_t *>(event)); Executed by:
| 2185 | ||||||||||||||||||
1042 | break; executed 2185 times by 70 tests: break; Executed by:
| 2185 | ||||||||||||||||||
1043 | - | |||||||||||||||||||
1044 | default executed 2995 times by 109 tests: :default: Executed by:
executed 2995 times by 109 tests: default: Executed by:
| 2995 | ||||||||||||||||||
1045 | handled = false; | - | ||||||||||||||||||
1046 | break; executed 2995 times by 109 tests: break; Executed by:
| 2995 | ||||||||||||||||||
1047 | } | - | ||||||||||||||||||
1048 | } | - | ||||||||||||||||||
1049 | - | |||||||||||||||||||
1050 | if (!handled
| 15-248892 | ||||||||||||||||||
1051 | if (response_type == xfixes_first_event + 0
| 67-248825 | ||||||||||||||||||
1052 | xcb_xfixes_selection_notify_event_t *notify_event = (xcb_xfixes_selection_notify_event_t *)event; | - | ||||||||||||||||||
1053 | setTime(notify_event->timestamp); | - | ||||||||||||||||||
1054 | - | |||||||||||||||||||
1055 | m_clipboard->handleXFixesSelectionRequest(notify_event); | - | ||||||||||||||||||
1056 | - | |||||||||||||||||||
1057 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_virtualDesktops)>::type> _container_((m_virtualDesktops)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (QXcbVirtualDesktop *virtualDesktop = *_container_.i; _container_.control; _container_.control = 0): qAsConst(m_virtualDesktops)) | - | ||||||||||||||||||
1058 | virtualDesktop->handleXFixesSelectionNotify(notify_event); executed 67 times by 6 tests: virtualDesktop->handleXFixesSelectionNotify(notify_event); Executed by:
| 67 | ||||||||||||||||||
1059 | - | |||||||||||||||||||
1060 | handled = true; | - | ||||||||||||||||||
1061 | } executed 67 times by 6 tests: else if (has_randr_extensionend of block Executed by:
| 0-248825 | ||||||||||||||||||
1062 | updateScreens((xcb_randr_notify_event_t *)event); | - | ||||||||||||||||||
1063 | handled = true; | - | ||||||||||||||||||
1064 | } never executed: else if (has_randr_extensionend of block
| 0-248825 | ||||||||||||||||||
1065 | xcb_randr_screen_change_notify_event_t *change_event = (xcb_randr_screen_change_notify_event_t *)event; | - | ||||||||||||||||||
for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_screens)>::type> _container_((m_screens)); _container_.control && _container_.i != _container_.e; | ||||||||||||||||||||
1066 | ++_container_.i, _container_.control ^= 1)for (QXcbScreen *s = *_container_.i; _container_.control; _container_.control = 0): qAsConst(m_screens)) { | - | ||||||||||||||||||
1067 | if (s->root() == change_event->root
| 0 | ||||||||||||||||||
1068 | s->handleScreenChange(change_event); never executed: s->handleScreenChange(change_event); | 0 | ||||||||||||||||||
1069 | } never executed: end of block | 0 | ||||||||||||||||||
1070 | handled = true; | - | ||||||||||||||||||
1071 | - | |||||||||||||||||||
1072 | } never executed: else if (response_type == xkb_first_eventend of block
| 0-248825 | ||||||||||||||||||
1073 | _xkb_event *xkb_event = reinterpret_cast<_xkb_event *>(event); | - | ||||||||||||||||||
1074 | if (xkb_event->any.deviceID == m_keyboard->coreDeviceId()
| 0 | ||||||||||||||||||
1075 | switch (xkb_event->any.xkbType) { | - | ||||||||||||||||||
1076 | - | |||||||||||||||||||
1077 | - | |||||||||||||||||||
1078 | case never executed: 2:case 2: never executed: case 2: | 0 | ||||||||||||||||||
1079 | m_keyboard->updateXKBState(&xkb_event->state_notify); | - | ||||||||||||||||||
1080 | handled = true; | - | ||||||||||||||||||
1081 | break; never executed: break; | 0 | ||||||||||||||||||
1082 | case never executed: 1:case 1: never executed: case 1: | 0 | ||||||||||||||||||
1083 | m_keyboard->handleMappingNotifyEvent(&xkb_event->map_notify); | - | ||||||||||||||||||
1084 | handled = true; | - | ||||||||||||||||||
1085 | break; never executed: break; | 0 | ||||||||||||||||||
1086 | case never executed: 0:case 0: never executed: {case 0: | 0 | ||||||||||||||||||
1087 | xcb_xkb_new_keyboard_notify_event_t *ev = &xkb_event->new_keyboard_notify; | - | ||||||||||||||||||
1088 | if (ev->changed & XCB_XKB_NKN_DETAIL_KEYCODES
| 0 | ||||||||||||||||||
1089 | m_keyboard->updateKeymap(); never executed: m_keyboard->updateKeymap(); | 0 | ||||||||||||||||||
1090 | break; never executed: break; | 0 | ||||||||||||||||||
1091 | } | - | ||||||||||||||||||
1092 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
1093 | break; never executed: break; | 0 | ||||||||||||||||||
1094 | } | - | ||||||||||||||||||
1095 | } | - | ||||||||||||||||||
1096 | - | |||||||||||||||||||
1097 | } never executed: end of block | 0 | ||||||||||||||||||
1098 | } executed 248892 times by 117 tests: end of block Executed by:
| 248892 | ||||||||||||||||||
1099 | - | |||||||||||||||||||
1100 | if (!handled
| 0-248825 | ||||||||||||||||||
1101 | handled = m_glIntegration->handleXcbEvent(event, response_type); executed 248825 times by 117 tests: handled = m_glIntegration->handleXcbEvent(event, response_type); Executed by:
| 248825 | ||||||||||||||||||
1102 | - | |||||||||||||||||||
1103 | if (handled
| 82-248825 | ||||||||||||||||||
1104 | printXcbEvent("Handled XCB event", event); executed 82 times by 6 tests: printXcbEvent("Handled XCB event", event); Executed by:
| 82 | ||||||||||||||||||
1105 | else | - | ||||||||||||||||||
1106 | printXcbEvent("Unhandled XCB event", event); executed 248825 times by 117 tests: printXcbEvent("Unhandled XCB event", event); Executed by:
| 248825 | ||||||||||||||||||
1107 | } | - | ||||||||||||||||||
1108 | - | |||||||||||||||||||
1109 | void QXcbConnection::addPeekFunc(PeekFunc f) | - | ||||||||||||||||||
1110 | { | - | ||||||||||||||||||
1111 | m_peekFuncs.append(f); | - | ||||||||||||||||||
1112 | } | - | ||||||||||||||||||
1113 | - | |||||||||||||||||||
1114 | QXcbEventReader::QXcbEventReader(QXcbConnection *connection) | - | ||||||||||||||||||
1115 | : m_connection(connection) | - | ||||||||||||||||||
1116 | { | - | ||||||||||||||||||
1117 | checkXcbPollForQueuedEvent(); | - | ||||||||||||||||||
1118 | } | - | ||||||||||||||||||
1119 | - | |||||||||||||||||||
1120 | void QXcbEventReader::start() | - | ||||||||||||||||||
1121 | { | - | ||||||||||||||||||
1122 | if (local_xcb_poll_for_queued_event) { | - | ||||||||||||||||||
1123 | connect(this, qFlagLocation("2""eventPending()" "\0" __FILE__ ":" "1302""1313"), m_connection, qFlagLocation("1""processXcbEvents()" "\0" __FILE__ ":" "1302""1313"), Qt::QueuedConnection); | - | ||||||||||||||||||
1124 | connect(this, qFlagLocation("2""finished()" "\0" __FILE__ ":" "1303""1314"), m_connection, qFlagLocation("1""processXcbEvents()" "\0" __FILE__ ":" "1303""1314")); | - | ||||||||||||||||||
1125 | QThread::start(); | - | ||||||||||||||||||
1126 | } else { | - | ||||||||||||||||||
1127 | - | |||||||||||||||||||
1128 | - | |||||||||||||||||||
1129 | QMetaObject::invokeMethod(this, "registerForEvents", Qt::QueuedConnection); | - | ||||||||||||||||||
1130 | } | - | ||||||||||||||||||
1131 | } | - | ||||||||||||||||||
1132 | - | |||||||||||||||||||
1133 | void QXcbEventReader::registerForEvents() | - | ||||||||||||||||||
1134 | { | - | ||||||||||||||||||
1135 | QSocketNotifier *notifier = new QSocketNotifier(xcb_get_file_descriptor(m_connection->xcb_connection()), QSocketNotifier::Read, this); | - | ||||||||||||||||||
1136 | connect(notifier, qFlagLocation("2""activated(int)" "\0" __FILE__ ":" "1315""1326"), m_connection, qFlagLocation("1""processXcbEvents()" "\0" __FILE__ ":" "1315""1326")); | - | ||||||||||||||||||
1137 | - | |||||||||||||||||||
1138 | QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; | - | ||||||||||||||||||
1139 | connect(dispatcher, qFlagLocation("2""aboutToBlock()" "\0" __FILE__ ":" "1318""1329"), m_connection, qFlagLocation("1""processXcbEvents()" "\0" __FILE__ ":" "1318""1329")); | - | ||||||||||||||||||
1140 | connect(dispatcher, qFlagLocation("2""awake()" "\0" __FILE__ ":" "1319""1330"), m_connection, qFlagLocation("1""processXcbEvents()" "\0" __FILE__ ":" "1319""1330")); | - | ||||||||||||||||||
1141 | } | - | ||||||||||||||||||
1142 | - | |||||||||||||||||||
1143 | void QXcbEventReader::registerEventDispatcher(QAbstractEventDispatcher *dispatcher) | - | ||||||||||||||||||
1144 | { | - | ||||||||||||||||||
1145 | - | |||||||||||||||||||
1146 | - | |||||||||||||||||||
1147 | - | |||||||||||||||||||
1148 | if (local_xcb_poll_for_queued_event) | - | ||||||||||||||||||
1149 | connect(dispatcher, qFlagLocation("2""aboutToBlock()" "\0" __FILE__ ":" "1328""1339"), m_connection, qFlagLocation("1""flush()" "\0" __FILE__ ":" "1328""1339")); | - | ||||||||||||||||||
1150 | } | - | ||||||||||||||||||
1151 | - | |||||||||||||||||||
1152 | void QXcbEventReader::run() | - | ||||||||||||||||||
1153 | { | - | ||||||||||||||||||
1154 | xcb_generic_event_t *event; | - | ||||||||||||||||||
1155 | while (m_connection && (event = xcb_wait_for_event(m_connection->xcb_connection()))) { | - | ||||||||||||||||||
1156 | m_mutex.lock(); | - | ||||||||||||||||||
1157 | addEvent(event); | - | ||||||||||||||||||
1158 | while (m_connection && (event = local_xcb_poll_for_queued_event(m_connection->xcb_connection()))) | - | ||||||||||||||||||
1159 | addEvent(event); | - | ||||||||||||||||||
1160 | m_mutex.unlock(); | - | ||||||||||||||||||
1161 | eventPending(); | - | ||||||||||||||||||
1162 | } | - | ||||||||||||||||||
1163 | - | |||||||||||||||||||
1164 | m_mutex.lock(); | - | ||||||||||||||||||
1165 | for (int i = 0; i < m_events.size(); ++i) | - | ||||||||||||||||||
1166 | free(m_events.at(i)); | - | ||||||||||||||||||
1167 | m_events.clear(); | - | ||||||||||||||||||
1168 | m_mutex.unlock(); | - | ||||||||||||||||||
1169 | } | - | ||||||||||||||||||
1170 | - | |||||||||||||||||||
1171 | void QXcbEventReader::addEvent(xcb_generic_event_t *event) | - | ||||||||||||||||||
1172 | { | - | ||||||||||||||||||
1173 | if ((event->response_type & ~0x80) == 33 | - | ||||||||||||||||||
1174 | && ((xcb_client_message_event_t *)event)->type == m_connection->atom(QXcbAtom::_QT_CLOSE_CONNECTION)) | - | ||||||||||||||||||
1175 | m_connection = 0; | - | ||||||||||||||||||
1176 | m_events << event; | - | ||||||||||||||||||
1177 | } | - | ||||||||||||||||||
1178 | - | |||||||||||||||||||
1179 | QXcbEventArray *QXcbEventReader::lock() | - | ||||||||||||||||||
1180 | { | - | ||||||||||||||||||
1181 | m_mutex.lock(); | - | ||||||||||||||||||
1182 | if (!local_xcb_poll_for_queued_event) { | - | ||||||||||||||||||
1183 | while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection->xcb_connection())) | - | ||||||||||||||||||
1184 | m_events << event; | - | ||||||||||||||||||
1185 | } | - | ||||||||||||||||||
1186 | return &m_events; | - | ||||||||||||||||||
1187 | } | - | ||||||||||||||||||
1188 | - | |||||||||||||||||||
1189 | void QXcbEventReader::unlock() | - | ||||||||||||||||||
1190 | { | - | ||||||||||||||||||
1191 | m_mutex.unlock(); | - | ||||||||||||||||||
1192 | } | - | ||||||||||||||||||
1193 | - | |||||||||||||||||||
1194 | void QXcbConnection::setFocusWindow(QXcbWindow *w) | - | ||||||||||||||||||
1195 | { | - | ||||||||||||||||||
1196 | m_focusWindow = w; | - | ||||||||||||||||||
1197 | } | - | ||||||||||||||||||
1198 | void QXcbConnection::setMouseGrabber(QXcbWindow *w) | - | ||||||||||||||||||
1199 | { | - | ||||||||||||||||||
1200 | m_mouseGrabber = w; | - | ||||||||||||||||||
1201 | m_mousePressWindow = nullptr; | - | ||||||||||||||||||
1202 | } | - | ||||||||||||||||||
1203 | void QXcbConnection::setMousePressWindow(QXcbWindow *w) | - | ||||||||||||||||||
1204 | { | - | ||||||||||||||||||
1205 | m_mousePressWindow = w; | - | ||||||||||||||||||
1206 | } | - | ||||||||||||||||||
1207 | - | |||||||||||||||||||
1208 | void QXcbConnection::grabServer() | - | ||||||||||||||||||
1209 | { | - | ||||||||||||||||||
1210 | if (m_canGrabServer) | - | ||||||||||||||||||
1211 | xcb_grab_server(m_connection); | - | ||||||||||||||||||
1212 | } | - | ||||||||||||||||||
1213 | - | |||||||||||||||||||
1214 | void QXcbConnection::ungrabServer() | - | ||||||||||||||||||
1215 | { | - | ||||||||||||||||||
1216 | if (m_canGrabServer) | - | ||||||||||||||||||
1217 | xcb_ungrab_server(m_connection); | - | ||||||||||||||||||
1218 | } | - | ||||||||||||||||||
1219 | - | |||||||||||||||||||
1220 | void QXcbConnection::sendConnectionEvent(QXcbAtom::Atom a, uint id) | - | ||||||||||||||||||
1221 | { | - | ||||||||||||||||||
1222 | xcb_client_message_event_t event; | - | ||||||||||||||||||
1223 | memset(&event, 0, sizeof(event)); | - | ||||||||||||||||||
1224 | - | |||||||||||||||||||
1225 | const xcb_window_t eventListener = xcb_generate_id(m_connection); | - | ||||||||||||||||||
1226 | xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); | - | ||||||||||||||||||
1227 | xcb_screen_t *screen = it.data; | - | ||||||||||||||||||
1228 | xcb_create_window(m_connection, 0L, eventListener, screen->root, 0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_ONLY, screen->root_visual, 0, 0) | - | ||||||||||||||||||
1229 | - | |||||||||||||||||||
1230 | - | |||||||||||||||||||
1231 | ; | - | ||||||||||||||||||
1232 | - | |||||||||||||||||||
1233 | event.response_type = 33; | - | ||||||||||||||||||
1234 | event.format = 32; | - | ||||||||||||||||||
1235 | event.sequence = 0; | - | ||||||||||||||||||
1236 | event.window = eventListener; | - | ||||||||||||||||||
1237 | event.type = atom(a); | - | ||||||||||||||||||
1238 | event.data.data32[0] = id; | - | ||||||||||||||||||
1239 | - | |||||||||||||||||||
1240 | xcb_send_event(xcb_connection(), false, eventListener, XCB_EVENT_MASK_NO_EVENT, (const char *)&event); | - | ||||||||||||||||||
1241 | xcb_destroy_window(m_connection, eventListener); | - | ||||||||||||||||||
1242 | xcb_flush(xcb_connection()); | - | ||||||||||||||||||
1243 | } | - | ||||||||||||||||||
1244 | - | |||||||||||||||||||
1245 | namespace | - | ||||||||||||||||||
1246 | { | - | ||||||||||||||||||
1247 | class PropertyNotifyEvent { | - | ||||||||||||||||||
1248 | public: | - | ||||||||||||||||||
1249 | PropertyNotifyEvent(xcb_window_t win, xcb_atom_t property) | - | ||||||||||||||||||
1250 | : window(win), type(28), atom(property) {} | - | ||||||||||||||||||
1251 | xcb_window_t window; | - | ||||||||||||||||||
1252 | int type; | - | ||||||||||||||||||
1253 | xcb_atom_t atom; | - | ||||||||||||||||||
1254 | bool checkEvent(xcb_generic_event_t *event) const { | - | ||||||||||||||||||
1255 | if (!event) | - | ||||||||||||||||||
1256 | return false; | - | ||||||||||||||||||
1257 | if ((event->response_type & ~0x80) != type) { | - | ||||||||||||||||||
1258 | return false; | - | ||||||||||||||||||
1259 | } else { | - | ||||||||||||||||||
1260 | xcb_property_notify_event_t *pn = (xcb_property_notify_event_t *)event; | - | ||||||||||||||||||
1261 | if ((pn->window == window) && (pn->atom == atom)) | - | ||||||||||||||||||
1262 | return true; | - | ||||||||||||||||||
1263 | } | - | ||||||||||||||||||
1264 | return false; | - | ||||||||||||||||||
1265 | } | - | ||||||||||||||||||
1266 | }; | - | ||||||||||||||||||
1267 | } | - | ||||||||||||||||||
1268 | - | |||||||||||||||||||
1269 | xcb_timestamp_t QXcbConnection::getTimestamp() | - | ||||||||||||||||||
1270 | { | - | ||||||||||||||||||
1271 | - | |||||||||||||||||||
1272 | xcb_window_t root_win = rootWindow(); | - | ||||||||||||||||||
1273 | xcb_change_property(xcb_connection(), XCB_PROP_MODE_APPEND, root_win, atom(QXcbAtom::CLIP_TEMPORARY), | - | ||||||||||||||||||
1274 | XCB_ATOM_INTEGER, 32, 0, __null); | - | ||||||||||||||||||
1275 | - | |||||||||||||||||||
1276 | connection()->flush(); | - | ||||||||||||||||||
1277 | PropertyNotifyEvent checker(root_win, atom(QXcbAtom::CLIP_TEMPORARY)); | - | ||||||||||||||||||
1278 | - | |||||||||||||||||||
1279 | xcb_generic_event_t *event = 0; | - | ||||||||||||||||||
1280 | - | |||||||||||||||||||
1281 | - | |||||||||||||||||||
1282 | - | |||||||||||||||||||
1283 | while (!event) { | - | ||||||||||||||||||
1284 | connection()->sync(); | - | ||||||||||||||||||
1285 | event = checkEvent(checker); | - | ||||||||||||||||||
1286 | } | - | ||||||||||||||||||
1287 | - | |||||||||||||||||||
1288 | xcb_property_notify_event_t *pn = (xcb_property_notify_event_t *)event; | - | ||||||||||||||||||
1289 | xcb_timestamp_t timestamp = pn->time; | - | ||||||||||||||||||
1290 | free(event); | - | ||||||||||||||||||
1291 | - | |||||||||||||||||||
1292 | xcb_delete_property(xcb_connection(), root_win, atom(QXcbAtom::CLIP_TEMPORARY)); | - | ||||||||||||||||||
1293 | - | |||||||||||||||||||
1294 | return timestamp; | - | ||||||||||||||||||
1295 | } | - | ||||||||||||||||||
1296 | - | |||||||||||||||||||
1297 | xcb_window_t QXcbConnection::getSelectionOwner(xcb_atom_t atom) const | - | ||||||||||||||||||
1298 | { | - | ||||||||||||||||||
1299 | xcb_connection_t *c = xcb_connection(); | - | ||||||||||||||||||
1300 | xcb_get_selection_owner_cookie_t cookie = xcb_get_selection_owner(c, atom); | - | ||||||||||||||||||
1301 | xcb_get_selection_owner_reply_t *reply; | - | ||||||||||||||||||
1302 | reply = xcb_get_selection_owner_reply(c, cookie, 0); | - | ||||||||||||||||||
1303 | xcb_window_t win = reply->owner; | - | ||||||||||||||||||
1304 | free(reply); | - | ||||||||||||||||||
1305 | return win; | - | ||||||||||||||||||
1306 | } | - | ||||||||||||||||||
1307 | - | |||||||||||||||||||
1308 | xcb_window_t QXcbConnection::getQtSelectionOwner() | - | ||||||||||||||||||
1309 | { | - | ||||||||||||||||||
1310 | if (!m_qtSelectionOwner) { | - | ||||||||||||||||||
1311 | xcb_screen_t *xcbScreen = primaryVirtualDesktop()->screen(); | - | ||||||||||||||||||
1312 | int x = 0, y = 0, w = 3, h = 3; | - | ||||||||||||||||||
1313 | m_qtSelectionOwner = xcb_generate_id(xcb_connection()); | - | ||||||||||||||||||
1314 | xcb_create_window(xcb_connection(), 0L, m_qtSelectionOwner, xcbScreen->root, x, y, w, h, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, xcbScreen->root_visual, 0, 0) | - | ||||||||||||||||||
1315 | ; | - | ||||||||||||||||||
1316 | } | - | ||||||||||||||||||
1317 | return m_qtSelectionOwner; | - | ||||||||||||||||||
1318 | } | - | ||||||||||||||||||
1319 | - | |||||||||||||||||||
1320 | xcb_window_t QXcbConnection::rootWindow() | - | ||||||||||||||||||
1321 | { | - | ||||||||||||||||||
1322 | QXcbScreen *s = primaryScreen(); | - | ||||||||||||||||||
1323 | return s ? s->root() : 0; | - | ||||||||||||||||||
1324 | } | - | ||||||||||||||||||
1325 | - | |||||||||||||||||||
1326 | xcb_window_t QXcbConnection::clientLeader() | - | ||||||||||||||||||
1327 | { | - | ||||||||||||||||||
1328 | if (m_clientLeader == 0) { | - | ||||||||||||||||||
1329 | m_clientLeader = xcb_generate_id(xcb_connection()); | - | ||||||||||||||||||
1330 | QXcbScreen *screen = primaryScreen(); | - | ||||||||||||||||||
1331 | xcb_create_window(xcb_connection(), 0L, m_clientLeader, screen->root(), 0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->screen()->root_visual, 0, 0) | - | ||||||||||||||||||
1332 | - | |||||||||||||||||||
1333 | - | |||||||||||||||||||
1334 | - | |||||||||||||||||||
1335 | - | |||||||||||||||||||
1336 | - | |||||||||||||||||||
1337 | - | |||||||||||||||||||
1338 | - | |||||||||||||||||||
1339 | ; | - | ||||||||||||||||||
1340 | - | |||||||||||||||||||
1341 | QByteArray ba("Qt client leader window"); | - | ||||||||||||||||||
1342 | xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_clientLeader, atom(QXcbAtom::_NET_WM_NAME), atom(QXcbAtom::UTF8_STRING), 8, ba.length(), ba.constData()) | - | ||||||||||||||||||
1343 | - | |||||||||||||||||||
1344 | - | |||||||||||||||||||
1345 | - | |||||||||||||||||||
1346 | - | |||||||||||||||||||
1347 | - | |||||||||||||||||||
1348 | - | |||||||||||||||||||
1349 | ; | - | ||||||||||||||||||
1350 | - | |||||||||||||||||||
1351 | xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_clientLeader, atom(QXcbAtom::WM_CLIENT_LEADER), XCB_ATOM_WINDOW, 32, 1, &m_clientLeader) | - | ||||||||||||||||||
1352 | - | |||||||||||||||||||
1353 | - | |||||||||||||||||||
1354 | - | |||||||||||||||||||
1355 | - | |||||||||||||||||||
1356 | - | |||||||||||||||||||
1357 | - | |||||||||||||||||||
1358 | ; | - | ||||||||||||||||||
1359 | - | |||||||||||||||||||
1360 | - | |||||||||||||||||||
1361 | - | |||||||||||||||||||
1362 | QByteArray session = (static_cast<QGuiApplication *>(QCoreApplication::instance()))->sessionId().toLatin1(); | - | ||||||||||||||||||
1363 | if (!session.isEmpty()) { | - | ||||||||||||||||||
1364 | xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_clientLeader, atom(QXcbAtom::SM_CLIENT_ID), XCB_ATOM_STRING, 8, session.length(), session.constData()) | - | ||||||||||||||||||
1365 | - | |||||||||||||||||||
1366 | - | |||||||||||||||||||
1367 | - | |||||||||||||||||||
1368 | - | |||||||||||||||||||
1369 | - | |||||||||||||||||||
1370 | - | |||||||||||||||||||
1371 | ; | - | ||||||||||||||||||
1372 | } | - | ||||||||||||||||||
1373 | - | |||||||||||||||||||
1374 | } | - | ||||||||||||||||||
1375 | return m_clientLeader; | - | ||||||||||||||||||
1376 | } | - | ||||||||||||||||||
1377 | - | |||||||||||||||||||
1378 | - | |||||||||||||||||||
1379 | void *QXcbConnection::xlib_display() const | - | ||||||||||||||||||
1380 | { | - | ||||||||||||||||||
1381 | return m_xlib_display; | - | ||||||||||||||||||
1382 | } | - | ||||||||||||||||||
1383 | - | |||||||||||||||||||
1384 | void *QXcbConnection::createVisualInfoForDefaultVisualId() const | - | ||||||||||||||||||
1385 | { | - | ||||||||||||||||||
1386 | if (m_defaultVisualId == (2147483647 * 2U + 1U)) | - | ||||||||||||||||||
1387 | return 0; | - | ||||||||||||||||||
1388 | XVisualInfo info; | - | ||||||||||||||||||
1389 | memset(&info, 0, sizeof info); | - | ||||||||||||||||||
1390 | info.visualid = m_defaultVisualId; | - | ||||||||||||||||||
1391 | - | |||||||||||||||||||
1392 | int count = 0; | - | ||||||||||||||||||
1393 | XVisualInfo *retVisual = XGetVisualInfo(((Display *)(this->connection()->xlib_display())), 0x1, &info, &count); | - | ||||||||||||||||||
1394 | ((!(count < 2)) ? qt_assert("count < 2",__FILE__,15811592) : qt_noop()); | - | ||||||||||||||||||
1395 | return retVisual; | - | ||||||||||||||||||
1396 | } | - | ||||||||||||||||||
1397 | - | |||||||||||||||||||
1398 | - | |||||||||||||||||||
1399 | - | |||||||||||||||||||
1400 | - | |||||||||||||||||||
1401 | - | |||||||||||||||||||
1402 | - | |||||||||||||||||||
1403 | static inline bool isXIType(xcb_generic_event_t *event, int opCode, uint16_t type) | - | ||||||||||||||||||
1404 | { | - | ||||||||||||||||||
1405 | if (!isXIEvent(event, opCode)) | - | ||||||||||||||||||
1406 | return false; | - | ||||||||||||||||||
1407 | - | |||||||||||||||||||
1408 | xXIGenericDeviceEvent *xiEvent = reinterpret_cast<xXIGenericDeviceEvent *>(event); | - | ||||||||||||||||||
1409 | return xiEvent->evtype == type; | - | ||||||||||||||||||
1410 | } | - | ||||||||||||||||||
1411 | - | |||||||||||||||||||
1412 | static inline bool isValid(xcb_generic_event_t *event) | - | ||||||||||||||||||
1413 | { | - | ||||||||||||||||||
1414 | return event && (event->response_type & ~0x80); | - | ||||||||||||||||||
1415 | } | - | ||||||||||||||||||
1416 | bool QXcbConnection::compressEvent(xcb_generic_event_t *event, int currentIndex, QXcbEventArray *eventqueue) const | - | ||||||||||||||||||
1417 | { | - | ||||||||||||||||||
1418 | uint responseType = event->response_type & ~0x80; | - | ||||||||||||||||||
1419 | int nextIndex = currentIndex + 1; | - | ||||||||||||||||||
1420 | - | |||||||||||||||||||
1421 | if (responseType == 6) { | - | ||||||||||||||||||
1422 | - | |||||||||||||||||||
1423 | for (int j = nextIndex; j < eventqueue->size(); ++j) { | - | ||||||||||||||||||
1424 | xcb_generic_event_t *next = eventqueue->at(j); | - | ||||||||||||||||||
1425 | if (!isValid(next)) | - | ||||||||||||||||||
1426 | continue; | - | ||||||||||||||||||
1427 | if (next->response_type == 6) | - | ||||||||||||||||||
1428 | return true; | - | ||||||||||||||||||
1429 | } | - | ||||||||||||||||||
1430 | return false; | - | ||||||||||||||||||
1431 | } | - | ||||||||||||||||||
1432 | - | |||||||||||||||||||
1433 | - | |||||||||||||||||||
1434 | if (responseType == 35) { | - | ||||||||||||||||||
1435 | if (!m_xi2Enabled) | - | ||||||||||||||||||
1436 | return false; | - | ||||||||||||||||||
1437 | - | |||||||||||||||||||
1438 | - | |||||||||||||||||||
1439 | if (isXIType(event, m_xiOpCode, 6)) { | - | ||||||||||||||||||
1440 | - | |||||||||||||||||||
1441 | xXIDeviceEvent *xdev = reinterpret_cast<xXIDeviceEvent *>(event); | - | ||||||||||||||||||
1442 | if (const_cast<QXcbConnection *>(this)->tabletDataForDevice(xdev->sourceid)) | - | ||||||||||||||||||
1443 | return false; | - | ||||||||||||||||||
1444 | - | |||||||||||||||||||
1445 | for (int j = nextIndex; j < eventqueue->size(); ++j) { | - | ||||||||||||||||||
1446 | xcb_generic_event_t *next = eventqueue->at(j); | - | ||||||||||||||||||
1447 | if (!isValid(next)) | - | ||||||||||||||||||
1448 | continue; | - | ||||||||||||||||||
1449 | if (isXIType(next, m_xiOpCode, 6)) | - | ||||||||||||||||||
1450 | return true; | - | ||||||||||||||||||
1451 | } | - | ||||||||||||||||||
1452 | return false; | - | ||||||||||||||||||
1453 | } | - | ||||||||||||||||||
1454 | - | |||||||||||||||||||
1455 | - | |||||||||||||||||||
1456 | if (isXIType(event, m_xiOpCode, 19)) { | - | ||||||||||||||||||
1457 | xXIDeviceEvent *xiDeviceEvent = reinterpret_cast<xXIDeviceEvent *>(event); | - | ||||||||||||||||||
1458 | uint32_t id = xiDeviceEvent->detail % 2147483647; | - | ||||||||||||||||||
1459 | for (int j = nextIndex; j < eventqueue->size(); ++j) { | - | ||||||||||||||||||
1460 | xcb_generic_event_t *next = eventqueue->at(j); | - | ||||||||||||||||||
1461 | if (!isValid(next)) | - | ||||||||||||||||||
1462 | continue; | - | ||||||||||||||||||
1463 | if (isXIType(next, m_xiOpCode, 19)) { | - | ||||||||||||||||||
1464 | xXIDeviceEvent *xiDeviceNextEvent = reinterpret_cast<xXIDeviceEvent *>(next); | - | ||||||||||||||||||
1465 | if (id == xiDeviceNextEvent->detail % 2147483647) | - | ||||||||||||||||||
1466 | return true; | - | ||||||||||||||||||
1467 | } | - | ||||||||||||||||||
1468 | } | - | ||||||||||||||||||
1469 | return false; | - | ||||||||||||||||||
1470 | } | - | ||||||||||||||||||
1471 | - | |||||||||||||||||||
1472 | return false; | - | ||||||||||||||||||
1473 | } | - | ||||||||||||||||||
1474 | - | |||||||||||||||||||
1475 | if (responseType == 22) { | - | ||||||||||||||||||
1476 | - | |||||||||||||||||||
1477 | for (int j = nextIndex; j < eventqueue->size(); ++j) { | - | ||||||||||||||||||
1478 | xcb_generic_event_t *next = eventqueue->at(j); | - | ||||||||||||||||||
1479 | if (isValid(next) && next->response_type == 22 | - | ||||||||||||||||||
1480 | && ((xcb_configure_notify_event_t *)next)->event == ((xcb_configure_notify_event_t*)event)->event) | - | ||||||||||||||||||
1481 | { | - | ||||||||||||||||||
1482 | return true; | - | ||||||||||||||||||
1483 | } | - | ||||||||||||||||||
1484 | } | - | ||||||||||||||||||
1485 | return false; | - | ||||||||||||||||||
1486 | } | - | ||||||||||||||||||
1487 | - | |||||||||||||||||||
1488 | return false; | - | ||||||||||||||||||
1489 | } | - | ||||||||||||||||||
1490 | - | |||||||||||||||||||
1491 | void QXcbConnection::processXcbEvents() | - | ||||||||||||||||||
1492 | { | - | ||||||||||||||||||
1493 | int connection_error = xcb_connection_has_error(xcb_connection()); | - | ||||||||||||||||||
1494 | if (connection_error
| 0-115472 | ||||||||||||||||||
1495 | QMessageLogger(__FILE__, 16951706, __PRETTY_FUNCTION__).warning("The X11 connection broke (error %d). Did the X11 server die?", connection_error); | - | ||||||||||||||||||
1496 | exit(1); never executed: exit(1); | 0 | ||||||||||||||||||
1497 | } | - | ||||||||||||||||||
1498 | - | |||||||||||||||||||
1499 | QXcbEventArray *eventqueue = m_reader->lock(); | - | ||||||||||||||||||
1500 | - | |||||||||||||||||||
1501 | for (int i = 0; i < eventqueue->size()
| 115472-250026 | ||||||||||||||||||
1502 | xcb_generic_event_t *event = eventqueue->at(i); | - | ||||||||||||||||||
1503 | if (!event
| 227-249799 | ||||||||||||||||||
1504 | continue; executed 227 times by 23 tests: continue; Executed by:
| 227 | ||||||||||||||||||
1505 | QScopedPointer<xcb_generic_event_t, QScopedPointerPodDeleter> eventGuard(event); | - | ||||||||||||||||||
1506 | (*eventqueue)[i] = 0; | - | ||||||||||||||||||
1507 | - | |||||||||||||||||||
1508 | if (!(event->response_type & ~0x80)
| 0-249799 | ||||||||||||||||||
1509 | handleXcbError((xcb_generic_error_t *)event); | - | ||||||||||||||||||
1510 | continue; never executed: continue; | 0 | ||||||||||||||||||
1511 | } | - | ||||||||||||||||||
1512 | - | |||||||||||||||||||
1513 | if (__builtin_expect(!!(QCoreApplication::testAttribute
| 0-249799 | ||||||||||||||||||
1514 | compressEvent(event, i, eventqueue)
| 902-248897 | ||||||||||||||||||
1515 | continue; executed 902 times by 83 tests: continue; Executed by:
| 902 | ||||||||||||||||||
1516 | - | |||||||||||||||||||
1517 | bool accepted = false; | - | ||||||||||||||||||
1518 | if (clipboard()->processIncr()
| 0-248897 | ||||||||||||||||||
1519 | clipboard()->incrTransactionPeeker(event, accepted); never executed: clipboard()->incrTransactionPeeker(event, accepted); | 0 | ||||||||||||||||||
1520 | if (accepted
| 0-248897 | ||||||||||||||||||
1521 | continue; never executed: continue; | 0 | ||||||||||||||||||
1522 | - | |||||||||||||||||||
1523 | QVector<PeekFunc>::iterator itauto isWaitingFor = m_peekFuncs.begin(); | - | ||||||||||||||||||
while (it != m_peekFuncs.end())[=](PeekFunc peekFunc) { | ||||||||||||||||||||
1524 | - | |||||||||||||||||||
1525 | - | |||||||||||||||||||
1526 | if ((*it)(return executed 121824 times by 85 tests: return peekFunc(this, event); Executed by:
executed 121824 times by 85 tests: peekFunc(this, event))return peekFunc(this, event); Executed by:
executed 121824 times by 85 tests: return peekFunc(this, event); Executed by:
| 121824 | ||||||||||||||||||
it = executed 121824 times by 85 tests: return peekFunc(this, event); Executed by:
executed 121824 times by 85 tests: );return peekFunc(this, event); Executed by:
executed 121824 times by 85 tests: return peekFunc(this, event); Executed by:
| ||||||||||||||||||||
1527 | }; | - | ||||||||||||||||||
1528 | m_peekFuncs.erase(it); | - | ||||||||||||||||||
else | ||||||||||||||||||||
++it; | ||||||||||||||||||||
}std::remove_if(m_peekFuncs.begin(), m_peekFuncs.end(), | ||||||||||||||||||||
1529 | isWaitingFor), | - | ||||||||||||||||||
1530 | m_peekFuncs.end()); | - | ||||||||||||||||||
1531 | m_reader->unlock(); | - | ||||||||||||||||||
1532 | handleXcbEvent(event); | - | ||||||||||||||||||
1533 | m_reader->lock(); | - | ||||||||||||||||||
1534 | } executed 248897 times by 113 tests: end of block Executed by:
| 248897 | ||||||||||||||||||
1535 | - | |||||||||||||||||||
1536 | eventqueue->clear(); | - | ||||||||||||||||||
1537 | - | |||||||||||||||||||
1538 | m_reader->unlock(); | - | ||||||||||||||||||
1539 | - | |||||||||||||||||||
1540 | - | |||||||||||||||||||
1541 | - | |||||||||||||||||||
1542 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_peekFuncs)>::type> _container_((m_peekFuncs)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (PeekFunc f = *_container_.i; _container_.control; _container_.control = 0): qAsConst(m_peekFuncs)) | - | ||||||||||||||||||
1543 | f(this, 0); executed 1941 times by 83 tests: f(this, 0); Executed by:
| 1941 | ||||||||||||||||||
1544 | m_peekFuncs.clear(); | - | ||||||||||||||||||
1545 | - | |||||||||||||||||||
1546 | xcb_flush(xcb_connection()); | - | ||||||||||||||||||
1547 | } executed 115472 times by 113 tests: end of block Executed by:
| 115472 | ||||||||||||||||||
1548 | - | |||||||||||||||||||
1549 | void QXcbConnection::handleClientMessageEvent(const xcb_client_message_event_t *event) | - | ||||||||||||||||||
1550 | { | - | ||||||||||||||||||
1551 | if (event->format != 32) | - | ||||||||||||||||||
1552 | return; | - | ||||||||||||||||||
1553 | - | |||||||||||||||||||
1554 | - | |||||||||||||||||||
1555 | if (event->type == atom(QXcbAtom::XdndStatus)) { | - | ||||||||||||||||||
1556 | drag()->handleStatus(event); | - | ||||||||||||||||||
1557 | } else if (event->type == atom(QXcbAtom::XdndFinished)) { | - | ||||||||||||||||||
1558 | drag()->handleFinished(event); | - | ||||||||||||||||||
1559 | } | - | ||||||||||||||||||
1560 | - | |||||||||||||||||||
1561 | if (m_systemTrayTracker && event->type == atom(QXcbAtom::MANAGER)) | - | ||||||||||||||||||
1562 | m_systemTrayTracker->notifyManagerClientMessageEvent(event); | - | ||||||||||||||||||
1563 | - | |||||||||||||||||||
1564 | QXcbWindow *window = platformWindowFromId(event->window); | - | ||||||||||||||||||
1565 | if (!window) | - | ||||||||||||||||||
1566 | return; | - | ||||||||||||||||||
1567 | - | |||||||||||||||||||
1568 | window->handleClientMessageEvent(event); | - | ||||||||||||||||||
1569 | } | - | ||||||||||||||||||
1570 | - | |||||||||||||||||||
1571 | xcb_generic_event_t *QXcbConnection::checkEvent(int type) | - | ||||||||||||||||||
1572 | { | - | ||||||||||||||||||
1573 | QXcbEventArray *eventqueue = m_reader->lock(); | - | ||||||||||||||||||
1574 | - | |||||||||||||||||||
1575 | for (int i = 0; i < eventqueue->size(); ++i) { | - | ||||||||||||||||||
1576 | xcb_generic_event_t *event = eventqueue->at(i); | - | ||||||||||||||||||
1577 | if (event && event->response_type == type) { | - | ||||||||||||||||||
1578 | (*eventqueue)[i] = 0; | - | ||||||||||||||||||
1579 | m_reader->unlock(); | - | ||||||||||||||||||
1580 | return event; | - | ||||||||||||||||||
1581 | } | - | ||||||||||||||||||
1582 | } | - | ||||||||||||||||||
1583 | - | |||||||||||||||||||
1584 | m_reader->unlock(); | - | ||||||||||||||||||
1585 | - | |||||||||||||||||||
1586 | return 0; | - | ||||||||||||||||||
1587 | } | - | ||||||||||||||||||
1588 | - | |||||||||||||||||||
1589 | static const char * xcb_atomnames = { | - | ||||||||||||||||||
1590 | - | |||||||||||||||||||
1591 | "WM_PROTOCOLS\0" | - | ||||||||||||||||||
1592 | "WM_DELETE_WINDOW\0" | - | ||||||||||||||||||
1593 | "WM_TAKE_FOCUS\0" | - | ||||||||||||||||||
1594 | "_NET_WM_PING\0" | - | ||||||||||||||||||
1595 | "_NET_WM_CONTEXT_HELP\0" | - | ||||||||||||||||||
1596 | "_NET_WM_SYNC_REQUEST\0" | - | ||||||||||||||||||
1597 | "_NET_WM_SYNC_REQUEST_COUNTER\0" | - | ||||||||||||||||||
1598 | "MANAGER\0" | - | ||||||||||||||||||
1599 | "_NET_SYSTEM_TRAY_OPCODE\0" | - | ||||||||||||||||||
1600 | - | |||||||||||||||||||
1601 | - | |||||||||||||||||||
1602 | "WM_STATE\0" | - | ||||||||||||||||||
1603 | "WM_CHANGE_STATE\0" | - | ||||||||||||||||||
1604 | "WM_CLASS\0" | - | ||||||||||||||||||
1605 | "WM_NAME\0" | - | ||||||||||||||||||
1606 | - | |||||||||||||||||||
1607 | - | |||||||||||||||||||
1608 | "WM_CLIENT_LEADER\0" | - | ||||||||||||||||||
1609 | "WM_WINDOW_ROLE\0" | - | ||||||||||||||||||
1610 | "SM_CLIENT_ID\0" | - | ||||||||||||||||||
1611 | - | |||||||||||||||||||
1612 | - | |||||||||||||||||||
1613 | "CLIPBOARD\0" | - | ||||||||||||||||||
1614 | "INCR\0" | - | ||||||||||||||||||
1615 | "TARGETS\0" | - | ||||||||||||||||||
1616 | "MULTIPLE\0" | - | ||||||||||||||||||
1617 | "TIMESTAMP\0" | - | ||||||||||||||||||
1618 | "SAVE_TARGETS\0" | - | ||||||||||||||||||
1619 | "CLIP_TEMPORARY\0" | - | ||||||||||||||||||
1620 | "_QT_SELECTION\0" | - | ||||||||||||||||||
1621 | "_QT_CLIPBOARD_SENTINEL\0" | - | ||||||||||||||||||
1622 | "_QT_SELECTION_SENTINEL\0" | - | ||||||||||||||||||
1623 | "CLIPBOARD_MANAGER\0" | - | ||||||||||||||||||
1624 | - | |||||||||||||||||||
1625 | "RESOURCE_MANAGER\0" | - | ||||||||||||||||||
1626 | - | |||||||||||||||||||
1627 | "_XSETROOT_ID\0" | - | ||||||||||||||||||
1628 | - | |||||||||||||||||||
1629 | "_QT_SCROLL_DONE\0" | - | ||||||||||||||||||
1630 | "_QT_INPUT_ENCODING\0" | - | ||||||||||||||||||
1631 | - | |||||||||||||||||||
1632 | "_QT_CLOSE_CONNECTION\0" | - | ||||||||||||||||||
1633 | - | |||||||||||||||||||
1634 | "_MOTIF_WM_HINTS\0" | - | ||||||||||||||||||
1635 | - | |||||||||||||||||||
1636 | "DTWM_IS_RUNNING\0" | - | ||||||||||||||||||
1637 | "ENLIGHTENMENT_DESKTOP\0" | - | ||||||||||||||||||
1638 | "_DT_SAVE_MODE\0" | - | ||||||||||||||||||
1639 | "_SGI_DESKS_MANAGER\0" | - | ||||||||||||||||||
1640 | - | |||||||||||||||||||
1641 | - | |||||||||||||||||||
1642 | "_NET_SUPPORTED\0" | - | ||||||||||||||||||
1643 | "_NET_VIRTUAL_ROOTS\0" | - | ||||||||||||||||||
1644 | "_NET_WORKAREA\0" | - | ||||||||||||||||||
1645 | - | |||||||||||||||||||
1646 | "_NET_MOVERESIZE_WINDOW\0" | - | ||||||||||||||||||
1647 | "_NET_WM_MOVERESIZE\0" | - | ||||||||||||||||||
1648 | - | |||||||||||||||||||
1649 | "_NET_WM_NAME\0" | - | ||||||||||||||||||
1650 | "_NET_WM_ICON_NAME\0" | - | ||||||||||||||||||
1651 | "_NET_WM_ICON\0" | - | ||||||||||||||||||
1652 | - | |||||||||||||||||||
1653 | "_NET_WM_PID\0" | - | ||||||||||||||||||
1654 | - | |||||||||||||||||||
1655 | "_NET_WM_WINDOW_OPACITY\0" | - | ||||||||||||||||||
1656 | - | |||||||||||||||||||
1657 | "_NET_WM_STATE\0" | - | ||||||||||||||||||
1658 | "_NET_WM_STATE_ABOVE\0" | - | ||||||||||||||||||
1659 | "_NET_WM_STATE_BELOW\0" | - | ||||||||||||||||||
1660 | "_NET_WM_STATE_FULLSCREEN\0" | - | ||||||||||||||||||
1661 | "_NET_WM_STATE_MAXIMIZED_HORZ\0" | - | ||||||||||||||||||
1662 | "_NET_WM_STATE_MAXIMIZED_VERT\0" | - | ||||||||||||||||||
1663 | "_NET_WM_STATE_MODAL\0" | - | ||||||||||||||||||
1664 | "_NET_WM_STATE_STAYS_ON_TOP\0" | - | ||||||||||||||||||
1665 | "_NET_WM_STATE_DEMANDS_ATTENTION\0" | - | ||||||||||||||||||
1666 | - | |||||||||||||||||||
1667 | "_NET_WM_USER_TIME\0" | - | ||||||||||||||||||
1668 | "_NET_WM_USER_TIME_WINDOW\0" | - | ||||||||||||||||||
1669 | "_NET_WM_FULL_PLACEMENT\0" | - | ||||||||||||||||||
1670 | - | |||||||||||||||||||
1671 | "_NET_WM_WINDOW_TYPE\0" | - | ||||||||||||||||||
1672 | "_NET_WM_WINDOW_TYPE_DESKTOP\0" | - | ||||||||||||||||||
1673 | "_NET_WM_WINDOW_TYPE_DOCK\0" | - | ||||||||||||||||||
1674 | "_NET_WM_WINDOW_TYPE_TOOLBAR\0" | - | ||||||||||||||||||
1675 | "_NET_WM_WINDOW_TYPE_MENU\0" | - | ||||||||||||||||||
1676 | "_NET_WM_WINDOW_TYPE_UTILITY\0" | - | ||||||||||||||||||
1677 | "_NET_WM_WINDOW_TYPE_SPLASH\0" | - | ||||||||||||||||||
1678 | "_NET_WM_WINDOW_TYPE_DIALOG\0" | - | ||||||||||||||||||
1679 | "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" | - | ||||||||||||||||||
1680 | "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" | - | ||||||||||||||||||
1681 | "_NET_WM_WINDOW_TYPE_TOOLTIP\0" | - | ||||||||||||||||||
1682 | "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" | - | ||||||||||||||||||
1683 | "_NET_WM_WINDOW_TYPE_COMBO\0" | - | ||||||||||||||||||
1684 | "_NET_WM_WINDOW_TYPE_DND\0" | - | ||||||||||||||||||
1685 | "_NET_WM_WINDOW_TYPE_NORMAL\0" | - | ||||||||||||||||||
1686 | "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" | - | ||||||||||||||||||
1687 | - | |||||||||||||||||||
1688 | "_KDE_NET_WM_FRAME_STRUT\0" | - | ||||||||||||||||||
1689 | "_NET_FRAME_EXTENTS\0" | - | ||||||||||||||||||
1690 | - | |||||||||||||||||||
1691 | "_NET_STARTUP_INFO\0" | - | ||||||||||||||||||
1692 | "_NET_STARTUP_INFO_BEGIN\0" | - | ||||||||||||||||||
1693 | - | |||||||||||||||||||
1694 | "_NET_SUPPORTING_WM_CHECK\0" | - | ||||||||||||||||||
1695 | - | |||||||||||||||||||
1696 | "_NET_WM_CM_S0\0" | - | ||||||||||||||||||
1697 | - | |||||||||||||||||||
1698 | "_NET_SYSTEM_TRAY_VISUAL\0" | - | ||||||||||||||||||
1699 | - | |||||||||||||||||||
1700 | "_NET_ACTIVE_WINDOW\0" | - | ||||||||||||||||||
1701 | - | |||||||||||||||||||
1702 | - | |||||||||||||||||||
1703 | "TEXT\0" | - | ||||||||||||||||||
1704 | "UTF8_STRING\0" | - | ||||||||||||||||||
1705 | "CARDINAL\0" | - | ||||||||||||||||||
1706 | - | |||||||||||||||||||
1707 | - | |||||||||||||||||||
1708 | "XdndEnter\0" | - | ||||||||||||||||||
1709 | "XdndPosition\0" | - | ||||||||||||||||||
1710 | "XdndStatus\0" | - | ||||||||||||||||||
1711 | "XdndLeave\0" | - | ||||||||||||||||||
1712 | "XdndDrop\0" | - | ||||||||||||||||||
1713 | "XdndFinished\0" | - | ||||||||||||||||||
1714 | "XdndTypeList\0" | - | ||||||||||||||||||
1715 | "XdndActionList\0" | - | ||||||||||||||||||
1716 | - | |||||||||||||||||||
1717 | "XdndSelection\0" | - | ||||||||||||||||||
1718 | - | |||||||||||||||||||
1719 | "XdndAware\0" | - | ||||||||||||||||||
1720 | "XdndProxy\0" | - | ||||||||||||||||||
1721 | - | |||||||||||||||||||
1722 | "XdndActionCopy\0" | - | ||||||||||||||||||
1723 | "XdndActionLink\0" | - | ||||||||||||||||||
1724 | "XdndActionMove\0" | - | ||||||||||||||||||
1725 | "XdndActionPrivate\0" | - | ||||||||||||||||||
1726 | - | |||||||||||||||||||
1727 | - | |||||||||||||||||||
1728 | "_MOTIF_DRAG_AND_DROP_MESSAGE\0" | - | ||||||||||||||||||
1729 | "_MOTIF_DRAG_INITIATOR_INFO\0" | - | ||||||||||||||||||
1730 | "_MOTIF_DRAG_RECEIVER_INFO\0" | - | ||||||||||||||||||
1731 | "_MOTIF_DRAG_WINDOW\0" | - | ||||||||||||||||||
1732 | "_MOTIF_DRAG_TARGETS\0" | - | ||||||||||||||||||
1733 | - | |||||||||||||||||||
1734 | "XmTRANSFER_SUCCESS\0" | - | ||||||||||||||||||
1735 | "XmTRANSFER_FAILURE\0" | - | ||||||||||||||||||
1736 | - | |||||||||||||||||||
1737 | - | |||||||||||||||||||
1738 | "_XKB_RULES_NAMES\0" | - | ||||||||||||||||||
1739 | - | |||||||||||||||||||
1740 | - | |||||||||||||||||||
1741 | "_XEMBED\0" | - | ||||||||||||||||||
1742 | "_XEMBED_INFO\0" | - | ||||||||||||||||||
1743 | - | |||||||||||||||||||
1744 | - | |||||||||||||||||||
1745 | "Button Left\0" | - | ||||||||||||||||||
1746 | "Button Middle\0" | - | ||||||||||||||||||
1747 | "Button Right\0" | - | ||||||||||||||||||
1748 | "Button Wheel Up\0" | - | ||||||||||||||||||
1749 | "Button Wheel Down\0" | - | ||||||||||||||||||
1750 | "Button Horiz Wheel Left\0" | - | ||||||||||||||||||
1751 | "Button Horiz Wheel Right\0" | - | ||||||||||||||||||
1752 | "Abs MT Position X\0" | - | ||||||||||||||||||
1753 | "Abs MT Position Y\0" | - | ||||||||||||||||||
1754 | "Abs MT Touch Major\0" | - | ||||||||||||||||||
1755 | "Abs MT Touch Minor\0" | - | ||||||||||||||||||
1756 | "Abs MT Orientation\0" | - | ||||||||||||||||||
1757 | "Abs MT Pressure\0" | - | ||||||||||||||||||
1758 | "Abs MT Tracking ID\0" | - | ||||||||||||||||||
1759 | "Max Contacts\0" | - | ||||||||||||||||||
1760 | "Rel X\0" | - | ||||||||||||||||||
1761 | "Rel Y\0" | - | ||||||||||||||||||
1762 | - | |||||||||||||||||||
1763 | "Abs X\0" | - | ||||||||||||||||||
1764 | "Abs Y\0" | - | ||||||||||||||||||
1765 | "Abs Pressure\0" | - | ||||||||||||||||||
1766 | "Abs Tilt X\0" | - | ||||||||||||||||||
1767 | "Abs Tilt Y\0" | - | ||||||||||||||||||
1768 | "Abs Wheel\0" | - | ||||||||||||||||||
1769 | "Abs Distance\0" | - | ||||||||||||||||||
1770 | "Wacom Serial IDs\0" | - | ||||||||||||||||||
1771 | "INTEGER\0" | - | ||||||||||||||||||
1772 | "Rel Horiz Wheel\0" | - | ||||||||||||||||||
1773 | "Rel Vert Wheel\0" | - | ||||||||||||||||||
1774 | "Rel Horiz Scroll\0" | - | ||||||||||||||||||
1775 | "Rel Vert Scroll\0" | - | ||||||||||||||||||
1776 | "_XSETTINGS_SETTINGS\0" | - | ||||||||||||||||||
1777 | "_COMPIZ_DECOR_PENDING\0" | - | ||||||||||||||||||
1778 | "_COMPIZ_DECOR_REQUEST\0" | - | ||||||||||||||||||
1779 | "_COMPIZ_DECOR_DELETE_PIXMAP\0" | - | ||||||||||||||||||
1780 | "_COMPIZ_TOOLKIT_ACTION\0" | - | ||||||||||||||||||
1781 | "_GTK_LOAD_ICONTHEMES\0" | - | ||||||||||||||||||
1782 | - | |||||||||||||||||||
1783 | }; | - | ||||||||||||||||||
1784 | - | |||||||||||||||||||
1785 | QXcbAtom::Atom QXcbConnection::qatom(xcb_atom_t xatom) const | - | ||||||||||||||||||
1786 | { | - | ||||||||||||||||||
1787 | return static_cast<QXcbAtom::Atom>(std::find(m_allAtoms, m_allAtoms + QXcbAtom::NAtoms, xatom) - m_allAtoms); | - | ||||||||||||||||||
1788 | } | - | ||||||||||||||||||
1789 | - | |||||||||||||||||||
1790 | void QXcbConnection::initializeAllAtoms() { | - | ||||||||||||||||||
1791 | const char *names[QXcbAtom::NAtoms]; | - | ||||||||||||||||||
1792 | const char *ptr = xcb_atomnames; | - | ||||||||||||||||||
1793 | - | |||||||||||||||||||
1794 | int i = 0; | - | ||||||||||||||||||
1795 | while (*ptr) { | - | ||||||||||||||||||
1796 | names[i++] = ptr; | - | ||||||||||||||||||
1797 | while (*ptr) | - | ||||||||||||||||||
1798 | ++ptr; | - | ||||||||||||||||||
1799 | ++ptr; | - | ||||||||||||||||||
1800 | } | - | ||||||||||||||||||
1801 | - | |||||||||||||||||||
1802 | ((!(i == QXcbAtom::NPredefinedAtoms)) ? qt_assert("i == QXcbAtom::NPredefinedAtoms",__FILE__,20022013) : qt_noop()); | - | ||||||||||||||||||
1803 | - | |||||||||||||||||||
1804 | QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); | - | ||||||||||||||||||
1805 | settings_atom_name += m_displayName; | - | ||||||||||||||||||
1806 | names[i++] = settings_atom_name; | - | ||||||||||||||||||
1807 | - | |||||||||||||||||||
1808 | xcb_intern_atom_cookie_t cookies[QXcbAtom::NAtoms]; | - | ||||||||||||||||||
1809 | - | |||||||||||||||||||
1810 | ((!(i == QXcbAtom::NAtoms)) ? qt_assert("i == QXcbAtom::NAtoms",__FILE__,20102021) : qt_noop()); | - | ||||||||||||||||||
1811 | for (i = 0; i < QXcbAtom::NAtoms; ++i) | - | ||||||||||||||||||
1812 | cookies[i] = xcb_intern_atom(xcb_connection(), false, strlen(names[i]), names[i]); | - | ||||||||||||||||||
1813 | - | |||||||||||||||||||
1814 | for (i = 0; i < QXcbAtom::NAtoms; ++i) { | - | ||||||||||||||||||
1815 | xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0); | - | ||||||||||||||||||
1816 | m_allAtoms[i] = reply->atom; | - | ||||||||||||||||||
1817 | free(reply); | - | ||||||||||||||||||
1818 | } | - | ||||||||||||||||||
1819 | } | - | ||||||||||||||||||
1820 | - | |||||||||||||||||||
1821 | xcb_atom_t QXcbConnection::internAtom(const char *name) | - | ||||||||||||||||||
1822 | { | - | ||||||||||||||||||
1823 | if (!name || *name == 0) | - | ||||||||||||||||||
1824 | return 0L; | - | ||||||||||||||||||
1825 | - | |||||||||||||||||||
1826 | xcb_intern_atom_cookie_t cookie = xcb_intern_atom(xcb_connection(), false, strlen(name), name); | - | ||||||||||||||||||
1827 | xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(xcb_connection(), cookie, 0); | - | ||||||||||||||||||
1828 | int atom = reply->atom; | - | ||||||||||||||||||
1829 | free(reply); | - | ||||||||||||||||||
1830 | return atom; | - | ||||||||||||||||||
1831 | } | - | ||||||||||||||||||
1832 | - | |||||||||||||||||||
1833 | QByteArray QXcbConnection::atomName(xcb_atom_t atom) | - | ||||||||||||||||||
1834 | { | - | ||||||||||||||||||
1835 | if (!atom) | - | ||||||||||||||||||
1836 | return QByteArray(); | - | ||||||||||||||||||
1837 | - | |||||||||||||||||||
1838 | xcb_generic_error_t *error = 0; | - | ||||||||||||||||||
1839 | xcb_get_atom_name_cookie_t cookie = xcb_get_atom_name(xcb_connection(), atom); | - | ||||||||||||||||||
1840 | xcb_get_atom_name_reply_t *reply = xcb_get_atom_name_reply(xcb_connection(), cookie, &error); | - | ||||||||||||||||||
1841 | if (error) { | - | ||||||||||||||||||
1842 | QMessageLogger(__FILE__, 20422053, __PRETTY_FUNCTION__).warning() << "QXcbConnection::atomName: bad Atom" << atom; | - | ||||||||||||||||||
1843 | free(error); | - | ||||||||||||||||||
1844 | } | - | ||||||||||||||||||
1845 | if (reply) { | - | ||||||||||||||||||
1846 | QByteArray result(xcb_get_atom_name_name(reply), xcb_get_atom_name_name_length(reply)); | - | ||||||||||||||||||
1847 | free(reply); | - | ||||||||||||||||||
1848 | return result; | - | ||||||||||||||||||
1849 | } | - | ||||||||||||||||||
1850 | return QByteArray(); | - | ||||||||||||||||||
1851 | } | - | ||||||||||||||||||
1852 | - | |||||||||||||||||||
1853 | const xcb_format_t *QXcbConnection::formatForDepth(uint8_t depth) const | - | ||||||||||||||||||
1854 | { | - | ||||||||||||||||||
1855 | xcb_format_iterator_t iterator = | - | ||||||||||||||||||
1856 | xcb_setup_pixmap_formats_iterator(m_setup); | - | ||||||||||||||||||
1857 | - | |||||||||||||||||||
1858 | while (iterator.rem) { | - | ||||||||||||||||||
1859 | xcb_format_t *format = iterator.data; | - | ||||||||||||||||||
1860 | if (format->depth == depth) | - | ||||||||||||||||||
1861 | return format; | - | ||||||||||||||||||
1862 | xcb_format_next(&iterator); | - | ||||||||||||||||||
1863 | } | - | ||||||||||||||||||
1864 | - | |||||||||||||||||||
1865 | return 0; | - | ||||||||||||||||||
1866 | } | - | ||||||||||||||||||
1867 | - | |||||||||||||||||||
1868 | void QXcbConnection::sync() | - | ||||||||||||||||||
1869 | { | - | ||||||||||||||||||
1870 | - | |||||||||||||||||||
1871 | xcb_get_input_focus_cookie_t cookie = xcb_get_input_focus(xcb_connection()); | - | ||||||||||||||||||
1872 | free(xcb_get_input_focus_reply(xcb_connection(), cookie, 0)); | - | ||||||||||||||||||
1873 | } | - | ||||||||||||||||||
1874 | - | |||||||||||||||||||
1875 | void QXcbConnection::initializeXFixes() | - | ||||||||||||||||||
1876 | { | - | ||||||||||||||||||
1877 | xcb_generic_error_t *error = 0; | - | ||||||||||||||||||
1878 | const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xfixes_id); | - | ||||||||||||||||||
1879 | if (!reply || !reply->present) | - | ||||||||||||||||||
1880 | return; | - | ||||||||||||||||||
1881 | - | |||||||||||||||||||
1882 | xfixes_first_event = reply->first_event; | - | ||||||||||||||||||
1883 | xcb_xfixes_query_version_cookie_t xfixes_query_cookie = xcb_xfixes_query_version(m_connection, | - | ||||||||||||||||||
1884 | 5, | - | ||||||||||||||||||
1885 | 0); | - | ||||||||||||||||||
1886 | xcb_xfixes_query_version_reply_t *xfixes_query = xcb_xfixes_query_version_reply (m_connection, | - | ||||||||||||||||||
1887 | xfixes_query_cookie, &error); | - | ||||||||||||||||||
1888 | if (!xfixes_query || error || xfixes_query->major_version < 2) { | - | ||||||||||||||||||
1889 | QMessageLogger(__FILE__, 20892100, __PRETTY_FUNCTION__).warning("QXcbConnection: Failed to initialize XFixes"); | - | ||||||||||||||||||
1890 | free(error); | - | ||||||||||||||||||
1891 | xfixes_first_event = 0; | - | ||||||||||||||||||
1892 | } | - | ||||||||||||||||||
1893 | free(xfixes_query); | - | ||||||||||||||||||
1894 | } | - | ||||||||||||||||||
1895 | - | |||||||||||||||||||
1896 | void QXcbConnection::initializeXRender() | - | ||||||||||||||||||
1897 | { | - | ||||||||||||||||||
1898 | - | |||||||||||||||||||
1899 | const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_render_id); | - | ||||||||||||||||||
1900 | if (!reply || !reply->present) | - | ||||||||||||||||||
1901 | return; | - | ||||||||||||||||||
1902 | - | |||||||||||||||||||
1903 | xcb_generic_error_t *error = 0; | - | ||||||||||||||||||
1904 | xcb_render_query_version_cookie_t xrender_query_cookie = xcb_render_query_version(m_connection, | - | ||||||||||||||||||
1905 | 0, | - | ||||||||||||||||||
1906 | 11); | - | ||||||||||||||||||
1907 | xcb_render_query_version_reply_t *xrender_query = xcb_render_query_version_reply(m_connection, | - | ||||||||||||||||||
1908 | xrender_query_cookie, &error); | - | ||||||||||||||||||
1909 | if (!xrender_query || error || (xrender_query->major_version == 0 && xrender_query->minor_version < 5)) { | - | ||||||||||||||||||
1910 | QMessageLogger(__FILE__, 21102121, __PRETTY_FUNCTION__).warning("QXcbConnection: Failed to initialize XRender"); | - | ||||||||||||||||||
1911 | free(error); | - | ||||||||||||||||||
1912 | } | - | ||||||||||||||||||
1913 | free(xrender_query); | - | ||||||||||||||||||
1914 | - | |||||||||||||||||||
1915 | } | - | ||||||||||||||||||
1916 | - | |||||||||||||||||||
1917 | void QXcbConnection::initializeXRandr() | - | ||||||||||||||||||
1918 | { | - | ||||||||||||||||||
1919 | const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_randr_id); | - | ||||||||||||||||||
1920 | if (!reply || !reply->present) | - | ||||||||||||||||||
1921 | return; | - | ||||||||||||||||||
1922 | - | |||||||||||||||||||
1923 | xrandr_first_event = reply->first_event; | - | ||||||||||||||||||
1924 | - | |||||||||||||||||||
1925 | xcb_generic_error_t *error = 0; | - | ||||||||||||||||||
1926 | xcb_randr_query_version_cookie_t xrandr_query_cookie = xcb_randr_query_version(m_connection, | - | ||||||||||||||||||
1927 | 1, | - | ||||||||||||||||||
1928 | 4); | - | ||||||||||||||||||
1929 | - | |||||||||||||||||||
1930 | has_randr_extension = true; | - | ||||||||||||||||||
1931 | - | |||||||||||||||||||
1932 | xcb_randr_query_version_reply_t *xrandr_query = xcb_randr_query_version_reply(m_connection, | - | ||||||||||||||||||
1933 | xrandr_query_cookie, &error); | - | ||||||||||||||||||
1934 | if (!xrandr_query || error || (xrandr_query->major_version < 1 || (xrandr_query->major_version == 1 && xrandr_query->minor_version < 2))) { | - | ||||||||||||||||||
1935 | QMessageLogger(__FILE__, 21352146, __PRETTY_FUNCTION__).warning("QXcbConnection: Failed to initialize XRandr"); | - | ||||||||||||||||||
1936 | free(error); | - | ||||||||||||||||||
1937 | has_randr_extension = false; | - | ||||||||||||||||||
1938 | } | - | ||||||||||||||||||
1939 | free(xrandr_query); | - | ||||||||||||||||||
1940 | - | |||||||||||||||||||
1941 | xcb_screen_iterator_t rootIter = xcb_setup_roots_iterator(m_setup); | - | ||||||||||||||||||
1942 | for (; rootIter.rem; xcb_screen_next(&rootIter)) { | - | ||||||||||||||||||
1943 | xcb_randr_select_input(xcb_connection(), | - | ||||||||||||||||||
1944 | rootIter.data->root, | - | ||||||||||||||||||
1945 | XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE | | - | ||||||||||||||||||
1946 | XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE | | - | ||||||||||||||||||
1947 | XCB_RANDR_NOTIFY_MASK_CRTC_CHANGE | | - | ||||||||||||||||||
1948 | XCB_RANDR_NOTIFY_MASK_OUTPUT_PROPERTY | - | ||||||||||||||||||
1949 | ); | - | ||||||||||||||||||
1950 | } | - | ||||||||||||||||||
1951 | } | - | ||||||||||||||||||
1952 | - | |||||||||||||||||||
1953 | void QXcbConnection::initializeXinerama() | - | ||||||||||||||||||
1954 | { | - | ||||||||||||||||||
1955 | const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xinerama_id); | - | ||||||||||||||||||
1956 | if (!reply || !reply->present) | - | ||||||||||||||||||
1957 | return; | - | ||||||||||||||||||
1958 | - | |||||||||||||||||||
1959 | xcb_generic_error_t *error = nullptr; | - | ||||||||||||||||||
1960 | xcb_xinerama_is_active_cookie_t xinerama_query_cookie = xcb_xinerama_is_active(m_connection); | - | ||||||||||||||||||
1961 | xcb_xinerama_is_active_reply_t *xinerama_is_active = xcb_xinerama_is_active_reply(m_connection, | - | ||||||||||||||||||
1962 | xinerama_query_cookie, | - | ||||||||||||||||||
1963 | &error); | - | ||||||||||||||||||
1964 | has_xinerama_extension = xinerama_is_active && !error && xinerama_is_active->state; | - | ||||||||||||||||||
1965 | free(error); | - | ||||||||||||||||||
1966 | free(xinerama_is_active); | - | ||||||||||||||||||
1967 | } | - | ||||||||||||||||||
1968 | - | |||||||||||||||||||
1969 | void QXcbConnection::initializeXShape() | - | ||||||||||||||||||
1970 | { | - | ||||||||||||||||||
1971 | const xcb_query_extension_reply_t *xshape_reply = xcb_get_extension_data(m_connection, &xcb_shape_id); | - | ||||||||||||||||||
1972 | if (!xshape_reply || !xshape_reply->present) | - | ||||||||||||||||||
1973 | return; | - | ||||||||||||||||||
1974 | - | |||||||||||||||||||
1975 | has_shape_extension = true; | - | ||||||||||||||||||
1976 | xcb_shape_query_version_cookie_t cookie = xcb_shape_query_version(m_connection); | - | ||||||||||||||||||
1977 | xcb_shape_query_version_reply_t *shape_query = xcb_shape_query_version_reply(m_connection, | - | ||||||||||||||||||
1978 | cookie, __null); | - | ||||||||||||||||||
1979 | if (!shape_query) { | - | ||||||||||||||||||
1980 | QMessageLogger(__FILE__, 21802191, __PRETTY_FUNCTION__).warning("QXcbConnection: Failed to initialize SHAPE extension"); | - | ||||||||||||||||||
1981 | } else if (shape_query->major_version > 1 || (shape_query->major_version == 1 && shape_query->minor_version >= 1)) { | - | ||||||||||||||||||
1982 | - | |||||||||||||||||||
1983 | has_input_shape = true; | - | ||||||||||||||||||
1984 | } | - | ||||||||||||||||||
1985 | free(shape_query); | - | ||||||||||||||||||
1986 | } | - | ||||||||||||||||||
1987 | - | |||||||||||||||||||
1988 | void QXcbConnection::initializeXKB() | - | ||||||||||||||||||
1989 | { | - | ||||||||||||||||||
1990 | - | |||||||||||||||||||
1991 | const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xkb_id); | - | ||||||||||||||||||
1992 | if (!reply
| 0-135 | ||||||||||||||||||
1993 | QMessageLogger(__FILE__, 21932204, __PRETTY_FUNCTION__).warning() << ("Qt: XKEYBOARD extension not present on the X server.";); | - | ||||||||||||||||||
1994 | xkb_first_event = 0; | - | ||||||||||||||||||
1995 | return; never executed: return; | 0 | ||||||||||||||||||
1996 | } | - | ||||||||||||||||||
1997 | xkb_first_event = reply->first_event; | - | ||||||||||||||||||
1998 | - | |||||||||||||||||||
1999 | xcb_connection_t *c = connection()->xcb_connection(); | - | ||||||||||||||||||
2000 | xcb_xkb_use_extension_cookie_t xkb_query_cookie; | - | ||||||||||||||||||
2001 | xcb_xkb_use_extension_reply_t *xkb_query; | - | ||||||||||||||||||
2002 | - | |||||||||||||||||||
2003 | xkb_query_cookie = xcb_xkb_use_extension(c, 1, 0); | - | ||||||||||||||||||
2004 | xkb_query = xcb_xkb_use_extension_reply(c, xkb_query_cookie, 0); | - | ||||||||||||||||||
2005 | - | |||||||||||||||||||
2006 | if (!xkb_query
| 0-135 | ||||||||||||||||||
2007 | QMessageLogger(__FILE__, 22072218, __PRETTY_FUNCTION__).warning("Qt: Failed to initialize XKB extension"); | - | ||||||||||||||||||
2008 | return; never executed: return; | 0 | ||||||||||||||||||
2009 | } else if (!xkb_query->supported
| 0-135 | ||||||||||||||||||
2010 | QMessageLogger(__FILE__, 22102221, __PRETTY_FUNCTION__).warning("Qt: Unsupported XKB version (We want %d %d, but X server has %d %d)", | - | ||||||||||||||||||
2011 | 1, 0, | - | ||||||||||||||||||
2012 | xkb_query->serverMajor, xkb_query->serverMinor); | - | ||||||||||||||||||
2013 | free(xkb_query); | - | ||||||||||||||||||
2014 | return; never executed: return; | 0 | ||||||||||||||||||
2015 | } | - | ||||||||||||||||||
2016 | - | |||||||||||||||||||
2017 | has_xkb = true; | - | ||||||||||||||||||
2018 | free(xkb_query); | - | ||||||||||||||||||
2019 | - | |||||||||||||||||||
2020 | const uint16_t required_map_parts = (XCB_XKB_MAP_PART_KEY_TYPES | | - | ||||||||||||||||||
2021 | XCB_XKB_MAP_PART_KEY_SYMS | | - | ||||||||||||||||||
2022 | XCB_XKB_MAP_PART_MODIFIER_MAP | | - | ||||||||||||||||||
2023 | XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS | | - | ||||||||||||||||||
2024 | XCB_XKB_MAP_PART_KEY_ACTIONS | | - | ||||||||||||||||||
2025 | XCB_XKB_MAP_PART_KEY_BEHAVIORS | | - | ||||||||||||||||||
2026 | XCB_XKB_MAP_PART_VIRTUAL_MODS | | - | ||||||||||||||||||
2027 | XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP); | - | ||||||||||||||||||
2028 | - | |||||||||||||||||||
2029 | const uint16_t required_events = (XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY | | - | ||||||||||||||||||
2030 | XCB_XKB_EVENT_TYPE_MAP_NOTIFY | | - | ||||||||||||||||||
2031 | XCB_XKB_EVENT_TYPE_STATE_NOTIFY); | - | ||||||||||||||||||
2032 | - | |||||||||||||||||||
2033 | - | |||||||||||||||||||
2034 | - | |||||||||||||||||||
2035 | xcb_void_cookie_t select = xcb_xkb_select_events_checked(c, | - | ||||||||||||||||||
2036 | XCB_XKB_ID_USE_CORE_KBD, | - | ||||||||||||||||||
2037 | required_events, | - | ||||||||||||||||||
2038 | 0, | - | ||||||||||||||||||
2039 | required_events, | - | ||||||||||||||||||
2040 | required_map_parts, | - | ||||||||||||||||||
2041 | required_map_parts, | - | ||||||||||||||||||
2042 | 0); | - | ||||||||||||||||||
2043 | - | |||||||||||||||||||
2044 | xcb_generic_error_t *error = xcb_request_check(c, select); | - | ||||||||||||||||||
2045 | if (error
| 0-135 | ||||||||||||||||||
2046 | free(error); | - | ||||||||||||||||||
2047 | QMessageLogger(__FILE__, 22472258, __PRETTY_FUNCTION__).warning() << ("Qt: failed to select notify events from xcb-xkb";); | - | ||||||||||||||||||
2048 | return; never executed: return; | 0 | ||||||||||||||||||
2049 | } | - | ||||||||||||||||||
2050 | - | |||||||||||||||||||
2051 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||
2052 | - | |||||||||||||||||||
2053 | - | |||||||||||||||||||
2054 | bool QXcbConnection::xi2MouseEvents() const | - | ||||||||||||||||||
2055 | { | - | ||||||||||||||||||
2056 | static bool mouseViaXI2 = !qEnvironmentVariableIsSet("QT_XCB_NO_XI2_MOUSE"); | - | ||||||||||||||||||
2057 | - | |||||||||||||||||||
2058 | - | |||||||||||||||||||
2059 | return mouseViaXI2 && !has_xinerama_extension; | - | ||||||||||||||||||
2060 | } | - | ||||||||||||||||||
2061 | - | |||||||||||||||||||
2062 | - | |||||||||||||||||||
2063 | - | |||||||||||||||||||
2064 | static int xi2ValuatorOffset(const unsigned char *maskPtr, int maskLen, int number) | - | ||||||||||||||||||
2065 | { | - | ||||||||||||||||||
2066 | int offset = 0; | - | ||||||||||||||||||
2067 | for (int i = 0; i < maskLen
| 0 | ||||||||||||||||||
2068 | if (number < 8
| 0 | ||||||||||||||||||
2069 | if ((
| 0 | ||||||||||||||||||
2070 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
2071 | } never executed: end of block | 0 | ||||||||||||||||||
2072 | for (int j = 0; j < 8
| 0 | ||||||||||||||||||
2073 | if (j == number
| 0 | ||||||||||||||||||
2074 | return never executed: offset;return offset; never executed: return offset; | 0 | ||||||||||||||||||
2075 | if (maskPtr[i] & (1 << j)
| 0 | ||||||||||||||||||
2076 | offset++; never executed: offset++; | 0 | ||||||||||||||||||
2077 | } never executed: end of block | 0 | ||||||||||||||||||
2078 | number -= 8; | - | ||||||||||||||||||
2079 | } never executed: end of block | 0 | ||||||||||||||||||
2080 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
2081 | } | - | ||||||||||||||||||
2082 | - | |||||||||||||||||||
2083 | bool QXcbConnection::xi2GetValuatorValueIfSet(const void *event, int valuatorNum, double *value) | - | ||||||||||||||||||
2084 | { | - | ||||||||||||||||||
2085 | const xXIDeviceEvent *xideviceevent = static_cast<const xXIDeviceEvent *>(event); | - | ||||||||||||||||||
2086 | const unsigned char *buttonsMaskAddr = (const unsigned char*)&xideviceevent[1]; | - | ||||||||||||||||||
2087 | const unsigned char *valuatorsMaskAddr = buttonsMaskAddr + xideviceevent->buttons_len * 4; | - | ||||||||||||||||||
2088 | FP3232 *valuatorsValuesAddr = (FP3232*)(valuatorsMaskAddr + xideviceevent->valuators_len * 4); | - | ||||||||||||||||||
2089 | - | |||||||||||||||||||
2090 | int valuatorOffset = xi2ValuatorOffset(valuatorsMaskAddr, xideviceevent->valuators_len, valuatorNum); | - | ||||||||||||||||||
2091 | if (valuatorOffset < 0
| 0 | ||||||||||||||||||
2092 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
2093 | - | |||||||||||||||||||
2094 | *value = valuatorsValuesAddr[valuatorOffset].integral; | - | ||||||||||||||||||
2095 | *value += ((double)valuatorsValuesAddr[valuatorOffset].frac / (1 << 16) / (1 << 16)); | - | ||||||||||||||||||
2096 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||
2097 | } | - | ||||||||||||||||||
2098 | - | |||||||||||||||||||
2099 | void QXcbConnection::xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *event) | - | ||||||||||||||||||
2100 | { | - | ||||||||||||||||||
2101 | - | |||||||||||||||||||
2102 | - | |||||||||||||||||||
2103 | - | |||||||||||||||||||
2104 | - | |||||||||||||||||||
2105 | memmove((char*) event + 32, (char*) event + 36, event->length * 4); | - | ||||||||||||||||||
2106 | } | - | ||||||||||||||||||
2107 | - | |||||||||||||||||||
2108 | - | |||||||||||||||||||
2109 | QXcbSystemTrayTracker *QXcbConnection::systemTrayTracker() const | - | ||||||||||||||||||
2110 | { | - | ||||||||||||||||||
2111 | if (!m_systemTrayTracker) { | - | ||||||||||||||||||
2112 | QXcbConnection *self = const_cast<QXcbConnection *>(this); | - | ||||||||||||||||||
2113 | if ((self->m_systemTrayTracker = QXcbSystemTrayTracker::create(self))) { | - | ||||||||||||||||||
2114 | connect(m_systemTrayTracker, qFlagLocation("2""systemTrayWindowChanged(QScreen*)" "\0" __FILE__ ":" "2314""2325"), | - | ||||||||||||||||||
2115 | QGuiApplication::platformNativeInterface(), qFlagLocation("2""systemTrayWindowChanged(QScreen*)" "\0" __FILE__ ":" "2315""2326")); | - | ||||||||||||||||||
2116 | } | - | ||||||||||||||||||
2117 | } | - | ||||||||||||||||||
2118 | return m_systemTrayTracker; | - | ||||||||||||||||||
2119 | } | - | ||||||||||||||||||
2120 | - | |||||||||||||||||||
2121 | bool QXcbConnection::xEmbedSystemTrayAvailable() | - | ||||||||||||||||||
2122 | { | - | ||||||||||||||||||
2123 | if (!QGuiApplicationPrivate::platformIntegration()) | - | ||||||||||||||||||
2124 | return false; | - | ||||||||||||||||||
2125 | QXcbConnection *connection = static_cast<QXcbIntegration *>(QGuiApplicationPrivate::platformIntegration())->defaultConnection(); | - | ||||||||||||||||||
2126 | return connection->systemTrayTracker(); | - | ||||||||||||||||||
2127 | } | - | ||||||||||||||||||
2128 | - | |||||||||||||||||||
2129 | bool QXcbConnection::xEmbedSystemTrayVisualHasAlphaChannel() | - | ||||||||||||||||||
2130 | { | - | ||||||||||||||||||
2131 | if (!QGuiApplicationPrivate::platformIntegration()) | - | ||||||||||||||||||
2132 | return false; | - | ||||||||||||||||||
2133 | QXcbConnection *connection = static_cast<QXcbIntegration *>(QGuiApplicationPrivate::platformIntegration())->defaultConnection(); | - | ||||||||||||||||||
2134 | return connection->systemTrayTracker() && connection->systemTrayTracker()->visualHasAlphaChannel(); | - | ||||||||||||||||||
2135 | } | - | ||||||||||||||||||
2136 | - | |||||||||||||||||||
2137 | bool QXcbConnection::event(QEvent *e) | - | ||||||||||||||||||
2138 | { | - | ||||||||||||||||||
2139 | if (e->type() == QEvent::User + 1) { | - | ||||||||||||||||||
2140 | QXcbSyncWindowRequest *ev = static_cast<QXcbSyncWindowRequest *>(e); | - | ||||||||||||||||||
2141 | QXcbWindow *w = ev->window(); | - | ||||||||||||||||||
2142 | if (w) { | - | ||||||||||||||||||
2143 | w->updateSyncRequestCounter(); | - | ||||||||||||||||||
2144 | ev->invalidate(); | - | ||||||||||||||||||
2145 | } | - | ||||||||||||||||||
2146 | return true; | - | ||||||||||||||||||
2147 | } | - | ||||||||||||||||||
2148 | return QObject::event(e); | - | ||||||||||||||||||
2149 | } | - | ||||||||||||||||||
2150 | - | |||||||||||||||||||
2151 | void QXcbSyncWindowRequest::invalidate() | - | ||||||||||||||||||
2152 | { | - | ||||||||||||||||||
2153 | if (m_window) { | - | ||||||||||||||||||
2154 | m_window->clearSyncWindowRequest(); | - | ||||||||||||||||||
2155 | m_window = 0; | - | ||||||||||||||||||
2156 | } | - | ||||||||||||||||||
2157 | } | - | ||||||||||||||||||
2158 | - | |||||||||||||||||||
2159 | QXcbConnectionGrabber::QXcbConnectionGrabber(QXcbConnection *connection) | - | ||||||||||||||||||
2160 | :m_connection(connection) | - | ||||||||||||||||||
2161 | { | - | ||||||||||||||||||
2162 | connection->grabServer(); | - | ||||||||||||||||||
2163 | } | - | ||||||||||||||||||
2164 | - | |||||||||||||||||||
2165 | QXcbConnectionGrabber::~QXcbConnectionGrabber() | - | ||||||||||||||||||
2166 | { | - | ||||||||||||||||||
2167 | if (m_connection) | - | ||||||||||||||||||
2168 | m_connection->ungrabServer(); | - | ||||||||||||||||||
2169 | } | - | ||||||||||||||||||
2170 | - | |||||||||||||||||||
2171 | void QXcbConnectionGrabber::release() | - | ||||||||||||||||||
2172 | { | - | ||||||||||||||||||
2173 | if (m_connection) { | - | ||||||||||||||||||
2174 | m_connection->ungrabServer(); | - | ||||||||||||||||||
2175 | m_connection = 0; | - | ||||||||||||||||||
2176 | } | - | ||||||||||||||||||
2177 | } | - | ||||||||||||||||||
2178 | - | |||||||||||||||||||
2179 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |