Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbscreen.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||||||||||||||
2 | ** | - | ||||||||||||||||||||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
5 | ** | - | ||||||||||||||||||||||||
6 | ** This file is part of the plugins of the Qt Toolkit. | - | ||||||||||||||||||||||||
7 | ** | - | ||||||||||||||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||||||||
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 http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
15 | ** information use the contact form at http://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 2.1 or version 3 as published by the Free | - | ||||||||||||||||||||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||||||||
25 | ** | - | ||||||||||||||||||||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||||||||
29 | ** | - | ||||||||||||||||||||||||
30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
31 | ** | - | ||||||||||||||||||||||||
32 | ****************************************************************************/ | - | ||||||||||||||||||||||||
33 | - | |||||||||||||||||||||||||
34 | #include "qxcbscreen.h" | - | ||||||||||||||||||||||||
35 | #include "qxcbwindow.h" | - | ||||||||||||||||||||||||
36 | #include "qxcbcursor.h" | - | ||||||||||||||||||||||||
37 | #include "qxcbimage.h" | - | ||||||||||||||||||||||||
38 | #include "qnamespace.h" | - | ||||||||||||||||||||||||
39 | #include "qxcbxsettings.h" | - | ||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||
41 | #include <stdio.h> | - | ||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||
43 | #include <QDebug> | - | ||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||
45 | #include <qpa/qwindowsysteminterface.h> | - | ||||||||||||||||||||||||
46 | #include <private/qmath_p.h> | - | ||||||||||||||||||||||||
47 | #include <QtGui/private/qhighdpiscaling_p.h> | - | ||||||||||||||||||||||||
48 | - | |||||||||||||||||||||||||
49 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
50 | - | |||||||||||||||||||||||||
51 | QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t *screen, int number) | - | ||||||||||||||||||||||||
52 | : QXcbObject(connection) | - | ||||||||||||||||||||||||
53 | , m_screen(screen) | - | ||||||||||||||||||||||||
54 | , m_number(number) | - | ||||||||||||||||||||||||
55 | , m_xSettings(Q_NULLPTR) | - | ||||||||||||||||||||||||
56 | { | - | ||||||||||||||||||||||||
57 | QByteArray cmAtomName("_NET_WM_CM_S"); | - | ||||||||||||||||||||||||
58 | cmAtomName += QByteArray::number(m_number); | - | ||||||||||||||||||||||||
59 | m_net_wm_cm_atom = connection->internAtom(cmAtomName.constData()); | - | ||||||||||||||||||||||||
60 | m_compositingActive = connection->getSelectionOwner(m_net_wm_cm_atom); | - | ||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||
62 | m_workArea = getWorkArea(); | - | ||||||||||||||||||||||||
63 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||
65 | QXcbVirtualDesktop::~QXcbVirtualDesktop() | - | ||||||||||||||||||||||||
66 | { | - | ||||||||||||||||||||||||
67 | delete m_xSettings; | - | ||||||||||||||||||||||||
68 | } executed 341 times by 220 tests: end of block Executed by:
| 341 | ||||||||||||||||||||||||
69 | - | |||||||||||||||||||||||||
70 | QXcbScreen *QXcbVirtualDesktop::screenAt(const QPoint &pos) const | - | ||||||||||||||||||||||||
71 | { | - | ||||||||||||||||||||||||
72 | foreach (QXcbScreen *screen, connection()->screens()) { | - | ||||||||||||||||||||||||
73 | if (screen->virtualDesktop() == this && screen->geometry().contains(pos))
| 0 | ||||||||||||||||||||||||
74 | return screen; never executed: return screen; | 0 | ||||||||||||||||||||||||
75 | } never executed: end of block | 0 | ||||||||||||||||||||||||
76 | return Q_NULLPTR; never executed: return nullptr; | 0 | ||||||||||||||||||||||||
77 | } | - | ||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||
79 | void QXcbVirtualDesktop::addScreen(QPlatformScreen *s) | - | ||||||||||||||||||||||||
80 | { | - | ||||||||||||||||||||||||
81 | ((QXcbScreen *) s)->isPrimary() ? m_screens.prepend(s) : m_screens.append(s); | - | ||||||||||||||||||||||||
82 | } never executed: end of block | 0 | ||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||
84 | void QXcbVirtualDesktop::setPrimaryScreen(QPlatformScreen *s) | - | ||||||||||||||||||||||||
85 | { | - | ||||||||||||||||||||||||
86 | const int idx = m_screens.indexOf(s); | - | ||||||||||||||||||||||||
87 | Q_ASSERT(idx > -1); | - | ||||||||||||||||||||||||
88 | m_screens.swap(0, idx); | - | ||||||||||||||||||||||||
89 | } never executed: end of block | 0 | ||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||
91 | QXcbXSettings *QXcbVirtualDesktop::xSettings() const | - | ||||||||||||||||||||||||
92 | { | - | ||||||||||||||||||||||||
93 | if (!m_xSettings) {
| 19-57 | ||||||||||||||||||||||||
94 | QXcbVirtualDesktop *self = const_cast<QXcbVirtualDesktop *>(this); | - | ||||||||||||||||||||||||
95 | self->m_xSettings = new QXcbXSettings(self); | - | ||||||||||||||||||||||||
96 | } executed 19 times by 19 tests: end of block Executed by:
| 19 | ||||||||||||||||||||||||
97 | return m_xSettings; executed 76 times by 38 tests: return m_xSettings; Executed by:
| 76 | ||||||||||||||||||||||||
98 | } | - | ||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||
100 | bool QXcbVirtualDesktop::compositingActive() const | - | ||||||||||||||||||||||||
101 | { | - | ||||||||||||||||||||||||
102 | if (connection()->hasXFixes())
| 0 | ||||||||||||||||||||||||
103 | return m_compositingActive; never executed: return m_compositingActive; | 0 | ||||||||||||||||||||||||
104 | else | - | ||||||||||||||||||||||||
105 | return connection()->getSelectionOwner(m_net_wm_cm_atom); never executed: return connection()->getSelectionOwner(m_net_wm_cm_atom); | 0 | ||||||||||||||||||||||||
106 | } | - | ||||||||||||||||||||||||
107 | - | |||||||||||||||||||||||||
108 | void QXcbVirtualDesktop::handleXFixesSelectionNotify(xcb_xfixes_selection_notify_event_t *notify_event) | - | ||||||||||||||||||||||||
109 | { | - | ||||||||||||||||||||||||
110 | if (notify_event->selection == m_net_wm_cm_atom)
| 0-67 | ||||||||||||||||||||||||
111 | m_compositingActive = notify_event->owner; never executed: m_compositingActive = notify_event->owner; | 0 | ||||||||||||||||||||||||
112 | } executed 67 times by 6 tests: end of block Executed by:
| 67 | ||||||||||||||||||||||||
113 | - | |||||||||||||||||||||||||
114 | void QXcbVirtualDesktop::subscribeToXFixesSelectionNotify() | - | ||||||||||||||||||||||||
115 | { | - | ||||||||||||||||||||||||
116 | if (connection()->hasXFixes()) {
| 0-129 | ||||||||||||||||||||||||
117 | const uint32_t mask = XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER | | - | ||||||||||||||||||||||||
118 | XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY | | - | ||||||||||||||||||||||||
119 | XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE; | - | ||||||||||||||||||||||||
120 | Q_XCB_CALL(xcb_xfixes_select_selection_input_checked(xcb_connection(), connection()->getQtSelectionOwner(), m_net_wm_cm_atom, mask)); | - | ||||||||||||||||||||||||
121 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
122 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
123 | - | |||||||||||||||||||||||||
124 | QRect QXcbVirtualDesktop::getWorkArea() const | - | ||||||||||||||||||||||||
125 | { | - | ||||||||||||||||||||||||
126 | QRect r; | - | ||||||||||||||||||||||||
127 | xcb_get_property_reply_t * workArea = | - | ||||||||||||||||||||||||
128 | xcb_get_property_reply(xcb_connection(), | - | ||||||||||||||||||||||||
129 | xcb_get_property_unchecked(xcb_connection(), false, screen()->root, | - | ||||||||||||||||||||||||
130 | atom(QXcbAtom::_NET_WORKAREA), | - | ||||||||||||||||||||||||
131 | XCB_ATOM_CARDINAL, 0, 1024), NULL); | - | ||||||||||||||||||||||||
132 | if (workArea && workArea->type == XCB_ATOM_CARDINAL && workArea->format == 32 && workArea->value_len >= 4) {
| 0-129 | ||||||||||||||||||||||||
133 | // If workArea->value_len > 4, the remaining ones seem to be for WM's virtual desktops | - | ||||||||||||||||||||||||
134 | // (don't mess with QXcbVirtualDesktop which represents an X screen). | - | ||||||||||||||||||||||||
135 | // But QScreen doesn't know about that concept. In reality there could be a | - | ||||||||||||||||||||||||
136 | // "docked" panel (with _NET_WM_STRUT_PARTIAL atom set) on just one desktop. | - | ||||||||||||||||||||||||
137 | // But for now just assume the first 4 values give us the geometry of the | - | ||||||||||||||||||||||||
138 | // "work area", AKA "available geometry" | - | ||||||||||||||||||||||||
139 | uint32_t *geom = (uint32_t*)xcb_get_property_value(workArea); | - | ||||||||||||||||||||||||
140 | r = QRect(geom[0], geom[1], geom[2], geom[3]); | - | ||||||||||||||||||||||||
141 | } else { executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
142 | r = QRect(QPoint(), size()); | - | ||||||||||||||||||||||||
143 | } never executed: end of block | 0 | ||||||||||||||||||||||||
144 | free(workArea); | - | ||||||||||||||||||||||||
145 | return r; executed 129 times by 5 tests: return r; Executed by:
| 129 | ||||||||||||||||||||||||
146 | } | - | ||||||||||||||||||||||||
147 | - | |||||||||||||||||||||||||
148 | void QXcbVirtualDesktop::updateWorkArea() | - | ||||||||||||||||||||||||
149 | { | - | ||||||||||||||||||||||||
150 | QRect workArea = getWorkArea(); | - | ||||||||||||||||||||||||
151 | if (m_workArea != workArea) {
| 0 | ||||||||||||||||||||||||
152 | m_workArea = workArea; | - | ||||||||||||||||||||||||
153 | foreach (QPlatformScreen *screen, m_screens) | - | ||||||||||||||||||||||||
154 | ((QXcbScreen *)screen)->updateAvailableGeometry(); never executed: ((QXcbScreen *)screen)->updateAvailableGeometry(); | 0 | ||||||||||||||||||||||||
155 | } never executed: end of block | 0 | ||||||||||||||||||||||||
156 | } never executed: end of block | 0 | ||||||||||||||||||||||||
157 | - | |||||||||||||||||||||||||
158 | static inline QSizeF sizeInMillimeters(const QSize &size, const QDpi &dpi) | - | ||||||||||||||||||||||||
159 | { | - | ||||||||||||||||||||||||
160 | return QSizeF(Q_MM_PER_INCH * size.width() / dpi.first, executed 129 times by 5 tests: return QSizeF(Q_MM_PER_INCH * size.width() / dpi.first, Q_MM_PER_INCH * size.height() / dpi.second); Executed by:
| 129 | ||||||||||||||||||||||||
161 | Q_MM_PER_INCH * size.height() / dpi.second); executed 129 times by 5 tests: return QSizeF(Q_MM_PER_INCH * size.width() / dpi.first, Q_MM_PER_INCH * size.height() / dpi.second); Executed by:
| 129 | ||||||||||||||||||||||||
162 | } | - | ||||||||||||||||||||||||
163 | - | |||||||||||||||||||||||||
164 | QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop, | - | ||||||||||||||||||||||||
165 | xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output, | - | ||||||||||||||||||||||||
166 | const xcb_xinerama_screen_info_t *xineramaScreenInfo, int xineramaScreenIdx) | - | ||||||||||||||||||||||||
167 | : QXcbObject(connection) | - | ||||||||||||||||||||||||
168 | , m_virtualDesktop(virtualDesktop) | - | ||||||||||||||||||||||||
169 | , m_output(outputId) | - | ||||||||||||||||||||||||
170 | , m_crtc(output ? output->crtc : XCB_NONE) | - | ||||||||||||||||||||||||
171 | , m_mode(XCB_NONE) | - | ||||||||||||||||||||||||
172 | , m_primary(false) | - | ||||||||||||||||||||||||
173 | , m_rotation(XCB_RANDR_ROTATION_ROTATE_0) | - | ||||||||||||||||||||||||
174 | , m_outputName(getOutputName(output)) | - | ||||||||||||||||||||||||
175 | , m_outputSizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize()) | - | ||||||||||||||||||||||||
176 | , m_virtualSize(virtualDesktop->size()) | - | ||||||||||||||||||||||||
177 | , m_virtualSizeMillimeters(virtualDesktop->physicalSize()) | - | ||||||||||||||||||||||||
178 | , m_orientation(Qt::PrimaryOrientation) | - | ||||||||||||||||||||||||
179 | , m_refreshRate(60) | - | ||||||||||||||||||||||||
180 | , m_forcedDpi(-1) | - | ||||||||||||||||||||||||
181 | , m_pixelDensity(1) | - | ||||||||||||||||||||||||
182 | , m_hintStyle(QFontEngine::HintStyle(-1)) | - | ||||||||||||||||||||||||
183 | , m_noFontHinting(false) | - | ||||||||||||||||||||||||
184 | , m_subpixelType(QFontEngine::SubpixelAntialiasingType(-1)) | - | ||||||||||||||||||||||||
185 | , m_antialiasingEnabled(-1) | - | ||||||||||||||||||||||||
186 | { | - | ||||||||||||||||||||||||
187 | if (connection->hasXRandr()) {
| 0-129 | ||||||||||||||||||||||||
188 | xcb_randr_select_input(xcb_connection(), screen()->root, true); | - | ||||||||||||||||||||||||
189 | xcb_randr_get_crtc_info_cookie_t crtcCookie = | - | ||||||||||||||||||||||||
190 | xcb_randr_get_crtc_info_unchecked(xcb_connection(), m_crtc, output ? output->timestamp : 0); | - | ||||||||||||||||||||||||
191 | xcb_randr_get_crtc_info_reply_t *crtc = | - | ||||||||||||||||||||||||
192 | xcb_randr_get_crtc_info_reply(xcb_connection(), crtcCookie, NULL); | - | ||||||||||||||||||||||||
193 | if (crtc) {
| 0-129 | ||||||||||||||||||||||||
194 | updateGeometry(QRect(crtc->x, crtc->y, crtc->width, crtc->height), crtc->rotation); | - | ||||||||||||||||||||||||
195 | updateRefreshRate(crtc->mode); | - | ||||||||||||||||||||||||
196 | free(crtc); | - | ||||||||||||||||||||||||
197 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
198 | } else if (xineramaScreenInfo) { executed 129 times by 5 tests: end of block Executed by:
| 0-129 | ||||||||||||||||||||||||
199 | m_geometry = QRect(xineramaScreenInfo->x_org, xineramaScreenInfo->y_org, | - | ||||||||||||||||||||||||
200 | xineramaScreenInfo->width, xineramaScreenInfo->height); | - | ||||||||||||||||||||||||
201 | m_availableGeometry = m_geometry & m_virtualDesktop->workArea(); | - | ||||||||||||||||||||||||
202 | m_sizeMillimeters = sizeInMillimeters(m_geometry.size(), virtualDpi()); | - | ||||||||||||||||||||||||
203 | if (xineramaScreenIdx > -1)
| 0 | ||||||||||||||||||||||||
204 | m_outputName += QLatin1Char('-') + QString::number(xineramaScreenIdx); never executed: m_outputName += QLatin1Char('-') + QString::number(xineramaScreenIdx); | 0 | ||||||||||||||||||||||||
205 | } never executed: end of block | 0 | ||||||||||||||||||||||||
206 | - | |||||||||||||||||||||||||
207 | if (m_geometry.isEmpty())
| 0-129 | ||||||||||||||||||||||||
208 | m_geometry = QRect(QPoint(), m_virtualSize); never executed: m_geometry = QRect(QPoint(), m_virtualSize); | 0 | ||||||||||||||||||||||||
209 | - | |||||||||||||||||||||||||
210 | if (m_availableGeometry.isEmpty())
| 0-129 | ||||||||||||||||||||||||
211 | m_availableGeometry = m_geometry & m_virtualDesktop->workArea(); never executed: m_availableGeometry = m_geometry & m_virtualDesktop->workArea(); | 0 | ||||||||||||||||||||||||
212 | - | |||||||||||||||||||||||||
213 | if (m_sizeMillimeters.isEmpty())
| 0-129 | ||||||||||||||||||||||||
214 | m_sizeMillimeters = m_virtualSizeMillimeters; never executed: m_sizeMillimeters = m_virtualSizeMillimeters; | 0 | ||||||||||||||||||||||||
215 | - | |||||||||||||||||||||||||
216 | readXResources(); | - | ||||||||||||||||||||||||
217 | - | |||||||||||||||||||||||||
218 | QScopedPointer<xcb_get_window_attributes_reply_t, QScopedPointerPodDeleter> rootAttribs( | - | ||||||||||||||||||||||||
219 | xcb_get_window_attributes_reply(xcb_connection(), | - | ||||||||||||||||||||||||
220 | xcb_get_window_attributes_unchecked(xcb_connection(), screen()->root), NULL)); | - | ||||||||||||||||||||||||
221 | const quint32 existingEventMask = rootAttribs.isNull() ? 0 : rootAttribs->your_event_mask;
| 0-129 | ||||||||||||||||||||||||
222 | - | |||||||||||||||||||||||||
223 | const quint32 mask = XCB_CW_EVENT_MASK; | - | ||||||||||||||||||||||||
224 | const quint32 values[] = { | - | ||||||||||||||||||||||||
225 | // XCB_CW_EVENT_MASK | - | ||||||||||||||||||||||||
226 | XCB_EVENT_MASK_ENTER_WINDOW | - | ||||||||||||||||||||||||
227 | | XCB_EVENT_MASK_LEAVE_WINDOW | - | ||||||||||||||||||||||||
228 | | XCB_EVENT_MASK_PROPERTY_CHANGE | - | ||||||||||||||||||||||||
229 | | XCB_EVENT_MASK_STRUCTURE_NOTIFY // for the "MANAGER" atom (system tray notification). | - | ||||||||||||||||||||||||
230 | | existingEventMask // don't overwrite the event mask on the root window | - | ||||||||||||||||||||||||
231 | }; | - | ||||||||||||||||||||||||
232 | - | |||||||||||||||||||||||||
233 | xcb_change_window_attributes(xcb_connection(), screen()->root, mask, values); | - | ||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||
235 | xcb_get_property_reply_t *reply = | - | ||||||||||||||||||||||||
236 | xcb_get_property_reply(xcb_connection(), | - | ||||||||||||||||||||||||
237 | xcb_get_property_unchecked(xcb_connection(), false, screen()->root, | - | ||||||||||||||||||||||||
238 | atom(QXcbAtom::_NET_SUPPORTING_WM_CHECK), | - | ||||||||||||||||||||||||
239 | XCB_ATOM_WINDOW, 0, 1024), NULL); | - | ||||||||||||||||||||||||
240 | - | |||||||||||||||||||||||||
241 | if (reply && reply->format == 32 && reply->type == XCB_ATOM_WINDOW) {
| 0-129 | ||||||||||||||||||||||||
242 | xcb_window_t windowManager = *((xcb_window_t *)xcb_get_property_value(reply)); | - | ||||||||||||||||||||||||
243 | - | |||||||||||||||||||||||||
244 | if (windowManager != XCB_WINDOW_NONE) {
| 0-129 | ||||||||||||||||||||||||
245 | xcb_get_property_reply_t *windowManagerReply = | - | ||||||||||||||||||||||||
246 | xcb_get_property_reply(xcb_connection(), | - | ||||||||||||||||||||||||
247 | xcb_get_property_unchecked(xcb_connection(), false, windowManager, | - | ||||||||||||||||||||||||
248 | atom(QXcbAtom::_NET_WM_NAME), | - | ||||||||||||||||||||||||
249 | atom(QXcbAtom::UTF8_STRING), 0, 1024), NULL); | - | ||||||||||||||||||||||||
250 | if (windowManagerReply && windowManagerReply->format == 8 && windowManagerReply->type == atom(QXcbAtom::UTF8_STRING)) {
| 0-129 | ||||||||||||||||||||||||
251 | m_windowManagerName = QString::fromUtf8((const char *)xcb_get_property_value(windowManagerReply), xcb_get_property_value_length(windowManagerReply)); | - | ||||||||||||||||||||||||
252 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||
254 | free(windowManagerReply); | - | ||||||||||||||||||||||||
255 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
256 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
257 | free(reply); | - | ||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||
259 | const xcb_query_extension_reply_t *sync_reply = xcb_get_extension_data(xcb_connection(), &xcb_sync_id); | - | ||||||||||||||||||||||||
260 | if (!sync_reply || !sync_reply->present)
| 0-129 | ||||||||||||||||||||||||
261 | m_syncRequestSupported = false; never executed: m_syncRequestSupported = false; | 0 | ||||||||||||||||||||||||
262 | else | - | ||||||||||||||||||||||||
263 | m_syncRequestSupported = true; executed 129 times by 5 tests: m_syncRequestSupported = true; Executed by:
| 129 | ||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||
265 | xcb_depth_iterator_t depth_iterator = | - | ||||||||||||||||||||||||
266 | xcb_screen_allowed_depths_iterator(screen()); | - | ||||||||||||||||||||||||
267 | - | |||||||||||||||||||||||||
268 | while (depth_iterator.rem) {
| 129-903 | ||||||||||||||||||||||||
269 | xcb_depth_t *depth = depth_iterator.data; | - | ||||||||||||||||||||||||
270 | xcb_visualtype_iterator_t visualtype_iterator = | - | ||||||||||||||||||||||||
271 | xcb_depth_visuals_iterator(depth); | - | ||||||||||||||||||||||||
272 | - | |||||||||||||||||||||||||
273 | while (visualtype_iterator.rem) {
| 903-15480 | ||||||||||||||||||||||||
274 | xcb_visualtype_t *visualtype = visualtype_iterator.data; | - | ||||||||||||||||||||||||
275 | m_visuals.insert(visualtype->visual_id, *visualtype); | - | ||||||||||||||||||||||||
276 | m_visualDepths.insert(visualtype->visual_id, depth->depth); | - | ||||||||||||||||||||||||
277 | xcb_visualtype_next(&visualtype_iterator); | - | ||||||||||||||||||||||||
278 | } executed 15480 times by 5 tests: end of block Executed by:
| 15480 | ||||||||||||||||||||||||
279 | - | |||||||||||||||||||||||||
280 | xcb_depth_next(&depth_iterator); | - | ||||||||||||||||||||||||
281 | } executed 903 times by 5 tests: end of block Executed by:
| 903 | ||||||||||||||||||||||||
282 | - | |||||||||||||||||||||||||
283 | m_cursor = new QXcbCursor(connection, this); | - | ||||||||||||||||||||||||
284 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
285 | - | |||||||||||||||||||||||||
286 | QXcbScreen::~QXcbScreen() | - | ||||||||||||||||||||||||
287 | { | - | ||||||||||||||||||||||||
288 | delete m_cursor; | - | ||||||||||||||||||||||||
289 | } executed 341 times by 220 tests: end of block Executed by:
| 341 | ||||||||||||||||||||||||
290 | - | |||||||||||||||||||||||||
291 | QString QXcbScreen::getOutputName(xcb_randr_get_output_info_reply_t *outputInfo) | - | ||||||||||||||||||||||||
292 | { | - | ||||||||||||||||||||||||
293 | QString name; | - | ||||||||||||||||||||||||
294 | if (outputInfo) {
| 0-129 | ||||||||||||||||||||||||
295 | name = QString::fromUtf8((const char*)xcb_randr_get_output_info_name(outputInfo), | - | ||||||||||||||||||||||||
296 | xcb_randr_get_output_info_name_length(outputInfo)); | - | ||||||||||||||||||||||||
297 | } else { executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
298 | QByteArray displayName = connection()->displayName(); | - | ||||||||||||||||||||||||
299 | int dotPos = displayName.lastIndexOf('.'); | - | ||||||||||||||||||||||||
300 | if (dotPos != -1)
| 0 | ||||||||||||||||||||||||
301 | displayName.truncate(dotPos); never executed: displayName.truncate(dotPos); | 0 | ||||||||||||||||||||||||
302 | name = QString::fromLocal8Bit(displayName) + QLatin1Char('.') | - | ||||||||||||||||||||||||
303 | + QString::number(m_virtualDesktop->number()); | - | ||||||||||||||||||||||||
304 | } never executed: end of block | 0 | ||||||||||||||||||||||||
305 | return name; executed 129 times by 5 tests: return name; Executed by:
| 129 | ||||||||||||||||||||||||
306 | } | - | ||||||||||||||||||||||||
307 | - | |||||||||||||||||||||||||
308 | QWindow *QXcbScreen::topLevelAt(const QPoint &p) const | - | ||||||||||||||||||||||||
309 | { | - | ||||||||||||||||||||||||
310 | xcb_window_t root = screen()->root; | - | ||||||||||||||||||||||||
311 | - | |||||||||||||||||||||||||
312 | int x = p.x(); | - | ||||||||||||||||||||||||
313 | int y = p.y(); | - | ||||||||||||||||||||||||
314 | - | |||||||||||||||||||||||||
315 | xcb_window_t parent = root; | - | ||||||||||||||||||||||||
316 | xcb_window_t child = root; | - | ||||||||||||||||||||||||
317 | - | |||||||||||||||||||||||||
318 | do { | - | ||||||||||||||||||||||||
319 | xcb_translate_coordinates_cookie_t translate_cookie = | - | ||||||||||||||||||||||||
320 | xcb_translate_coordinates_unchecked(xcb_connection(), parent, child, x, y); | - | ||||||||||||||||||||||||
321 | - | |||||||||||||||||||||||||
322 | xcb_translate_coordinates_reply_t *translate_reply = | - | ||||||||||||||||||||||||
323 | xcb_translate_coordinates_reply(xcb_connection(), translate_cookie, NULL); | - | ||||||||||||||||||||||||
324 | - | |||||||||||||||||||||||||
325 | if (!translate_reply) {
| 0-583 | ||||||||||||||||||||||||
326 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
327 | } | - | ||||||||||||||||||||||||
328 | - | |||||||||||||||||||||||||
329 | parent = child; | - | ||||||||||||||||||||||||
330 | child = translate_reply->child; | - | ||||||||||||||||||||||||
331 | x = translate_reply->dst_x; | - | ||||||||||||||||||||||||
332 | y = translate_reply->dst_y; | - | ||||||||||||||||||||||||
333 | - | |||||||||||||||||||||||||
334 | free(translate_reply); | - | ||||||||||||||||||||||||
335 | - | |||||||||||||||||||||||||
336 | if (!child || child == root)
| 0-373 | ||||||||||||||||||||||||
337 | return 0; executed 210 times by 17 tests: return 0; Executed by:
| 210 | ||||||||||||||||||||||||
338 | - | |||||||||||||||||||||||||
339 | QPlatformWindow *platformWindow = connection()->platformWindowFromId(child); | - | ||||||||||||||||||||||||
340 | if (platformWindow)
| 69-304 | ||||||||||||||||||||||||
341 | return platformWindow->window(); executed 69 times by 6 tests: return platformWindow->window(); Executed by:
| 69 | ||||||||||||||||||||||||
342 | } while (parent != child); executed 304 times by 19 tests: end of block Executed by:
| 0-304 | ||||||||||||||||||||||||
343 | - | |||||||||||||||||||||||||
344 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
345 | } | - | ||||||||||||||||||||||||
346 | - | |||||||||||||||||||||||||
347 | void QXcbScreen::windowShown(QXcbWindow *window) | - | ||||||||||||||||||||||||
348 | { | - | ||||||||||||||||||||||||
349 | // Freedesktop.org Startup Notification | - | ||||||||||||||||||||||||
350 | if (!connection()->startupId().isEmpty() && window->window()->isTopLevel()) {
| 0-4054 | ||||||||||||||||||||||||
351 | sendStartupMessage(QByteArrayLiteral("remove: ID=") + connection()->startupId()); never executed: return ba; | 0 | ||||||||||||||||||||||||
352 | connection()->clearStartupId(); | - | ||||||||||||||||||||||||
353 | } never executed: end of block | 0 | ||||||||||||||||||||||||
354 | } executed 4054 times by 122 tests: end of block Executed by:
| 4054 | ||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||
356 | void QXcbScreen::sendStartupMessage(const QByteArray &message) const | - | ||||||||||||||||||||||||
357 | { | - | ||||||||||||||||||||||||
358 | xcb_window_t rootWindow = root(); | - | ||||||||||||||||||||||||
359 | - | |||||||||||||||||||||||||
360 | xcb_client_message_event_t ev; | - | ||||||||||||||||||||||||
361 | ev.response_type = XCB_CLIENT_MESSAGE; | - | ||||||||||||||||||||||||
362 | ev.format = 8; | - | ||||||||||||||||||||||||
363 | ev.type = connection()->atom(QXcbAtom::_NET_STARTUP_INFO_BEGIN); | - | ||||||||||||||||||||||||
364 | ev.sequence = 0; | - | ||||||||||||||||||||||||
365 | ev.window = rootWindow; | - | ||||||||||||||||||||||||
366 | int sent = 0; | - | ||||||||||||||||||||||||
367 | int length = message.length() + 1; // include NUL byte | - | ||||||||||||||||||||||||
368 | const char *data = message.constData(); | - | ||||||||||||||||||||||||
369 | do { | - | ||||||||||||||||||||||||
370 | if (sent == 20)
| 0 | ||||||||||||||||||||||||
371 | ev.type = connection()->atom(QXcbAtom::_NET_STARTUP_INFO); never executed: ev.type = connection()->atom(QXcbAtom::_NET_STARTUP_INFO); | 0 | ||||||||||||||||||||||||
372 | - | |||||||||||||||||||||||||
373 | const int start = sent; | - | ||||||||||||||||||||||||
374 | const int numBytes = qMin(length - start, 20); | - | ||||||||||||||||||||||||
375 | memcpy(ev.data.data8, data + start, numBytes); | - | ||||||||||||||||||||||||
376 | xcb_send_event(connection()->xcb_connection(), false, rootWindow, XCB_EVENT_MASK_PROPERTY_CHANGE, (const char *) &ev); | - | ||||||||||||||||||||||||
377 | - | |||||||||||||||||||||||||
378 | sent += numBytes; | - | ||||||||||||||||||||||||
379 | } while (sent < length); never executed: end of block
| 0 | ||||||||||||||||||||||||
380 | } never executed: end of block | 0 | ||||||||||||||||||||||||
381 | - | |||||||||||||||||||||||||
382 | const xcb_visualtype_t *QXcbScreen::visualForId(xcb_visualid_t visualid) const | - | ||||||||||||||||||||||||
383 | { | - | ||||||||||||||||||||||||
384 | QMap<xcb_visualid_t, xcb_visualtype_t>::const_iterator it = m_visuals.find(visualid); | - | ||||||||||||||||||||||||
385 | if (it == m_visuals.constEnd())
| 0-423 | ||||||||||||||||||||||||
386 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
387 | return &*it; executed 423 times by 124 tests: return &*it; Executed by:
| 423 | ||||||||||||||||||||||||
388 | } | - | ||||||||||||||||||||||||
389 | - | |||||||||||||||||||||||||
390 | quint8 QXcbScreen::depthOfVisual(xcb_visualid_t visualid) const | - | ||||||||||||||||||||||||
391 | { | - | ||||||||||||||||||||||||
392 | QMap<xcb_visualid_t, quint8>::const_iterator it = m_visualDepths.find(visualid); | - | ||||||||||||||||||||||||
393 | if (it == m_visualDepths.constEnd())
| 0-3 | ||||||||||||||||||||||||
394 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
395 | return *it; executed 3 times by 1 test: return *it; Executed by:
| 3 | ||||||||||||||||||||||||
396 | } | - | ||||||||||||||||||||||||
397 | - | |||||||||||||||||||||||||
398 | QImage::Format QXcbScreen::format() const | - | ||||||||||||||||||||||||
399 | { | - | ||||||||||||||||||||||||
400 | return QImage::Format_RGB32; executed 72855 times by 105 tests: return QImage::Format_RGB32; Executed by:
| 72855 | ||||||||||||||||||||||||
401 | } | - | ||||||||||||||||||||||||
402 | - | |||||||||||||||||||||||||
403 | QDpi QXcbScreen::virtualDpi() const | - | ||||||||||||||||||||||||
404 | { | - | ||||||||||||||||||||||||
405 | return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(), executed 129 times by 5 tests: return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(), Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height()); Executed by:
| 129 | ||||||||||||||||||||||||
406 | Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height()); executed 129 times by 5 tests: return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(), Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height()); Executed by:
| 129 | ||||||||||||||||||||||||
407 | } | - | ||||||||||||||||||||||||
408 | - | |||||||||||||||||||||||||
409 | - | |||||||||||||||||||||||||
410 | QDpi QXcbScreen::logicalDpi() const | - | ||||||||||||||||||||||||
411 | { | - | ||||||||||||||||||||||||
412 | static const int overrideDpi = qEnvironmentVariableIntValue("QT_FONT_DPI"); | - | ||||||||||||||||||||||||
413 | if (overrideDpi)
| 0-404 | ||||||||||||||||||||||||
414 | return QDpi(overrideDpi, overrideDpi); never executed: return QDpi(overrideDpi, overrideDpi); | 0 | ||||||||||||||||||||||||
415 | - | |||||||||||||||||||||||||
416 | if (m_forcedDpi > 0) {
| 0-404 | ||||||||||||||||||||||||
417 | return QDpi(m_forcedDpi, m_forcedDpi); executed 404 times by 8 tests: return QDpi(m_forcedDpi, m_forcedDpi); Executed by:
| 404 | ||||||||||||||||||||||||
418 | } | - | ||||||||||||||||||||||||
419 | return virtualDpi(); never executed: return virtualDpi(); | 0 | ||||||||||||||||||||||||
420 | } | - | ||||||||||||||||||||||||
421 | - | |||||||||||||||||||||||||
422 | qreal QXcbScreen::pixelDensity() const | - | ||||||||||||||||||||||||
423 | { | - | ||||||||||||||||||||||||
424 | return m_pixelDensity; never executed: return m_pixelDensity; | 0 | ||||||||||||||||||||||||
425 | } | - | ||||||||||||||||||||||||
426 | - | |||||||||||||||||||||||||
427 | QPlatformCursor *QXcbScreen::cursor() const | - | ||||||||||||||||||||||||
428 | { | - | ||||||||||||||||||||||||
429 | return m_cursor; executed 24058 times by 119 tests: return m_cursor; Executed by:
| 24058 | ||||||||||||||||||||||||
430 | } | - | ||||||||||||||||||||||||
431 | - | |||||||||||||||||||||||||
432 | void QXcbScreen::setOutput(xcb_randr_output_t outputId, | - | ||||||||||||||||||||||||
433 | xcb_randr_get_output_info_reply_t *outputInfo) | - | ||||||||||||||||||||||||
434 | { | - | ||||||||||||||||||||||||
435 | m_output = outputId; | - | ||||||||||||||||||||||||
436 | m_crtc = outputInfo ? outputInfo->crtc : XCB_NONE;
| 0 | ||||||||||||||||||||||||
437 | m_mode = XCB_NONE; | - | ||||||||||||||||||||||||
438 | m_outputName = getOutputName(outputInfo); | - | ||||||||||||||||||||||||
439 | // TODO: Send an event to the QScreen instance that the screen changed its name | - | ||||||||||||||||||||||||
440 | } never executed: end of block | 0 | ||||||||||||||||||||||||
441 | - | |||||||||||||||||||||||||
442 | int QXcbScreen::virtualDesktopNumberStatic(const QScreen *screen) | - | ||||||||||||||||||||||||
443 | { | - | ||||||||||||||||||||||||
444 | if (screen && screen->handle())
| 0 | ||||||||||||||||||||||||
445 | return static_cast<const QXcbScreen *>(screen->handle())->screenNumber(); never executed: return static_cast<const QXcbScreen *>(screen->handle())->screenNumber(); | 0 | ||||||||||||||||||||||||
446 | - | |||||||||||||||||||||||||
447 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
448 | } | - | ||||||||||||||||||||||||
449 | - | |||||||||||||||||||||||||
450 | /*! | - | ||||||||||||||||||||||||
451 | \brief handle the XCB screen change event and update properties | - | ||||||||||||||||||||||||
452 | - | |||||||||||||||||||||||||
453 | On a mobile device, the ideal use case is that the accelerometer would | - | ||||||||||||||||||||||||
454 | drive the orientation. This could be achieved by using QSensors to read the | - | ||||||||||||||||||||||||
455 | accelerometer and adjusting the rotation in QML, or by reading the | - | ||||||||||||||||||||||||
456 | orientation from the QScreen object and doing the same, or in many other | - | ||||||||||||||||||||||||
457 | ways. However, on X we have the XRandR extension, which makes it possible | - | ||||||||||||||||||||||||
458 | to have the whole screen rotated, so that individual apps DO NOT have to | - | ||||||||||||||||||||||||
459 | rotate themselves. Apps could optionally use the | - | ||||||||||||||||||||||||
460 | QScreen::primaryOrientation property to optimize layout though. | - | ||||||||||||||||||||||||
461 | Furthermore, there is no support in X for accelerometer events anyway. So | - | ||||||||||||||||||||||||
462 | it makes more sense on a Linux system running X to just run a daemon which | - | ||||||||||||||||||||||||
463 | monitors the accelerometer and runs xrandr automatically to do the rotation, | - | ||||||||||||||||||||||||
464 | then apps do not have to be aware of it (but probably the window manager | - | ||||||||||||||||||||||||
465 | would resize them accordingly). updateGeometry() is written with this | - | ||||||||||||||||||||||||
466 | design in mind. Therefore the physical geometry, available geometry, | - | ||||||||||||||||||||||||
467 | virtual geometry, orientation and primaryOrientation should all change at | - | ||||||||||||||||||||||||
468 | the same time. On a system which cannot rotate the whole screen, it would | - | ||||||||||||||||||||||||
469 | be correct for only the orientation (not the primary orientation) to | - | ||||||||||||||||||||||||
470 | change. | - | ||||||||||||||||||||||||
471 | */ | - | ||||||||||||||||||||||||
472 | void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *change_event) | - | ||||||||||||||||||||||||
473 | { | - | ||||||||||||||||||||||||
474 | // No need to do anything when screen rotation did not change - if any | - | ||||||||||||||||||||||||
475 | // xcb output geometry has changed, we will get RRCrtcChangeNotify and | - | ||||||||||||||||||||||||
476 | // RROutputChangeNotify events next | - | ||||||||||||||||||||||||
477 | if (change_event->rotation == m_rotation)
| 0 | ||||||||||||||||||||||||
478 | return; never executed: return; | 0 | ||||||||||||||||||||||||
479 | - | |||||||||||||||||||||||||
480 | m_rotation = change_event->rotation; | - | ||||||||||||||||||||||||
481 | switch (m_rotation) { | - | ||||||||||||||||||||||||
482 | case XCB_RANDR_ROTATION_ROTATE_0: // xrandr --rotate normal never executed: case XCB_RANDR_ROTATION_ROTATE_0: | 0 | ||||||||||||||||||||||||
483 | m_orientation = Qt::LandscapeOrientation; | - | ||||||||||||||||||||||||
484 | m_virtualSize.setWidth(change_event->width); | - | ||||||||||||||||||||||||
485 | m_virtualSize.setHeight(change_event->height); | - | ||||||||||||||||||||||||
486 | m_virtualSizeMillimeters.setWidth(change_event->mwidth); | - | ||||||||||||||||||||||||
487 | m_virtualSizeMillimeters.setHeight(change_event->mheight); | - | ||||||||||||||||||||||||
488 | break; never executed: break; | 0 | ||||||||||||||||||||||||
489 | case XCB_RANDR_ROTATION_ROTATE_90: // xrandr --rotate left never executed: case XCB_RANDR_ROTATION_ROTATE_90: | 0 | ||||||||||||||||||||||||
490 | m_orientation = Qt::PortraitOrientation; | - | ||||||||||||||||||||||||
491 | m_virtualSize.setWidth(change_event->height); | - | ||||||||||||||||||||||||
492 | m_virtualSize.setHeight(change_event->width); | - | ||||||||||||||||||||||||
493 | m_virtualSizeMillimeters.setWidth(change_event->mheight); | - | ||||||||||||||||||||||||
494 | m_virtualSizeMillimeters.setHeight(change_event->mwidth); | - | ||||||||||||||||||||||||
495 | break; never executed: break; | 0 | ||||||||||||||||||||||||
496 | case XCB_RANDR_ROTATION_ROTATE_180: // xrandr --rotate inverted never executed: case XCB_RANDR_ROTATION_ROTATE_180: | 0 | ||||||||||||||||||||||||
497 | m_orientation = Qt::InvertedLandscapeOrientation; | - | ||||||||||||||||||||||||
498 | m_virtualSize.setWidth(change_event->width); | - | ||||||||||||||||||||||||
499 | m_virtualSize.setHeight(change_event->height); | - | ||||||||||||||||||||||||
500 | m_virtualSizeMillimeters.setWidth(change_event->mwidth); | - | ||||||||||||||||||||||||
501 | m_virtualSizeMillimeters.setHeight(change_event->mheight); | - | ||||||||||||||||||||||||
502 | break; never executed: break; | 0 | ||||||||||||||||||||||||
503 | case XCB_RANDR_ROTATION_ROTATE_270: // xrandr --rotate right never executed: case XCB_RANDR_ROTATION_ROTATE_270: | 0 | ||||||||||||||||||||||||
504 | m_orientation = Qt::InvertedPortraitOrientation; | - | ||||||||||||||||||||||||
505 | m_virtualSize.setWidth(change_event->height); | - | ||||||||||||||||||||||||
506 | m_virtualSize.setHeight(change_event->width); | - | ||||||||||||||||||||||||
507 | m_virtualSizeMillimeters.setWidth(change_event->mheight); | - | ||||||||||||||||||||||||
508 | m_virtualSizeMillimeters.setHeight(change_event->mwidth); | - | ||||||||||||||||||||||||
509 | break; never executed: break; | 0 | ||||||||||||||||||||||||
510 | // We don't need to do anything with these, since QScreen doesn't store reflection state, | - | ||||||||||||||||||||||||
511 | // and Qt-based applications probably don't need to care about it anyway. | - | ||||||||||||||||||||||||
512 | case XCB_RANDR_ROTATION_REFLECT_X: break; never executed: break; never executed: case XCB_RANDR_ROTATION_REFLECT_X: | 0 | ||||||||||||||||||||||||
513 | case XCB_RANDR_ROTATION_REFLECT_Y: break; never executed: break; never executed: case XCB_RANDR_ROTATION_REFLECT_Y: | 0 | ||||||||||||||||||||||||
514 | } | - | ||||||||||||||||||||||||
515 | - | |||||||||||||||||||||||||
516 | updateGeometry(change_event->timestamp); | - | ||||||||||||||||||||||||
517 | - | |||||||||||||||||||||||||
518 | QWindowSystemInterface::handleScreenOrientationChange(QPlatformScreen::screen(), m_orientation); | - | ||||||||||||||||||||||||
519 | - | |||||||||||||||||||||||||
520 | QDpi ldpi = logicalDpi(); | - | ||||||||||||||||||||||||
521 | QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QPlatformScreen::screen(), ldpi.first, ldpi.second); | - | ||||||||||||||||||||||||
522 | } never executed: end of block | 0 | ||||||||||||||||||||||||
523 | - | |||||||||||||||||||||||||
524 | void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp) | - | ||||||||||||||||||||||||
525 | { | - | ||||||||||||||||||||||||
526 | if (!connection()->hasXRandr())
| 0 | ||||||||||||||||||||||||
527 | return; never executed: return; | 0 | ||||||||||||||||||||||||
528 | - | |||||||||||||||||||||||||
529 | xcb_randr_get_crtc_info_cookie_t crtcCookie = | - | ||||||||||||||||||||||||
530 | xcb_randr_get_crtc_info_unchecked(xcb_connection(), m_crtc, timestamp); | - | ||||||||||||||||||||||||
531 | xcb_randr_get_crtc_info_reply_t *crtc = | - | ||||||||||||||||||||||||
532 | xcb_randr_get_crtc_info_reply(xcb_connection(), crtcCookie, NULL); | - | ||||||||||||||||||||||||
533 | if (crtc) {
| 0 | ||||||||||||||||||||||||
534 | updateGeometry(QRect(crtc->x, crtc->y, crtc->width, crtc->height), crtc->rotation); | - | ||||||||||||||||||||||||
535 | free(crtc); | - | ||||||||||||||||||||||||
536 | } never executed: end of block | 0 | ||||||||||||||||||||||||
537 | } never executed: end of block | 0 | ||||||||||||||||||||||||
538 | - | |||||||||||||||||||||||||
539 | void QXcbScreen::updateGeometry(const QRect &geom, uint8_t rotation) | - | ||||||||||||||||||||||||
540 | { | - | ||||||||||||||||||||||||
541 | QRect xGeometry = geom; | - | ||||||||||||||||||||||||
542 | switch (rotation) { | - | ||||||||||||||||||||||||
543 | case XCB_RANDR_ROTATION_ROTATE_0: // xrandr --rotate normal executed 129 times by 5 tests: case XCB_RANDR_ROTATION_ROTATE_0: Executed by:
| 129 | ||||||||||||||||||||||||
544 | m_orientation = Qt::LandscapeOrientation; | - | ||||||||||||||||||||||||
545 | m_sizeMillimeters = m_outputSizeMillimeters; | - | ||||||||||||||||||||||||
546 | break; executed 129 times by 5 tests: break; Executed by:
| 129 | ||||||||||||||||||||||||
547 | case XCB_RANDR_ROTATION_ROTATE_90: // xrandr --rotate left never executed: case XCB_RANDR_ROTATION_ROTATE_90: | 0 | ||||||||||||||||||||||||
548 | m_orientation = Qt::PortraitOrientation; | - | ||||||||||||||||||||||||
549 | m_sizeMillimeters = m_outputSizeMillimeters.transposed(); | - | ||||||||||||||||||||||||
550 | break; never executed: break; | 0 | ||||||||||||||||||||||||
551 | case XCB_RANDR_ROTATION_ROTATE_180: // xrandr --rotate inverted never executed: case XCB_RANDR_ROTATION_ROTATE_180: | 0 | ||||||||||||||||||||||||
552 | m_orientation = Qt::InvertedLandscapeOrientation; | - | ||||||||||||||||||||||||
553 | m_sizeMillimeters = m_outputSizeMillimeters; | - | ||||||||||||||||||||||||
554 | break; never executed: break; | 0 | ||||||||||||||||||||||||
555 | case XCB_RANDR_ROTATION_ROTATE_270: // xrandr --rotate right never executed: case XCB_RANDR_ROTATION_ROTATE_270: | 0 | ||||||||||||||||||||||||
556 | m_orientation = Qt::InvertedPortraitOrientation; | - | ||||||||||||||||||||||||
557 | m_sizeMillimeters = m_outputSizeMillimeters.transposed(); | - | ||||||||||||||||||||||||
558 | break; never executed: break; | 0 | ||||||||||||||||||||||||
559 | } | - | ||||||||||||||||||||||||
560 | - | |||||||||||||||||||||||||
561 | // It can be that physical size is unknown while virtual size | - | ||||||||||||||||||||||||
562 | // is known (probably back-calculated from DPI and resolution), | - | ||||||||||||||||||||||||
563 | // e.g. on VNC or with some hardware. | - | ||||||||||||||||||||||||
564 | if (m_sizeMillimeters.isEmpty())
| 0-129 | ||||||||||||||||||||||||
565 | m_sizeMillimeters = sizeInMillimeters(xGeometry.size(), virtualDpi()); executed 129 times by 5 tests: m_sizeMillimeters = sizeInMillimeters(xGeometry.size(), virtualDpi()); Executed by:
| 129 | ||||||||||||||||||||||||
566 | - | |||||||||||||||||||||||||
567 | qreal dpi = xGeometry.width() / physicalSize().width() * qreal(25.4); | - | ||||||||||||||||||||||||
568 | m_pixelDensity = qRound(dpi/96); | - | ||||||||||||||||||||||||
569 | m_geometry = QRect(xGeometry.topLeft(), xGeometry.size()); | - | ||||||||||||||||||||||||
570 | m_availableGeometry = xGeometry & m_virtualDesktop->workArea(); | - | ||||||||||||||||||||||||
571 | QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); | - | ||||||||||||||||||||||||
572 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
573 | - | |||||||||||||||||||||||||
574 | void QXcbScreen::updateAvailableGeometry() | - | ||||||||||||||||||||||||
575 | { | - | ||||||||||||||||||||||||
576 | QRect availableGeometry = m_geometry & m_virtualDesktop->workArea(); | - | ||||||||||||||||||||||||
577 | if (m_availableGeometry != availableGeometry) {
| 0 | ||||||||||||||||||||||||
578 | m_availableGeometry = availableGeometry; | - | ||||||||||||||||||||||||
579 | QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); | - | ||||||||||||||||||||||||
580 | } never executed: end of block | 0 | ||||||||||||||||||||||||
581 | } never executed: end of block | 0 | ||||||||||||||||||||||||
582 | - | |||||||||||||||||||||||||
583 | void QXcbScreen::updateRefreshRate(xcb_randr_mode_t mode) | - | ||||||||||||||||||||||||
584 | { | - | ||||||||||||||||||||||||
585 | if (!connection()->hasXRandr())
| 0-129 | ||||||||||||||||||||||||
586 | return; never executed: return; | 0 | ||||||||||||||||||||||||
587 | - | |||||||||||||||||||||||||
588 | if (m_mode == mode)
| 0-129 | ||||||||||||||||||||||||
589 | return; never executed: return; | 0 | ||||||||||||||||||||||||
590 | - | |||||||||||||||||||||||||
591 | // we can safely use get_screen_resources_current here, because in order to | - | ||||||||||||||||||||||||
592 | // get here, we must have called get_screen_resources before | - | ||||||||||||||||||||||||
593 | xcb_randr_get_screen_resources_current_cookie_t resourcesCookie = | - | ||||||||||||||||||||||||
594 | xcb_randr_get_screen_resources_current_unchecked(xcb_connection(), screen()->root); | - | ||||||||||||||||||||||||
595 | xcb_randr_get_screen_resources_current_reply_t *resources = | - | ||||||||||||||||||||||||
596 | xcb_randr_get_screen_resources_current_reply(xcb_connection(), resourcesCookie, NULL); | - | ||||||||||||||||||||||||
597 | if (resources) {
| 0-129 | ||||||||||||||||||||||||
598 | xcb_randr_mode_info_iterator_t modesIter = | - | ||||||||||||||||||||||||
599 | xcb_randr_get_screen_resources_current_modes_iterator(resources); | - | ||||||||||||||||||||||||
600 | for (; modesIter.rem; xcb_randr_mode_info_next(&modesIter)) {
| 0-129 | ||||||||||||||||||||||||
601 | xcb_randr_mode_info_t *modeInfo = modesIter.data; | - | ||||||||||||||||||||||||
602 | if (modeInfo->id == mode) {
| 0-129 | ||||||||||||||||||||||||
603 | const uint32_t dotCount = modeInfo->htotal * modeInfo->vtotal; | - | ||||||||||||||||||||||||
604 | m_refreshRate = (dotCount != 0) ? modeInfo->dot_clock / dotCount : 0;
| 0-129 | ||||||||||||||||||||||||
605 | m_mode = mode; | - | ||||||||||||||||||||||||
606 | break; executed 129 times by 5 tests: break; Executed by:
| 129 | ||||||||||||||||||||||||
607 | } | - | ||||||||||||||||||||||||
608 | } never executed: end of block | 0 | ||||||||||||||||||||||||
609 | - | |||||||||||||||||||||||||
610 | free(resources); | - | ||||||||||||||||||||||||
611 | QWindowSystemInterface::handleScreenRefreshRateChange(QPlatformScreen::screen(), m_refreshRate); | - | ||||||||||||||||||||||||
612 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
613 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
614 | - | |||||||||||||||||||||||||
615 | QPixmap QXcbScreen::grabWindow(WId window, int x, int y, int width, int height) const | - | ||||||||||||||||||||||||
616 | { | - | ||||||||||||||||||||||||
617 | if (width == 0 || height == 0)
| 0-22 | ||||||||||||||||||||||||
618 | return QPixmap(); never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||
620 | // TODO: handle multiple screens | - | ||||||||||||||||||||||||
621 | QXcbScreen *screen = const_cast<QXcbScreen *>(this); | - | ||||||||||||||||||||||||
622 | xcb_window_t root = screen->root(); | - | ||||||||||||||||||||||||
623 | - | |||||||||||||||||||||||||
624 | if (window == 0)
| 0-22 | ||||||||||||||||||||||||
625 | window = root; never executed: window = root; | 0 | ||||||||||||||||||||||||
626 | - | |||||||||||||||||||||||||
627 | xcb_get_geometry_cookie_t geometry_cookie = xcb_get_geometry_unchecked(xcb_connection(), window); | - | ||||||||||||||||||||||||
628 | - | |||||||||||||||||||||||||
629 | xcb_get_geometry_reply_t *reply = | - | ||||||||||||||||||||||||
630 | xcb_get_geometry_reply(xcb_connection(), geometry_cookie, NULL); | - | ||||||||||||||||||||||||
631 | - | |||||||||||||||||||||||||
632 | if (!reply) {
| 0-22 | ||||||||||||||||||||||||
633 | return QPixmap(); never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
634 | } | - | ||||||||||||||||||||||||
635 | - | |||||||||||||||||||||||||
636 | if (width < 0)
| 0-22 | ||||||||||||||||||||||||
637 | width = reply->width - x; never executed: width = reply->width - x; | 0 | ||||||||||||||||||||||||
638 | if (height < 0)
| 0-22 | ||||||||||||||||||||||||
639 | height = reply->height - y; never executed: height = reply->height - y; | 0 | ||||||||||||||||||||||||
640 | - | |||||||||||||||||||||||||
641 | geometry_cookie = xcb_get_geometry_unchecked(xcb_connection(), root); | - | ||||||||||||||||||||||||
642 | xcb_get_geometry_reply_t *root_reply = | - | ||||||||||||||||||||||||
643 | xcb_get_geometry_reply(xcb_connection(), geometry_cookie, NULL); | - | ||||||||||||||||||||||||
644 | - | |||||||||||||||||||||||||
645 | if (!root_reply) {
| 0-22 | ||||||||||||||||||||||||
646 | free(reply); | - | ||||||||||||||||||||||||
647 | return QPixmap(); never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
648 | } | - | ||||||||||||||||||||||||
649 | - | |||||||||||||||||||||||||
650 | if (reply->depth == root_reply->depth) {
| 0-22 | ||||||||||||||||||||||||
651 | // if the depth of the specified window and the root window are the | - | ||||||||||||||||||||||||
652 | // same, grab pixels from the root window (so that we get the any | - | ||||||||||||||||||||||||
653 | // overlapping windows and window manager frames) | - | ||||||||||||||||||||||||
654 | - | |||||||||||||||||||||||||
655 | // map x and y to the root window | - | ||||||||||||||||||||||||
656 | xcb_translate_coordinates_cookie_t translate_cookie = | - | ||||||||||||||||||||||||
657 | xcb_translate_coordinates_unchecked(xcb_connection(), window, root, x, y); | - | ||||||||||||||||||||||||
658 | - | |||||||||||||||||||||||||
659 | xcb_translate_coordinates_reply_t *translate_reply = | - | ||||||||||||||||||||||||
660 | xcb_translate_coordinates_reply(xcb_connection(), translate_cookie, NULL); | - | ||||||||||||||||||||||||
661 | - | |||||||||||||||||||||||||
662 | if (!translate_reply) {
| 0-22 | ||||||||||||||||||||||||
663 | free(reply); | - | ||||||||||||||||||||||||
664 | free(root_reply); | - | ||||||||||||||||||||||||
665 | return QPixmap(); never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
666 | } | - | ||||||||||||||||||||||||
667 | - | |||||||||||||||||||||||||
668 | x = translate_reply->dst_x; | - | ||||||||||||||||||||||||
669 | y = translate_reply->dst_y; | - | ||||||||||||||||||||||||
670 | - | |||||||||||||||||||||||||
671 | window = root; | - | ||||||||||||||||||||||||
672 | - | |||||||||||||||||||||||||
673 | free(translate_reply); | - | ||||||||||||||||||||||||
674 | free(reply); | - | ||||||||||||||||||||||||
675 | reply = root_reply; | - | ||||||||||||||||||||||||
676 | } else { executed 22 times by 3 tests: end of block Executed by:
| 22 | ||||||||||||||||||||||||
677 | free(root_reply); | - | ||||||||||||||||||||||||
678 | root_reply = 0; | - | ||||||||||||||||||||||||
679 | } never executed: end of block | 0 | ||||||||||||||||||||||||
680 | - | |||||||||||||||||||||||||
681 | xcb_get_window_attributes_reply_t *attributes_reply = | - | ||||||||||||||||||||||||
682 | xcb_get_window_attributes_reply(xcb_connection(), xcb_get_window_attributes_unchecked(xcb_connection(), window), NULL); | - | ||||||||||||||||||||||||
683 | - | |||||||||||||||||||||||||
684 | if (!attributes_reply) {
| 0-22 | ||||||||||||||||||||||||
685 | free(reply); | - | ||||||||||||||||||||||||
686 | return QPixmap(); never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
687 | } | - | ||||||||||||||||||||||||
688 | - | |||||||||||||||||||||||||
689 | const xcb_visualtype_t *visual = screen->visualForId(attributes_reply->visual); | - | ||||||||||||||||||||||||
690 | free(attributes_reply); | - | ||||||||||||||||||||||||
691 | - | |||||||||||||||||||||||||
692 | xcb_pixmap_t pixmap = xcb_generate_id(xcb_connection()); | - | ||||||||||||||||||||||||
693 | xcb_create_pixmap(xcb_connection(), reply->depth, pixmap, window, width, height); | - | ||||||||||||||||||||||||
694 | - | |||||||||||||||||||||||||
695 | uint32_t gc_value_mask = XCB_GC_SUBWINDOW_MODE; | - | ||||||||||||||||||||||||
696 | uint32_t gc_value_list[] = { XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS }; | - | ||||||||||||||||||||||||
697 | - | |||||||||||||||||||||||||
698 | xcb_gcontext_t gc = xcb_generate_id(xcb_connection()); | - | ||||||||||||||||||||||||
699 | xcb_create_gc(xcb_connection(), gc, pixmap, gc_value_mask, gc_value_list); | - | ||||||||||||||||||||||||
700 | - | |||||||||||||||||||||||||
701 | xcb_copy_area(xcb_connection(), window, pixmap, gc, x, y, 0, 0, width, height); | - | ||||||||||||||||||||||||
702 | - | |||||||||||||||||||||||||
703 | QPixmap result = qt_xcb_pixmapFromXPixmap(connection(), pixmap, width, height, reply->depth, visual); | - | ||||||||||||||||||||||||
704 | - | |||||||||||||||||||||||||
705 | free(reply); | - | ||||||||||||||||||||||||
706 | xcb_free_gc(xcb_connection(), gc); | - | ||||||||||||||||||||||||
707 | xcb_free_pixmap(xcb_connection(), pixmap); | - | ||||||||||||||||||||||||
708 | - | |||||||||||||||||||||||||
709 | return result; executed 22 times by 3 tests: return result; Executed by:
| 22 | ||||||||||||||||||||||||
710 | } | - | ||||||||||||||||||||||||
711 | - | |||||||||||||||||||||||||
712 | static bool parseXftInt(const QByteArray& stringValue, int *value) | - | ||||||||||||||||||||||||
713 | { | - | ||||||||||||||||||||||||
714 | Q_ASSERT(value != 0); | - | ||||||||||||||||||||||||
715 | bool ok; | - | ||||||||||||||||||||||||
716 | *value = stringValue.toInt(&ok); | - | ||||||||||||||||||||||||
717 | return ok; executed 258 times by 5 tests: return ok; Executed by:
| 258 | ||||||||||||||||||||||||
718 | } | - | ||||||||||||||||||||||||
719 | - | |||||||||||||||||||||||||
720 | static QFontEngine::HintStyle parseXftHintStyle(const QByteArray& stringValue) | - | ||||||||||||||||||||||||
721 | { | - | ||||||||||||||||||||||||
722 | if (stringValue == "hintfull")
| 0-129 | ||||||||||||||||||||||||
723 | return QFontEngine::HintFull; never executed: return QFontEngine::HintFull; | 0 | ||||||||||||||||||||||||
724 | else if (stringValue == "hintnone")
| 0-129 | ||||||||||||||||||||||||
725 | return QFontEngine::HintNone; never executed: return QFontEngine::HintNone; | 0 | ||||||||||||||||||||||||
726 | else if (stringValue == "hintmedium")
| 0-129 | ||||||||||||||||||||||||
727 | return QFontEngine::HintMedium; executed 129 times by 5 tests: return QFontEngine::HintMedium; Executed by:
| 129 | ||||||||||||||||||||||||
728 | else if (stringValue == "hintslight")
| 0 | ||||||||||||||||||||||||
729 | return QFontEngine::HintLight; never executed: return QFontEngine::HintLight; | 0 | ||||||||||||||||||||||||
730 | - | |||||||||||||||||||||||||
731 | return QFontEngine::HintStyle(-1); never executed: return QFontEngine::HintStyle(-1); | 0 | ||||||||||||||||||||||||
732 | } | - | ||||||||||||||||||||||||
733 | - | |||||||||||||||||||||||||
734 | static QFontEngine::SubpixelAntialiasingType parseXftRgba(const QByteArray& stringValue) | - | ||||||||||||||||||||||||
735 | { | - | ||||||||||||||||||||||||
736 | if (stringValue == "none")
| 0-129 | ||||||||||||||||||||||||
737 | return QFontEngine::Subpixel_None; executed 129 times by 5 tests: return QFontEngine::Subpixel_None; Executed by:
| 129 | ||||||||||||||||||||||||
738 | else if (stringValue == "rgb")
| 0 | ||||||||||||||||||||||||
739 | return QFontEngine::Subpixel_RGB; never executed: return QFontEngine::Subpixel_RGB; | 0 | ||||||||||||||||||||||||
740 | else if (stringValue == "bgr")
| 0 | ||||||||||||||||||||||||
741 | return QFontEngine::Subpixel_BGR; never executed: return QFontEngine::Subpixel_BGR; | 0 | ||||||||||||||||||||||||
742 | else if (stringValue == "vrgb")
| 0 | ||||||||||||||||||||||||
743 | return QFontEngine::Subpixel_VRGB; never executed: return QFontEngine::Subpixel_VRGB; | 0 | ||||||||||||||||||||||||
744 | else if (stringValue == "vbgr")
| 0 | ||||||||||||||||||||||||
745 | return QFontEngine::Subpixel_VBGR; never executed: return QFontEngine::Subpixel_VBGR; | 0 | ||||||||||||||||||||||||
746 | - | |||||||||||||||||||||||||
747 | return QFontEngine::SubpixelAntialiasingType(-1); never executed: return QFontEngine::SubpixelAntialiasingType(-1); | 0 | ||||||||||||||||||||||||
748 | } | - | ||||||||||||||||||||||||
749 | - | |||||||||||||||||||||||||
750 | bool QXcbScreen::xResource(const QByteArray &identifier, | - | ||||||||||||||||||||||||
751 | const QByteArray &expectedIdentifier, | - | ||||||||||||||||||||||||
752 | QByteArray& stringValue) | - | ||||||||||||||||||||||||
753 | { | - | ||||||||||||||||||||||||
754 | if (identifier.startsWith(expectedIdentifier)) {
| 516-2322 | ||||||||||||||||||||||||
755 | stringValue = identifier.mid(expectedIdentifier.size()); | - | ||||||||||||||||||||||||
756 | return true; executed 516 times by 5 tests: return true; Executed by:
| 516 | ||||||||||||||||||||||||
757 | } | - | ||||||||||||||||||||||||
758 | return false; executed 2322 times by 5 tests: return false; Executed by:
| 2322 | ||||||||||||||||||||||||
759 | } | - | ||||||||||||||||||||||||
760 | - | |||||||||||||||||||||||||
761 | void QXcbScreen::readXResources() | - | ||||||||||||||||||||||||
762 | { | - | ||||||||||||||||||||||||
763 | int offset = 0; | - | ||||||||||||||||||||||||
764 | QByteArray resources; | - | ||||||||||||||||||||||||
765 | while(1) { | - | ||||||||||||||||||||||||
766 | xcb_get_property_reply_t *reply = | - | ||||||||||||||||||||||||
767 | xcb_get_property_reply(xcb_connection(), | - | ||||||||||||||||||||||||
768 | xcb_get_property_unchecked(xcb_connection(), false, screen()->root, | - | ||||||||||||||||||||||||
769 | XCB_ATOM_RESOURCE_MANAGER, | - | ||||||||||||||||||||||||
770 | XCB_ATOM_STRING, offset/4, 8192), NULL); | - | ||||||||||||||||||||||||
771 | bool more = false; | - | ||||||||||||||||||||||||
772 | if (reply && reply->format == 8 && reply->type == XCB_ATOM_STRING) {
| 0-129 | ||||||||||||||||||||||||
773 | resources += QByteArray((const char *)xcb_get_property_value(reply), xcb_get_property_value_length(reply)); | - | ||||||||||||||||||||||||
774 | offset += xcb_get_property_value_length(reply); | - | ||||||||||||||||||||||||
775 | more = reply->bytes_after != 0; | - | ||||||||||||||||||||||||
776 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
777 | - | |||||||||||||||||||||||||
778 | if (reply)
| 0-129 | ||||||||||||||||||||||||
779 | free(reply); executed 129 times by 5 tests: free(reply); Executed by:
| 129 | ||||||||||||||||||||||||
780 | - | |||||||||||||||||||||||||
781 | if (!more)
| 0-129 | ||||||||||||||||||||||||
782 | break; executed 129 times by 5 tests: break; Executed by:
| 129 | ||||||||||||||||||||||||
783 | } never executed: end of block | 0 | ||||||||||||||||||||||||
784 | - | |||||||||||||||||||||||||
785 | QList<QByteArray> split = resources.split('\n'); | - | ||||||||||||||||||||||||
786 | for (int i = 0; i < split.size(); ++i) {
| 129-903 | ||||||||||||||||||||||||
787 | const QByteArray &r = split.at(i); | - | ||||||||||||||||||||||||
788 | int value; | - | ||||||||||||||||||||||||
789 | QByteArray stringValue; | - | ||||||||||||||||||||||||
790 | if (xResource(r, "Xft.dpi:\t", stringValue)) {
| 129-774 | ||||||||||||||||||||||||
791 | if (parseXftInt(stringValue, &value))
| 0-129 | ||||||||||||||||||||||||
792 | m_forcedDpi = value; executed 129 times by 5 tests: m_forcedDpi = value; Executed by:
| 129 | ||||||||||||||||||||||||
793 | } else if (xResource(r, "Xft.hintstyle:\t", stringValue)) { executed 129 times by 5 tests: end of block Executed by:
| 129-645 | ||||||||||||||||||||||||
794 | m_hintStyle = parseXftHintStyle(stringValue); | - | ||||||||||||||||||||||||
795 | } else if (xResource(r, "Xft.antialias:\t", stringValue)) { executed 129 times by 5 tests: end of block Executed by:
| 129-516 | ||||||||||||||||||||||||
796 | if (parseXftInt(stringValue, &value))
| 0-129 | ||||||||||||||||||||||||
797 | m_antialiasingEnabled = value; executed 129 times by 5 tests: m_antialiasingEnabled = value; Executed by:
| 129 | ||||||||||||||||||||||||
798 | } else if (xResource(r, "Xft.rgba:\t", stringValue)) { executed 129 times by 5 tests: end of block Executed by:
| 129-387 | ||||||||||||||||||||||||
799 | m_subpixelType = parseXftRgba(stringValue); | - | ||||||||||||||||||||||||
800 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
801 | } executed 903 times by 5 tests: end of block Executed by:
| 903 | ||||||||||||||||||||||||
802 | } executed 129 times by 5 tests: end of block Executed by:
| 129 | ||||||||||||||||||||||||
803 | - | |||||||||||||||||||||||||
804 | QXcbXSettings *QXcbScreen::xSettings() const | - | ||||||||||||||||||||||||
805 | { | - | ||||||||||||||||||||||||
806 | return m_virtualDesktop->xSettings(); executed 76 times by 38 tests: return m_virtualDesktop->xSettings(); Executed by:
| 76 | ||||||||||||||||||||||||
807 | } | - | ||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||
809 | static inline void formatRect(QDebug &debug, const QRect r) | - | ||||||||||||||||||||||||
810 | { | - | ||||||||||||||||||||||||
811 | debug << r.width() << 'x' << r.height() | - | ||||||||||||||||||||||||
812 | << forcesign << r.x() << r.y() << noforcesign; | - | ||||||||||||||||||||||||
813 | } never executed: end of block | 0 | ||||||||||||||||||||||||
814 | - | |||||||||||||||||||||||||
815 | static inline void formatSizeF(QDebug &debug, const QSizeF s) | - | ||||||||||||||||||||||||
816 | { | - | ||||||||||||||||||||||||
817 | debug << s.width() << 'x' << s.height() << "mm"; | - | ||||||||||||||||||||||||
818 | } never executed: end of block | 0 | ||||||||||||||||||||||||
819 | - | |||||||||||||||||||||||||
820 | QDebug operator<<(QDebug debug, const QXcbScreen *screen) | - | ||||||||||||||||||||||||
821 | { | - | ||||||||||||||||||||||||
822 | const QDebugStateSaver saver(debug); | - | ||||||||||||||||||||||||
823 | debug.nospace(); | - | ||||||||||||||||||||||||
824 | debug << "QXcbScreen(" << (const void *)screen; | - | ||||||||||||||||||||||||
825 | if (screen) {
| 0 | ||||||||||||||||||||||||
826 | debug << fixed << qSetRealNumberPrecision(1); | - | ||||||||||||||||||||||||
827 | debug << ", name=" << screen->name(); | - | ||||||||||||||||||||||||
828 | debug << ", geometry="; | - | ||||||||||||||||||||||||
829 | formatRect(debug, screen->geometry()); | - | ||||||||||||||||||||||||
830 | debug << ", availableGeometry="; | - | ||||||||||||||||||||||||
831 | formatRect(debug, screen->availableGeometry()); | - | ||||||||||||||||||||||||
832 | debug << ", devicePixelRatio=" << screen->devicePixelRatio(); | - | ||||||||||||||||||||||||
833 | debug << ", logicalDpi=" << screen->logicalDpi(); | - | ||||||||||||||||||||||||
834 | debug << ", physicalSize="; | - | ||||||||||||||||||||||||
835 | formatSizeF(debug, screen->physicalSize()); | - | ||||||||||||||||||||||||
836 | // TODO 5.6 if (debug.verbosity() > 2) { | - | ||||||||||||||||||||||||
837 | debug << ", screenNumber=" << screen->screenNumber(); | - | ||||||||||||||||||||||||
838 | debug << ", virtualSize=" << screen->virtualSize().width() << 'x' << screen->virtualSize().height() << " ("; | - | ||||||||||||||||||||||||
839 | formatSizeF(debug, screen->virtualSize()); | - | ||||||||||||||||||||||||
840 | debug << "), orientation=" << screen->orientation(); | - | ||||||||||||||||||||||||
841 | debug << ", depth=" << screen->depth(); | - | ||||||||||||||||||||||||
842 | debug << ", refreshRate=" << screen->refreshRate(); | - | ||||||||||||||||||||||||
843 | debug << ", root=" << hex << screen->root(); | - | ||||||||||||||||||||||||
844 | debug << ", windowManagerName=" << screen->windowManagerName(); | - | ||||||||||||||||||||||||
845 | } never executed: end of block | 0 | ||||||||||||||||||||||||
846 | debug << ')'; | - | ||||||||||||||||||||||||
847 | return debug; never executed: return debug; | 0 | ||||||||||||||||||||||||
848 | } | - | ||||||||||||||||||||||||
849 | - | |||||||||||||||||||||||||
850 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
Source code | Switch to Preprocessed file |