Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | QXcbWMSupport::QXcbWMSupport(QXcbConnection *c) | - |
6 | : QXcbObject(c) | - |
7 | { | - |
8 | updateNetWMAtoms(); | - |
9 | updateVirtualRoots(); | - |
10 | } | - |
11 | | - |
12 | bool QXcbWMSupport::isSupportedByWM(xcb_atom_t atom) const | - |
13 | { | - |
14 | return net_wm_atoms.contains(atom); | - |
15 | } | - |
16 | | - |
17 | | - |
18 | | - |
19 | void QXcbWMSupport::updateNetWMAtoms() | - |
20 | { | - |
21 | net_wm_atoms.clear(); | - |
22 | | - |
23 | xcb_window_t root = connection()->primaryScreen()->root(); | - |
24 | int offset = 0; | - |
25 | int remaining = 0; | - |
26 | do { | - |
27 | xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, root, atom(QXcbAtom::_NET_SUPPORTED), XCB_ATOM_ATOM, offset, 1024); | - |
28 | xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, __null); | - |
29 | if (!reply) | - |
30 | break; | - |
31 | | - |
32 | remaining = 0; | - |
33 | | - |
34 | if (reply->type == XCB_ATOM_ATOM && reply->format == 32) { | - |
35 | int len = xcb_get_property_value_length(reply)/sizeof(xcb_atom_t); | - |
36 | xcb_atom_t *atoms = (xcb_atom_t *)xcb_get_property_value(reply); | - |
37 | int s = net_wm_atoms.size(); | - |
38 | net_wm_atoms.resize(s + len); | - |
39 | memcpy(net_wm_atoms.data() + s, atoms, len*sizeof(xcb_atom_t)); | - |
40 | | - |
41 | remaining = reply->bytes_after; | - |
42 | offset += len; | - |
43 | } | - |
44 | | - |
45 | free(reply); | - |
46 | } while (remaining > 0); | - |
47 | } | - |
48 | | - |
49 | | - |
50 | void QXcbWMSupport::updateVirtualRoots() | - |
51 | { | - |
52 | net_virtual_roots.clear(); | - |
53 | | - |
54 | if (!isSupportedByWM(atom(QXcbAtom::_NET_VIRTUAL_ROOTS))TRUE | evaluated 135 times by 5 testsEvaluated by:- tst_QApplication
- tst_QGuiApplication
- tst_qapplication - unknown status
- tst_qprocess - unknown status
- tst_selftests - unknown status
| FALSE | never evaluated |
) | 0-135 |
55 | return;executed 135 times by 5 tests: return; Executed by:- tst_QApplication
- tst_QGuiApplication
- tst_qapplication - unknown status
- tst_qprocess - unknown status
- tst_selftests - unknown status
| 135 |
56 | | - |
57 | xcb_window_t root = connection()->primaryScreen()->root(); | - |
58 | int offset = 0; | - |
59 | int remaining = 0; | - |
60 | do { | - |
61 | xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, root, atom(QXcbAtom::_NET_VIRTUAL_ROOTS), XCB_ATOM_WINDOW, offset, 1024); | - |
62 | xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, __null); | - |
63 | if (!replyTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
64 | break; never executed: break; | 0 |
65 | | - |
66 | remaining = 0; | - |
67 | | - |
68 | if (reply->type == XCB_ATOM_WINDOWTRUE | never evaluated | FALSE | never evaluated |
&& reply->format == 32TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
69 | int len = xcb_get_property_value_length(reply)/sizeof(xcb_window_t); | - |
70 | xcb_window_t *roots = (xcb_window_t *)xcb_get_property_value(reply); | - |
71 | int s = net_virtual_roots.size(); | - |
72 | net_virtual_roots.resize(s + len); | - |
73 | memcpy(net_virtual_roots.data() + s, roots, len*sizeof(xcb_window_t)); | - |
74 | | - |
75 | remaining = reply->bytes_after; | - |
76 | offset += len; | - |
77 | } never executed: end of block | 0 |
78 | | - |
79 | free(reply); | - |
80 | } never executed: end of block while (remaining > 0TRUE | never evaluated | FALSE | never evaluated |
); | 0 |
81 | | - |
82 | | - |
83 | | - |
84 | | - |
85 | | - |
86 | | - |
87 | | - |
88 | } never executed: end of block | 0 |
89 | | - |
90 | | - |
| | |