Skip to content

fix: use availableGeometry for quake window to avoid dock overlap - #592

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/agent/262464502504
Nov 11, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/agent/262464502504

Conversation

@pengfeixx

@pengfeixx pengfeixx commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Root Cause Analysis

QuakeWindow::resizeByCurrentScreen and getQuakeHeight used QScreen::geometry() (full screen rectangle) instead of availableGeometry() (usable work area excluding dock). When the dock position switched to top/left/right, the availableGeometryChanged signal triggered slotWorkAreaResized → resizeByCurrentScreen(true), but the window was repositioned using the full-screen rect, causing it to overlap the dock. The historical fix 298e3ca (which used availableGeometry) was only on old-master and never merged into master; the master refactor (57b7c43) reintroduced geometry().

Fix

Replace geometry() with availableGeometry() at 4 call sites in src/main/mainwindow.cpp: resizeByCurrentScreen (width L3605, topLeft L3606, maxHeight L3609) and getQuakeHeight (default height L3746). When no dock is present, availableGeometry() equals geometry(), so behavior is unchanged.

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • No signature changes, no public member changes, no new functions. Target lines are not a historical fix product on master (298e3ca was old-master only).
  • Affected callers (slotWorkAreaResized, animation start/end values, animation duration calc) all benefit from the corrected geometry; no behavioral regression.

Business Impact Scope

Affected module: Quake Window (雷神窗口) positioning and height calculation. User scenario: after opening the quake window and switching the dock to top/left/right, the window no longer overlaps the dock.

Verification Suggestion

Test quake window with dock at bottom (regression), top/left/right (fix scenario), and after switching dock position while the window is open. Verify no-dock environment is unchanged.


根因分析

QuakeWindow::resizeByCurrentScreen 和 getQuakeHeight 使用 QScreen::geometry()(全屏矩形)而非 availableGeometry()(扣除 dock 的可用区域)。dock 位置切换至顶部/左侧/右侧时,availableGeometryChanged 信号触发 slotWorkAreaResized → resizeByCurrentScreen(true),但窗口按全屏矩形重新定位,导致遮挡 dock。历史修复 298e3ca(使用 availableGeometry)仅在 old-master,未合入 master;master 重构(57b7c437)重新引入了 geometry()。

修复方案

将 src/main/mainwindow.cpp 中 4 处 geometry() 替换为 availableGeometry():resizeByCurrentScreen(宽度 L3605、左上角 L3606、最大高度 L3609)和 getQuakeHeight(默认高度 L3746)。dock 不存在时 availableGeometry() 与 geometry() 返回值相同,行为不变。

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • 无签名变更、无公开成员变更、无新增函数。master 上目标行非历史修复产物(298e3cac 仅在 old-master 不可达)。
  • 受影响调用者(slotWorkAreaResized、动画起止值、动画时长计算)均受益于修正后的几何计算,无行为回归。

业务影响范围

受影响模块:雷神窗口定位与高度计算。用户场景:打开雷神窗口后切换 dock 至顶部/左侧/右侧时,窗口不再遮挡 dock。

验证建议

测试 dock 在底部(回归)、顶部/左侧/右侧(修复场景)时的雷神窗口,以及窗口打开后切换 dock 位置。验证无 dock 环境行为不变。

Summary by Sourcery

Use each screen’s available work area for quake window sizing and positioning.

Bug Fixes:

  • Prevent the quake window from overlapping the dock by basing its position, width, and height limits on the screen’s available work area.
  • Preserve existing behavior when no dock reduces the available screen area.

1. Root cause: QuakeWindow::resizeByCurrentScreen and getQuakeHeight
   used QScreen::geometry() (full screen rect) instead of
   availableGeometry() (work area excluding dock), so the quake window
   covered the dock when dock moved to top/left/right
2. Fix: replace geometry() with availableGeometry() at 4 call sites in
   resizeByCurrentScreen (width, topLeft, maxHeight) and getQuakeHeight
   (default height) so the window is positioned within the usable area
3. Impact: when no dock is present availableGeometry() equals
   geometry(), so behavior is unchanged; when dock is present the quake
   window no longer overlaps the dock after position switches

Log: fix quake window overlapping dock after switching dock position

Influence:
1. Test quake window with dock at bottom (regression, behavior unchanged)
2. Test quake window with dock at top/left/right (fix scenario)
3. Test switching dock position while quake window is open
4. Test quake window with no dock present

fix: 雷神窗口使用 availableGeometry 避免遮挡任务栏

1. 根因:QuakeWindow::resizeByCurrentScreen 和 getQuakeHeight 使用
   QScreen::geometry()(全屏矩形)而非 availableGeometry()(扣除
   dock 的可用区域),导致 dock 切换至顶部/左侧/右侧时雷神窗口
   覆盖 dock
2. 方案:将 resizeByCurrentScreen 中 width、topLeft、maxHeight 三处
   及 getQuakeHeight 默认高度处的 geometry() 替换为
   availableGeometry(),使窗口定位在可用区域内
3. 影响:dock 不存在时 availableGeometry() 与 geometry() 返回值相同,
   行为不变;dock 存在时雷神窗口不再遮挡 dock

Log: 修复切换任务栏位置后雷神窗口遮挡任务栏的问题

Influence:
1. 测试 dock 在底部时雷神窗口(回归,行为不变)
2. 测试 dock 在顶部/左侧/右侧时雷神窗口(修复场景)
3. 测试雷神窗口打开后切换 dock 位置
4. 测试无 dock 环境下雷神窗口

PMS: BUG-378923
@pengfeixx
pengfeixx marked this pull request as draft November 6, 2026 22:25
@sourcery-ai

sourcery-ai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Use each screen’s available geometry for the quake window’s position and size so it stays within the usable work area when the dock moves.

  • src/main/mainwindow.cpp L3605-3609, L3746

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@pengfeixx
pengfeixx marked this pull request as ready for review November 11, 2026 06:07
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, pengfeixx

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pengfeixx

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit ca4b3e2 into linuxdeepin:master Nov 11, 2026
13 checks passed
@pengfeixx
pengfeixx deleted the agent/agent/262464502504 branch November 11, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants