plugins/overview: Don't rely on item type to determine drop behavior
Item type is incredibly fragile as a way to determine what was dropped, as proven by recent breakage. Instead, we can use `Drag.keys` to provide metadata about what is being dragged/dropped.
This commit is contained in:
parent
81f9cd9992
commit
71be0f68c0
2 changed files with 3 additions and 1 deletions
|
@ -541,7 +541,7 @@ FocusScope {
|
|||
}
|
||||
onDropped: (drop) => {
|
||||
drop.accepted = true;
|
||||
if (drag.source instanceof Item) {
|
||||
if (drop.keys.includes("kwin-desktop")) {
|
||||
// dragging a desktop as a whole
|
||||
if (drag.source === mainBackground) {
|
||||
drop.action = Qt.IgnoreAction;
|
||||
|
@ -607,6 +607,7 @@ FocusScope {
|
|||
Drag.supportedActions: Qt.MoveAction
|
||||
Drag.source: mainBackground
|
||||
Drag.hotSpot: Qt.point(width * 0.5, height * 0.5)
|
||||
Drag.keys: ["kwin-desktop"]
|
||||
|
||||
layout.mode: effect.layout
|
||||
focus: current
|
||||
|
|
|
@ -103,6 +103,7 @@ Item {
|
|||
Drag.hotSpot: Qt.point(
|
||||
thumb.activeDragHandler.centroid.pressPosition.x * thumb.targetScale,
|
||||
thumb.activeDragHandler.centroid.pressPosition.y * thumb.targetScale)
|
||||
Drag.keys: ["kwin-window"]
|
||||
|
||||
onXChanged: effect.checkItemDraggedOutOfScreen(thumbSource)
|
||||
onYChanged: effect.checkItemDraggedOutOfScreen(thumbSource)
|
||||
|
|
Loading…
Reference in a new issue