Repository navigation
fix: disable maximize button to prevent flicker - #831
Open
pppanghu77 wants to merge 1 commit into
Open
pppanghu77 wants to merge 1 commit into
pppanghu77 wants to merge 1 commit into
Conversation
|
TAG Bot TAG: 0.8.9 |
|
[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 |
1. Root cause: setFixedSize(500,630) does not prevent WM from maximizing the window; DTitlebar maximize button remained enabled 2. Fix: disable Qt::WindowMaximizeButtonHint in initTitleBar() so the fixed-size window cannot be maximized, eliminating size jumps 3. Impact: maximize button is no longer clickable; minimize button behavior unchanged; Windows platform unaffected (separate impl) Log: Disabled maximize button on fixed-size window to prevent flicker Influence: 1. Verify maximize button is disabled on Linux main window 2. Verify window still functions normally (settings, refresh, menu) 3. Verify onlyTransfer mode still disables minimize button correctly fix: 禁用最大化按钮防止固定尺寸窗口闪屏 1. 根因:setFixedSize(500,630) 不能阻止窗口管理器最大化窗口, DTitlebar 最大化按钮仍可用 2. 方案:在 initTitleBar() 中禁用 Qt::WindowMaximizeButtonHint, 使固定尺寸窗口无法被最大化,消除尺寸跳变 3. 影响:最大化按钮不可点击;最小化按钮行为不变; Windows 平台不受影响(独立实现) Log: 禁用固定尺寸窗口的最大化按钮以防止闪屏 Influence: 1. 验证 Linux 主窗口最大化按钮已被禁用 2. 验证窗口其他功能正常(设置、刷新、菜单) 3. 验证 onlyTransfer 模式仍正常禁用最小化按钮 Bug: https://pms.uniontech.com/bug-view-329609.html
pppanghu77
force-pushed
the
agent/agent/aa43b9fb513e
branch
from
October 28, 2026 18:17
86deee1 to
62d1c8a
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: 无需修改。 2. 代码质量 ✅评价: 代码结构清晰 ✅ 通过 潜在问题: 建议: 建议在 setWindowFlags 调用上方添加注释,如: // 禁用最大化按钮,避免窗口闪烁 q->setWindowFlags(q->windowFlags() & ~Qt::WindowMaximizeButtonHint); 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: 无需优化。 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: 无需安全加固。 💡 改进建议代码示例// 建议补充行内注释,提升可维护性 void MainWindowPrivate::initTitleBar() {
bool isOnlyTransfer = qApp->property("onlyTransfer").toBool();
auto titleBar = q->titlebar();
// 禁用最大化按钮,避免窗口闪烁
q->setWindowFlags(q->windowFlags() & ~Qt::WindowMaximizeButtonHint);
if (!isOnlyTransfer) {
titleBar->setIcon(QIcon::fromTheme("dde-cooperation"));
}
}本报告由 AI 代码审查工具自动生成 |
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
dde-cooperation's main window uses
setFixedSize(500, 630)to lock its size, but this does not prevent the window manager from maximizing the window — the DTitlebar maximize button remained enabled. When the user maximizes and then restores, the window jumps through multiple sizes (500×630 → fullscreen → 500×630), producing multiple paint events at different sizes that the compositor shows frame-by-frame as flicker. The codebase has nochangeEvent/QWindowStateChangeEventhandler to intercept the state transition (confirmed by repo-wide search returning zero hits).Fix
Disable the maximize button by clearing
Qt::WindowMaximizeButtonHintininitTitleBar(), right after obtaining the titlebar and before theisOnlyTransferbranch, so it applies to all modes. This prevents the fixed-size window from being maximized at all, eliminating the size jump at its source. The implementation follows the exact same pattern already used in theisOnlyTransferbranch for disabling the minimize button.Change Safety Assessment
Code Safety
setWindowFlags & ~Qt::WindowMaximizeButtonHint) following the established pattern already present in the same function for the minimize buttongit blame); no existing fix is revertedReferences=0in change-safety gather)Business Impact Scope
mainwindow_p_win.cpp)Verification Suggestion
Open dde-cooperation and confirm the maximize button is gone from the title bar; verify minimize/close buttons and the settings menu still work normally; verify the window cannot be maximized via double-click on title bar or keyboard shortcuts.
根因分析
dde-cooperation 主窗口使用
setFixedSize(500, 630)锁定尺寸,但这不能阻止窗口管理器最大化窗口——DTitlebar 最大化按钮仍可点击。用户最大化后还原时,窗口在多个尺寸间跳变(500×630 → 全屏 → 500×630),产生多次不同尺寸的 paint 事件,组合器逐帧展示即闪屏。代码中无changeEvent/QWindowStateChangeEvent处理来拦截状态转换(全仓搜索零命中确认)。修复方案
在
initTitleBar()中获取 titlebar 后、isOnlyTransfer分支前,清除Qt::WindowMaximizeButtonHint禁用最大化按钮,对所有模式生效。这使固定尺寸窗口无法被最大化,从根源消除尺寸跳变。实现方式与同函数中isOnlyTransfer分支已有的禁用最小化按钮模式完全一致。改动安全评估
代码安全评估
setWindowFlags & ~Qt::WindowMaximizeButtonHint),遵循同函数中已有的禁用最小化按钮模式git blame确认),不撤销任何已有修复References=0)业务影响范围
mainwindow_p_win.cpp)验证建议
打开 dde-cooperation 确认标题栏最大化按钮已消失;验证最小化/关闭按钮和设置菜单正常工作;验证窗口无法通过双击标题栏或键盘快捷键最大化。
Summary by Sourcery
Prevent the fixed-size Linux main window from being maximized to eliminate resize flicker.
Bug Fixes:
Enhancements:
Chores: