Skip to content

Commit 4ba91a4

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 4d8c9f8 commit 4ba91a4

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

panels/dock/tray/package/TrayContainer.qml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@ Item {
191191

192192
// 根据 ActionShowStashDelegate 的显示状态动态改变条件
193193
let shouldAllowDrop = showStashActionVisible ? (dropHoverIndex !== 0) : (dropHoverIndex !== -1)
194-
195-
// 使用暂存机制
196-
if (isStash && shouldAllowDrop) {
197-
// 调用 stageDropPosition 来预览拖放位置,预留空位
194+
195+
if (shouldAllowDrop && (isStash || source === "quickPanel")) {
196+
// 收纳区或快捷面板拖拽:使用暂存机制
198197
DDT.TraySortOrderModel.stageDropPosition(surfaceId, Math.floor(currentItemIndex))
199-
} else if (!isStash && shouldAllowDrop) {
198+
} else if (shouldAllowDrop) {
199+
// 托盘内部拖拽:使用定时器机制
200200
dropTrayTimer.handleDrop = function() {
201201
if (isDropped || dragExited) return
202202
DDT.TraySortOrderModel.dropToDockTray(surfaceId, Math.floor(currentItemIndex), isBefore)
@@ -215,11 +215,12 @@ Item {
215215
let isBefore = dropIdx.isBefore
216216
let isStash = dropEvent.getDataAsString("text/x-dde-shell-tray-dnd-sectionType") === "stashed"
217217
console.log("dropped", currentItemIndex, isBefore, isStash)
218-
219-
if (isStash) {
220-
// 提交暂存的拖放位置
218+
219+
// 从收纳区或快捷中心拖拽的使用暂存机制
220+
if (isStash || source === "quickPanel") {
221221
DDT.TraySortOrderModel.commitStagedDrop()
222222
} else {
223+
// 托盘内部拖拽直接提交
223224
DDT.TraySortOrderModel.dropToDockTray(surfaceId, Math.floor(currentItemIndex), isBefore);
224225
}
225226
DDT.TraySortOrderModel.actionsAlwaysVisible = false
@@ -228,11 +229,6 @@ Item {
228229
onExited: function () {
229230
dragExited = true
230231
DDT.TraySortOrderModel.clearStagedDrop()
231-
// dragging from quickPanel, entered trayContainer, but not dropped in this area
232-
if (source !== "" && !isDropped) {
233-
dropTrayTimer.stop()
234-
DDT.TraySortOrderModel.setSurfaceVisible(surfaceId, false)
235-
}
236232
// Hide action icons when drag leaves tray without dropping
237233
if (!isDropped) {
238234
DDT.TraySortOrderModel.actionsAlwaysVisible = false

0 commit comments

Comments
 (0)