Changeset View
Changeset View
Standalone View
Standalone View
src/server/seat_interface.cpp
Show First 20 Lines • Show All 296 Lines • ▼ Show 20 Line(s) | 287 | [this, dataDevice] { | |||
---|---|---|---|---|---|
297 | drag.sourcePointer = interfaceForSurface(drag.surface, pointers); | 297 | drag.sourcePointer = interfaceForSurface(drag.surface, pointers); | ||
298 | // TODO: transformation needs to be either pointer or touch | 298 | // TODO: transformation needs to be either pointer or touch | ||
299 | drag.transformation = globalPointer.focus.transformation; | 299 | drag.transformation = globalPointer.focus.transformation; | ||
300 | drag.destroyConnection = QObject::connect(dataDevice, &QObject::destroyed, q, | 300 | drag.destroyConnection = QObject::connect(dataDevice, &QObject::destroyed, q, | ||
301 | [this] { | 301 | [this] { | ||
302 | endDrag(display->nextSerial()); | 302 | endDrag(display->nextSerial()); | ||
303 | } | 303 | } | ||
304 | ); | 304 | ); | ||
305 | if (dataDevice->dragSource()) { | ||||
306 | drag.dragSourceDestroyConnection = QObject::connect(dataDevice->dragSource(), &Resource::aboutToBeUnbound, q, | ||||
307 | [this] { | ||||
308 | const auto serial = display->nextSerial(); | ||||
309 | if (drag.target) { | ||||
310 | drag.target->updateDragTarget(nullptr, serial); | ||||
311 | drag.target = nullptr; | ||||
312 | } | ||||
313 | endDrag(serial); | ||||
314 | } | ||||
315 | ); | ||||
316 | } else { | ||||
317 | drag.dragSourceDestroyConnection = QMetaObject::Connection(); | ||||
318 | } | ||||
305 | dataDevice->updateDragTarget(dataDevice->origin(), dataDevice->dragImplicitGrabSerial()); | 319 | dataDevice->updateDragTarget(dataDevice->origin(), dataDevice->dragImplicitGrabSerial()); | ||
306 | emit q->dragStarted(); | 320 | emit q->dragStarted(); | ||
307 | emit q->dragSurfaceChanged(); | 321 | emit q->dragSurfaceChanged(); | ||
308 | } | 322 | } | ||
309 | ); | 323 | ); | ||
310 | // is the new DataDevice for the current keyoard focus? | 324 | // is the new DataDevice for the current keyoard focus? | ||
311 | if (keys.focus.surface && !keys.focus.selection) { | 325 | if (keys.focus.surface && !keys.focus.selection) { | ||
312 | // same client? | 326 | // same client? | ||
Show All 32 Lines | 352 | QObject::connect(ti, &QObject::destroyed, q, | |||
345 | } | 359 | } | ||
346 | ); | 360 | ); | ||
347 | } | 361 | } | ||
348 | 362 | | |||
349 | void SeatInterface::Private::endDrag(quint32 serial) | 363 | void SeatInterface::Private::endDrag(quint32 serial) | ||
350 | { | 364 | { | ||
351 | auto target = drag.target; | 365 | auto target = drag.target; | ||
352 | QObject::disconnect(drag.destroyConnection); | 366 | QObject::disconnect(drag.destroyConnection); | ||
353 | if (drag.source) { | 367 | QObject::disconnect(drag.dragSourceDestroyConnection); | ||
368 | if (drag.source && drag.source->dragSource()) { | ||||
354 | drag.source->dragSource()->dropPerformed(); | 369 | drag.source->dragSource()->dropPerformed(); | ||
355 | } | 370 | } | ||
356 | if (target) { | 371 | if (target) { | ||
357 | target->drop(); | 372 | target->drop(); | ||
358 | target->updateDragTarget(nullptr, serial); | 373 | target->updateDragTarget(nullptr, serial); | ||
359 | } | 374 | } | ||
360 | drag = Drag(); | 375 | drag = Drag(); | ||
361 | emit q->dragSurfaceChanged(); | 376 | emit q->dragSurfaceChanged(); | ||
▲ Show 20 Lines • Show All 1135 Lines • Show Last 20 Lines |