fix: ensure minimum OSD window size to prevent zero-size protocol error#1593
Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom May 9, 2026
Merged
fix: ensure minimum OSD window size to prevent zero-size protocol error#1593deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
Conversation
BLumia
reviewed
May 9, 2026
BLumia
previously approved these changes
May 9, 2026
Use Math.max to enforce a minimum size of 60px for OSD window width and height when osdView is null or has zero dimensions, preventing Wayland protocol errors caused by zero-size windows. Log: Fixed OSD window width=0 protocol error by enforcing minimum size Influence: 1. Test OSD notifications display correctly with various content sizes 2. Verify no Wayland protocol error when osdView dimensions are zero 3. Test OSD window positioning and display under different screen configurations fix: 确保 OSD 窗口最小尺寸以防止零尺寸协议错误 使用 Math.max 为 OSD 窗口的宽度和高度设置 60px 的最小尺寸限制,当 osdView 为空或尺寸为零时防止因零尺寸窗口导致的 Wayland 协议错误。 Log: 修复 OSD 窗口 width=0 协议错误,强制设置最小尺寸 Influence: 1. 测试不同内容大小下 OSD 通知的正常显示 2. 验证 osdView 尺寸为零时不会出现 Wayland 协议错误 3. 测试不同屏幕配置下 OSD 窗口的定位和显示 PMS: BUG-344893
BLumia
approved these changes
May 9, 2026
deepin pr auto review这段代码修改主要涉及版权年份更新和窗口尺寸计算逻辑的优化。以下是详细的审查意见和改进建议: 1. 语法逻辑审查修改点: // 原代码
width: osdView ? osdView.width : 100
height: osdView ? osdView.height : 100
// 新代码
width: Math.max(osdView?.width ?? 0, 60)
height: Math.max(osdView?.height ?? 0, 60)分析:
潜在问题:
2. 代码质量审查优点:
建议改进:
readonly property int minWindowSize: 60
width: Math.max(osdView?.width ?? 0, minWindowSize)
height: Math.max(osdView?.height ?? 0, minWindowSize)
3. 代码性能审查性能影响:
优化建议: Binding {
target: root
property: "width"
value: Math.max(osdView?.width ?? 0, minWindowSize)
when: osdView !== null
}4. 代码安全审查安全考虑:
潜在风险:
width: Math.max(Number(osdView?.width ?? 0) || 0, minWindowSize)
height: Math.max(Number(osdView?.height ?? 0) || 0, minWindowSize)综合改进建议代码Window {
id: root
readonly property int minWindowSize: 60
width: Math.max(Number(osdView?.width ?? 0) || 0, minWindowSize)
height: Math.max(Number(osdView?.height ?? 0) || 0, minWindowSize)
// ... 其他代码
}总结这次修改总体上是积极的改进,使用了更现代的语法并增强了代码的健壮性。主要需要注意:
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, mhduiy 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 |
Contributor
Author
|
/forcemerge |
|
This pr force merged! (status: blocked) |
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.
Use Math.max to enforce a minimum size of 60px for OSD window width and height when osdView is null or has zero dimensions, preventing Wayland protocol errors caused by zero-size windows.
Log: Fixed OSD window width=0 protocol error by enforcing minimum size
Influence:
fix: 确保 OSD 窗口最小尺寸以防止零尺寸协议错误
使用 Math.max 为 OSD 窗口的宽度和高度设置 60px 的最小尺寸限制,当
osdView 为空或尺寸为零时防止因零尺寸窗口导致的 Wayland 协议错误。
Log: 修复 OSD 窗口 width=0 协议错误,强制设置最小尺寸
Influence:
PMS: BUG-344893