OpenCoverage

qxcbclipboard.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbclipboard.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 "qxcbclipboard.h"-
41-
42#include "qxcbconnection.h"-
43#include "qxcbscreen.h"-
44#include "qxcbmime.h"-
45-
46#include <private/qguiapplication_p.h>-
47#include <QElapsedTimer>-
48-
49#include <QtCore/QDebug>-
50-
51#define class class_name // Workaround XCB-ICCCM 3.8 breakage-
52#include <xcb/xcb_icccm.h>-
53#undef class-
54-
55QT_BEGIN_NAMESPACE-
56-
57#ifndef QT_NO_CLIPBOARD-
58-
59class QXcbClipboardMime : public QXcbMime-
60{-
61 Q_OBJECT-
62public:-
63 QXcbClipboardMime(QClipboard::Mode mode, QXcbClipboard *clipboard)-
64 : QXcbMime()-
65 , m_clipboard(clipboard)-
66 {-
67 switch (mode) {-
68 case QClipboard::Selection:
never executed: case QClipboard::Selection:
0
69 modeAtom = XCB_ATOM_PRIMARY;-
70 break;
never executed: break;
0
71-
72 case QClipboard::Clipboard:
executed 5 times by 5 tests: case QClipboard::Clipboard:
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
5
73 modeAtom = m_clipboard->atom(QXcbAtom::CLIPBOARD);-
74 break;
executed 5 times by 5 tests: break;
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
5
75-
76 default:
never executed: default:
0
77 qWarning("QXcbClipboardMime: Internal error: Unsupported clipboard mode");-
78 break;
never executed: break;
0
79 }-
80 }-
81-
82 void reset()-
83 {-
84 formatList.clear();-
85 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QClipboard
1
86-
87 bool isEmpty() const-
88 {-
89 return m_clipboard->getSelectionOwner(modeAtom) == XCB_NONE;
executed 60 times by 5 tests: return m_clipboard->getSelectionOwner(modeAtom) == 0L;
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
60
90 }-
91-
92protected:-
93 QStringList formats_sys() const Q_DECL_OVERRIDE-
94 {-
95 if (isEmpty())
isEmpty()Description
TRUEevaluated 49 times by 2 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
2-49
96 return QStringList();
executed 49 times by 2 tests: return QStringList();
Executed by:
  • tst_QPlainTextEdit
  • tst_QTextEdit
49
97-
98 if (!formatList.count()) {
!formatList.count()Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
FALSEnever evaluated
0-2
99 QXcbClipboardMime *that = const_cast<QXcbClipboardMime *>(this);-
100 // get the list of targets from the current clipboard owner - we do this-
101 // once so that multiple calls to this function don't require multiple-
102 // server round trips...-
103 that->format_atoms = m_clipboard->getDataInFormat(modeAtom, m_clipboard->atom(QXcbAtom::TARGETS));-
104-
105 if (format_atoms.size() > 0) {
format_atoms.size() > 0Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
FALSEnever evaluated
0-2
106 const xcb_atom_t *targets = (const xcb_atom_t *) format_atoms.data();-
107 int size = format_atoms.size() / sizeof(xcb_atom_t);-
108-
109 for (int i = 0; i < size; ++i) {
i < sizeDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
2-14
110 if (targets[i] == 0)
targets[i] == 0Description
TRUEnever evaluated
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
0-14
111 continue;
never executed: continue;
0
112-
113 QString format = mimeAtomToString(m_clipboard->connection(), targets[i]);-
114 if (!formatList.contains(format))
!formatList.contains(format)Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
6-8
115 that->formatList.append(format);
executed 8 times by 2 tests: that->formatList.append(format);
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
8
116 }
executed 14 times by 2 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
14
117 }
executed 2 times by 2 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
2
118 }
executed 2 times by 2 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
2
119-
120 return formatList;
executed 2 times by 2 tests: return formatList;
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
2
121 }-
122-
123 bool hasFormat_sys(const QString &format) const Q_DECL_OVERRIDE-
124 {-
125 QStringList list = formats();-
126 return list.contains(format);
executed 49 times by 2 tests: return list.contains(format);
Executed by:
  • tst_QPlainTextEdit
  • tst_QTextEdit
49
127 }-
128-
129 QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const Q_DECL_OVERRIDE-
130 {-
131 if (fmt.isEmpty() || isEmpty())
fmt.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 5 times by 3 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QStyleSheetStyle
isEmpty()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QClipboard
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
0-5
132 return QByteArray();
executed 3 times by 1 test: return QByteArray();
Executed by:
  • tst_QClipboard
3
133-
134 (void)formats(); // trigger update of format list-
135-
136 QVector<xcb_atom_t> atoms;-
137 const xcb_atom_t *targets = (const xcb_atom_t *) format_atoms.data();-
138 int size = format_atoms.size() / sizeof(xcb_atom_t);-
139 atoms.reserve(size);-
140 for (int i = 0; i < size; ++i)
i < sizeDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
2-14
141 atoms.append(targets[i]);
executed 14 times by 2 tests: atoms.append(targets[i]);
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
14
142-
143 QByteArray encoding;-
144 xcb_atom_t fmtatom = mimeAtomForFormat(m_clipboard->connection(), fmt, requestedType, atoms, &encoding);-
145-
146 if (fmtatom == 0)
fmtatom == 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
0-2
147 return QVariant();
never executed: return QVariant();
0
148-
149 return mimeConvertToFormat(m_clipboard->connection(), fmtatom, m_clipboard->getDataInFormat(modeAtom, fmtatom), fmt, requestedType, encoding);
executed 2 times by 2 tests: return mimeConvertToFormat(m_clipboard->connection(), fmtatom, m_clipboard->getDataInFormat(modeAtom, fmtatom), fmt, requestedType, encoding);
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
2
150 }-
151private:-
152-
153 xcb_atom_t modeAtom;-
154 QXcbClipboard *m_clipboard;-
155 QStringList formatList;-
156 QByteArray format_atoms;-
157};-
158-
159class INCRTransaction;-
160typedef QMap<xcb_window_t,INCRTransaction*> TransactionMap;-
161static TransactionMap *transactions = 0;-
162-
163//#define INCR_DEBUG-
164-
165class INCRTransaction : public QObject-
166{-
167 Q_OBJECT-
168public:-
169 INCRTransaction(QXcbConnection *c, xcb_window_t w, xcb_atom_t p,-
170 QByteArray d, uint i, xcb_atom_t t, int f, int to) :-
171 conn(c), win(w), property(p), data(d), increment(i),-
172 target(t), format(f), timeout(to), offset(0)-
173 {-
174 const quint32 values[] = { XCB_EVENT_MASK_PROPERTY_CHANGE };-
175 xcb_change_window_attributes(conn->xcb_connection(), win,-
176 XCB_CW_EVENT_MASK, values);-
177 if (!transactions) {
!transactionsDescription
TRUEnever evaluated
FALSEnever evaluated
0
178#ifdef INCR_DEBUG-
179 qDebug("INCRTransaction: creating the TransactionMap");-
180#endif-
181 transactions = new TransactionMap;-
182 conn->clipboard()->setProcessIncr(true);-
183 }
never executed: end of block
0
184 transactions->insert(win, this);-
185 abort_timer = startTimer(timeout);-
186 }
never executed: end of block
0
187-
188 ~INCRTransaction()-
189 {-
190 if (abort_timer)
abort_timerDescription
TRUEnever evaluated
FALSEnever evaluated
0
191 killTimer(abort_timer);
never executed: killTimer(abort_timer);
0
192 abort_timer = 0;-
193 transactions->remove(win);-
194 if (transactions->isEmpty()) {
transactions->isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
195#ifdef INCR_DEBUG-
196 qDebug("INCRTransaction: no more INCR transactions left in the TransactionMap");-
197#endif-
198 delete transactions;-
199 transactions = 0;-
200 conn->clipboard()->setProcessIncr(false);-
201 }
never executed: end of block
0
202 }
never executed: end of block
0
203-
204 void updateIncrProperty(xcb_property_notify_event_t *event, bool &accepted)-
205 {-
206 xcb_connection_t *c = conn->xcb_connection();-
207 if (event->atom == property && event->state == XCB_PROPERTY_DELETE) {
event->atom == propertyDescription
TRUEnever evaluated
FALSEnever evaluated
event->state =...ROPERTY_DELETEDescription
TRUEnever evaluated
FALSEnever evaluated
0
208 accepted = true;-
209 // restart the timer-
210 if (abort_timer)
abort_timerDescription
TRUEnever evaluated
FALSEnever evaluated
0
211 killTimer(abort_timer);
never executed: killTimer(abort_timer);
0
212 abort_timer = startTimer(timeout);-
213-
214 unsigned int bytes_left = data.size() - offset;-
215 if (bytes_left > 0) {
bytes_left > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
216 unsigned int bytes_to_send = qMin(increment, bytes_left);-
217#ifdef INCR_DEBUG-
218 qDebug("INCRTransaction: sending %d bytes, %d remaining (INCR transaction %p)",-
219 bytes_to_send, bytes_left - bytes_to_send, this);-
220#endif-
221 int dataSize = bytes_to_send / (format / 8);-
222 xcb_change_property(c, XCB_PROP_MODE_REPLACE, win, property,-
223 target, format, dataSize, data.constData() + offset);-
224 offset += bytes_to_send;-
225 } else {
never executed: end of block
0
226#ifdef INCR_DEBUG-
227 qDebug("INCRTransaction: INCR transaction %p completed", this);-
228#endif-
229 xcb_change_property(c, XCB_PROP_MODE_REPLACE, win, property,-
230 target, format, 0, (const void *)0);-
231 const quint32 values[] = { XCB_EVENT_MASK_NO_EVENT };-
232 xcb_change_window_attributes(conn->xcb_connection(), win,-
233 XCB_CW_EVENT_MASK, values);-
234 // self destroy-
235 delete this;-
236 }
never executed: end of block
0
237 }-
238 }
never executed: end of block
0
239-
240protected:-
241 void timerEvent(QTimerEvent *ev) Q_DECL_OVERRIDE-
242 {-
243 if (ev->timerId() == abort_timer) {
ev->timerId() == abort_timerDescription
TRUEnever evaluated
FALSEnever evaluated
0
244 // this can happen when the X client we are sending data-
245 // to decides to exit (normally or abnormally)-
246#ifdef INCR_DEBUG-
247 qDebug("INCRTransaction: Timed out while sending data to %p", this);-
248#endif-
249 delete this;-
250 }
never executed: end of block
0
251 }
never executed: end of block
0
252-
253private:-
254 QXcbConnection *conn;-
255 xcb_window_t win;-
256 xcb_atom_t property;-
257 QByteArray data;-
258 uint increment;-
259 xcb_atom_t target;-
260 int format;-
261 int timeout;-
262 uint offset;-
263 int abort_timer;-
264};-
265-
266const int QXcbClipboard::clipboard_timeout = 5000;-
267-
268QXcbClipboard::QXcbClipboard(QXcbConnection *c)-
269 : QXcbObject(c), QPlatformClipboard()-
270 , m_requestor(XCB_NONE)-
271 , m_owner(XCB_NONE)-
272 , m_incr_active(false)-
273 , m_clipboard_closing(false)-
274 , m_incr_receive_time(0)-
275{-
276 Q_ASSERT(QClipboard::Clipboard == 0);-
277 Q_ASSERT(QClipboard::Selection == 1);-
278 m_clientClipboard[QClipboard::Clipboard] = 0;-
279 m_clientClipboard[QClipboard::Selection] = 0;-
280 m_timestamp[QClipboard::Clipboard] = XCB_CURRENT_TIME;-
281 m_timestamp[QClipboard::Selection] = XCB_CURRENT_TIME;-
282 m_owner = connection()->getQtSelectionOwner();-
283-
284#ifndef QT_NO_DEBUG-
285 QByteArray ba("Qt clipboard window");-
286 Q_XCB_CALL(xcb_change_property(xcb_connection(),-
287 XCB_PROP_MODE_REPLACE,-
288 m_owner,-
289 atom(QXcbAtom::_NET_WM_NAME),-
290 atom(QXcbAtom::UTF8_STRING),-
291 8,-
292 ba.length(),-
293 ba.constData()));-
294#endif-
295-
296 if (connection()->hasXFixes()) {
connection()->hasXFixes()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
297 const uint32_t mask = XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER |-
298 XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY |-
299 XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE;-
300 Q_XCB_CALL(xcb_xfixes_select_selection_input_checked(xcb_connection(), m_owner, XCB_ATOM_PRIMARY, mask));-
301 Q_XCB_CALL(xcb_xfixes_select_selection_input_checked(xcb_connection(), m_owner, atom(QXcbAtom::CLIPBOARD), mask));-
302 }
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
303}
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
304-
305QXcbClipboard::~QXcbClipboard()-
306{-
307 m_clipboard_closing = true;-
308 // Transfer the clipboard content to the clipboard manager if we own a selection-
309 if (m_timestamp[QClipboard::Clipboard] != XCB_CURRENT_TIME ||
m_timestamp[QC...ipboard] != 0LDescription
TRUEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 342 times by 215 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qcolor - unknown status
  • ...
5-342
310 m_timestamp[QClipboard::Selection] != XCB_CURRENT_TIME) {
m_timestamp[QC...lection] != 0LDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qgraphicsproxywidget - unknown status
FALSEevaluated 341 times by 214 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qcolor - unknown status
  • ...
1-341
311-
312 // First we check if there is a clipboard manager.-
313 xcb_get_selection_owner_cookie_t cookie = xcb_get_selection_owner(xcb_connection(), atom(QXcbAtom::CLIPBOARD_MANAGER));-
314 xcb_get_selection_owner_reply_t *reply = xcb_get_selection_owner_reply(xcb_connection(), cookie, 0);-
315 if (reply && reply->owner != XCB_NONE) {
replyDescription
TRUEevaluated 6 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
reply->owner != 0LDescription
TRUEevaluated 6 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
0-6
316 // we delete the property so the manager saves all TARGETS.-
317 xcb_delete_property(xcb_connection(), m_owner, atom(QXcbAtom::_QT_SELECTION));-
318 xcb_convert_selection(xcb_connection(), m_owner, atom(QXcbAtom::CLIPBOARD_MANAGER), atom(QXcbAtom::SAVE_TARGETS),-
319 atom(QXcbAtom::_QT_SELECTION), connection()->time());-
320 connection()->sync();-
321-
322 // waiting until the clipboard manager fetches the content.-
323 if (!waitForClipboardEvent(m_owner, XCB_SELECTION_NOTIFY, clipboard_timeout, true)) {
!waitForClipbo...timeout, true)Description
TRUEnever evaluated
FALSEevaluated 6 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-6
324 qWarning("QXcbClipboard: Unable to receive an event from the "-
325 "clipboard manager in a reasonable time");-
326 }
never executed: end of block
0
327 }
executed 6 times by 6 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
6
328 free(reply);-
329 }
executed 6 times by 6 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
6
330-
331 if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection])
m_clientClipbo...rd::Selection]Description
TRUEevaluated 6 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 341 times by 214 tests
Evaluated by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qcolor - unknown status
  • ...
