mirror of
https://github.com/KDE/latte-dock.git
synced 2025-08-14 21:49:24 +03:00
plasmoid: port away from custom drag handler
BUG: 464528 CCBUG: 402376
This commit is contained in:
@ -598,7 +598,9 @@ Item {
|
||||
TaskManagerApplet.DragHelper {
|
||||
id: dragHelper
|
||||
|
||||
dragIconSize: units.iconSizes.medium
|
||||
Drag.dragType: Drag.Automatic
|
||||
Drag.supportedActions: Qt.CopyAction | Qt.MoveAction | Qt.LinkAction
|
||||
Drag.onDragFinished: root.dragSource = null;
|
||||
}
|
||||
|
||||
TaskManager.VirtualDesktopInfo {
|
||||
@ -1273,11 +1275,6 @@ Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
function resetDragSource() {
|
||||
dragSource.z = 0;
|
||||
dragSource = null;
|
||||
}
|
||||
|
||||
///REMOVE
|
||||
/*function createContextMenu(task) {
|
||||
var menu = root.contextMenuComponent.createObject(task);
|
||||
@ -1307,7 +1304,6 @@ Item {
|
||||
}
|
||||
|
||||
root.windowsHovered.connect(backend.windowsHovered);
|
||||
dragHelper.dropped.connect(resetDragSource);
|
||||
updateListViewParent();
|
||||
}
|
||||
|
||||
@ -1319,7 +1315,6 @@ Item {
|
||||
}
|
||||
|
||||
root.windowsHovered.disconnect(backend.windowsHovered);
|
||||
dragHelper.dropped.disconnect(resetDragSource);
|
||||
}
|
||||
|
||||
//BEGIN states
|
||||
|
@ -328,9 +328,15 @@ AbilityItem.BasicItem {
|
||||
|
||||
onIsDraggedChanged: {
|
||||
if (isDragged){
|
||||
root.dragSource = taskItem;
|
||||
dragHelper.startDrag(taskItem, model.MimeType, model.MimeData,
|
||||
model.LauncherUrlWithoutIcon, model.decoration);
|
||||
taskItem.contentItem.monochromizedItem.grabToImage((result) => {
|
||||
root.dragSource = taskItem;
|
||||
dragHelper.Drag.imageSource = result.url;
|
||||
dragHelper.Drag.mimeData = dragHelper.generateMimeData(model.MimeType, model.MimeData, model.LauncherUrlWithoutIcon);
|
||||
dragHelper.Drag.active = true;
|
||||
});
|
||||
} else {
|
||||
dragHelper.Drag.active = false;
|
||||
dragHelper.Drag.imageSource = "";
|
||||
pressX = -1;
|
||||
pressY = -1;
|
||||
}
|
||||
|
@ -81,12 +81,15 @@ MouseArea {
|
||||
// mouse.button is always 0 here, hence checking with mouse.buttons
|
||||
if (pressX != -1 && mouse.buttons == Qt.LeftButton
|
||||
&& isDragged
|
||||
&& dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y) ) {
|
||||
root.dragSource = taskItem;
|
||||
dragHelper.startDrag(taskItem, model.MimeType, model.MimeData,
|
||||
model.LauncherUrlWithoutIcon, model.decoration);
|
||||
pressX = -1;
|
||||
pressY = -1;
|
||||
&& (Math.abs(pressX - mouse.x) + Math.abs(pressY - mouse.y) >= Qt.styleHints.startDragDistance) ) {
|
||||
taskItem.contentItem.monochromizedItem.grabToImage((result) => {
|
||||
pressX = -1;
|
||||
pressY = -1;
|
||||
root.dragSource = taskItem;
|
||||
dragHelper.Drag.imageSource = result.url;
|
||||
dragHelper.Drag.mimeData = dragHelper.generateMimeData(model.MimeType, model.MimeData, model.LauncherUrlWithoutIcon);
|
||||
dragHelper.Drag.active = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user