| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbwmsupport.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | QXcbWMSupport::QXcbWMSupport(QXcbConnection *c) | - | ||||||||||||
| 6 | : QXcbObject(c) | - | ||||||||||||
| 7 | { | - | ||||||||||||
| 8 | updateNetWMAtoms(); | - | ||||||||||||
| 9 | updateVirtualRoots(); | - | ||||||||||||
| 10 | } executed 135 times by 5 tests: end of blockExecuted by:
| 135 | ||||||||||||
| 11 | - | |||||||||||||
| 12 | bool QXcbWMSupport::isSupportedByWM(xcb_atom_t atom) const | - | ||||||||||||
| 13 | { | - | ||||||||||||
| 14 | return executed 9184 times by 109 tests: net_wm_atoms.contains(atom);return net_wm_atoms.contains(atom);Executed by:
executed 9184 times by 109 tests: return net_wm_atoms.contains(atom);Executed by:
| 9184 | ||||||||||||
| 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
| 0-135 | ||||||||||||
| 30 | break; never executed: break; | 0 | ||||||||||||
| 31 | - | |||||||||||||
| 32 | remaining = 0; | - | ||||||||||||
| 33 | - | |||||||||||||
| 34 | if (reply->type == XCB_ATOM_ATOM
| 0-135 | ||||||||||||
| 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 | } executed 135 times by 5 tests: end of blockExecuted by:
| 135 | ||||||||||||
| 44 | - | |||||||||||||
| 45 | free(reply); | - | ||||||||||||
| 46 | } executed 135 times by 5 tests: while (remaining > 0end of blockExecuted by:
| 0-135 | ||||||||||||
| 47 | } executed 135 times by 5 tests: end of blockExecuted by:
| 135 | ||||||||||||
| 48 | - | |||||||||||||
| 49 | - | |||||||||||||
| 50 | void QXcbWMSupport::updateVirtualRoots() | - | ||||||||||||
| 51 | { | - | ||||||||||||
| 52 | net_virtual_roots.clear(); | - | ||||||||||||
| 53 | - | |||||||||||||
| 54 | if (!isSupportedByWM(atom(QXcbAtom::_NET_VIRTUAL_ROOTS))
| 0-135 | ||||||||||||
| 55 | return; executed 135 times by 5 tests: return;Executed by:
| 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 (!reply
| 0 | ||||||||||||
| 64 | break; never executed: break; | 0 | ||||||||||||
| 65 | - | |||||||||||||
| 66 | remaining = 0; | - | ||||||||||||
| 67 | - | |||||||||||||
| 68 | if (reply->type == XCB_ATOM_WINDOW
| 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: while (remaining > 0end of block
| 0 | ||||||||||||
| 81 | - | |||||||||||||
| 82 | - | |||||||||||||
| 83 | - | |||||||||||||
| 84 | - | |||||||||||||
| 85 | - | |||||||||||||
| 86 | - | |||||||||||||
| 87 | - | |||||||||||||
| 88 | } never executed: end of block | 0 | ||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| Switch to Source code | Preprocessed file |