@@ -59,7 +59,7 @@ ContainmentItem {
5959 required property list< string> windows
6060 keys: [" text/x-dde-dock-dnd-appid" ]
6161 z: attention ? - 1 : 0
62- property bool visibility: itemId !== launcherDndDropArea .launcherDndDesktopId
62+ property bool visibility: itemId !== taskmanager . Applet . desktopIdToAppId ( launcherDndDropArea .launcherDndDesktopId )
6363
6464 states: [
6565 State {
@@ -100,13 +100,12 @@ ContainmentItem {
100100 menus: delegateRoot .menus
101101 windows: delegateRoot .windows
102102 visualIndex: delegateRoot .visualIndex
103+ ListView .delayRemove : Drag .active
103104 Component .onCompleted : {
104105 clickItem .connect (taskmanager .Applet .clickItem )
105106 }
106-
107107 onDragFinished : function () {
108- // 就算在非法区域松开也更新 Model
109- taskmanager .Applet .dataModel .moveTo (itemId, visualIndex)
108+ launcherDndDropArea .resetDndState ()
110109 }
111110 anchors .fill : parent // This is mandatory for draggable item center in drop area
112111 }
@@ -118,11 +117,19 @@ ContainmentItem {
118117 anchors .fill : parent
119118 keys: [" text/x-dde-dock-dnd-appid" ]
120119 property string launcherDndDesktopId: " "
120+ property string launcherDndDragSource: " "
121+
122+ function resetDndState () {
123+ launcherDndDesktopId = " "
124+ launcherDndDragSource = " "
125+ }
126+
121127 onEntered : function (drag ) {
122128 let desktopId = drag .getDataAsString (" text/x-dde-dock-dnd-appid" )
123- launcherDndDesktopId = taskmanager .Applet .desktopIdToAppId (desktopId)
129+ launcherDndDragSource = drag .getDataAsString (" text/x-dde-dock-dnd-source" )
130+ launcherDndDesktopId = desktopId
124131 if (taskmanager .Applet .requestDockByDesktopId (desktopId) === false ) {
125- launcherDndDesktopId = " "
132+ resetDndState ()
126133 }
127134 }
128135
@@ -133,7 +140,8 @@ ContainmentItem {
133140 let cellWidth = Panel .rootObject .dockItemMaxSize
134141 let curCell = curX / cellWidth
135142 let left = (curX % cellWidth) < (cellWidth / 2 )
136- taskmanager .Applet .dataModel .moveTo (launcherDndDesktopId, curCell)
143+ let appId = taskmanager .Applet .desktopIdToAppId (launcherDndDesktopId)
144+ taskmanager .Applet .dataModel .moveTo (appId, curCell)
137145 }
138146
139147 onDropped : function (drop ) {
@@ -143,12 +151,16 @@ ContainmentItem {
143151 let cellWidth = Panel .rootObject .dockItemMaxSize
144152 let curCell = curX / cellWidth
145153 let left = (curX % cellWidth) < (cellWidth / 2 )
146- taskmanager .Applet .dataModel .moveTo (launcherDndDesktopId, curCell)
147- launcherDndDesktopId = " "
154+ let appId = taskmanager .Applet .desktopIdToAppId (launcherDndDesktopId)
155+ taskmanager .Applet .dataModel .moveTo (appId, curCell)
156+ resetDndState ()
148157 }
149158
150159 onExited : function () {
151- launcherDndDesktopId = " "
160+ if (launcherDndDesktopId !== " " && launcherDndDragSource !== " taskbar" ) {
161+ taskmanager .Applet .requestUndockByDesktopId (launcherDndDesktopId)
162+ }
163+ resetDndState ()
152164 }
153165 }
154166 }
0 commit comments