6-341
332 delete m_clientClipboard[QClipboard::Clipboard];
executed 6 times by 6 tests: delete m_clientClipboard[QClipboard::Clipboard];
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
6
333 delete m_clientClipboard[QClipboard::Selection];-
334}
executed 347 times by 219 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QGuiApplication
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qapplication - unknown status
  • tst_qbackingstore - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuttongroup - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcheckbox - unknown status
  • tst_qclipboard - unknown status
  • ...
347
335-
336void QXcbClipboard::incrTransactionPeeker(xcb_generic_event_t *ge, bool &accepted)-
337{-
338 uint response_type = ge->response_type & ~0x80;-
339 if (response_type == XCB_PROPERTY_NOTIFY) {
response_type == 28Description
TRUEnever evaluated
FALSEnever evaluated
0
340 xcb_property_notify_event_t *event = (xcb_property_notify_event_t *)ge;-
341 TransactionMap::Iterator it = transactions->find(event->window);-
342 if (it != transactions->end()) {
it != transactions->end()Description
TRUEnever evaluated
FALSEnever evaluated
0
343 (*it)->updateIncrProperty(event, accepted);-
344 }
never executed: end of block
0
345 }
never executed: end of block
0
346}
never executed: end of block
0
347-
348xcb_window_t QXcbClipboard::getSelectionOwner(xcb_atom_t atom) const-
349{-
350 return connection()->getSelectionOwner(atom);
executed 217 times by 7 tests: return connection()->getSelectionOwner(atom);
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
217
351}-
352-
353xcb_atom_t QXcbClipboard::atomForMode(QClipboard::Mode mode) const-
354{-
355 if (mode == QClipboard::Clipboard)
mode == QClipboard::ClipboardDescription
TRUEevaluated 140 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
FALSEevaluated 16 times by 4 tests
Evaluated by:
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QPlainTextEdit
  • tst_QTextEdit
16-140
356 return atom(QXcbAtom::CLIPBOARD);
executed 140 times by 6 tests: return atom(QXcbAtom::CLIPBOARD);
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
140
357 if (mode == QClipboard::Selection)
mode == QClipboard::SelectionDescription
TRUEevaluated 16 times by 4 tests
Evaluated by:
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEnever evaluated
0-16
358 return XCB_ATOM_PRIMARY;
executed 16 times by 4 tests: return XCB_ATOM_PRIMARY;
Executed by:
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QPlainTextEdit
  • tst_QTextEdit
16
359 return XCB_NONE;
never executed: return 0L;
0
360}-
361-
362QClipboard::Mode QXcbClipboard::modeForAtom(xcb_atom_t a) const-
363{-
364 if (a == XCB_ATOM_PRIMARY)
a == XCB_ATOM_PRIMARYDescription
TRUEevaluated 11 times by 4 tests
Evaluated by:
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 81 times by 9 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
11-81
365 return QClipboard::Selection;
executed 11 times by 4 tests: return QClipboard::Selection;
Executed by:
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QPlainTextEdit
  • tst_QTextEdit
11
366 if (a == atom(QXcbAtom::CLIPBOARD))
a == atom(QXcbAtom::CLIPBOARD)Description
TRUEevaluated 81 times by 9 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
0-81
367 return QClipboard::Clipboard;
executed 81 times by 9 tests: return QClipboard::Clipboard;
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
81
368 // not supported enum value, used to detect errors-
369 return QClipboard::FindBuffer;
never executed: return QClipboard::FindBuffer;
0
370}-
371-
372-
373QMimeData * QXcbClipboard::mimeData(QClipboard::Mode mode)-
374{-
375 if (mode > QClipboard::Selection)
mode > QClipboard::SelectionDescription
TRUEnever evaluated
FALSEevaluated 89 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
0-89
376 return 0;
never executed: return 0;
0
377-
378 xcb_window_t clipboardOwner = getSelectionOwner(atomForMode(mode));-
379 if (clipboardOwner == owner()) {
clipboardOwner == owner()Description
TRUEevaluated 65 times by 4 tests
Evaluated by:
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 24 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
24-65
380 return m_clientClipboard[mode];
executed 65 times by 4 tests: return m_clientClipboard[mode];
Executed by:
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
65
381 } else {-
382 if (!m_xClipboard[mode])
!m_xClipboard[mode]Description
TRUEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
FALSEevaluated 19 times by 3 tests
Evaluated by:
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QTextEdit
5-19
383 m_xClipboard[mode].reset(new QXcbClipboardMime(mode, this));
executed 5 times by 5 tests: m_xClipboard[mode].reset(new QXcbClipboardMime(mode, this));
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
5
384-
385 return m_xClipboard[mode].data();
executed 24 times by 5 tests: return m_xClipboard[mode].data();
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
24
386 }-
387}-
388-
389void QXcbClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)-
390{-
391 if (mode > QClipboard::Selection)
mode > QClipboard::SelectionDescription
TRUEnever evaluated
FALSEevaluated 72 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
0-72
392 return;
never executed: return;
0
393-
394 QXcbClipboardMime *xClipboard = 0;-
395 // verify if there is data to be cleared on global X Clipboard.-
396 if (!data) {
!dataDescription
TRUEevaluated 19 times by 3 tests
Evaluated by:
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 53 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
19-53
397 xClipboard = qobject_cast<QXcbClipboardMime *>(mimeData(mode));-
398 if (xClipboard) {
xClipboardDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 15 times by 3 tests
Evaluated by:
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QTextEdit
4-15
399 if (xClipboard->isEmpty())
xClipboard->isEmpty()Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEnever evaluated
0-4
400 return;
executed 4 times by 2 tests: return;
Executed by:
  • tst_QPlainTextEdit
  • tst_QTextEdit
4
401 }
never executed: end of block
0
402 }
executed 15 times by 3 tests: end of block
Executed by:
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QTextEdit
15
403-
404 if (!xClipboard && (m_clientClipboard[mode] == data))
!xClipboardDescription
TRUEevaluated 68 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEnever evaluated
(m_clientClipb...mode] == data)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QClipboard
FALSEevaluated 67 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
0-68
405 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QClipboard
1
406-
407 xcb_atom_t modeAtom = atomForMode(mode);-
408 xcb_window_t newOwner = XCB_NONE;-
409-
410 if (m_clientClipboard[mode]) {
m_clientClipboard[mode]Description
TRUEevaluated 43 times by 4 tests
Evaluated by:
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 24 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
24-43
411 if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection])
m_clientClipbo...rd::Selection]Description
TRUEevaluated 40 times by 4 tests
Evaluated by:
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QClipboard
3-40
412 delete m_clientClipboard[mode];
executed 40 times by 4 tests: delete m_clientClipboard[mode];
Executed by:
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
40
413 m_clientClipboard[mode] = 0;-
414 m_timestamp[mode] = XCB_CURRENT_TIME;-
415 }
executed 43 times by 4 tests: end of block
Executed by:
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
43
416-
417 if (connection()->time() == XCB_CURRENT_TIME)
connection()->time() == 0LDescription
TRUEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 62 times by 5 tests
Evaluated by:
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
5-62
418 connection()->setTime(connection()->getTimestamp());
executed 5 times by 5 tests: connection()->setTime(connection()->getTimestamp());
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
5
419-
420 if (data) {
dataDescription
TRUEevaluated 52 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 15 times by 3 tests
Evaluated by:
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QTextEdit
15-52
421 newOwner = owner();-
422-
423 m_clientClipboard[mode] = data;-
424 m_timestamp[mode] = connection()->time();-
425 }
executed 52 times by 6 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
52
426-
427 xcb_set_selection_owner(xcb_connection(), newOwner, modeAtom, connection()->time());-
428-
429 if (getSelectionOwner(modeAtom) != newOwner) {
getSelectionOw...m) != newOwnerDescription
TRUEnever evaluated
FALSEevaluated 67 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
0-67
430 qWarning("QXcbClipboard::setMimeData: Cannot set X11 selection owner");-
431 }
never executed: end of block
0
432-
433 emitChanged(mode);-
434}
executed 67 times by 6 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
67
435-
436bool QXcbClipboard::supportsMode(QClipboard::Mode mode) const-
437{-
438 if (mode <= QClipboard::Selection)
mode <= QClipboard::SelectionDescription
TRUEevaluated 169 times by 7 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QClipboard
9-169
439 return true;
executed 169 times by 7 tests: return true;
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
169
440 return false;
executed 9 times by 1 test: return false;
Executed by:
  • tst_QClipboard
9
441}-
442-
443bool QXcbClipboard::ownsMode(QClipboard::Mode mode) const-
444{-
445 if (m_owner == XCB_NONE || mode > QClipboard::Selection)
m_owner == 0LDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QClipboard
mode > QClipboard::SelectionDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QClipboard
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QClipboard
0-3
446 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QClipboard
1
447-
448 Q_ASSERT(m_timestamp[mode] == XCB_CURRENT_TIME || getSelectionOwner(atomForMode(mode)) == m_owner);-
449-
450 return m_timestamp[mode] != XCB_CURRENT_TIME;
executed 2 times by 1 test: return m_timestamp[mode] != 0L;
Executed by:
  • tst_QClipboard
2
451}-
452-
453QXcbScreen *QXcbClipboard::screen() const-
454{-
455 return connection()->primaryScreen();
executed 24 times by 6 tests: return connection()->primaryScreen();
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
24
456}-
457-
458xcb_window_t QXcbClipboard::requestor() const-
459{-
460 QXcbScreen *platformScreen = screen();-
461-
462 if (!m_requestor && platformScreen) {
!m_requestorDescription
TRUEevaluated 6 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 18 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
platformScreenDescription
TRUEevaluated 6 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
0-18
463 const int x = 0, y = 0, w = 3, h = 3;-
464 QXcbClipboard *that = const_cast<QXcbClipboard *>(this);-
465-
466 xcb_window_t window = xcb_generate_id(xcb_connection());-
467 Q_XCB_CALL(xcb_create_window(xcb_connection(),-
468 XCB_COPY_FROM_PARENT, // depth -- same as root-
469 window, // window id-
470 platformScreen->screen()->root, // parent window id-
471 x, y, w, h,-
472 0, // border width-
473 XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class-
474 platformScreen->screen()->root_visual, // visual-
475 0, // value mask-
476 0)); // value list-
477#ifndef QT_NO_DEBUG-
478 QByteArray ba("Qt clipboard requestor window");-
479 Q_XCB_CALL(xcb_change_property(xcb_connection(),-
480 XCB_PROP_MODE_REPLACE,-
481 window,-
482 atom(QXcbAtom::_NET_WM_NAME),-
483 atom(QXcbAtom::UTF8_STRING),-
484 8,-
485 ba.length(),-
486 ba.constData()));-
487#endif-
488-
489 uint32_t mask = XCB_EVENT_MASK_PROPERTY_CHANGE;-
490 xcb_change_window_attributes(xcb_connection(), window, XCB_CW_EVENT_MASK, &mask);-
491-
492 that->setRequestor(window);-
493 }
executed 6 times by 6 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
6
494 return m_requestor;
executed 24 times by 6 tests: return m_requestor;
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
24
495}-
496-
497void QXcbClipboard::setRequestor(xcb_window_t window)-
498{-
499 if (m_requestor != XCB_NONE) {
m_requestor != 0LDescription
TRUEnever evaluated
FALSEevaluated 6 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-6
500 xcb_destroy_window(xcb_connection(), m_requestor);-
501 }
never executed: end of block
0
502 m_requestor = window;-
503}
executed 6 times by 6 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
6
504-
505xcb_window_t QXcbClipboard::owner() const-
506{-
507 return m_owner;
executed 208 times by 7 tests: return m_owner;
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
208
508}-
509-
510xcb_atom_t QXcbClipboard::sendTargetsSelection(QMimeData *d, xcb_window_t window, xcb_atom_t property)-
511{-
512 QVector<xcb_atom_t> types;-
513 QStringList formats = QInternalMimeData::formatsHelper(d);-
514 for (int i = 0; i < formats.size(); ++i) {
i < formats.size()Description
TRUEevaluated 9 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5-9
515 QVector<xcb_atom_t> atoms = QXcbMime::mimeAtomsForFormat(connection(), formats.at(i));-
516 for (int j = 0; j < atoms.size(); ++j) {
j < atoms.size()Description
TRUEevaluated 24 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 9 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
9-24
517 if (!types.contains(atoms.at(j)))
!types.contains(atoms.at(j))Description
TRUEevaluated 24 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
0-24
518 types.append(atoms.at(j));
executed 24 times by 5 tests: types.append(atoms.at(j));
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
24
519 }
executed 24 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
24
520 }
executed 9 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
9
521 types.append(atom(QXcbAtom::TARGETS));-
522 types.append(atom(QXcbAtom::MULTIPLE));-
523 types.append(atom(QXcbAtom::TIMESTAMP));-
524 types.append(atom(QXcbAtom::SAVE_TARGETS));-
525-
526 xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, window, property, XCB_ATOM_ATOM,-
527 32, types.size(), (const void *)types.constData());-
528 return property;
executed 5 times by 5 tests: return property;
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5
529}-
530-
531xcb_atom_t QXcbClipboard::sendSelection(QMimeData *d, xcb_atom_t target, xcb_window_t window, xcb_atom_t property)-
532{-
533 xcb_atom_t atomFormat = target;-
534 int dataFormat = 0;-
535 QByteArray data;-
536-
537 QString fmt = QXcbMime::mimeAtomToString(connection(), target);-
538 if (fmt.isEmpty()) { // Not a MIME type we have
fmt.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 29 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-29
539// qDebug() << "QClipboard: send_selection(): converting to type" << connection()->atomName(target) << "is not supported";-
540 return XCB_NONE;
never executed: return 0L;
0
541 }-
542// qDebug() << "QClipboard: send_selection(): converting to type" << fmt;-
543-
544 if (QXcbMime::mimeDataForAtom(connection(), target, d, &data, &atomFormat, &dataFormat)) {
QXcbMime::mime..., &dataFormat)Description
TRUEevaluated 24 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5-24
545-
546 // don't allow INCR transfers when using MULTIPLE or to-
547 // Motif clients (since Motif doesn't support INCR)-
548 static xcb_atom_t motif_clip_temporary = atom(QXcbAtom::CLIP_TEMPORARY);-
549 bool allow_incr = property != motif_clip_temporary;-
550 // This 'bool' can be removed once there is a proper fix for QTBUG-32853-
551 if (m_clipboard_closing)
m_clipboard_closingDescription
TRUEevaluated 24 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
0-24
552 allow_incr = false;
executed 24 times by 5 tests: allow_incr = false;
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
24
553 // X_ChangeProperty protocol request is 24 bytes-
554 const int increment = (xcb_get_maximum_request_length(xcb_connection()) * 4) - 24;-
555 if (data.size() > increment && allow_incr) {
data.size() > incrementDescription
TRUEnever evaluated
FALSEevaluated 24 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
allow_incrDescription
TRUEnever evaluated
FALSEnever evaluated
0-24
556 long bytes = data.size();-
557 xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, window, property,-
558 atom(QXcbAtom::INCR), 32, 1, (const void *)&bytes);-
559 new INCRTransaction(connection(), window, property, data, increment,-
560 atomFormat, dataFormat, clipboard_timeout);-
561 return property;
never executed: return property;
0
562 }-
563-
564 // make sure we can perform the XChangeProperty in a single request-
565 if (data.size() > increment)
data.size() > incrementDescription
TRUEnever evaluated
FALSEevaluated 24 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-24
566 return XCB_NONE; // ### perhaps use several XChangeProperty calls w/ PropModeAppend?
never executed: return 0L;
0
567 int dataSize = data.size() / (dataFormat / 8);-
568 // use a single request to transfer data-
569 xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, window, property, atomFormat,-
570 dataFormat, dataSize, (const void *)data.constData());-
571 }
executed 24 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
24
572 return property;
executed 29 times by 5 tests: return property;
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
29
573}-
574-
575void QXcbClipboard::handleSelectionClearRequest(xcb_selection_clear_event_t *event)-
576{-
577 QClipboard::Mode mode = modeForAtom(event->selection);-
578 if (mode > QClipboard::Selection)
mode > QClipboard::SelectionDescription
TRUEnever evaluated
FALSEevaluated 15 times by 3 tests
Evaluated by:
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QTextEdit
0-15
579 return;
never executed: return;
0
580-
581 // ignore the event if it was generated before we gained selection ownership-
582 if (m_timestamp[mode] != XCB_CURRENT_TIME && event->time <= m_timestamp[mode])
m_timestamp[mode] != 0LDescription
TRUEevaluated 14 times by 3 tests
Evaluated by:
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QClipboard
event->time <=...imestamp[mode]Description
TRUEevaluated 14 times by 3 tests
Evaluated by:
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEnever evaluated
0-14
583 return;
executed 14 times by 3 tests: return;
Executed by:
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QTextEdit
14
584-
585// DEBUG("QClipboard: new selection owner 0x%lx at time %lx (ours %lx)",-
586// XGetSelectionOwner(dpy, XA_PRIMARY),-
587// xevent->xselectionclear.time, d->timestamp);-
588-
589 xcb_window_t newOwner = getSelectionOwner(event->selection);-
590-
591 /* If selection ownership was given up voluntarily from QClipboard::clear(), then we do nothing here-
592 since its already handled in setMimeData. Otherwise, the event must have come from another client-
593 as a result of a call to xcb_set_selection_owner in which case we need to delete the local mime data-
594 */-
595 if (newOwner != XCB_NONE) {
newOwner != 0LDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QClipboard
0-1
596 if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection])
m_clientClipbo...rd::Selection]Description
TRUEnever evaluated
FALSEnever evaluated
0
597 delete m_clientClipboard[mode];
never executed: delete m_clientClipboard[mode];
0
598 m_clientClipboard[mode] = 0;-
599 m_timestamp[mode] = XCB_CURRENT_TIME;-
600 }
never executed: end of block
0
601}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QClipboard
1
602-
603void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req)-
604{-
605 if (requestor() && req->requestor == requestor()) {
requestor()Description
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
req->requestor == requestor()Description
TRUEnever evaluated
FALSEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-10
606 qWarning("QXcbClipboard: Selection request should be caught before");-
607 return;
never executed: return;
0
608 }-
609-
610 xcb_selection_notify_event_t event;-
611 event.response_type = XCB_SELECTION_NOTIFY;-
612 event.requestor = req->requestor;-
613 event.selection = req->selection;-
614 event.target = req->target;-
615 event.property = XCB_NONE;-
616 event.time = req->time;-
617-
618 QMimeData *d;-
619 QClipboard::Mode mode = modeForAtom(req->selection);-
620 if (mode > QClipboard::Selection) {
mode > QClipboard::SelectionDescription
TRUEnever evaluated
FALSEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-10
621 qWarning() << "QXcbClipboard: Unknown selection" << connection()->atomName(req->selection);-
622 xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event);-
623 return;
never executed: return;
0
624 }-
625-
626 d = m_clientClipboard[mode];-
627-
628 if (!d) {
!dDescription
TRUEnever evaluated
FALSEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-10
629 qWarning("QXcbClipboard: Cannot transfer data, no data available");-
630 xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event);-
631 return;
never executed: return;
0
632 }-
633-
634 if (m_timestamp[mode] == XCB_CURRENT_TIME // we don't own the selection anymore
m_timestamp[mode] == 0LDescription
TRUEnever evaluated
FALSEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-10
635 || (req->time != XCB_CURRENT_TIME && req->time < m_timestamp[mode])) {
req->time != 0LDescription
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
req->time < m_timestamp[mode]Description
TRUEnever evaluated
FALSEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-10
636 qWarning("QXcbClipboard: SelectionRequest too old");-
637 xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event);-
638 return;
never executed: return;
0
639 }-
640-
641 xcb_atom_t targetsAtom = atom(QXcbAtom::TARGETS);-
642 xcb_atom_t multipleAtom = atom(QXcbAtom::MULTIPLE);-
643 xcb_atom_t timestampAtom = atom(QXcbAtom::TIMESTAMP);-
644-
645 struct AtomPair { xcb_atom_t target; xcb_atom_t property; } *multi = 0;-
646 xcb_atom_t multi_type = XCB_NONE;-
647 int multi_format = 0;-
648 int nmulti = 0;-
649 int imulti = -1;-
650 bool multi_writeback = false;-
651-
652 if (req->target == multipleAtom) {
req->target == multipleAtomDescription
TRUEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5
653 QByteArray multi_data;-
654 if (req->property == XCB_NONE
req->property == 0LDescription
TRUEnever evaluated
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-5
655 || !clipboardReadProperty(req->requestor, req->property, false, &multi_data,
!clipboardRead...&multi_format)Description
TRUEnever evaluated
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-5
656 0, &multi_type, &multi_format)
!clipboardRead...&multi_format)Description
TRUEnever evaluated
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-5
657 || multi_format != 32) {
multi_format != 32Description
TRUEnever evaluated
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-5
658 // MULTIPLE property not formatted correctly-
659 xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event);-
660 return;
never executed: return;
0
661 }-
662 nmulti = multi_data.size()/sizeof(*multi);-
663 multi = new AtomPair[nmulti];-
664 memcpy(multi,multi_data.data(),multi_data.size());-
665 imulti = 0;-
666 }
executed 5 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5
667-
668 for (; imulti < nmulti; ++imulti) {
imulti < nmultiDescription
TRUEevaluated 39 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5-39
669 xcb_atom_t target;-
670 xcb_atom_t property;-
671-
672 if (multi) {
multiDescription
TRUEevaluated 34 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5-34
673 target = multi[imulti].target;-
674 property = multi[imulti].property;-
675 } else {
executed 34 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
34
676 target = req->target;-
677 property = req->property;-
678 if (property == XCB_NONE) // obsolete client
property == 0LDescription
TRUEnever evaluated
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-5
679 property = target;
never executed: property = target;
0
680 }
executed 5 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5
681-
682 xcb_atom_t ret = XCB_NONE;-
683 if (target == XCB_NONE || property == XCB_NONE) {
target == 0LDescription
TRUEnever evaluated
FALSEevaluated 39 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
property == 0LDescription
TRUEnever evaluated
FALSEevaluated 39 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-39
684 ;-
685 } else if (target == timestampAtom) {
never executed: end of block
target == timestampAtomDescription
TRUEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 34 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-34
686 if (m_timestamp[mode] != XCB_CURRENT_TIME) {
m_timestamp[mode] != 0LDescription
TRUEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
0-5
687 xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, req->requestor,-
688 property, XCB_ATOM_INTEGER, 32, 1, &m_timestamp[mode]);-
689 ret = property;-
690 } else {
executed 5 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5
691 qWarning("QXcbClipboard: Invalid data timestamp");-
692 }
never executed: end of block
0
693 } else if (target == targetsAtom) {
target == targetsAtomDescription
TRUEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 29 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5-29
694 ret = sendTargetsSelection(d, req->requestor, property);-
695 } else {
executed 5 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5
696 ret = sendSelection(d, target, req->requestor, property);-
697 }
executed 29 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
29
698-
699 if (nmulti > 0) {
nmulti > 0Description
TRUEevaluated 34 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5-34
700 if (ret == XCB_NONE) {
ret == 0LDescription
TRUEnever evaluated
FALSEevaluated 34 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-34
701 multi[imulti].property = XCB_NONE;-
702 multi_writeback = true;-
703 }
never executed: end of block
0
704 } else {
executed 34 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
34
705 event.property = ret;-
706 break;
executed 5 times by 5 tests: break;
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5
707 }-
708 }-
709-
710 if (nmulti > 0) {
nmulti > 0Description
TRUEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5
711 if (multi_writeback) {
multi_writebackDescription
TRUEnever evaluated
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-5
712 // according to ICCCM 2.6.2 says to put None back-
713 // into the original property on the requestor window-
714 xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, req->requestor, req->property,-
715 multi_type, 32, nmulti*2, (const void *)multi);-
716 }
never executed: end of block
0
717-
718 delete [] multi;-
719 event.property = req->property;-
720 }
executed 5 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5
721-
722 // send selection notify to requestor-
723 xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event);-
724}
executed 10 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
10
725-
726void QXcbClipboard::handleXFixesSelectionRequest(xcb_xfixes_selection_notify_event_t *event)-
727{-
728 QClipboard::Mode mode = modeForAtom(event->selection);-
729 if (mode > QClipboard::Selection)
mode > QClipboard::SelectionDescription
TRUEnever evaluated
FALSEevaluated 67 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
0-67
730 return;
never executed: return;
0
731-
732 // Note1: Here we care only about the xfixes events that come from other processes.-
733 // Note2: If the QClipboard::clear() is issued, event->owner is XCB_NONE,-
734 // so we check selection_timestamp to not handle our own QClipboard::clear().-
735 if (event->owner != owner() && event->selection_timestamp > m_timestamp[mode]) {
event->owner != owner()Description
TRUEevaluated 15 times by 3 tests
Evaluated by:
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 52 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
event->selecti...imestamp[mode]Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QClipboard
FALSEevaluated 14 times by 3 tests
Evaluated by:
  • tst_QClipboard
  • tst_QPlainTextEdit
  • tst_QTextEdit
1-52
736 if (!m_xClipboard[mode]) {
!m_xClipboard[mode]Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QClipboard
0-1
737 m_xClipboard[mode].reset(new QXcbClipboardMime(mode, this));-
738 } else {
never executed: end of block
0
739 m_xClipboard[mode]->reset();-
740 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QClipboard
1
741 emitChanged(mode);-
742 } else if (event->subtype == XCB_XFIXES_SELECTION_EVENT_SELECTION_CLIENT_CLOSE ||
executed 1 time by 1 test: end of block
Executed by:
  • tst_QClipboard
event->subtype...N_CLIENT_CLOSEDescription
TRUEnever evaluated
FALSEevaluated 66 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
0-66
743 event->subtype == XCB_XFIXES_SELECTION_EVENT_SELECTION_WINDOW_DESTROY)
event->subtype...WINDOW_DESTROYDescription
TRUEnever evaluated
FALSEevaluated 66 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
0-66
744 emitChanged(mode);
never executed: emitChanged(mode);
0
745}
executed 67 times by 6 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QPlainTextEdit
  • tst_QTextEdit
67
746-
747-
748static inline int maxSelectionIncr(xcb_connection_t *c)-
749{-
750 int l = xcb_get_maximum_request_length(c);-
751 return (l > 65536 ? 65536*4 : l*4) - 100;
executed 9 times by 6 tests: return (l > 65536 ? 65536*4 : l*4) - 100;
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
9
752}-
753-
754bool QXcbClipboard::clipboardReadProperty(xcb_window_t win, xcb_atom_t property, bool deleteProperty, QByteArray *buffer, int *size, xcb_atom_t *type, int *format)-
755{-
756 int maxsize = maxSelectionIncr(xcb_connection());-
757 ulong bytes_left; // bytes_after-
758 xcb_atom_t dummy_type;-
759 int dummy_format;-
760-
761 if (!type) // allow null args
!typeDescription
TRUEnever evaluated
FALSEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-9
762 type = &dummy_type;
never executed: type = &dummy_type;
0
763 if (!format)
!formatDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
4-5
764 format = &dummy_format;
executed 4 times by 2 tests: format = &dummy_format;
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
4
765-
766 // Don't read anything, just get the size of the property data-
767 xcb_get_property_cookie_t cookie = Q_XCB_CALL(xcb_get_property(xcb_connection(), false, win, property, XCB_GET_PROPERTY_TYPE_ANY, 0, 0));-
768 xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0);-
769 if (!reply || reply->type == XCB_NONE) {
!replyDescription
TRUEnever evaluated
FALSEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
reply->type == 0LDescription
TRUEnever evaluated
FALSEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-9
770 free(reply);-
771 buffer->resize(0);-
772 return false;
never executed: return false;
0
773 }-
774 *type = reply->type;-
775 *format = reply->format;-
776 bytes_left = reply->bytes_after;-
777 free(reply);-
778-
779 int offset = 0, buffer_offset = 0;-
780-
781 int newSize = bytes_left;-
782 buffer->resize(newSize);-
783-
784 bool ok = (buffer->size() == newSize);-
785-
786 if (ok && newSize) {
okDescription
TRUEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
newSizeDescription
TRUEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
0-9
787 // could allocate buffer-
788-
789 while (bytes_left) {
bytes_leftDescription
TRUEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
9
790 // more to read...-
791-
792 xcb_get_property_cookie_t cookie = Q_XCB_CALL(xcb_get_property(xcb_connection(), false, win, property, XCB_GET_PROPERTY_TYPE_ANY, offset, maxsize/4));-
793 reply = xcb_get_property_reply(xcb_connection(), cookie, 0);-
794 if (!reply || reply->type == XCB_NONE) {
!replyDescription
TRUEnever evaluated
FALSEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
reply->type == 0LDescription
TRUEnever evaluated
FALSEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-9
795 free(reply);-
796 break;
never executed: break;
0
797 }-
798 *type = reply->type;-
799 *format = reply->format;-
800 bytes_left = reply->bytes_after;-
801 char *data = (char *)xcb_get_property_value(reply);-
802 int length = xcb_get_property_value_length(reply);-
803-
804 // Here we check if we get a buffer overflow and tries to-
805 // recover -- this shouldn't normally happen, but it doesn't-
806 // hurt to be defensive-
807 if ((int)(buffer_offset + length) > buffer->size()) {
(int)(buffer_o...buffer->size()Description
TRUEnever evaluated
FALSEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-9
808 qWarning("QXcbClipboard: buffer overflow");-
809 length = buffer->size() - buffer_offset;-
810-
811 // escape loop-
812 bytes_left = 0;-
813 }
never executed: end of block
0
814-
815 memcpy(buffer->data() + buffer_offset, data, length);-
816 buffer_offset += length;-
817-
818 if (bytes_left) {
bytes_leftDescription
TRUEnever evaluated
FALSEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-9
819 // offset is specified in 32-bit multiples-
820 offset += length / 4;-
821 }
never executed: end of block
0
822 free(reply);-
823 }
executed 9 times by 6 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
9
824 }
executed 9 times by 6 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
9
825-
826-
827 // correct size, not 0-term.-
828 if (size)
sizeDescription
TRUEnever evaluated
FALSEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-9
829 *size = buffer_offset;
never executed: *size = buffer_offset;
0
830 if (*type == atom(QXcbAtom::INCR))
*type == atom(QXcbAtom::INCR)Description
TRUEnever evaluated
FALSEevaluated 9 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-9
831 m_incr_receive_time = connection()->getTimestamp();
never executed: m_incr_receive_time = connection()->getTimestamp();
0
832 if (deleteProperty)
deletePropertyDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
FALSEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
4-5
833 xcb_delete_property(xcb_connection(), win, property);
executed 4 times by 2 tests: xcb_delete_property(xcb_connection(), win, property);
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
4
834-
835 connection()->flush();-
836-
837 return ok;
executed 9 times by 6 tests: return ok;
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
9
838}-
839-
840-
841namespace-
842{-
843 class Notify {-
844 public:-
845 Notify(xcb_window_t win, int t)-
846 : window(win), type(t) {}
executed 21 times by 7 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
21
847 xcb_window_t window;-
848 int type;-
849 bool checkEvent(xcb_generic_event_t *event) const {-
850 if (!event)
!eventDescription
TRUEevaluated 17 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 1436 times by 7 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
17-1436
851 return false;
executed 17 times by 6 tests: return false;
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
17
852 int t = event->response_type & 0x7f;-
853 if (t != type)
t != typeDescription
TRUEevaluated 1426 times by 7 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 10 times by 7 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
10-1426
854 return false;
executed 1426 times by 7 tests: return false;
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
1426
855 if (t == XCB_PROPERTY_NOTIFY) {
t == 28Description
TRUEnever evaluated
FALSEevaluated 10 times by 7 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-10
856 xcb_property_notify_event_t *pn = (xcb_property_notify_event_t *)event;-
857 if (pn->window == window)
pn->window == windowDescription
TRUEnever evaluated
FALSEnever evaluated
0
858 return true;
never executed: return true;
0
859 } else if (t == XCB_SELECTION_NOTIFY) {
never executed: end of block
t == 31Description
TRUEevaluated 10 times by 7 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
0-10
860 xcb_selection_notify_event_t *sn = (xcb_selection_notify_event_t *)event;-
861 if (sn->requestor == window)
sn->requestor == windowDescription
TRUEevaluated 10 times by 7 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
0-10
862 return true;
executed 10 times by 7 tests: return true;
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
10
863 }
never executed: end of block
0
864 return false;
never executed: return false;
0
865 }-
866 };-
867 class ClipboardEvent {-
868 public:-
869 ClipboardEvent(QXcbConnection *c)-
870 { clipboard = c->internAtom("CLIPBOARD"); }
executed 11 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
11
871 xcb_atom_t clipboard;-
872 bool checkEvent(xcb_generic_event_t *e) const {-
873 if (!e)
!eDescription
TRUEevaluated 5 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 848 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5-848
874 return false;
executed 5 times by 5 tests: return false;
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
5
875 int type = e->response_type & 0x7f;-
876 if (type == XCB_SELECTION_REQUEST) {
type == 30Description
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 838 times by 4 tests
Evaluated by:
  • tst_QApplication
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
10-838
877 xcb_selection_request_event_t *sr = (xcb_selection_request_event_t *)e;-
878 return sr->selection == XCB_ATOM_PRIMARY || sr->selection == clipboard;
executed 10 times by 5 tests: return sr->selection == XCB_ATOM_PRIMARY || sr->selection == clipboard;
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
10
879 } else if (type == XCB_SELECTION_CLEAR) {
type == 29Description
TRUEnever evaluated
FALSEevaluated 838 times by 4 tests
Evaluated by:
  • tst_QApplication
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-838
880 xcb_selection_clear_event_t *sc = (xcb_selection_clear_event_t *)e;-
881 return sc->selection == XCB_ATOM_PRIMARY || sc->selection == clipboard;
never executed: return sc->selection == XCB_ATOM_PRIMARY || sc->selection == clipboard;
0
882 }-
883 return false;
executed 838 times by 4 tests: return false;
Executed by:
  • tst_QApplication
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
838
884 }-
885 };-
886}-
887-
888xcb_generic_event_t *QXcbClipboard::waitForClipboardEvent(xcb_window_t win, int type, int timeout, bool checkManager)-
889{-
890 QElapsedTimer timer;-
891 timer.start();-
892 do {-
893 Notify notify(win, type);-
894 xcb_generic_event_t *e = connection()->checkEvent(notify);-
895 if (e)
eDescription
TRUEevaluated 10 times by 7 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 11 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
10-11
896 return e;
executed 10 times by 7 tests: return e;
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
  • tst_qclipboard - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
10
897-
898 if (checkManager) {
checkManagerDescription
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QApplication
1-10
899 xcb_get_selection_owner_cookie_t cookie = xcb_get_selection_owner(xcb_connection(), atom(QXcbAtom::CLIPBOARD_MANAGER));-
900 xcb_get_selection_owner_reply_t *reply = xcb_get_selection_owner_reply(xcb_connection(), cookie, 0);-
901 if (!reply || reply->owner == XCB_NONE) {
!replyDescription
TRUEnever evaluated
FALSEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
reply->owner == 0LDescription
TRUEnever evaluated
FALSEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
0-10
902 free(reply);-
903 return 0;
never executed: return 0;
0
904 }-
905 free(reply);-
906 }
executed 10 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
10
907-
908 // process other clipboard events, since someone is probably requesting data from us-
909 ClipboardEvent clipboard(connection());-
910 e = connection()->checkEvent(clipboard);-
911 if (e) {
eDescription
TRUEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QApplication
1-10
912 connection()->handleXcbEvent(e);-
913 free(e);-
914 }
executed 10 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
10
915-
916 connection()->flush();-
917-
918 // sleep 50 ms, so we don't use up CPU cycles all the time.-
919 struct timeval usleep_tv;-
920 usleep_tv.tv_sec = 0;-
921 usleep_tv.tv_usec = 50000;-
922 select(0, 0, 0, 0, &usleep_tv);-
923 } while (timer.elapsed() < timeout);
executed 11 times by 5 tests: end of block
Executed by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
timer.elapsed() < timeoutDescription
TRUEevaluated 11 times by 5 tests
Evaluated by:
  • tst_QApplication
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
0-11
924-
925 return 0;
never executed: return 0;
0
926}-
927-
928QByteArray QXcbClipboard::clipboardReadIncrementalProperty(xcb_window_t win, xcb_atom_t property, int nbytes, bool nullterm)-
929{-
930 QByteArray buf;-
931 QByteArray tmp_buf;-
932 bool alloc_error = false;-
933 int length;-
934 int offset = 0;-
935 xcb_timestamp_t prev_time = m_incr_receive_time;-
936-
937 if (nbytes > 0) {
nbytes > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
938 // Reserve buffer + zero-terminator (for text data)-
939 // We want to complete the INCR transfer even if we cannot-
940 // allocate more memory-
941 buf.resize(nbytes+1);-
942 alloc_error = buf.size() != nbytes+1;-
943 }
never executed: end of block
0
944-
945 for (;;) {-
946 connection()->flush();-
947 xcb_generic_event_t *ge = waitForClipboardEvent(win, XCB_PROPERTY_NOTIFY, clipboard_timeout);-
948 if (!ge)
!geDescription
TRUEnever evaluated
FALSEnever evaluated
0
949 break;
never executed: break;
0
950 xcb_property_notify_event_t *event = (xcb_property_notify_event_t *)ge;-
951-
952 if (event->atom != property
event->atom != propertyDescription
TRUEnever evaluated
FALSEnever evaluated
0
953 || event->state != XCB_PROPERTY_NEW_VALUE
event->state !...ERTY_NEW_VALUEDescription
TRUEnever evaluated
FALSEnever evaluated
0
954 || event->time < prev_time)
event->time < prev_timeDescription
TRUEnever evaluated
FALSEnever evaluated
0
955 continue;
never executed: continue;
0
956 prev_time = event->time;-
957-
958 if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) {
clipboardReadP...&length, 0, 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
959 if (length == 0) { // no more data, we're done
length == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
960 if (nullterm) {
nulltermDescription
TRUEnever evaluated
FALSEnever evaluated
0
961 buf.resize(offset+1);-
962 buf[offset] = '\0';-
963 } else {
never executed: end of block
0
964 buf.resize(offset);-
965 }
never executed: end of block
0
966 return buf;
never executed: return buf;
0
967 } else if (!alloc_error) {
!alloc_errorDescription
TRUEnever evaluated
FALSEnever evaluated
0
968 if (offset+length > (int)buf.size()) {
offset+length ...int)buf.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
969 buf.resize(offset+length+65535);-
970 if (buf.size() != offset+length+65535) {
buf.size() != ...t+length+65535Description
TRUEnever evaluated
FALSEnever evaluated
0
971 alloc_error = true;-
972 length = buf.size() - offset;-
973 }
never executed: end of block
0
974 }
never executed: end of block
0
975 memcpy(buf.data()+offset, tmp_buf.constData(), length);-
976 tmp_buf.resize(0);-
977 offset += length;-
978 }
never executed: end of block
0
979 } else {
never executed: end of block
0
980 break;
never executed: break;
0
981 }-
982-
983 free(ge);-
984 }
never executed: end of block
0
985-
986 // timed out ... create a new requestor window, otherwise the requestor-
987 // could consider next request to be still part of this timed out request-
988 setRequestor(0);-
989-
990 return QByteArray();
never executed: return QByteArray();
0
991}-
992-
993QByteArray QXcbClipboard::getDataInFormat(xcb_atom_t modeAtom, xcb_atom_t fmtAtom)-
994{-
995 return getSelection(modeAtom, fmtAtom, atom(QXcbAtom::_QT_SELECTION));
executed 4 times by 2 tests: return getSelection(modeAtom, fmtAtom, atom(QXcbAtom::_QT_SELECTION));
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
4
996}-
997-
998QByteArray QXcbClipboard::getSelection(xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property, xcb_timestamp_t time)-
999{-
1000 QByteArray buf;-
1001 xcb_window_t win = requestor();-
1002-
1003 if (time == 0) time = connection()->time();
executed 4 times by 2 tests: time = connection()->time();
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
time == 0Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
FALSEnever evaluated
0-4
1004-
1005 xcb_delete_property(xcb_connection(), win, property);-
1006 xcb_convert_selection(xcb_connection(), win, selection, target, property, time);-
1007-
1008 connection()->sync();-
1009-
1010 xcb_generic_event_t *ge = waitForClipboardEvent(win, XCB_SELECTION_NOTIFY, clipboard_timeout);-
1011 bool no_selection = !ge || ((xcb_selection_notify_event_t *)ge)->property == XCB_NONE;
!geDescription
TRUEnever evaluated
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
((xcb_selectio...property == 0LDescription
TRUEnever evaluated
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
0-4
1012 free(ge);-
1013-
1014 if (no_selection)
no_selectionDescription
TRUEnever evaluated
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
0-4
1015 return buf;
never executed: return buf;
0
1016-
1017 xcb_atom_t type;-
1018 if (clipboardReadProperty(win, property, true, &buf, 0, &type, 0)) {
clipboardReadP..., 0, &type, 0)Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
FALSEnever evaluated
0-4
1019 if (type == atom(QXcbAtom::INCR)) {
type == atom(QXcbAtom::INCR)Description
TRUEnever evaluated
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QApplication
  • tst_QStyleSheetStyle
0-4
1020 int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0;
buf.size() >= 4Description
TRUEnever evaluated
FALSEnever evaluated
0
1021 buf = clipboardReadIncrementalProperty(win, property, nbytes, false);-
1022 }
never executed: end of block
0
1023 }
executed 4 times by 2 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
4
1024-
1025 return buf;
executed 4 times by 2 tests: return buf;
Executed by:
  • tst_QApplication
  • tst_QStyleSheetStyle
4
1026}-
1027-
1028#endif // QT_NO_CLIPBOARD-
1029-
1030QT_END_NAMESPACE-
1031-
1032#include "qxcbclipboard.moc"-
Source codeSwitch to Preprocessed file

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