Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/xcb/qxcbdrag.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | const int xdnd_version = 5; | - | ||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | static inline xcb_window_t xcb_window(QPlatformWindow *w) | - | ||||||||||||||||||||||||
9 | { | - | ||||||||||||||||||||||||
10 | return never executed: static_cast<QXcbWindow *>(w)->xcb_window();return static_cast<QXcbWindow *>(w)->xcb_window(); never executed: return static_cast<QXcbWindow *>(w)->xcb_window(); | 0 | ||||||||||||||||||||||||
11 | } | - | ||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||
13 | static inline xcb_window_t xcb_window(QWindow *w) | - | ||||||||||||||||||||||||
14 | { | - | ||||||||||||||||||||||||
15 | return never executed: static_cast<QXcbWindow *>(w->handle())->xcb_window();return static_cast<QXcbWindow *>(w->handle())->xcb_window(); never executed: return static_cast<QXcbWindow *>(w->handle())->xcb_window(); | 0 | ||||||||||||||||||||||||
16 | } | - | ||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||
18 | static xcb_window_t xdndProxy(QXcbConnection *c, xcb_window_t w) | - | ||||||||||||||||||||||||
19 | { | - | ||||||||||||||||||||||||
20 | xcb_window_t proxy = 0L; | - | ||||||||||||||||||||||||
21 | - | |||||||||||||||||||||||||
22 | xcb_get_property_cookie_t cookie = xcb_get_property(c->xcb_connection(), false, w, c->atom(QXcbAtom::XdndProxy), XCB_ATOM_WINDOW, 0, 1) | - | ||||||||||||||||||||||||
23 | ; | - | ||||||||||||||||||||||||
24 | xcb_get_property_reply_t *reply = xcb_get_property_reply(c->xcb_connection(), cookie, 0); | - | ||||||||||||||||||||||||
25 | - | |||||||||||||||||||||||||
26 | if (reply
| 0 | ||||||||||||||||||||||||
27 | proxy = *((xcb_window_t *)xcb_get_property_value(reply)); never executed: proxy = *((xcb_window_t *)xcb_get_property_value(reply)); | 0 | ||||||||||||||||||||||||
28 | free(reply); | - | ||||||||||||||||||||||||
29 | - | |||||||||||||||||||||||||
30 | if (proxy == 0L
| 0 | ||||||||||||||||||||||||
31 | return never executed: proxy;return proxy; never executed: return proxy; | 0 | ||||||||||||||||||||||||
32 | - | |||||||||||||||||||||||||
33 | - | |||||||||||||||||||||||||
34 | cookie = xcb_get_property(c->xcb_connection(), false, proxy, c->atom(QXcbAtom::XdndProxy), XCB_ATOM_WINDOW, 0, 1) | - | ||||||||||||||||||||||||
35 | ; | - | ||||||||||||||||||||||||
36 | reply = xcb_get_property_reply(c->xcb_connection(), cookie, 0); | - | ||||||||||||||||||||||||
37 | - | |||||||||||||||||||||||||
38 | if (reply
| 0 | ||||||||||||||||||||||||
39 | xcb_window_t p = *((xcb_window_t *)xcb_get_property_value(reply)); | - | ||||||||||||||||||||||||
40 | if (proxy != p
| 0 | ||||||||||||||||||||||||
41 | proxy = 0; never executed: proxy = 0; | 0 | ||||||||||||||||||||||||
42 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
43 | proxy = 0; | - | ||||||||||||||||||||||||
44 | } never executed: end of block | 0 | ||||||||||||||||||||||||
45 | - | |||||||||||||||||||||||||
46 | free(reply); | - | ||||||||||||||||||||||||
47 | - | |||||||||||||||||||||||||
48 | return never executed: proxy;return proxy; never executed: return proxy; | 0 | ||||||||||||||||||||||||
49 | } | - | ||||||||||||||||||||||||
50 | - | |||||||||||||||||||||||||
51 | class QXcbDropData : public QXcbMime | - | ||||||||||||||||||||||||
52 | { | - | ||||||||||||||||||||||||
53 | public: | - | ||||||||||||||||||||||||
54 | QXcbDropData(QXcbDrag *d); | - | ||||||||||||||||||||||||
55 | ~QXcbDropData(); | - | ||||||||||||||||||||||||
56 | - | |||||||||||||||||||||||||
57 | protected: | - | ||||||||||||||||||||||||
58 | bool hasFormat_sys(const QString &mimeType) const override; | - | ||||||||||||||||||||||||
59 | QStringList formats_sys() const override; | - | ||||||||||||||||||||||||
60 | QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const override; | - | ||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||
62 | QVariant xdndObtainData(const QByteArray &format, QVariant::Type requestedType) const; | - | ||||||||||||||||||||||||
63 | - | |||||||||||||||||||||||||
64 | QXcbDrag *drag; | - | ||||||||||||||||||||||||
65 | }; | - | ||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||
68 | QXcbDrag::QXcbDrag(QXcbConnection *c) : QXcbObject(c) | - | ||||||||||||||||||||||||
69 | { | - | ||||||||||||||||||||||||
70 | dropData = new QXcbDropData(this); | - | ||||||||||||||||||||||||
71 | - | |||||||||||||||||||||||||
72 | init(); | - | ||||||||||||||||||||||||
73 | cleanup_timer = -1; | - | ||||||||||||||||||||||||
74 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||||||||
75 | - | |||||||||||||||||||||||||
76 | QXcbDrag::~QXcbDrag() | - | ||||||||||||||||||||||||
77 | { | - | ||||||||||||||||||||||||
78 | delete dropData; | - | ||||||||||||||||||||||||
79 | } executed 347 times by 219 tests: end of block Executed by:
| 347 | ||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||
81 | void QXcbDrag::init() | - | ||||||||||||||||||||||||
82 | { | - | ||||||||||||||||||||||||
83 | currentWindow.clear(); | - | ||||||||||||||||||||||||
84 | - | |||||||||||||||||||||||||
85 | accepted_drop_action = Qt::IgnoreAction; | - | ||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||
87 | xdnd_dragsource = 0L; | - | ||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||
89 | waiting_for_status = false; | - | ||||||||||||||||||||||||
90 | current_target = 0L; | - | ||||||||||||||||||||||||
91 | current_proxy_target = 0L; | - | ||||||||||||||||||||||||
92 | - | |||||||||||||||||||||||||
93 | source_time = 0L; | - | ||||||||||||||||||||||||
94 | target_time = 0L; | - | ||||||||||||||||||||||||
95 | - | |||||||||||||||||||||||||
96 | QXcbCursor::queryPointer(connection(), ¤t_virtual_desktop, 0); | - | ||||||||||||||||||||||||
97 | drag_types.clear(); | - | ||||||||||||||||||||||||
98 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||
100 | QMimeData *QXcbDrag::platformDropData() | - | ||||||||||||||||||||||||
101 | { | - | ||||||||||||||||||||||||
102 | return executed 9 times by 9 tests: dropData;return dropData; Executed by:
executed 9 times by 9 tests: return dropData; Executed by:
| 9 | ||||||||||||||||||||||||
103 | } | - | ||||||||||||||||||||||||
104 | - | |||||||||||||||||||||||||
105 | bool QXcbDrag::eventFilter(QObject *o, QEvent *e) | - | ||||||||||||||||||||||||
106 | { | - | ||||||||||||||||||||||||
107 | - | |||||||||||||||||||||||||
108 | - | |||||||||||||||||||||||||
109 | - | |||||||||||||||||||||||||
110 | - | |||||||||||||||||||||||||
111 | if (initiatorWindow
| 0 | ||||||||||||||||||||||||
112 | o = initiatorWindow.data(); never executed: o = initiatorWindow.data(); | 0 | ||||||||||||||||||||||||
113 | return never executed: QBasicDrag::eventFilter(o, e);return QBasicDrag::eventFilter(o, e); never executed: return QBasicDrag::eventFilter(o, e); | 0 | ||||||||||||||||||||||||
114 | } | - | ||||||||||||||||||||||||
115 | - | |||||||||||||||||||||||||
116 | void QXcbDrag::startDrag() | - | ||||||||||||||||||||||||
117 | { | - | ||||||||||||||||||||||||
118 | - | |||||||||||||||||||||||||
119 | - | |||||||||||||||||||||||||
120 | init(); | - | ||||||||||||||||||||||||
121 | - | |||||||||||||||||||||||||
122 | xcb_set_selection_owner(xcb_connection(), connection()->clipboard()->owner(), | - | ||||||||||||||||||||||||
123 | atom(QXcbAtom::XdndSelection), connection()->time()); | - | ||||||||||||||||||||||||
124 | - | |||||||||||||||||||||||||
125 | QStringList fmts = QXcbMime::formatsHelper(drag()->mimeData()); | - | ||||||||||||||||||||||||
126 | for (int i = 0; i < fmts.size()
| 0 | ||||||||||||||||||||||||
127 | QVector<xcb_atom_t> atoms = QXcbMime::mimeAtomsForFormat(connection(), fmts.at(i)); | - | ||||||||||||||||||||||||
128 | for (int j = 0; j < atoms.size()
| 0 | ||||||||||||||||||||||||
129 | if (!drag_types.contains(atoms.at(j))
| 0 | ||||||||||||||||||||||||
130 | drag_types.append(atoms.at(j)); never executed: drag_types.append(atoms.at(j)); | 0 | ||||||||||||||||||||||||
131 | } never executed: end of block | 0 | ||||||||||||||||||||||||
132 | } never executed: end of block | 0 | ||||||||||||||||||||||||
133 | if (drag_types.size() > 3
| 0 | ||||||||||||||||||||||||
134 | xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, connection()->clipboard()->owner(), never executed: xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, connection()->clipboard()->owner(), atom(QXcbAtom::XdndTypelist), XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData()); | 0 | ||||||||||||||||||||||||
135 | atom(QXcbAtom::XdndTypelist), never executed: xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, connection()->clipboard()->owner(), atom(QXcbAtom::XdndTypelist), XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData()); | 0 | ||||||||||||||||||||||||
136 | XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData()); never executed: xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, connection()->clipboard()->owner(), atom(QXcbAtom::XdndTypelist), XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData()); | 0 | ||||||||||||||||||||||||
137 | - | |||||||||||||||||||||||||
138 | setUseCompositing(current_virtual_desktop->compositingActive()); | - | ||||||||||||||||||||||||
139 | setScreen(current_virtual_desktop->screens().constFirst()->screen()); | - | ||||||||||||||||||||||||
140 | initiatorWindow = QGuiApplicationPrivate::currentMouseWindow; | - | ||||||||||||||||||||||||
141 | QBasicDrag::startDrag(); | - | ||||||||||||||||||||||||
142 | if (connection()->mouseGrabber() == nullptr
| 0 | ||||||||||||||||||||||||
143 | shapedPixmapWindow()->setMouseGrabEnabled(true); never executed: shapedPixmapWindow()->setMouseGrabEnabled(true); | 0 | ||||||||||||||||||||||||
144 | } never executed: end of block | 0 | ||||||||||||||||||||||||
145 | - | |||||||||||||||||||||||||
146 | void QXcbDrag::endDrag() | - | ||||||||||||||||||||||||
147 | { | - | ||||||||||||||||||||||||
148 | QBasicDrag::endDrag(); | - | ||||||||||||||||||||||||
149 | initiatorWindow.clear(); | - | ||||||||||||||||||||||||
150 | } never executed: end of block | 0 | ||||||||||||||||||||||||
151 | - | |||||||||||||||||||||||||
152 | static xcb_translate_coordinates_reply_t * | - | ||||||||||||||||||||||||
153 | translateCoordinates(QXcbConnection *c, xcb_window_t from, xcb_window_t to, int x, int y) | - | ||||||||||||||||||||||||
154 | { | - | ||||||||||||||||||||||||
155 | xcb_translate_coordinates_cookie_t cookie = | - | ||||||||||||||||||||||||
156 | xcb_translate_coordinates(c->xcb_connection(), from, to, x, y); | - | ||||||||||||||||||||||||
157 | return never executed: xcb_translate_coordinates_reply(c->xcb_connection(), cookie, 0);return xcb_translate_coordinates_reply(c->xcb_connection(), cookie, 0); never executed: return xcb_translate_coordinates_reply(c->xcb_connection(), cookie, 0); | 0 | ||||||||||||||||||||||||
158 | } | - | ||||||||||||||||||||||||
159 | - | |||||||||||||||||||||||||
160 | static | - | ||||||||||||||||||||||||
161 | bool windowInteractsWithPosition(xcb_connection_t *connection, const QPoint & pos, xcb_window_t w, xcb_shape_sk_t shapeType) | - | ||||||||||||||||||||||||
162 | { | - | ||||||||||||||||||||||||
163 | bool interacts = false; | - | ||||||||||||||||||||||||
164 | xcb_shape_get_rectangles_reply_t *reply = xcb_shape_get_rectangles_reply(connection, xcb_shape_get_rectangles(connection, w, shapeType), __null); | - | ||||||||||||||||||||||||
165 | if (reply
| 0 | ||||||||||||||||||||||||
166 | xcb_rectangle_t *rectangles = xcb_shape_get_rectangles_rectangles(reply); | - | ||||||||||||||||||||||||
167 | if (rectangles
| 0 | ||||||||||||||||||||||||
168 | const int nRectangles = xcb_shape_get_rectangles_rectangles_length(reply); | - | ||||||||||||||||||||||||
169 | for (int i = 0; !interacts
| 0 | ||||||||||||||||||||||||
170 | interacts = QRect(rectangles[i].x, rectangles[i].y, rectangles[i].width, rectangles[i].height).contains(pos); | - | ||||||||||||||||||||||||
171 | } never executed: end of block | 0 | ||||||||||||||||||||||||
172 | } never executed: end of block | 0 | ||||||||||||||||||||||||
173 | free(reply); | - | ||||||||||||||||||||||||
174 | } never executed: end of block | 0 | ||||||||||||||||||||||||
175 | - | |||||||||||||||||||||||||
176 | return never executed: interacts;return interacts; never executed: return interacts; | 0 | ||||||||||||||||||||||||
177 | } | - | ||||||||||||||||||||||||
178 | - | |||||||||||||||||||||||||
179 | xcb_window_t QXcbDrag::findRealWindow(const QPoint & pos, xcb_window_t w, int md, bool ignoreNonXdndAwareWindows) | - | ||||||||||||||||||||||||
180 | { | - | ||||||||||||||||||||||||
181 | if (w == shapedPixmapWindow()->handle()->winId()
| 0 | ||||||||||||||||||||||||
182 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
183 | - | |||||||||||||||||||||||||
184 | if (md
| 0 | ||||||||||||||||||||||||
185 | xcb_get_window_attributes_cookie_t cookie = xcb_get_window_attributes(xcb_connection(), w); | - | ||||||||||||||||||||||||
186 | xcb_get_window_attributes_reply_t *reply = xcb_get_window_attributes_reply(xcb_connection(), cookie, 0); | - | ||||||||||||||||||||||||
187 | if (!reply
| 0 | ||||||||||||||||||||||||
188 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
189 | - | |||||||||||||||||||||||||
190 | if (reply->map_state != XCB_MAP_STATE_VIEWABLE
| 0 | ||||||||||||||||||||||||
191 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
192 | - | |||||||||||||||||||||||||
193 | free(reply); | - | ||||||||||||||||||||||||
194 | - | |||||||||||||||||||||||||
195 | xcb_get_geometry_cookie_t gcookie = xcb_get_geometry(xcb_connection(), w); | - | ||||||||||||||||||||||||
196 | xcb_get_geometry_reply_t *greply = xcb_get_geometry_reply(xcb_connection(), gcookie, 0); | - | ||||||||||||||||||||||||
197 | if (!greply
| 0 | ||||||||||||||||||||||||
198 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
199 | - | |||||||||||||||||||||||||
200 | QRect windowRect(greply->x, greply->y, greply->width, greply->height); | - | ||||||||||||||||||||||||
201 | free(greply); | - | ||||||||||||||||||||||||
202 | if (windowRect.contains(pos)
| 0 | ||||||||||||||||||||||||
203 | bool windowContainsMouse = !ignoreNonXdndAwareWindows; | - | ||||||||||||||||||||||||
204 | { | - | ||||||||||||||||||||||||
205 | xcb_get_property_cookie_t cookie = | - | ||||||||||||||||||||||||
206 | xcb_get_property(xcb_connection(), false, w, connection()->atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 0) | - | ||||||||||||||||||||||||
207 | ; | - | ||||||||||||||||||||||||
208 | xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0); | - | ||||||||||||||||||||||||
209 | - | |||||||||||||||||||||||||
210 | bool isAware = reply
| 0 | ||||||||||||||||||||||||
211 | free(reply); | - | ||||||||||||||||||||||||
212 | if (isAware
| 0 | ||||||||||||||||||||||||
213 | const QPoint relPos = pos - windowRect.topLeft(); | - | ||||||||||||||||||||||||
214 | - | |||||||||||||||||||||||||
215 | - | |||||||||||||||||||||||||
216 | if (connection()->hasInputShape()
| 0 | ||||||||||||||||||||||||
217 | windowContainsMouse = windowInteractsWithPosition(xcb_connection(), relPos, w, XCB_SHAPE_SK_INPUT); never executed: windowContainsMouse = windowInteractsWithPosition(xcb_connection(), relPos, w, XCB_SHAPE_SK_INPUT); | 0 | ||||||||||||||||||||||||
218 | if (windowContainsMouse
| 0 | ||||||||||||||||||||||||
219 | windowContainsMouse = windowInteractsWithPosition(xcb_connection(), relPos, w, XCB_SHAPE_SK_BOUNDING); never executed: windowContainsMouse = windowInteractsWithPosition(xcb_connection(), relPos, w, XCB_SHAPE_SK_BOUNDING); | 0 | ||||||||||||||||||||||||
220 | if (!connection()->hasInputShape()
| 0 | ||||||||||||||||||||||||
221 | windowContainsMouse = true; never executed: windowContainsMouse = true; | 0 | ||||||||||||||||||||||||
222 | if (windowContainsMouse
| 0 | ||||||||||||||||||||||||
223 | return never executed: w;return w; never executed: return w; | 0 | ||||||||||||||||||||||||
224 | } never executed: end of block | 0 | ||||||||||||||||||||||||
225 | } | - | ||||||||||||||||||||||||
226 | - | |||||||||||||||||||||||||
227 | xcb_query_tree_cookie_t cookie = xcb_query_tree (xcb_connection(), w); | - | ||||||||||||||||||||||||
228 | xcb_query_tree_reply_t *reply = xcb_query_tree_reply(xcb_connection(), cookie, 0); | - | ||||||||||||||||||||||||
229 | - | |||||||||||||||||||||||||
230 | if (!reply
| 0 | ||||||||||||||||||||||||
231 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
232 | int nc = xcb_query_tree_children_length(reply); | - | ||||||||||||||||||||||||
233 | xcb_window_t *c = xcb_query_tree_children(reply); | - | ||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||
235 | xcb_window_t r = 0; | - | ||||||||||||||||||||||||
236 | for (uint i = nc; !r
| 0 | ||||||||||||||||||||||||
237 | r = findRealWindow(pos - windowRect.topLeft(), c[i], md-1, ignoreNonXdndAwareWindows); never executed: r = findRealWindow(pos - windowRect.topLeft(), c[i], md-1, ignoreNonXdndAwareWindows); | 0 | ||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||
239 | free(reply); | - | ||||||||||||||||||||||||
240 | if (r
| 0 | ||||||||||||||||||||||||
241 | return never executed: r;return r; never executed: return r; | 0 | ||||||||||||||||||||||||
242 | - | |||||||||||||||||||||||||
243 | - | |||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||
245 | - | |||||||||||||||||||||||||
246 | - | |||||||||||||||||||||||||
247 | if (!windowContainsMouse
| 0 | ||||||||||||||||||||||||
248 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
249 | else | - | ||||||||||||||||||||||||
250 | return never executed: w;return w; never executed: return w; | 0 | ||||||||||||||||||||||||
251 | } | - | ||||||||||||||||||||||||
252 | } never executed: end of block | 0 | ||||||||||||||||||||||||
253 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
254 | } | - | ||||||||||||||||||||||||
255 | - | |||||||||||||||||||||||||
256 | void QXcbDrag::move(const QPoint &globalPos) | - | ||||||||||||||||||||||||
257 | { | - | ||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||
259 | if (source_sameanswer.contains(globalPos)
| 0 | ||||||||||||||||||||||||
260 | return; never executed: return; | 0 | ||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||
262 | QXcbVirtualDesktop *virtualDesktop = nullptr; | - | ||||||||||||||||||||||||
263 | QPoint cursorPos; | - | ||||||||||||||||||||||||
264 | QXcbCursor::queryPointer(connection(), &virtualDesktop, &cursorPos); | - | ||||||||||||||||||||||||
265 | QXcbScreen *screen = virtualDesktop->screenAt(cursorPos); | - | ||||||||||||||||||||||||
266 | QPoint deviceIndependentPos = QHighDpiScaling::mapPositionFromNative(globalPos, screen); | - | ||||||||||||||||||||||||
267 | - | |||||||||||||||||||||||||
268 | if (virtualDesktop != current_virtual_desktop
| 0 | ||||||||||||||||||||||||
269 | setUseCompositing(virtualDesktop->compositingActive()); | - | ||||||||||||||||||||||||
270 | recreateShapedPixmapWindow(static_cast<QPlatformScreen*>(screen)->screen(), deviceIndependentPos); | - | ||||||||||||||||||||||||
271 | if (connection()->mouseGrabber() == nullptr
| 0 | ||||||||||||||||||||||||
272 | shapedPixmapWindow()->setMouseGrabEnabled(true); never executed: shapedPixmapWindow()->setMouseGrabEnabled(true); | 0 | ||||||||||||||||||||||||
273 | - | |||||||||||||||||||||||||
274 | current_virtual_desktop = virtualDesktop; | - | ||||||||||||||||||||||||
275 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
276 | QBasicDrag::moveShapedPixmapWindow(deviceIndependentPos); | - | ||||||||||||||||||||||||
277 | } never executed: end of block | 0 | ||||||||||||||||||||||||
278 | - | |||||||||||||||||||||||||
279 | xcb_window_t rootwin = current_virtual_desktop->root(); | - | ||||||||||||||||||||||||
280 | xcb_translate_coordinates_reply_t *translate = | - | ||||||||||||||||||||||||
281 | ::translateCoordinates(connection(), rootwin, rootwin, globalPos.x(), globalPos.y()); | - | ||||||||||||||||||||||||
282 | if (!translate
| 0 | ||||||||||||||||||||||||
283 | return; never executed: return; | 0 | ||||||||||||||||||||||||
284 | - | |||||||||||||||||||||||||
285 | xcb_window_t target = translate->child; | - | ||||||||||||||||||||||||
286 | int lx = translate->dst_x; | - | ||||||||||||||||||||||||
287 | int ly = translate->dst_y; | - | ||||||||||||||||||||||||
288 | free (translate); | - | ||||||||||||||||||||||||
289 | - | |||||||||||||||||||||||||
290 | if (target
| 0 | ||||||||||||||||||||||||
291 | xcb_window_t src = rootwin; | - | ||||||||||||||||||||||||
292 | while (target != 0
| 0 | ||||||||||||||||||||||||
293 | if(0) QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__).debug() << "checking target for XdndAware" << target << lx << ly; dead code: QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__).debug() << "checking target for XdndAware" << target << lx << ly; | - | ||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||
295 | - | |||||||||||||||||||||||||
296 | translate = ::translateCoordinates(connection(), src, target, lx, ly); | - | ||||||||||||||||||||||||
297 | if (!translate
| 0 | ||||||||||||||||||||||||
298 | target = 0; | - | ||||||||||||||||||||||||
299 | break; never executed: break; | 0 | ||||||||||||||||||||||||
300 | } | - | ||||||||||||||||||||||||
301 | lx = translate->dst_x; | - | ||||||||||||||||||||||||
302 | ly = translate->dst_y; | - | ||||||||||||||||||||||||
303 | src = target; | - | ||||||||||||||||||||||||
304 | xcb_window_t child = translate->child; | - | ||||||||||||||||||||||||
305 | free(translate); | - | ||||||||||||||||||||||||
306 | - | |||||||||||||||||||||||||
307 | - | |||||||||||||||||||||||||
308 | xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, target, atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 0) | - | ||||||||||||||||||||||||
309 | ; | - | ||||||||||||||||||||||||
310 | xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0); | - | ||||||||||||||||||||||||
311 | bool aware = reply
| 0 | ||||||||||||||||||||||||
312 | free(reply); | - | ||||||||||||||||||||||||
313 | if (aware
| 0 | ||||||||||||||||||||||||
314 | if(0) QMessageLogger(__FILE__, 389, __PRETTY_FUNCTION__).debug() << "Found XdndAware on " << target; dead code: QMessageLogger(__FILE__, 389, __PRETTY_FUNCTION__).debug() << "Found XdndAware on " << target; | - | ||||||||||||||||||||||||
315 | break; never executed: break; | 0 | ||||||||||||||||||||||||
316 | } | - | ||||||||||||||||||||||||
317 | - | |||||||||||||||||||||||||
318 | target = child; | - | ||||||||||||||||||||||||
319 | } never executed: end of block | 0 | ||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||
321 | if (!target
| 0 | ||||||||||||||||||||||||
322 | if(0) QMessageLogger(__FILE__, 397, __PRETTY_FUNCTION__).debug() << "need to find real window"; dead code: QMessageLogger(__FILE__, 397, __PRETTY_FUNCTION__).debug() << "need to find real window"; | - | ||||||||||||||||||||||||
323 | target = findRealWindow(globalPos, rootwin, 6, true); | - | ||||||||||||||||||||||||
324 | if (target == 0
| 0 | ||||||||||||||||||||||||
325 | target = findRealWindow(globalPos, rootwin, 6, false); never executed: target = findRealWindow(globalPos, rootwin, 6, false); | 0 | ||||||||||||||||||||||||
326 | if(0) QMessageLogger(__FILE__, 401, __PRETTY_FUNCTION__).debug() << "real window found" << target; dead code: QMessageLogger(__FILE__, 401, __PRETTY_FUNCTION__).debug() << "real window found" << target; | - | ||||||||||||||||||||||||
327 | } never executed: end of block | 0 | ||||||||||||||||||||||||
328 | } never executed: end of block | 0 | ||||||||||||||||||||||||
329 | - | |||||||||||||||||||||||||
330 | QXcbWindow *w = 0; | - | ||||||||||||||||||||||||
331 | if (target
| 0 | ||||||||||||||||||||||||
332 | w = connection()->platformWindowFromId(target); | - | ||||||||||||||||||||||||
333 | if (w
| 0 | ||||||||||||||||||||||||
334 | w = 0; never executed: w = 0; | 0 | ||||||||||||||||||||||||
335 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
336 | w = 0; | - | ||||||||||||||||||||||||
337 | target = rootwin; | - | ||||||||||||||||||||||||
338 | } never executed: end of block | 0 | ||||||||||||||||||||||||
339 | - | |||||||||||||||||||||||||
340 | xcb_window_t proxy_target = xdndProxy(connection(), target); | - | ||||||||||||||||||||||||
341 | if (!proxy_target
| 0 | ||||||||||||||||||||||||
342 | proxy_target = target; never executed: proxy_target = target; | 0 | ||||||||||||||||||||||||
343 | int target_version = 1; | - | ||||||||||||||||||||||||
344 | - | |||||||||||||||||||||||||
345 | if (proxy_target
| 0 | ||||||||||||||||||||||||
346 | xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, proxy_target, | - | ||||||||||||||||||||||||
347 | atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 1); | - | ||||||||||||||||||||||||
348 | xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0); | - | ||||||||||||||||||||||||
349 | if (!reply
| 0 | ||||||||||||||||||||||||
350 | target = 0; never executed: target = 0; | 0 | ||||||||||||||||||||||||
351 | - | |||||||||||||||||||||||||
352 | target_version = *(uint32_t *)xcb_get_property_value(reply); | - | ||||||||||||||||||||||||
353 | target_version = qMin(xdnd_version, target_version ? target_version : 1); | - | ||||||||||||||||||||||||
354 | - | |||||||||||||||||||||||||
355 | free(reply); | - | ||||||||||||||||||||||||
356 | } never executed: end of block | 0 | ||||||||||||||||||||||||
357 | - | |||||||||||||||||||||||||
358 | if (target != current_target
| 0 | ||||||||||||||||||||||||
359 | if (current_target
| 0 | ||||||||||||||||||||||||
360 | send_leave(); never executed: send_leave(); | 0 | ||||||||||||||||||||||||
361 | - | |||||||||||||||||||||||||
362 | current_target = target; | - | ||||||||||||||||||||||||
363 | current_proxy_target = proxy_target; | - | ||||||||||||||||||||||||
364 | if (target
| 0 | ||||||||||||||||||||||||
365 | int flags = target_version << 24; | - | ||||||||||||||||||||||||
366 | if (drag_types.size() > 3
| 0 | ||||||||||||||||||||||||
367 | flags |= 0x0001; never executed: flags |= 0x0001; | 0 | ||||||||||||||||||||||||
368 | - | |||||||||||||||||||||||||
369 | xcb_client_message_event_t enter; | - | ||||||||||||||||||||||||
370 | enter.response_type = 33; | - | ||||||||||||||||||||||||
371 | enter.sequence = 0; | - | ||||||||||||||||||||||||
372 | enter.window = target; | - | ||||||||||||||||||||||||
373 | enter.format = 32; | - | ||||||||||||||||||||||||
374 | enter.type = atom(QXcbAtom::XdndEnter); | - | ||||||||||||||||||||||||
375 | enter.data.data32[0] = connection()->clipboard()->owner(); | - | ||||||||||||||||||||||||
376 | enter.data.data32[1] = flags; | - | ||||||||||||||||||||||||
377 | enter.data.data32[2] = drag_types.size()>0
| 0 | ||||||||||||||||||||||||
378 | enter.data.data32[3] = drag_types.size()>1
| 0 | ||||||||||||||||||||||||
379 | enter.data.data32[4] = drag_types.size()>2
| 0 | ||||||||||||||||||||||||
380 | - | |||||||||||||||||||||||||
381 | source_sameanswer = QRect(globalPos.x() - 2, globalPos.y() -2 , 5, 5); | - | ||||||||||||||||||||||||
382 | - | |||||||||||||||||||||||||
383 | if(0) QMessageLogger(__FILE__, 458, __PRETTY_FUNCTION__).debug() << "sending Xdnd enter source=" << enter.data.data32[0]; dead code: QMessageLogger(__FILE__, 458, __PRETTY_FUNCTION__).debug() << "sending Xdnd enter source=" << enter.data.data32[0]; | - | ||||||||||||||||||||||||
384 | if (w
| 0 | ||||||||||||||||||||||||
385 | handleEnter(w, &enter, current_proxy_target); never executed: handleEnter(w, &enter, current_proxy_target); | 0 | ||||||||||||||||||||||||
386 | else if (target
| 0 | ||||||||||||||||||||||||
387 | xcb_send_event(xcb_connection(), false, proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&enter); never executed: xcb_send_event(xcb_connection(), false, proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&enter); | 0 | ||||||||||||||||||||||||
388 | waiting_for_status = false; | - | ||||||||||||||||||||||||
389 | } never executed: end of block | 0 | ||||||||||||||||||||||||
390 | } never executed: end of block | 0 | ||||||||||||||||||||||||
391 | - | |||||||||||||||||||||||||
392 | if (waiting_for_status
| 0 | ||||||||||||||||||||||||
393 | return; never executed: return; | 0 | ||||||||||||||||||||||||
394 | - | |||||||||||||||||||||||||
395 | if (target
| 0 | ||||||||||||||||||||||||
396 | waiting_for_status = true; | - | ||||||||||||||||||||||||
397 | - | |||||||||||||||||||||||||
398 | xcb_client_message_event_t move; | - | ||||||||||||||||||||||||
399 | move.response_type = 33; | - | ||||||||||||||||||||||||
400 | move.sequence = 0; | - | ||||||||||||||||||||||||
401 | move.window = target; | - | ||||||||||||||||||||||||
402 | move.format = 32; | - | ||||||||||||||||||||||||
403 | move.type = atom(QXcbAtom::XdndPosition); | - | ||||||||||||||||||||||||
404 | move.data.data32[0] = connection()->clipboard()->owner(); | - | ||||||||||||||||||||||||
405 | move.data.data32[1] = 0; | - | ||||||||||||||||||||||||
406 | move.data.data32[2] = (globalPos.x() << 16) + globalPos.y(); | - | ||||||||||||||||||||||||
407 | move.data.data32[3] = connection()->time(); | - | ||||||||||||||||||||||||
408 | move.data.data32[4] = toXdndAction(defaultAction(currentDrag()->supportedActions(), QGuiApplication::keyboardModifiers())); | - | ||||||||||||||||||||||||
409 | if(0) QMessageLogger(__FILE__, 484, __PRETTY_FUNCTION__).debug() << "sending Xdnd position source=" << move.data.data32[0] << "target=" << move.window; dead code: QMessageLogger(__FILE__, 484, __PRETTY_FUNCTION__).debug() << "sending Xdnd position source=" << move.data.data32[0] << "target=" << move.window; | - | ||||||||||||||||||||||||
410 | - | |||||||||||||||||||||||||
411 | source_time = connection()->time(); | - | ||||||||||||||||||||||||
412 | - | |||||||||||||||||||||||||
413 | if (w
| 0 | ||||||||||||||||||||||||
414 | handle_xdnd_position(w, &move); never executed: handle_xdnd_position(w, &move); | 0 | ||||||||||||||||||||||||
415 | else | - | ||||||||||||||||||||||||
416 | xcb_send_event(xcb_connection(), false, proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&move); never executed: xcb_send_event(xcb_connection(), false, proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&move); | 0 | ||||||||||||||||||||||||
417 | } | - | ||||||||||||||||||||||||
418 | } never executed: end of block | 0 | ||||||||||||||||||||||||
419 | - | |||||||||||||||||||||||||
420 | void QXcbDrag::drop(const QPoint &globalPos) | - | ||||||||||||||||||||||||
421 | { | - | ||||||||||||||||||||||||
422 | QBasicDrag::drop(globalPos); | - | ||||||||||||||||||||||||
423 | - | |||||||||||||||||||||||||
424 | if (!current_target
| 0 | ||||||||||||||||||||||||
425 | return; never executed: return; | 0 | ||||||||||||||||||||||||
426 | - | |||||||||||||||||||||||||
427 | xcb_client_message_event_t drop; | - | ||||||||||||||||||||||||
428 | drop.response_type = 33; | - | ||||||||||||||||||||||||
429 | drop.sequence = 0; | - | ||||||||||||||||||||||||
430 | drop.window = current_target; | - | ||||||||||||||||||||||||
431 | drop.format = 32; | - | ||||||||||||||||||||||||
432 | drop.type = atom(QXcbAtom::XdndDrop); | - | ||||||||||||||||||||||||
433 | drop.data.data32[0] = connection()->clipboard()->owner(); | - | ||||||||||||||||||||||||
434 | drop.data.data32[1] = 0; | - | ||||||||||||||||||||||||
435 | drop.data.data32[2] = connection()->time(); | - | ||||||||||||||||||||||||
436 | - | |||||||||||||||||||||||||
437 | drop.data.data32[3] = 0; | - | ||||||||||||||||||||||||
438 | drop.data.data32[4] = currentDrag()->supportedActions(); | - | ||||||||||||||||||||||||
439 | - | |||||||||||||||||||||||||
440 | QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target); | - | ||||||||||||||||||||||||
441 | - | |||||||||||||||||||||||||
442 | if (w
| 0 | ||||||||||||||||||||||||
443 | w = 0; never executed: w = 0; | 0 | ||||||||||||||||||||||||
444 | - | |||||||||||||||||||||||||
445 | Transaction t = { | - | ||||||||||||||||||||||||
446 | connection()->time(), | - | ||||||||||||||||||||||||
447 | current_target, | - | ||||||||||||||||||||||||
448 | current_proxy_target, | - | ||||||||||||||||||||||||
449 | w, | - | ||||||||||||||||||||||||
450 | - | |||||||||||||||||||||||||
451 | currentDrag(), | - | ||||||||||||||||||||||||
452 | QTime::currentTime() | - | ||||||||||||||||||||||||
453 | }; | - | ||||||||||||||||||||||||
454 | transactions.append(t); | - | ||||||||||||||||||||||||
455 | - | |||||||||||||||||||||||||
456 | - | |||||||||||||||||||||||||
457 | if (!t.targetWindow
| 0 | ||||||||||||||||||||||||
458 | cleanup_timer = startTimer(XdndDropTransactionTimeout); | - | ||||||||||||||||||||||||
459 | } never executed: end of block | 0 | ||||||||||||||||||||||||
460 | - | |||||||||||||||||||||||||
461 | if (w
| 0 | ||||||||||||||||||||||||
462 | handleDrop(w, &drop); | - | ||||||||||||||||||||||||
463 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
464 | xcb_send_event(xcb_connection(), false, current_proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&drop); | - | ||||||||||||||||||||||||
465 | } never executed: end of block | 0 | ||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||
467 | current_target = 0; | - | ||||||||||||||||||||||||
468 | current_proxy_target = 0; | - | ||||||||||||||||||||||||
469 | source_time = 0; | - | ||||||||||||||||||||||||
470 | - | |||||||||||||||||||||||||
471 | } never executed: end of block | 0 | ||||||||||||||||||||||||
472 | - | |||||||||||||||||||||||||
473 | Qt::DropAction QXcbDrag::toDropAction(xcb_atom_t a) const | - | ||||||||||||||||||||||||
474 | { | - | ||||||||||||||||||||||||
475 | if (a == atom(QXcbAtom::XdndActionCopy)
| 0 | ||||||||||||||||||||||||
476 | return never executed: Qt::CopyAction;return Qt::CopyAction; never executed: return Qt::CopyAction; | 0 | ||||||||||||||||||||||||
477 | if (a == atom(QXcbAtom::XdndActionLink)
| 0 | ||||||||||||||||||||||||
478 | return never executed: Qt::LinkAction;return Qt::LinkAction; never executed: return Qt::LinkAction; | 0 | ||||||||||||||||||||||||
479 | if (a == atom(QXcbAtom::XdndActionMove)
| 0 | ||||||||||||||||||||||||
480 | return never executed: Qt::MoveAction;return Qt::MoveAction; never executed: return Qt::MoveAction; | 0 | ||||||||||||||||||||||||
481 | return never executed: Qt::CopyAction;return Qt::CopyAction; never executed: return Qt::CopyAction; | 0 | ||||||||||||||||||||||||
482 | } | - | ||||||||||||||||||||||||
483 | - | |||||||||||||||||||||||||
484 | xcb_atom_t QXcbDrag::toXdndAction(Qt::DropAction a) const | - | ||||||||||||||||||||||||
485 | { | - | ||||||||||||||||||||||||
486 | switch (a) { | - | ||||||||||||||||||||||||
487 | case never executed: Qt::CopyAction:case Qt::CopyAction: never executed: case Qt::CopyAction: | 0 | ||||||||||||||||||||||||
488 | return never executed: atom(QXcbAtom::XdndActionCopy);return atom(QXcbAtom::XdndActionCopy); never executed: return atom(QXcbAtom::XdndActionCopy); | 0 | ||||||||||||||||||||||||
489 | case never executed: Qt::LinkAction:case Qt::LinkAction: never executed: case Qt::LinkAction: | 0 | ||||||||||||||||||||||||
490 | return never executed: atom(QXcbAtom::XdndActionLink);return atom(QXcbAtom::XdndActionLink); never executed: return atom(QXcbAtom::XdndActionLink); | 0 | ||||||||||||||||||||||||
491 | case never executed: Qt::MoveAction:case Qt::MoveAction: never executed: case Qt::MoveAction: | 0 | ||||||||||||||||||||||||
492 | case never executed: Qt::TargetMoveAction:case Qt::TargetMoveAction: never executed: case Qt::TargetMoveAction: | 0 | ||||||||||||||||||||||||
493 | return never executed: atom(QXcbAtom::XdndActionMove);return atom(QXcbAtom::XdndActionMove); never executed: return atom(QXcbAtom::XdndActionMove); | 0 | ||||||||||||||||||||||||
494 | case never executed: Qt::IgnoreAction:case Qt::IgnoreAction: never executed: case Qt::IgnoreAction: | 0 | ||||||||||||||||||||||||
495 | return never executed: 0L;return 0L; never executed: return 0L; | 0 | ||||||||||||||||||||||||
496 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
497 | return never executed: atom(QXcbAtom::XdndActionCopy);return atom(QXcbAtom::XdndActionCopy); never executed: return atom(QXcbAtom::XdndActionCopy); | 0 | ||||||||||||||||||||||||
498 | } | - | ||||||||||||||||||||||||
499 | } | - | ||||||||||||||||||||||||
500 | - | |||||||||||||||||||||||||
501 | int QXcbDrag::findTransactionByWindow(xcb_window_t window) | - | ||||||||||||||||||||||||
502 | { | - | ||||||||||||||||||||||||
503 | int at = -1; | - | ||||||||||||||||||||||||
504 | for (int i = 0; i < transactions.count()
| 0 | ||||||||||||||||||||||||
505 | const Transaction &t = transactions.at(i); | - | ||||||||||||||||||||||||
506 | if (t.target == window
| 0 | ||||||||||||||||||||||||
507 | at = i; | - | ||||||||||||||||||||||||
508 | break; never executed: break; | 0 | ||||||||||||||||||||||||
509 | } | - | ||||||||||||||||||||||||
510 | } never executed: end of block | 0 | ||||||||||||||||||||||||
511 | return never executed: at;return at; never executed: return at; | 0 | ||||||||||||||||||||||||
512 | } | - | ||||||||||||||||||||||||
513 | - | |||||||||||||||||||||||||
514 | int QXcbDrag::findTransactionByTime(xcb_timestamp_t timestamp) | - | ||||||||||||||||||||||||
515 | { | - | ||||||||||||||||||||||||
516 | int at = -1; | - | ||||||||||||||||||||||||
517 | for (int i = 0; i < transactions.count()
| 0 | ||||||||||||||||||||||||
518 | const Transaction &t = transactions.at(i); | - | ||||||||||||||||||||||||
519 | if (t.timestamp == timestamp
| 0 | ||||||||||||||||||||||||
520 | at = i; | - | ||||||||||||||||||||||||
521 | break; never executed: break; | 0 | ||||||||||||||||||||||||
522 | } | - | ||||||||||||||||||||||||
523 | } never executed: end of block | 0 | ||||||||||||||||||||||||
524 | return never executed: at;return at; never executed: return at; | 0 | ||||||||||||||||||||||||
525 | } | - | ||||||||||||||||||||||||
526 | void QXcbDrag::handleEnter(QPlatformWindow *window, const xcb_client_message_event_t *event, xcb_window_t proxy) | - | ||||||||||||||||||||||||
527 | { | - | ||||||||||||||||||||||||
528 | (void)window;; | - | ||||||||||||||||||||||||
529 | if(0) QMessageLogger(__FILE__, 686, __PRETTY_FUNCTION__).debug() << "handleEnter" << window; dead code: QMessageLogger(__FILE__, 686, __PRETTY_FUNCTION__).debug() << "handleEnter" << window; | - | ||||||||||||||||||||||||
530 | - | |||||||||||||||||||||||||
531 | xdnd_types.clear(); | - | ||||||||||||||||||||||||
532 | - | |||||||||||||||||||||||||
533 | int version = (int)(event->data.data32[1] >> 24); | - | ||||||||||||||||||||||||
534 | if (version > xdnd_version
| 0 | ||||||||||||||||||||||||
535 | return; never executed: return; | 0 | ||||||||||||||||||||||||
536 | - | |||||||||||||||||||||||||
537 | xdnd_dragsource = event->data.data32[0]; | - | ||||||||||||||||||||||||
538 | if (!proxy
| 0 | ||||||||||||||||||||||||
539 | proxy = xdndProxy(connection(), xdnd_dragsource); never executed: proxy = xdndProxy(connection(), xdnd_dragsource); | 0 | ||||||||||||||||||||||||
540 | current_proxy_target = proxy
| 0 | ||||||||||||||||||||||||
541 | - | |||||||||||||||||||||||||
542 | if (event->data.data32[1] & 1
| 0 | ||||||||||||||||||||||||
543 | - | |||||||||||||||||||||||||
544 | xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, xdnd_dragsource, | - | ||||||||||||||||||||||||
545 | atom(QXcbAtom::XdndTypelist), XCB_ATOM_ATOM, | - | ||||||||||||||||||||||||
546 | 0, xdnd_max_type); | - | ||||||||||||||||||||||||
547 | xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0); | - | ||||||||||||||||||||||||
548 | if (reply
| 0 | ||||||||||||||||||||||||
549 | int length = xcb_get_property_value_length(reply) / 4; | - | ||||||||||||||||||||||||
550 | if (length > xdnd_max_type
| 0 | ||||||||||||||||||||||||
551 | length = xdnd_max_type; never executed: length = xdnd_max_type; | 0 | ||||||||||||||||||||||||
552 | - | |||||||||||||||||||||||||
553 | xcb_atom_t *atoms = (xcb_atom_t *)xcb_get_property_value(reply); | - | ||||||||||||||||||||||||
554 | xdnd_types.reserve(length); | - | ||||||||||||||||||||||||
555 | for (int i = 0; i < length
| 0 | ||||||||||||||||||||||||
556 | xdnd_types.append(atoms[i]); never executed: xdnd_types.append(atoms[i]); | 0 | ||||||||||||||||||||||||
557 | } never executed: end of block | 0 | ||||||||||||||||||||||||
558 | free(reply); | - | ||||||||||||||||||||||||
559 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
560 | - | |||||||||||||||||||||||||
561 | for(int i = 2; i < 5
| 0 | ||||||||||||||||||||||||
562 | if (event->data.data32[i]
| 0 | ||||||||||||||||||||||||
563 | xdnd_types.append(event->data.data32[i]); never executed: xdnd_types.append(event->data.data32[i]); | 0 | ||||||||||||||||||||||||
564 | } never executed: end of block | 0 | ||||||||||||||||||||||||
565 | } never executed: end of block | 0 | ||||||||||||||||||||||||
566 | for(int i = 0; i < xdnd_types.length()
| 0 | ||||||||||||||||||||||||
567 | if(0) QMessageLogger(__FILE__, 724, __PRETTY_FUNCTION__).debug() << " " << connection()->atomName(xdnd_types.at(i)); dead code: QMessageLogger(__FILE__, 724, __PRETTY_FUNCTION__).debug() << " " << connection()->atomName(xdnd_types.at(i)); | - | ||||||||||||||||||||||||
568 | } never executed: end of block | 0 | ||||||||||||||||||||||||
569 | - | |||||||||||||||||||||||||
570 | void QXcbDrag::handle_xdnd_position(QPlatformWindow *w, const xcb_client_message_event_t *e) | - | ||||||||||||||||||||||||
571 | { | - | ||||||||||||||||||||||||
572 | QPoint p((e->data.data32[2] & 0xffff0000) >> 16, e->data.data32[2] & 0x0000ffff); | - | ||||||||||||||||||||||||
573 | ((!(w)) ? qt_assert("w",__FILE__,730) : qt_noop()); | - | ||||||||||||||||||||||||
574 | QRect geometry = w->geometry(); | - | ||||||||||||||||||||||||
575 | p -= geometry.topLeft(); | - | ||||||||||||||||||||||||
576 | - | |||||||||||||||||||||||||
577 | if (!w
| 0 | ||||||||||||||||||||||||
578 | return; never executed: return; | 0 | ||||||||||||||||||||||||
579 | - | |||||||||||||||||||||||||
580 | if (e->data.data32[0] != xdnd_dragsource
| 0 | ||||||||||||||||||||||||
581 | if(0) QMessageLogger(__FILE__, 738, __PRETTY_FUNCTION__).debug("xdnd drag position from unexpected source (%x not %x)", e->data.data32[0], xdnd_dragsource); dead code: QMessageLogger(__FILE__, 738, __PRETTY_FUNCTION__).debug("xdnd drag position from unexpected source (%x not %x)", e->data.data32[0], xdnd_dragsource); | - | ||||||||||||||||||||||||
582 | return; never executed: return; | 0 | ||||||||||||||||||||||||
583 | } | - | ||||||||||||||||||||||||
584 | - | |||||||||||||||||||||||||
585 | currentPosition = p; | - | ||||||||||||||||||||||||
586 | currentWindow = w->window(); | - | ||||||||||||||||||||||||
587 | - | |||||||||||||||||||||||||
588 | - | |||||||||||||||||||||||||
589 | if (e->data.data32[3] != 0L
| 0 | ||||||||||||||||||||||||
590 | target_time = e->data.data32[3]; | - | ||||||||||||||||||||||||
591 | } never executed: end of block | 0 | ||||||||||||||||||||||||
592 | - | |||||||||||||||||||||||||
593 | QMimeData *dropData = 0; | - | ||||||||||||||||||||||||
594 | Qt::DropActions supported_actions = Qt::IgnoreAction; | - | ||||||||||||||||||||||||
595 | if (currentDrag()
| 0 | ||||||||||||||||||||||||
596 | dropData = currentDrag()->mimeData(); | - | ||||||||||||||||||||||||
597 | supported_actions = currentDrag()->supportedActions(); | - | ||||||||||||||||||||||||
598 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
599 | dropData = platformDropData(); | - | ||||||||||||||||||||||||
600 | supported_actions = Qt::DropActions(toDropAction(e->data.data32[4])); | - | ||||||||||||||||||||||||
601 | } never executed: end of block | 0 | ||||||||||||||||||||||||
602 | - | |||||||||||||||||||||||||
603 | QPlatformDragQtResponse qt_response = QWindowSystemInterface::handleDrag(w->window(),dropData,p,supported_actions); | - | ||||||||||||||||||||||||
604 | QRect answerRect(p + geometry.topLeft(), QSize(1,1)); | - | ||||||||||||||||||||||||
605 | answerRect = qt_response.answerRect().translated(geometry.topLeft()).intersected(geometry); | - | ||||||||||||||||||||||||
606 | - | |||||||||||||||||||||||||
607 | xcb_client_message_event_t response; | - | ||||||||||||||||||||||||
608 | response.response_type = 33; | - | ||||||||||||||||||||||||
609 | response.sequence = 0; | - | ||||||||||||||||||||||||
610 | response.window = xdnd_dragsource; | - | ||||||||||||||||||||||||
611 | response.format = 32; | - | ||||||||||||||||||||||||
612 | response.type = atom(QXcbAtom::XdndStatus); | - | ||||||||||||||||||||||||
613 | response.data.data32[0] = xcb_window(w); | - | ||||||||||||||||||||||||
614 | response.data.data32[1] = qt_response.isAccepted(); | - | ||||||||||||||||||||||||
615 | response.data.data32[2] = 0; | - | ||||||||||||||||||||||||
616 | response.data.data32[3] = 0; | - | ||||||||||||||||||||||||
617 | response.data.data32[4] = toXdndAction(qt_response.acceptedAction()); | - | ||||||||||||||||||||||||
618 | - | |||||||||||||||||||||||||
619 | accepted_drop_action = qt_response.acceptedAction(); | - | ||||||||||||||||||||||||
620 | - | |||||||||||||||||||||||||
621 | if (answerRect.left() < 0
| 0 | ||||||||||||||||||||||||
622 | answerRect.setLeft(0); never executed: answerRect.setLeft(0); | 0 | ||||||||||||||||||||||||
623 | if (answerRect.right() > 4096
| 0 | ||||||||||||||||||||||||
624 | answerRect.setRight(4096); never executed: answerRect.setRight(4096); | 0 | ||||||||||||||||||||||||
625 | if (answerRect.top() < 0
| 0 | ||||||||||||||||||||||||
626 | answerRect.setTop(0); never executed: answerRect.setTop(0); | 0 | ||||||||||||||||||||||||
627 | if (answerRect.bottom() > 4096
| 0 | ||||||||||||||||||||||||
628 | answerRect.setBottom(4096); never executed: answerRect.setBottom(4096); | 0 | ||||||||||||||||||||||||
629 | if (answerRect.width() < 0
| 0 | ||||||||||||||||||||||||
630 | answerRect.setWidth(0); never executed: answerRect.setWidth(0); | 0 | ||||||||||||||||||||||||
631 | if (answerRect.height() < 0
| 0 | ||||||||||||||||||||||||
632 | answerRect.setHeight(0); never executed: answerRect.setHeight(0); | 0 | ||||||||||||||||||||||||
633 | - | |||||||||||||||||||||||||
634 | - | |||||||||||||||||||||||||
635 | target_time = 0L; | - | ||||||||||||||||||||||||
636 | - | |||||||||||||||||||||||||
637 | if (xdnd_dragsource == connection()->clipboard()->owner()
| 0 | ||||||||||||||||||||||||
638 | handle_xdnd_status(&response); never executed: handle_xdnd_status(&response); | 0 | ||||||||||||||||||||||||
639 | else | - | ||||||||||||||||||||||||
640 | xcb_send_event(xcb_connection(), false, current_proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&response) never executed: xcb_send_event(xcb_connection(), false, current_proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&response) ; | 0 | ||||||||||||||||||||||||
641 | ; never executed: xcb_send_event(xcb_connection(), false, current_proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&response) ; | 0 | ||||||||||||||||||||||||
642 | } | - | ||||||||||||||||||||||||
643 | - | |||||||||||||||||||||||||
644 | namespace | - | ||||||||||||||||||||||||
645 | { | - | ||||||||||||||||||||||||
646 | class ClientMessageScanner { | - | ||||||||||||||||||||||||
647 | public: | - | ||||||||||||||||||||||||
648 | ClientMessageScanner(xcb_atom_t a) : atom(a) {} never executed: end of block | 0 | ||||||||||||||||||||||||
649 | xcb_atom_t atom; | - | ||||||||||||||||||||||||
650 | bool checkEvent(xcb_generic_event_t *event) const { | - | ||||||||||||||||||||||||
651 | if (!event
| 0 | ||||||||||||||||||||||||
652 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
653 | if ((
| 0 | ||||||||||||||||||||||||
654 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
655 | return never executed: ((xcb_client_message_event_t *)event)->type == atom;return ((xcb_client_message_event_t *)event)->type == atom; never executed: return ((xcb_client_message_event_t *)event)->type == atom; | 0 | ||||||||||||||||||||||||
656 | } | - | ||||||||||||||||||||||||
657 | }; | - | ||||||||||||||||||||||||
658 | } | - | ||||||||||||||||||||||||
659 | - | |||||||||||||||||||||||||
660 | void QXcbDrag::handlePosition(QPlatformWindow * w, const xcb_client_message_event_t *event) | - | ||||||||||||||||||||||||
661 | { | - | ||||||||||||||||||||||||
662 | xcb_client_message_event_t *lastEvent = const_cast<xcb_client_message_event_t *>(event); | - | ||||||||||||||||||||||||
663 | xcb_generic_event_t *nextEvent; | - | ||||||||||||||||||||||||
664 | ClientMessageScanner scanner(atom(QXcbAtom::XdndPosition)); | - | ||||||||||||||||||||||||
665 | while ((
| 0 | ||||||||||||||||||||||||
666 | if (lastEvent != event
| 0 | ||||||||||||||||||||||||
667 | free(lastEvent); never executed: free(lastEvent); | 0 | ||||||||||||||||||||||||
668 | lastEvent = (xcb_client_message_event_t *)nextEvent; | - | ||||||||||||||||||||||||
669 | } never executed: end of block | 0 | ||||||||||||||||||||||||
670 | - | |||||||||||||||||||||||||
671 | handle_xdnd_position(w, lastEvent); | - | ||||||||||||||||||||||||
672 | if (lastEvent != event
| 0 | ||||||||||||||||||||||||
673 | free(lastEvent); never executed: free(lastEvent); | 0 | ||||||||||||||||||||||||
674 | } never executed: end of block | 0 | ||||||||||||||||||||||||
675 | - | |||||||||||||||||||||||||
676 | void QXcbDrag::handle_xdnd_status(const xcb_client_message_event_t *event) | - | ||||||||||||||||||||||||
677 | { | - | ||||||||||||||||||||||||
678 | if(0) QMessageLogger(__FILE__, 835, __PRETTY_FUNCTION__).debug("xdndHandleStatus"); dead code: QMessageLogger(__FILE__, 835, __PRETTY_FUNCTION__).debug("xdndHandleStatus"); | - | ||||||||||||||||||||||||
679 | waiting_for_status = false; | - | ||||||||||||||||||||||||
680 | - | |||||||||||||||||||||||||
681 | if (event->data.data32[0]
| 0 | ||||||||||||||||||||||||
682 | return; never executed: return; | 0 | ||||||||||||||||||||||||
683 | - | |||||||||||||||||||||||||
684 | const bool dropPossible = event->data.data32[1]; | - | ||||||||||||||||||||||||
685 | setCanDrop(dropPossible); | - | ||||||||||||||||||||||||
686 | - | |||||||||||||||||||||||||
687 | if (dropPossible
| 0 | ||||||||||||||||||||||||
688 | accepted_drop_action = toDropAction(event->data.data32[4]); | - | ||||||||||||||||||||||||
689 | updateCursor(accepted_drop_action); | - | ||||||||||||||||||||||||
690 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
691 | updateCursor(Qt::IgnoreAction); | - | ||||||||||||||||||||||||
692 | } never executed: end of block | 0 | ||||||||||||||||||||||||
693 | - | |||||||||||||||||||||||||
694 | if ((
| 0 | ||||||||||||||||||||||||
695 | QPoint p((event->data.data32[2] & 0xffff0000) >> 16, event->data.data32[2] & 0x0000ffff); | - | ||||||||||||||||||||||||
696 | QSize s((event->data.data32[3] & 0xffff0000) >> 16, event->data.data32[3] & 0x0000ffff); | - | ||||||||||||||||||||||||
697 | source_sameanswer = QRect(p, s); | - | ||||||||||||||||||||||||
698 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
699 | source_sameanswer = QRect(); | - | ||||||||||||||||||||||||
700 | } never executed: end of block | 0 | ||||||||||||||||||||||||
701 | } | - | ||||||||||||||||||||||||
702 | - | |||||||||||||||||||||||||
703 | void QXcbDrag::handleStatus(const xcb_client_message_event_t *event) | - | ||||||||||||||||||||||||
704 | { | - | ||||||||||||||||||||||||
705 | if (event->window != connection()->clipboard()->owner()
| 0 | ||||||||||||||||||||||||
706 | return; never executed: return; | 0 | ||||||||||||||||||||||||
707 | - | |||||||||||||||||||||||||
708 | xcb_client_message_event_t *lastEvent = const_cast<xcb_client_message_event_t *>(event); | - | ||||||||||||||||||||||||
709 | xcb_generic_event_t *nextEvent; | - | ||||||||||||||||||||||||
710 | ClientMessageScanner scanner(atom(QXcbAtom::XdndStatus)); | - | ||||||||||||||||||||||||
711 | while ((
| 0 | ||||||||||||||||||||||||
712 | if (lastEvent != event
| 0 | ||||||||||||||||||||||||
713 | free(lastEvent); never executed: free(lastEvent); | 0 | ||||||||||||||||||||||||
714 | lastEvent = (xcb_client_message_event_t *)nextEvent; | - | ||||||||||||||||||||||||
715 | } never executed: end of block | 0 | ||||||||||||||||||||||||
716 | - | |||||||||||||||||||||||||
717 | handle_xdnd_status(lastEvent); | - | ||||||||||||||||||||||||
718 | if (lastEvent != event
| 0 | ||||||||||||||||||||||||
719 | free(lastEvent); never executed: free(lastEvent); | 0 | ||||||||||||||||||||||||
720 | if(0) QMessageLogger(__FILE__, 877, __PRETTY_FUNCTION__).debug("xdndHandleStatus end"); dead code: QMessageLogger(__FILE__, 877, __PRETTY_FUNCTION__).debug("xdndHandleStatus end"); | - | ||||||||||||||||||||||||
721 | } never executed: end of block | 0 | ||||||||||||||||||||||||
722 | - | |||||||||||||||||||||||||
723 | void QXcbDrag::handleLeave(QPlatformWindow *w, const xcb_client_message_event_t *event) | - | ||||||||||||||||||||||||
724 | { | - | ||||||||||||||||||||||||
725 | if(0) QMessageLogger(__FILE__, 882, __PRETTY_FUNCTION__).debug("xdnd leave"); dead code: QMessageLogger(__FILE__, 882, __PRETTY_FUNCTION__).debug("xdnd leave"); | - | ||||||||||||||||||||||||
726 | if (!currentWindow
| 0 | ||||||||||||||||||||||||
727 | return; never executed: return; | 0 | ||||||||||||||||||||||||
728 | if (event->data.data32[0] != xdnd_dragsource
| 0 | ||||||||||||||||||||||||
729 | - | |||||||||||||||||||||||||
730 | if(0) QMessageLogger(__FILE__, 895, __PRETTY_FUNCTION__).debug("xdnd drag leave from unexpected source (%x not %x", event->data.data32[0], xdnd_dragsource); dead code: QMessageLogger(__FILE__, 895, __PRETTY_FUNCTION__).debug("xdnd drag leave from unexpected source (%x not %x", event->data.data32[0], xdnd_dragsource); | - | ||||||||||||||||||||||||
731 | } never executed: end of block | 0 | ||||||||||||||||||||||||
732 | - | |||||||||||||||||||||||||
733 | QWindowSystemInterface::handleDrag(w->window(),0,QPoint(),Qt::IgnoreAction); | - | ||||||||||||||||||||||||
734 | - | |||||||||||||||||||||||||
735 | xdnd_dragsource = 0; | - | ||||||||||||||||||||||||
736 | xdnd_types.clear(); | - | ||||||||||||||||||||||||
737 | currentWindow.clear(); | - | ||||||||||||||||||||||||
738 | } never executed: end of block | 0 | ||||||||||||||||||||||||
739 | - | |||||||||||||||||||||||||
740 | void QXcbDrag::send_leave() | - | ||||||||||||||||||||||||
741 | { | - | ||||||||||||||||||||||||
742 | if (!current_target
| 0 | ||||||||||||||||||||||||
743 | return; never executed: return; | 0 | ||||||||||||||||||||||||
744 | - | |||||||||||||||||||||||||
745 | - | |||||||||||||||||||||||||
746 | xcb_client_message_event_t leave; | - | ||||||||||||||||||||||||
747 | leave.response_type = 33; | - | ||||||||||||||||||||||||
748 | leave.sequence = 0; | - | ||||||||||||||||||||||||
749 | leave.window = current_target; | - | ||||||||||||||||||||||||
750 | leave.format = 32; | - | ||||||||||||||||||||||||
751 | leave.type = atom(QXcbAtom::XdndLeave); | - | ||||||||||||||||||||||||
752 | leave.data.data32[0] = connection()->clipboard()->owner(); | - | ||||||||||||||||||||||||
753 | leave.data.data32[1] = 0; | - | ||||||||||||||||||||||||
754 | leave.data.data32[2] = 0; | - | ||||||||||||||||||||||||
755 | leave.data.data32[3] = 0; | - | ||||||||||||||||||||||||
756 | leave.data.data32[4] = 0; | - | ||||||||||||||||||||||||
757 | - | |||||||||||||||||||||||||
758 | QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target); | - | ||||||||||||||||||||||||
759 | - | |||||||||||||||||||||||||
760 | if (w
| 0 | ||||||||||||||||||||||||
761 | w = 0; never executed: w = 0; | 0 | ||||||||||||||||||||||||
762 | - | |||||||||||||||||||||||||
763 | if (w
| 0 | ||||||||||||||||||||||||
764 | handleLeave(w, (const xcb_client_message_event_t *)&leave); never executed: handleLeave(w, (const xcb_client_message_event_t *)&leave); | 0 | ||||||||||||||||||||||||
765 | else | - | ||||||||||||||||||||||||
766 | xcb_send_event(xcb_connection(), false,current_proxy_target, never executed: xcb_send_event(xcb_connection(), false,current_proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&leave); | 0 | ||||||||||||||||||||||||
767 | XCB_EVENT_MASK_NO_EVENT, (const char *)&leave); never executed: xcb_send_event(xcb_connection(), false,current_proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&leave); | 0 | ||||||||||||||||||||||||
768 | - | |||||||||||||||||||||||||
769 | current_target = 0; | - | ||||||||||||||||||||||||
770 | current_proxy_target = 0; | - | ||||||||||||||||||||||||
771 | source_time = 0L; | - | ||||||||||||||||||||||||
772 | waiting_for_status = false; | - | ||||||||||||||||||||||||
773 | } never executed: end of block | 0 | ||||||||||||||||||||||||
774 | - | |||||||||||||||||||||||||
775 | void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *event) | - | ||||||||||||||||||||||||
776 | { | - | ||||||||||||||||||||||||
777 | if(0) QMessageLogger(__FILE__, 942, __PRETTY_FUNCTION__).debug("xdndHandleDrop"); dead code: QMessageLogger(__FILE__, 942, __PRETTY_FUNCTION__).debug("xdndHandleDrop"); | - | ||||||||||||||||||||||||
778 | if (!currentWindow
| 0 | ||||||||||||||||||||||||
779 | xdnd_dragsource = 0; | - | ||||||||||||||||||||||||
780 | return; never executed: return; | 0 | ||||||||||||||||||||||||
781 | } | - | ||||||||||||||||||||||||
782 | - | |||||||||||||||||||||||||
783 | const uint32_t *l = event->data.data32; | - | ||||||||||||||||||||||||
784 | - | |||||||||||||||||||||||||
785 | if(0) QMessageLogger(__FILE__, 950, __PRETTY_FUNCTION__).debug("xdnd drop"); dead code: QMessageLogger(__FILE__, 950, __PRETTY_FUNCTION__).debug("xdnd drop"); | - | ||||||||||||||||||||||||
786 | - | |||||||||||||||||||||||||
787 | if (l[0] != xdnd_dragsource
| 0 | ||||||||||||||||||||||||
788 | if(0) QMessageLogger(__FILE__, 953, __PRETTY_FUNCTION__).debug("xdnd drop from unexpected source (%x not %x", l[0], xdnd_dragsource); dead code: QMessageLogger(__FILE__, 953, __PRETTY_FUNCTION__).debug("xdnd drop from unexpected source (%x not %x", l[0], xdnd_dragsource); | - | ||||||||||||||||||||||||
789 | return; never executed: return; | 0 | ||||||||||||||||||||||||
790 | } | - | ||||||||||||||||||||||||
791 | - | |||||||||||||||||||||||||
792 | - | |||||||||||||||||||||||||
793 | if (l[2] != 0
| 0 | ||||||||||||||||||||||||
794 | target_time = l[2]; never executed: target_time = l[2]; | 0 | ||||||||||||||||||||||||
795 | - | |||||||||||||||||||||||||
796 | Qt::DropActions supported_drop_actions; | - | ||||||||||||||||||||||||
797 | QMimeData *dropData = 0; | - | ||||||||||||||||||||||||
798 | if (currentDrag()
| 0 | ||||||||||||||||||||||||
799 | dropData = currentDrag()->mimeData(); | - | ||||||||||||||||||||||||
800 | supported_drop_actions = Qt::DropActions(l[4]); | - | ||||||||||||||||||||||||
801 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
802 | dropData = platformDropData(); | - | ||||||||||||||||||||||||
803 | supported_drop_actions = accepted_drop_action; | - | ||||||||||||||||||||||||
804 | - | |||||||||||||||||||||||||
805 | - | |||||||||||||||||||||||||
806 | QGuiApplicationPrivate::modifier_buttons = QGuiApplication::queryKeyboardModifiers(); | - | ||||||||||||||||||||||||
807 | } never executed: end of block | 0 | ||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||
809 | if (!dropData
| 0 | ||||||||||||||||||||||||
810 | return; never executed: return; | 0 | ||||||||||||||||||||||||
811 | - | |||||||||||||||||||||||||
812 | - | |||||||||||||||||||||||||
813 | - | |||||||||||||||||||||||||
814 | - | |||||||||||||||||||||||||
815 | - | |||||||||||||||||||||||||
816 | - | |||||||||||||||||||||||||
817 | QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(currentWindow.data(),dropData,currentPosition,supported_drop_actions); | - | ||||||||||||||||||||||||
818 | setExecutedDropAction(response.acceptedAction()); | - | ||||||||||||||||||||||||
819 | - | |||||||||||||||||||||||||
820 | xcb_client_message_event_t finished; | - | ||||||||||||||||||||||||
821 | finished.response_type = 33; | - | ||||||||||||||||||||||||
822 | finished.sequence = 0; | - | ||||||||||||||||||||||||
823 | finished.window = xdnd_dragsource; | - | ||||||||||||||||||||||||
824 | finished.format = 32; | - | ||||||||||||||||||||||||
825 | finished.type = atom(QXcbAtom::XdndFinished); | - | ||||||||||||||||||||||||
826 | finished.data.data32[0] = currentWindow
| 0 | ||||||||||||||||||||||||
827 | finished.data.data32[1] = response.isAccepted(); | - | ||||||||||||||||||||||||
828 | finished.data.data32[2] = toXdndAction(response.acceptedAction()); | - | ||||||||||||||||||||||||
829 | xcb_send_event(xcb_connection(), false, current_proxy_target, XCB_EVENT_MASK_NO_EVENT, (char *)&finished) | - | ||||||||||||||||||||||||
830 | ; | - | ||||||||||||||||||||||||
831 | - | |||||||||||||||||||||||||
832 | xdnd_dragsource = 0; | - | ||||||||||||||||||||||||
833 | currentWindow.clear(); | - | ||||||||||||||||||||||||
834 | waiting_for_status = false; | - | ||||||||||||||||||||||||
835 | - | |||||||||||||||||||||||||
836 | - | |||||||||||||||||||||||||
837 | target_time = 0L; | - | ||||||||||||||||||||||||
838 | } never executed: end of block | 0 | ||||||||||||||||||||||||
839 | - | |||||||||||||||||||||||||
840 | - | |||||||||||||||||||||||||
841 | void QXcbDrag::handleFinished(const xcb_client_message_event_t *event) | - | ||||||||||||||||||||||||
842 | { | - | ||||||||||||||||||||||||
843 | if(0) QMessageLogger(__FILE__, 1008, __PRETTY_FUNCTION__).debug("xdndHandleFinished"); dead code: QMessageLogger(__FILE__, 1008, __PRETTY_FUNCTION__).debug("xdndHandleFinished"); | - | ||||||||||||||||||||||||
844 | if (event->window != connection()->clipboard()->owner()
| 0 | ||||||||||||||||||||||||
845 | return; never executed: return; | 0 | ||||||||||||||||||||||||
846 | - | |||||||||||||||||||||||||
847 | const unsigned long *l = (const unsigned long *)event->data.data32; | - | ||||||||||||||||||||||||
848 | - | |||||||||||||||||||||||||
849 | if(0) QMessageLogger(__FILE__, 1014, __PRETTY_FUNCTION__).debug() << "xdndHandleFinished, l[0]" << l[0] dead code: QMessageLogger(__FILE__, 1014, __PRETTY_FUNCTION__).debug() << "xdndHandleFinished, l[0]" << l[0] << "current_target" << current_target << "qt_xdnd_current_proxy_targe" << current_proxy_target; | - | ||||||||||||||||||||||||
850 | << "current_target" << current_target dead code: QMessageLogger(__FILE__, 1014, __PRETTY_FUNCTION__).debug() << "xdndHandleFinished, l[0]" << l[0] << "current_target" << current_target << "qt_xdnd_current_proxy_targe" << current_proxy_target; | - | ||||||||||||||||||||||||
851 | << "qt_xdnd_current_proxy_targe" << current_proxy_target; dead code: QMessageLogger(__FILE__, 1014, __PRETTY_FUNCTION__).debug() << "xdndHandleFinished, l[0]" << l[0] << "current_target" << current_target << "qt_xdnd_current_proxy_targe" << current_proxy_target; | - | ||||||||||||||||||||||||
852 | - | |||||||||||||||||||||||||
853 | if (l[0]
| 0 | ||||||||||||||||||||||||
854 | int at = findTransactionByWindow(l[0]); | - | ||||||||||||||||||||||||
855 | if (at != -1
| 0 | ||||||||||||||||||||||||
856 | - | |||||||||||||||||||||||||
857 | Transaction t = transactions.takeAt(at); | - | ||||||||||||||||||||||||
858 | if (t.drag
| 0 | ||||||||||||||||||||||||
859 | t.drag->deleteLater(); never executed: t.drag->deleteLater(); | 0 | ||||||||||||||||||||||||
860 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
861 | QMessageLogger(__FILE__, 1049, __PRETTY_FUNCTION__).warning("QXcbDrag::handleFinished - drop data has expired"); | - | ||||||||||||||||||||||||
862 | } never executed: end of block | 0 | ||||||||||||||||||||||||
863 | } | - | ||||||||||||||||||||||||
864 | waiting_for_status = false; | - | ||||||||||||||||||||||||
865 | } never executed: end of block | 0 | ||||||||||||||||||||||||
866 | - | |||||||||||||||||||||||||
867 | void QXcbDrag::timerEvent(QTimerEvent* e) | - | ||||||||||||||||||||||||
868 | { | - | ||||||||||||||||||||||||
869 | if (e->timerId() == cleanup_timer
| 0 | ||||||||||||||||||||||||
870 | bool stopTimer = true; | - | ||||||||||||||||||||||||
871 | for (int i = 0; i < transactions.count()
| 0 | ||||||||||||||||||||||||
872 | const Transaction &t = transactions.at(i); | - | ||||||||||||||||||||||||
873 | if (t.targetWindow
| 0 | ||||||||||||||||||||||||
874 | - | |||||||||||||||||||||||||
875 | - | |||||||||||||||||||||||||
876 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
877 | } | - | ||||||||||||||||||||||||
878 | QTime currentTime = QTime::currentTime(); | - | ||||||||||||||||||||||||
879 | int delta = t.time.msecsTo(currentTime); | - | ||||||||||||||||||||||||
880 | if (delta > XdndDropTransactionTimeout
| 0 | ||||||||||||||||||||||||
881 | - | |||||||||||||||||||||||||
882 | - | |||||||||||||||||||||||||
883 | - | |||||||||||||||||||||||||
884 | - | |||||||||||||||||||||||||
885 | - | |||||||||||||||||||||||||
886 | - | |||||||||||||||||||||||||
887 | if (t.drag
| 0 | ||||||||||||||||||||||||
888 | t.drag->deleteLater(); never executed: t.drag->deleteLater(); | 0 | ||||||||||||||||||||||||
889 | transactions.removeAt(i--); | - | ||||||||||||||||||||||||
890 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
891 | stopTimer = false; | - | ||||||||||||||||||||||||
892 | } never executed: end of block | 0 | ||||||||||||||||||||||||
893 | - | |||||||||||||||||||||||||
894 | } | - | ||||||||||||||||||||||||
895 | if (stopTimer
| 0 | ||||||||||||||||||||||||
896 | killTimer(cleanup_timer); | - | ||||||||||||||||||||||||
897 | cleanup_timer = -1; | - | ||||||||||||||||||||||||
898 | } never executed: end of block | 0 | ||||||||||||||||||||||||
899 | } never executed: end of block | 0 | ||||||||||||||||||||||||
900 | } never executed: end of block | 0 | ||||||||||||||||||||||||
901 | - | |||||||||||||||||||||||||
902 | void QXcbDrag::cancel() | - | ||||||||||||||||||||||||
903 | { | - | ||||||||||||||||||||||||
904 | if(0) QMessageLogger(__FILE__, 1092, __PRETTY_FUNCTION__).debug("QXcbDrag::cancel"); dead code: QMessageLogger(__FILE__, 1092, __PRETTY_FUNCTION__).debug("QXcbDrag::cancel"); | - | ||||||||||||||||||||||||
905 | QBasicDrag::cancel(); | - | ||||||||||||||||||||||||
906 | if (current_target
| 0 | ||||||||||||||||||||||||
907 | send_leave(); never executed: send_leave(); | 0 | ||||||||||||||||||||||||
908 | } never executed: end of block | 0 | ||||||||||||||||||||||||
909 | - | |||||||||||||||||||||||||
910 | - | |||||||||||||||||||||||||
911 | static xcb_window_t findXdndAwareParent(QXcbConnection *c, xcb_window_t window) | - | ||||||||||||||||||||||||
912 | { | - | ||||||||||||||||||||||||
913 | xcb_window_t target = 0; | - | ||||||||||||||||||||||||
914 | for(;;) { | - | ||||||||||||||||||||||||
915 | - | |||||||||||||||||||||||||
916 | xcb_get_property_cookie_t gpCookie = xcb_get_property(c->xcb_connection(), false, window, c->atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 0) | - | ||||||||||||||||||||||||
917 | - | |||||||||||||||||||||||||
918 | ; | - | ||||||||||||||||||||||||
919 | xcb_get_property_reply_t *gpReply = xcb_get_property_reply( | - | ||||||||||||||||||||||||
920 | c->xcb_connection(), gpCookie, 0); | - | ||||||||||||||||||||||||
921 | bool aware = gpReply
| 0 | ||||||||||||||||||||||||
922 | free(gpReply); | - | ||||||||||||||||||||||||
923 | if (aware
| 0 | ||||||||||||||||||||||||
924 | target = window; | - | ||||||||||||||||||||||||
925 | break; never executed: break; | 0 | ||||||||||||||||||||||||
926 | } | - | ||||||||||||||||||||||||
927 | - | |||||||||||||||||||||||||
928 | - | |||||||||||||||||||||||||
929 | xcb_query_tree_cookie_t qtCookie = xcb_query_tree_unchecked(c->xcb_connection(), window) | - | ||||||||||||||||||||||||
930 | ; | - | ||||||||||||||||||||||||
931 | xcb_query_tree_reply_t *qtReply = xcb_query_tree_reply( | - | ||||||||||||||||||||||||
932 | c->xcb_connection(), qtCookie, __null); | - | ||||||||||||||||||||||||
933 | if (!qtReply
| 0 | ||||||||||||||||||||||||
934 | break; never executed: break; | 0 | ||||||||||||||||||||||||
935 | xcb_window_t root = qtReply->root; | - | ||||||||||||||||||||||||
936 | xcb_window_t parent = qtReply->parent; | - | ||||||||||||||||||||||||
937 | free(qtReply); | - | ||||||||||||||||||||||||
938 | if (window == root
| 0 | ||||||||||||||||||||||||
939 | break; never executed: break; | 0 | ||||||||||||||||||||||||
940 | window = parent; | - | ||||||||||||||||||||||||
941 | } never executed: end of block | 0 | ||||||||||||||||||||||||
942 | return never executed: target;return target; never executed: return target; | 0 | ||||||||||||||||||||||||
943 | } | - | ||||||||||||||||||||||||
944 | - | |||||||||||||||||||||||||
945 | void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event) | - | ||||||||||||||||||||||||
946 | { | - | ||||||||||||||||||||||||
947 | xcb_selection_notify_event_t notify; | - | ||||||||||||||||||||||||
948 | notify.response_type = 31; | - | ||||||||||||||||||||||||
949 | notify.requestor = event->requestor; | - | ||||||||||||||||||||||||
950 | notify.selection = event->selection; | - | ||||||||||||||||||||||||
951 | notify.target = 0L; | - | ||||||||||||||||||||||||
952 | notify.property = 0L; | - | ||||||||||||||||||||||||
953 | notify.time = event->time; | - | ||||||||||||||||||||||||
954 | - | |||||||||||||||||||||||||
955 | - | |||||||||||||||||||||||||
956 | int at = -1; | - | ||||||||||||||||||||||||
957 | - | |||||||||||||||||||||||||
958 | - | |||||||||||||||||||||||||
959 | if (currentDrag()
| 0 | ||||||||||||||||||||||||
960 | - | |||||||||||||||||||||||||
961 | at = -2; | - | ||||||||||||||||||||||||
962 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
963 | - | |||||||||||||||||||||||||
964 | - | |||||||||||||||||||||||||
965 | at = findTransactionByTime(event->time); | - | ||||||||||||||||||||||||
966 | if (at == -1
| 0 | ||||||||||||||||||||||||
967 | - | |||||||||||||||||||||||||
968 | - | |||||||||||||||||||||||||
969 | at = findTransactionByWindow(event->requestor); | - | ||||||||||||||||||||||||
970 | } never executed: end of block | 0 | ||||||||||||||||||||||||
971 | - | |||||||||||||||||||||||||
972 | if (at == -1
| 0 | ||||||||||||||||||||||||
973 | xcb_window_t target = findXdndAwareParent(connection(), event->requestor); | - | ||||||||||||||||||||||||
974 | if (target
| 0 | ||||||||||||||||||||||||
975 | if (event->time == 0L
| 0 | ||||||||||||||||||||||||
976 | at = -2; never executed: at = -2; | 0 | ||||||||||||||||||||||||
977 | else | - | ||||||||||||||||||||||||
978 | at = findTransactionByWindow(target); never executed: at = findTransactionByWindow(target); | 0 | ||||||||||||||||||||||||
979 | } | - | ||||||||||||||||||||||||
980 | } never executed: end of block | 0 | ||||||||||||||||||||||||
981 | } never executed: end of block | 0 | ||||||||||||||||||||||||
982 | - | |||||||||||||||||||||||||
983 | QDrag *transactionDrag = 0; | - | ||||||||||||||||||||||||
984 | if (at >= 0
| 0 | ||||||||||||||||||||||||
985 | transactionDrag = transactions.at(at).drag; | - | ||||||||||||||||||||||||
986 | } never executed: else if (at == -2end of block
| 0 | ||||||||||||||||||||||||
987 | transactionDrag = currentDrag(); | - | ||||||||||||||||||||||||
988 | } never executed: end of block | 0 | ||||||||||||||||||||||||
989 | - | |||||||||||||||||||||||||
990 | if (transactionDrag
| 0 | ||||||||||||||||||||||||
991 | xcb_atom_t atomFormat = event->target; | - | ||||||||||||||||||||||||
992 | int dataFormat = 0; | - | ||||||||||||||||||||||||
993 | QByteArray data; | - | ||||||||||||||||||||||||
994 | if (QXcbMime::mimeDataForAtom(connection(), event->target, transactionDrag->mimeData(),
| 0 | ||||||||||||||||||||||||
995 | &data, &atomFormat, &dataFormat)
| 0 | ||||||||||||||||||||||||
996 | int dataSize = data.size() / (dataFormat / 8); | - | ||||||||||||||||||||||||
997 | xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, event->requestor, event->property, | - | ||||||||||||||||||||||||
998 | atomFormat, dataFormat, dataSize, (const void *)data.constData()); | - | ||||||||||||||||||||||||
999 | notify.property = event->property; | - | ||||||||||||||||||||||||
1000 | notify.target = atomFormat; | - | ||||||||||||||||||||||||
1001 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1002 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1003 | - | |||||||||||||||||||||||||
1004 | xcb_window_t proxy_target = xdndProxy(connection(), event->requestor); | - | ||||||||||||||||||||||||
1005 | if (!proxy_target
| 0 | ||||||||||||||||||||||||
1006 | proxy_target = event->requestor; never executed: proxy_target = event->requestor; | 0 | ||||||||||||||||||||||||
1007 | - | |||||||||||||||||||||||||
1008 | xcb_send_event(xcb_connection(), false, proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)¬ify); | - | ||||||||||||||||||||||||
1009 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1010 | - | |||||||||||||||||||||||||
1011 | - | |||||||||||||||||||||||||
1012 | bool QXcbDrag::dndEnable(QXcbWindow *w, bool on) | - | ||||||||||||||||||||||||
1013 | { | - | ||||||||||||||||||||||||
1014 | if(0) QMessageLogger(__FILE__, 1202, __PRETTY_FUNCTION__).debug() << "xdndEnable" << w << on; dead code: QMessageLogger(__FILE__, 1202, __PRETTY_FUNCTION__).debug() << "xdndEnable" << w << on; | - | ||||||||||||||||||||||||
1015 | if (on
| 0-4107 | ||||||||||||||||||||||||
1016 | QXcbWindow *xdnd_widget = 0; | - | ||||||||||||||||||||||||
1017 | if ((
| 0-4107 | ||||||||||||||||||||||||
1018 | if (desktop_proxy
| 0 | ||||||||||||||||||||||||
1019 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1020 | - | |||||||||||||||||||||||||
1021 | QXcbConnectionGrabber grabber(connection()); | - | ||||||||||||||||||||||||
1022 | - | |||||||||||||||||||||||||
1023 | - | |||||||||||||||||||||||||
1024 | xcb_window_t proxy_id = xdndProxy(connection(), w->xcb_window()); | - | ||||||||||||||||||||||||
1025 | - | |||||||||||||||||||||||||
1026 | if (!proxy_id
| 0 | ||||||||||||||||||||||||
1027 | desktop_proxy = new QWindow; | - | ||||||||||||||||||||||||
1028 | xdnd_widget = static_cast<QXcbWindow *>(desktop_proxy->handle()); | - | ||||||||||||||||||||||||
1029 | proxy_id = xdnd_widget->xcb_window(); | - | ||||||||||||||||||||||||
1030 | xcb_atom_t xdnd_proxy = atom(QXcbAtom::XdndProxy); | - | ||||||||||||||||||||||||
1031 | xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, w->xcb_window(), xdnd_proxy, | - | ||||||||||||||||||||||||
1032 | XCB_ATOM_WINDOW, 32, 1, &proxy_id); | - | ||||||||||||||||||||||||
1033 | xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, proxy_id, xdnd_proxy, | - | ||||||||||||||||||||||||
1034 | XCB_ATOM_WINDOW, 32, 1, &proxy_id); | - | ||||||||||||||||||||||||
1035 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1036 | - | |||||||||||||||||||||||||
1037 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1038 | xdnd_widget = w; | - | ||||||||||||||||||||||||
1039 | } executed 4107 times by 125 tests: end of block Executed by:
| 4107 | ||||||||||||||||||||||||
1040 | if (xdnd_widget
| 0-4107 | ||||||||||||||||||||||||
1041 | if(0) QMessageLogger(__FILE__, 1229, __PRETTY_FUNCTION__).debug() << "setting XdndAware for" << xdnd_widget << xdnd_widget->xcb_window(); dead code: QMessageLogger(__FILE__, 1229, __PRETTY_FUNCTION__).debug() << "setting XdndAware for" << xdnd_widget << xdnd_widget->xcb_window(); | - | ||||||||||||||||||||||||
1042 | xcb_atom_t atm = xdnd_version; | - | ||||||||||||||||||||||||
1043 | xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, xdnd_widget->xcb_window(), | - | ||||||||||||||||||||||||
1044 | atom(QXcbAtom::XdndAware), XCB_ATOM_ATOM, 32, 1, &atm); | - | ||||||||||||||||||||||||
1045 | return executed 4107 times by 125 tests: true;return true; Executed by:
executed 4107 times by 125 tests: return true; Executed by:
| 4107 | ||||||||||||||||||||||||
1046 | } else { | - | ||||||||||||||||||||||||
1047 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1048 | } | - | ||||||||||||||||||||||||
1049 | } else { | - | ||||||||||||||||||||||||
1050 | if ((
| 0 | ||||||||||||||||||||||||
1051 | xcb_delete_property(xcb_connection(), w->xcb_window(), atom(QXcbAtom::XdndProxy)); | - | ||||||||||||||||||||||||
1052 | delete desktop_proxy; | - | ||||||||||||||||||||||||
1053 | desktop_proxy = 0; | - | ||||||||||||||||||||||||
1054 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1055 | if(0) QMessageLogger(__FILE__, 1243, __PRETTY_FUNCTION__).debug() << "not deleting XDndAware"; dead code: QMessageLogger(__FILE__, 1243, __PRETTY_FUNCTION__).debug() << "not deleting XDndAware"; | - | ||||||||||||||||||||||||
1056 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1057 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1058 | } | - | ||||||||||||||||||||||||
1059 | } | - | ||||||||||||||||||||||||
1060 | - | |||||||||||||||||||||||||
1061 | bool QXcbDrag::ownsDragObject() const | - | ||||||||||||||||||||||||
1062 | { | - | ||||||||||||||||||||||||
1063 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1064 | } | - | ||||||||||||||||||||||||
1065 | - | |||||||||||||||||||||||||
1066 | QXcbDropData::QXcbDropData(QXcbDrag *d) | - | ||||||||||||||||||||||||
1067 | : QXcbMime(), | - | ||||||||||||||||||||||||
1068 | drag(d) | - | ||||||||||||||||||||||||
1069 | { | - | ||||||||||||||||||||||||
1070 | } executed 135 times by 5 tests: end of block Executed by:
| 135 | ||||||||||||||||||||||||
1071 | - | |||||||||||||||||||||||||
1072 | QXcbDropData::~QXcbDropData() | - | ||||||||||||||||||||||||
1073 | { | - | ||||||||||||||||||||||||
1074 | } | - | ||||||||||||||||||||||||
1075 | - | |||||||||||||||||||||||||
1076 | QVariant QXcbDropData::retrieveData_sys(const QString &mimetype, QVariant::Type requestedType) const | - | ||||||||||||||||||||||||
1077 | { | - | ||||||||||||||||||||||||
1078 | QByteArray mime = mimetype.toLatin1(); | - | ||||||||||||||||||||||||
1079 | QVariant data = xdndObtainData(mime, requestedType); | - | ||||||||||||||||||||||||
1080 | return never executed: data;return data; never executed: return data; | 0 | ||||||||||||||||||||||||
1081 | } | - | ||||||||||||||||||||||||
1082 | - | |||||||||||||||||||||||||
1083 | QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QVariant::Type requestedType) const | - | ||||||||||||||||||||||||
1084 | { | - | ||||||||||||||||||||||||
1085 | QByteArray result; | - | ||||||||||||||||||||||||
1086 | - | |||||||||||||||||||||||||
1087 | QXcbConnection *c = drag->connection(); | - | ||||||||||||||||||||||||
1088 | QXcbWindow *xcb_window = c->platformWindowFromId(drag->xdnd_dragsource); | - | ||||||||||||||||||||||||
1089 | if (xcb_window
| 0 | ||||||||||||||||||||||||
1090 | QMimeData *data = drag->currentDrag()->mimeData(); | - | ||||||||||||||||||||||||
1091 | if (data->hasFormat(QLatin1String(format))
| 0 | ||||||||||||||||||||||||
1092 | result = data->data(QLatin1String(format)); never executed: result = data->data(QLatin1String(format)); | 0 | ||||||||||||||||||||||||
1093 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||||||||
1094 | } | - | ||||||||||||||||||||||||
1095 | - | |||||||||||||||||||||||||
1096 | QVector<xcb_atom_t> atoms = drag->xdnd_types; | - | ||||||||||||||||||||||||
1097 | QByteArray encoding; | - | ||||||||||||||||||||||||
1098 | xcb_atom_t a = mimeAtomForFormat(c, QLatin1String(format), requestedType, atoms, &encoding); | - | ||||||||||||||||||||||||
1099 | if (a == 0L
| 0 | ||||||||||||||||||||||||
1100 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||||||||
1101 | - | |||||||||||||||||||||||||
1102 | if (c->clipboard()->getSelectionOwner(drag->atom(QXcbAtom::XdndSelection)) == 0L
| 0 | ||||||||||||||||||||||||
1103 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||||||||
1104 | - | |||||||||||||||||||||||||
1105 | xcb_atom_t xdnd_selection = c->atom(QXcbAtom::XdndSelection); | - | ||||||||||||||||||||||||
1106 | result = c->clipboard()->getSelection(xdnd_selection, a, xdnd_selection, drag->targetTime()); | - | ||||||||||||||||||||||||
1107 | - | |||||||||||||||||||||||||
1108 | return never executed: mimeConvertToFormat(c, a, result, QLatin1String(format), requestedType, encoding);return mimeConvertToFormat(c, a, result, QLatin1String(format), requestedType, encoding); never executed: return mimeConvertToFormat(c, a, result, QLatin1String(format), requestedType, encoding); | 0 | ||||||||||||||||||||||||
1109 | } | - | ||||||||||||||||||||||||
1110 | - | |||||||||||||||||||||||||
1111 | - | |||||||||||||||||||||||||
1112 | bool QXcbDropData::hasFormat_sys(const QString &format) const | - | ||||||||||||||||||||||||
1113 | { | - | ||||||||||||||||||||||||
1114 | return never executed: formats().contains(format);return formats().contains(format); never executed: return formats().contains(format); | 0 | ||||||||||||||||||||||||
1115 | } | - | ||||||||||||||||||||||||
1116 | - | |||||||||||||||||||||||||
1117 | QStringList QXcbDropData::formats_sys() const | - | ||||||||||||||||||||||||
1118 | { | - | ||||||||||||||||||||||||
1119 | QStringList formats; | - | ||||||||||||||||||||||||
1120 | for (int i = 0; i < drag->xdnd_types.size()
| 0 | ||||||||||||||||||||||||
1121 | QString f = mimeAtomToString(drag->connection(), drag->xdnd_types.at(i)); | - | ||||||||||||||||||||||||
1122 | if (!formats.contains(f)
| 0 | ||||||||||||||||||||||||
1123 | formats.append(f); never executed: formats.append(f); | 0 | ||||||||||||||||||||||||
1124 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1125 | return never executed: formats;return formats; never executed: return formats; | 0 | ||||||||||||||||||||||||
1126 | } | - | ||||||||||||||||||||||||
1127 | - | |||||||||||||||||||||||||
1128 | - | |||||||||||||||||||||||||
1129 | - | |||||||||||||||||||||||||
1130 | - | |||||||||||||||||||||||||
Switch to Source code | Preprocessed file |