| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | #include "qxcbwmsupport.h" | - |
| 41 | #include "qxcbscreen.h" | - |
| 42 | | - |
| 43 | #include <qdebug.h> | - |
| 44 | | - |
| 45 | QT_BEGIN_NAMESPACE | - |
| 46 | | - |
| 47 | QXcbWMSupport::QXcbWMSupport(QXcbConnection *c) | - |
| 48 | : QXcbObject(c) | - |
| 49 | { | - |
| 50 | updateNetWMAtoms(); | - |
| 51 | updateVirtualRoots(); | - |
| 52 | } | - |
| 53 | | - |
| 54 | bool QXcbWMSupport::isSupportedByWM(xcb_atom_t atom) const | - |
| 55 | { | - |
| 56 | return net_wm_atoms.contains(atom); | - |
| 57 | } | - |
| 58 | | - |
| 59 | | - |
| 60 | | - |
| 61 | void QXcbWMSupport::updateNetWMAtoms() | - |
| 62 | { | - |
| 63 | net_wm_atoms.clear(); | - |
| 64 | | - |
| 65 | xcb_window_t root = connection()->primaryScreen()->root(); | - |
| 66 | int offset = 0; | - |
| 67 | int remaining = 0; | - |
| 68 | do { | - |
| 69 | xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, root, atom(QXcbAtom::_NET_SUPPORTED), XCB_ATOM_ATOM, offset, 1024); | - |
| 70 | xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, NULL); | - |
| 71 | if (!reply) | - |
| 72 | break; | - |
| 73 | | - |
| 74 | remaining = 0; | - |
| 75 | | - |
| 76 | if (reply->type == XCB_ATOM_ATOM && reply->format == 32) { | - |
| 77 | int len = xcb_get_property_value_length(reply)/sizeof(xcb_atom_t); | - |
| 78 | xcb_atom_t *atoms = (xcb_atom_t *)xcb_get_property_value(reply); | - |
| 79 | int s = net_wm_atoms.size(); | - |
| 80 | net_wm_atoms.resize(s + len); | - |
| 81 | memcpy(net_wm_atoms.data() + s, atoms, len*sizeof(xcb_atom_t)); | - |
| 82 | | - |
| 83 | remaining = reply->bytes_after; | - |
| 84 | offset += len; | - |
| 85 | } | - |
| 86 | | - |
| 87 | free(reply); | - |
| 88 | } while (remaining > 0); | - |
| 89 | } | - |
| 90 | | - |
| 91 | | - |
| 92 | void QXcbWMSupport::updateVirtualRoots() | - |
| 93 | { | - |
| 94 | net_virtual_roots.clear(); | - |
| 95 | | - |
| 96 | 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 |
| 97 | 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 |
| 98 | | - |
| 99 | xcb_window_t root = connection()->primaryScreen()->root(); | - |
| 100 | int offset = 0; | - |
| 101 | int remaining = 0; | - |
| 102 | do { | - |
| 103 | xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, root, atom(QXcbAtom::_NET_VIRTUAL_ROOTS), XCB_ATOM_WINDOW, offset, 1024); | - |
| 104 | xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, NULL); | - |
| 105 | if (!reply)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 106 | break; never executed: break; | 0 |
| 107 | | - |
| 108 | remaining = 0; | - |
| 109 | | - |
| 110 | if (reply->type == XCB_ATOM_WINDOW && reply->format == 32) {| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 111 | int len = xcb_get_property_value_length(reply)/sizeof(xcb_window_t); | - |
| 112 | xcb_window_t *roots = (xcb_window_t *)xcb_get_property_value(reply); | - |
| 113 | int s = net_virtual_roots.size(); | - |
| 114 | net_virtual_roots.resize(s + len); | - |
| 115 | memcpy(net_virtual_roots.data() + s, roots, len*sizeof(xcb_window_t)); | - |
| 116 | | - |
| 117 | remaining = reply->bytes_after; | - |
| 118 | offset += len; | - |
| 119 | } never executed: end of block | 0 |
| 120 | | - |
| 121 | free(reply); | - |
| 122 | } while (remaining > 0); never executed: end of block | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 123 | | - |
| 124 | #ifdef Q_XCB_DEBUG | - |
| 125 | qDebug() << ("======== updateVirtualRoots";); | - |
| 126 | for (int i = 0; i < net_virtual_roots.size(); ++i) | - |
| 127 | qDebug() << connection()->atomName(net_virtual_roots.at(i)); | - |
| 128 | qDebug() << ("======== updateVirtualRoots";); | - |
| 129 | #endif | - |
| 130 | } never executed: end of block | 0 |
| 131 | | - |
| 132 | QT_END_NAMESPACE | - |
| | |