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.
wilder/Plasma/6.2
Arjen Hiemstra 2 years ago
parent 81f9cd9992
commit 71be0f68c0
  1. 3
      src/plugins/overview/qml/main.qml
  2. 1
      src/plugins/private/qml/WindowHeapDelegate.qml

@ -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…
Cancel
Save