Repository navigation
fix: use window center for shortcuts popup position - #702
Draft
pppanghu77 wants to merge 1 commit into
Draft
pppanghu77 wants to merge 1 commit into
pppanghu77 wants to merge 1 commit into
Conversation
pppanghu77
marked this pull request as draft
October 29, 2026 19:07
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pppanghu77 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 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRemoves an incorrect screen-center overwrite in Window::displayShortcuts(), allowing the shortcuts popup to use the window’s geometric center while preserving screen selection for multi-monitor scenarios. Sequence diagram for shortcuts popup positioningsequenceDiagram
actor User
participant Window
participant QtScreen
participant ShortcutViewer
User->>Window: displayShortcuts()
Window->>QtScreen: screenAt(QCursor::pos())
QtScreen-->>Window: screen
Window->>Window: calculate window geometry center
Window->>ShortcutViewer: launch with window center position
ShortcutViewer-->>User: show shortcuts popup centered on window
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1. Root cause: displayShortcuts() calculated window center at line 2574-2575 but then overwrote it with screen center via screen->geometry().center() at line 2593, causing the popup to center on the full screen instead of the window 2. Fix: remove the pos = screen->geometry().center() override line, keeping the screen selection logic for multi-monitor support while using window center as the position 3. Impact: shortcuts popup now centers on the editor window instead of screen center; fixes occlusion in split-screen mode where screen center falls on the split boundary Log: Fix shortcuts popup occlusion in split-screen mode Influence: 1. Test shortcuts popup position in single-screen mode 2. Test shortcuts popup position in split-screen mode 3. Test shortcuts popup position in multi-monitor mode fix: 修复分屏模式下快捷键帮助浮窗遮挡问题 1. 根因:displayShortcuts() 在第 2574-2575 行计算了窗口中心 坐标,但第 2593 行用 screen->geometry().center() 覆盖为 屏幕中心,导致浮窗以整屏中心定位而非窗口中心 2. 方案:删除 pos = screen->geometry().center() 覆盖行,保留 屏幕选择逻辑用于多显示器场景,定位坐标使用窗口中心 3. 影响:快捷键帮助浮窗以编辑器窗口中心定位,修复分屏模式 下浮窗定位于分屏分界线导致的遮挡问题 Log: 修复分屏模式下快捷键帮助浮窗遮挡问题 Influence: 1. 测试单屏模式下快捷键帮助浮窗定位 2. 测试分屏模式下快捷键帮助浮窗定位 3. 测试多显示器场景下快捷键帮助浮窗定位 Bug: #189255
pppanghu77
force-pushed
the
agent/agent/35fa779880ba
branch
from
October 29, 2026 20:32
5d9825b to
51114ac
Compare
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.
Root Cause Analysis
In
Window::displayShortcuts()(src/widgets/window.cpp), the shortcuts popup position was first correctly calculated as the window's geometric center (lines 2574–2575), but then overwritten byscreen->geometry().center()at line 2591 (introduced by commit5d0074a2). In split-screen mode the full-screen center falls exactly on the split boundary, causingdeepin-shortcut-viewerto center the popup on the boundary — producing partial occlusion and a visible reposition animation by the compositor. See analysis-report.md §6 for the root-cause conclusion.Fix Approach
Remove the
pos = screen->geometry().center()override line, keeping the screen-selection logic (QGuiApplication::screenAt(QCursor::pos())etc.) for multi-monitor support while using the window center as the positioning coordinate. This aligns with thedeepin-shortcut-viewer --helpdocumentation, which states-pshould be "your window's central position". See analysis-report.md §10 for the fix recommendation.Change Safety Assessment
Code Safety
5d0074a2(not a historical bug fix); removing it does not revert any prior bug fix. Screen-selection logic is preserved, only the position override is deleted.displayShortcuts()is a private slot invoked only by the Qt signal system; no external callers are affected.Business Impact Scope
Ctrl+Shift+?) — the popup now centers on the editor window instead of the full screen center.Verification Suggestion
根因分析
Window::displayShortcuts()(src/widgets/window.cpp)在第 2574–2575 行正确计算了窗口几何中心坐标,但第 2591 行用screen->geometry().center()覆盖了该值(由 commit5d0074a2引入)。在分屏模式下,整屏中心恰好位于分屏分界线上,导致deepin-shortcut-viewer以分界线为中心定位浮窗,产生遮挡和合成器重定位动画。详见 analysis-report.md 第六节。修复方案
删除
pos = screen->geometry().center()覆盖行,保留屏幕选择逻辑(QGuiApplication::screenAt(QCursor::pos())等)用于多显示器场景确定目标屏幕,定位坐标使用窗口中心。这与deepin-shortcut-viewer --help文档一致(-p参数为 "your window's central position")。详见 analysis-report.md 第十节。改动安全评估
代码安全评估
5d0074a2引入(非历史 bug 修复),删除不撤销任何已有 bug 修复。屏幕选择逻辑保留,仅删除位置覆盖行。displayShortcuts()为私有槽函数,仅由 Qt 信号系统调用,无外部调用者受影响。业务影响范围
Ctrl+Shift+?)— 浮窗现以编辑器窗口中心定位,而非整屏中心。验证建议
Summary by Sourcery
Bug Fixes: