Skip to content

Commit 8a42367

Browse files
committed
fix(dock): delay plugin resident status until drag release from quick panel
1. Use staging mechanism for plugins dragged from quick panel to tray 2. Only commit visibility change when mouse is released, not during drag 3. Preserve original behavior for plugins dragged within tray itself 4. Remove unnecessary setSurfaceVisible call in onExited handler Log: Fix plugins being marked as resident during drag instead of on drop Influence: 1. Verify plugins from quick panel are not marked resident until drop 2. Verify tray-internal plugin dragging still works correctly fix(dock): 延迟插件驻留状态直到从快捷中心拖拽松手 1. 对从快捷中心拖拽到托盘的插件使用暂存机制 2. 仅在松手时提交可见性变更,拖拽过程中不触发 3. 保留托盘内部插件拖拽的原有行为 4. 移除 onExited 处理器中不必要的 setSurfaceVisible 调用 Log: 修复插件在拖拽过程中被标记为驻留而非松手时标记的问题 Influence: 1. 验证从快捷中心拖拽的插件在松手前不会被标记为驻留 2. 验证托盘内部插件拖拽仍然正常工作 PMS: BUG-361185
1 parent 263f2ec commit 8a42367

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

panels/dock/tray/package/TrayContainer.qml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,23 @@ Item {
191191

192192
// 根据 ActionShowStashDelegate 的显示状态动态改变条件
193193
let shouldAllowDrop = showStashActionVisible ? (dropHoverIndex !== 0) : (dropHoverIndex !== -1)
194-
194+
195195
// 使用暂存机制
196196
if (isStash && shouldAllowDrop) {
197197
// 调用 stageDropPosition 来预览拖放位置,预留空位
198198
DDT.TraySortOrderModel.stageDropPosition(surfaceId, Math.floor(currentItemIndex))
199199
} else if (!isStash && shouldAllowDrop) {
200-
dropTrayTimer.handleDrop = function() {
201-
if (isDropped || dragExited) return
202-
DDT.TraySortOrderModel.dropToDockTray(surfaceId, Math.floor(currentItemIndex), isBefore)
200+
// 从快捷中心拖拽的插件使用暂存机制,避免拖拽时立即触发驻留状态
201+
if (source === "quickPanel") {
202+
DDT.TraySortOrderModel.stageDropPosition(surfaceId, Math.floor(currentItemIndex))
203+
} else {
204+
// 托盘内部拖拽保持原有逻辑
205+
dropTrayTimer.handleDrop = function() {
206+
if (isDropped || dragExited) return
207+
DDT.TraySortOrderModel.dropToDockTray(surfaceId, Math.floor(currentItemIndex), isBefore)
208+
}
209+
dropTrayTimer.start()
203210
}
204-
dropTrayTimer.start()
205211
} else if (!surfaceId.startsWith("application-tray")){
206212
dragEvent.accepted = false
207213
}
@@ -215,11 +221,12 @@ Item {
215221
let isBefore = dropIdx.isBefore
216222
let isStash = dropEvent.getDataAsString("text/x-dde-shell-tray-dnd-sectionType") === "stashed"
217223
console.log("dropped", currentItemIndex, isBefore, isStash)
218-
219-
if (isStash) {
220-
// 提交暂存的拖放位置
224+
225+
// 从收纳区或快捷中心拖拽的使用暂存机制
226+
if (isStash || source === "quickPanel") {
221227
DDT.TraySortOrderModel.commitStagedDrop()
222228
} else {
229+
// 托盘内部拖拽直接提交
223230
DDT.TraySortOrderModel.dropToDockTray(surfaceId, Math.floor(currentItemIndex), isBefore);
224231
}
225232
DDT.TraySortOrderModel.actionsAlwaysVisible = false
@@ -229,10 +236,11 @@ Item {
229236
dragExited = true
230237
DDT.TraySortOrderModel.clearStagedDrop()
231238
// dragging from quickPanel, entered trayContainer, but not dropped in this area
232-
if (source !== "" && !isDropped) {
239+
if (source !== "quickPanel" && !isDropped) {
240+
// 托盘内部拖拽但未松手,停止定时器
233241
dropTrayTimer.stop()
234-
DDT.TraySortOrderModel.setSurfaceVisible(surfaceId, false)
235242
}
243+
// 从快捷中心拖拽但未松手时无需额外处理,clearStagedDrop 已清理暂存状态
236244
// Hide action icons when drag leaves tray without dropping
237245
if (!isDropped) {
238246
DDT.TraySortOrderModel.actionsAlwaysVisible = false

0 commit comments

Comments
 (0)