qxcbwmsupport.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbwmsupport.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the plugins of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qxcbwmsupport.h"-
41#include "qxcbscreen.h"-
42-
43#include <qdebug.h>-
44-
45QT_BEGIN_NAMESPACE-
46-
47QXcbWMSupport::QXcbWMSupport(QXcbConnection *c)-
48 : QXcbObject(c)-
49{-
50 updateNetWMAtoms();-
51 updateVirtualRoots();-
52}
executed 135 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
135
53-
54bool QXcbWMSupport::isSupportedByWM(xcb_atom_t atom) const-
55{-
56 return net_wm_atoms.contains(atom);
executed 9184 times by 109 tests: return net_wm_atoms.contains(atom);
Executed by:
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDesktopWidget
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • tst_QDoubleSpinBox
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • ...
9184
57}-
58-
59-
60-
61void 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)
!replyDescription
TRUEnever evaluated
FALSEevaluated 135 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-135
72 break;
never executed: break;
0
73-
74 remaining = 0;-
75-
76 if (reply->type == XCB_ATOM_ATOM && reply->format == 32) {
reply->type == XCB_ATOM_ATOMDescription
TRUEevaluated 135 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
reply->format == 32Description
TRUEevaluated 135 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
0-135
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 }
executed 135 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
135
86-
87 free(reply);-
88 } while (remaining > 0);
executed 135 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
remaining > 0Description
TRUEnever evaluated
FALSEevaluated 135 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
0-135
89}
executed 135 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
135
90-
91// update the virtual roots array-
92void QXcbWMSupport::updateVirtualRoots()-
93{-
94 net_virtual_roots.clear();-
95-
96 if (!isSupportedByWM(atom(QXcbAtom::_NET_VIRTUAL_ROOTS)))
!isSupportedBy...IRTUAL_ROOTS))Description
TRUEevaluated 135 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
FALSEnever 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)
!replyDescription
TRUEnever evaluated
FALSEnever evaluated
0
106 break;
never executed: break;
0
107-
108 remaining = 0;-
109-
110 if (reply->type == XCB_ATOM_WINDOW && reply->format == 32) {
reply->type == XCB_ATOM_WINDOWDescription
TRUEnever evaluated
FALSEnever evaluated
reply->format == 32Description
TRUEnever evaluated
FALSEnever 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
remaining > 0Description
TRUEnever evaluated
FALSEnever 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-
132QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9