fix(dock): delay plugin resident status until drag release from quick…#1607
Merged
Ivy233 merged 1 commit intoMay 29, 2026
Merged
Conversation
8a42367 to
02bc92c
Compare
18202781743
reviewed
May 26, 2026
e420b79 to
7b9e530
Compare
18202781743
reviewed
May 27, 2026
7b9e530 to
62aacec
Compare
18202781743
approved these changes
May 27, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, Ivy233 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
62aacec to
4ba91a4
Compare
|
TAG Bot New tag: 2.0.43 |
… 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
4ba91a4 to
85f5135
Compare
deepin pr auto review你好!我是CodeGeeX,你的智能编程助手。我已经仔细审查了你提供的 Git Diff 内容。 本次修改的主要目的是统一拖放机制:将“快捷面板”的拖放逻辑与“收纳区”对齐,采用“暂存机制”进行处理;同时移除了在 总体来看,修改的意图是合理的,有助于统一代码路径。但在语法逻辑、代码质量和代码安全方面,我发现了一些需要关注和改进的地方。以下是详细的审查意见: 1. 语法与逻辑
2. 代码质量
3. 代码性能
4. 代码安全
💡 改进后的代码建议综合以上意见,我为你重构了这部分代码,请参考: // 顶部建议定义常量,避免魔法字符串
// const SOURCE_QUICK_PANEL = "quickPanel"
// const MIME_TRAY_DND_SECTION_TYPE = "text/x-dde-shell-tray-dnd-sectionType"
// ... [省略上下文] ...
onPositionChanged: function (dropEvent) {
// ... [前置逻辑] ...
let shouldAllowDrop = showStashActionVisible ? (dropHoverIndex !== 0) : (dropHoverIndex !== -1)
// 缓存计算结果,提升高频事件性能
let targetIndex = Math.floor(currentItemIndex)
if (shouldAllowDrop && (isStash || source === "quickPanel")) {
// 收纳区或快捷面板拖拽:使用暂存机制
DDT.TraySortOrderModel.stageDropPosition(surfaceId, targetIndex)
} else if (shouldAllowDrop) {
// 托盘内部拖拽:使用定时器机制
dropTrayTimer.handleDrop = function() {
if (isDropped || dragExited) return
DDT.TraySortOrderModel.dropToDockTray(surfaceId, targetIndex, isBefore)
}
dropTrayTimer.restart()
}
}
onDropped: function (dropEvent) {
let currentItemIndex = mapFromItem(dropEvent.x, dropEvent.y) // 假设的获取方式
let targetIndex = Math.floor(currentItemIndex)
let isBefore = dropIdx.isBefore
let isStash = dropEvent.getDataAsString("text/x-dde-shell-tray-dnd-sectionType") === "stashed"
// 移除调试用的 console.log
// console.log("dropped", targetIndex, isBefore, isStash)
// 从收纳区或快捷中心拖拽的使用暂存机制
if (isStash || source === "quickPanel") {
DDT.TraySortOrderModel.commitStagedDrop()
} else {
// 托盘内部拖拽直接提交
DDT.TraySortOrderModel.dropToDockTray(surfaceId, targetIndex, isBefore);
}
DDT.TraySortOrderModel.actionsAlwaysVisible = false
}
onExited: function () {
dragExited = true
DDT.TraySortOrderModel.clearStagedDrop()
// 修复:需要保留针对快捷面板拖拽取消时的状态清理逻辑
// 如果快捷面板拖入但未放下,需要确保其可见性状态被正确还原或处理
if (source === "quickPanel" && !isDropped) {
// dropTrayTimer.stop() 已不需要,因为快捷面板不再走定时器
// 但如果原先 setSurfaceVisible 是必须的清理步骤,请根据后端逻辑评估是否需要保留或替换
// DDT.TraySortOrderModel.setSurfaceVisible(surfaceId, false)
}
// Hide action icons when drag leaves tray without dropping
if (!isDropped) {
DDT.TraySortOrderModel.actionsAlwaysVisible = false
}
}最后确认:请务必确认 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… panel
Log: Fix plugins being marked as resident during drag instead of on drop
Influence:
fix(dock): 延迟插件驻留状态直到从快捷中心拖拽松手
Log: 修复插件在拖拽过程中被标记为驻留而非松手时标记的问题
Influence:
PMS: BUG-361185