Skip to content

fix: ensure popup geometry is applied before setting plugin position - #486

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:master
Jul 28, 2026
Merged

fix: ensure popup geometry is applied before setting plugin position#486
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743

@18202781743 18202781743 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor
  1. Added call to setGeometryFromApplyConfigure in plugin_popup_geometry
  2. Popup geometry was being set after plugin position, causing layout
    issues
  3. This ensures the popup surface has its geometry correctly updated
    before positioning
  4. Prevents visual glitches and incorrect positioning in tray popups

Log: Fixed popup geometry application order for tray popups

Influence:

  1. Test tray popup positioning in different screen configurations
  2. Verify popup geometry matches expected dimensions after resize
  3. Test with multiple monitors and different scale factors
  4. Verify no visual glitches when opening/closing tray popups
  5. Test popup behavior with different tray icon implementations

fix: 在设置插件位置前确保应用弹出窗口几何

  1. 在 plugin_popup_geometry 中添加 setGeometryFromApplyConfigure 调用
  2. 弹出窗口几何信息在设置插件位置后才设置,导致布局问题
  3. 这确保弹出窗口表面在定位前正确更新其几何信息
  4. 防止托盘弹出窗口出现视觉故障和错误定位

Log: 修复托盘弹出窗口的几何应用顺序

Influence:

  1. 测试不同屏幕配置下的托盘弹出窗口定位
  2. 验证调整大小后弹出窗口几何信息符合预期尺寸
  3. 在多个显示器和不同缩放比例下测试
  4. 验证打开/关闭托盘弹出窗口时无视觉故障
  5. 使用不同的托盘图标实现测试弹出窗口行为

PMS: BUG-370143

Summary by Sourcery

Bug Fixes:

  • Update popup geometry before setting plugin position so tray popups use correct size and placement.

1. Added call to setGeometryFromApplyConfigure in plugin_popup_geometry
2. Popup geometry was being set after plugin position, causing layout
issues
3. This ensures the popup surface has its geometry correctly updated
before positioning
4. Prevents visual glitches and incorrect positioning in tray popups

Log: Fixed popup geometry application order for tray popups

Influence:
1. Test tray popup positioning in different screen configurations
2. Verify popup geometry matches expected dimensions after resize
3. Test with multiple monitors and different scale factors
4. Verify no visual glitches when opening/closing tray popups
5. Test popup behavior with different tray icon implementations

fix: 在设置插件位置前确保应用弹出窗口几何

1. 在 plugin_popup_geometry 中添加 setGeometryFromApplyConfigure 调用
2. 弹出窗口几何信息在设置插件位置后才设置,导致布局问题
3. 这确保弹出窗口表面在定位前正确更新其几何信息
4. 防止托盘弹出窗口出现视觉故障和错误定位

Log: 修复托盘弹出窗口的几何应用顺序

Influence:
1. 测试不同屏幕配置下的托盘弹出窗口定位
2. 验证调整大小后弹出窗口几何信息符合预期尺寸
3. 在多个显示器和不同缩放比例下测试
4. 验证打开/关闭托盘弹出窗口时无视觉故障
5. 使用不同的托盘图标实现测试弹出窗口行为

PMS: BUG-370143
@sourcery-ai

sourcery-ai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Ensures tray popup surfaces apply their configured geometry before setting the plugin position, fixing ordering-related layout and visual issues.

Sequence diagram for updated popup geometry application order

sequenceDiagram
    participant PluginPopupSurface
    participant m_popup
    participant plugin

    PluginPopupSurface->>PluginPopupSurface: plugin_popup_geometry(x, y, width, height)
    Note right of PluginPopupSurface: rect is normalized with window size
    PluginPopupSurface->>PluginPopupSurface: setGeometryFromApplyConfigure(rect.topLeft, rect.size)
    PluginPopupSurface->>m_popup: setPluginPos(QPoint(x, y))
    PluginPopupSurface->>plugin: eventGeometry(rect)
Loading

File-Level Changes

Change Details Files
Apply popup geometry before setting plugin position to fix tray popup layout issues.
  • Call setGeometryFromApplyConfigure with the computed rect’s top-left and size inside plugin_popup_geometry
  • Ensure popup surface geometry is updated before calling m_popup->setPluginPos
  • Preserve existing fallback behavior for zero/negative width and height when computing rect
src/tray-wayland-integration/pluginsurface.cpp

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

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:95分

■ 【总体评价】

代码修复了Wayland环境下弹窗几何属性未应用的问题,逻辑正确且无安全风险。
修改精准地补全了缺失的函数调用,显著提升了系统托盘插件的显示正确性。

■ 【详细分析】

  • 1.语法逻辑(基本正确)✓

PluginPopupSurface::plugin_popup_geometry函数中,新增的setGeometryFromApplyConfigure(rect.topLeft(), rect.size());调用参数类型匹配正确,放置在尺寸计算之后、发送信号之前,执行顺序合理。
潜在问题:无
建议:无

  • 2.代码质量(良好)✓

修改直接针对问题根源,补全了将计算后的rect应用到Wayland surface的关键步骤,代码简洁明了。
潜在问题:无
建议:无

  • 3.代码性能(无性能问题)✓

仅增加一次成员函数调用,未引入循环或复杂计算,对性能无负面影响。
潜在问题:无
建议:无

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次修改仅涉及UI几何属性设置,不涉及外部输入处理、文件操作或网络通信,不存在安全风险。

  • 建议:无

■ 【改进建议代码示例】

// 当前代码已正确修复问题,无需额外修改
void PluginPopupSurface::plugin_popup_geometry(int32_t x, int32_t y, int32_t width, int32_t height) {
    // ... 前置计算逻辑 ...
    if (rect.width() <= 0)
        rect.setWidth(m_window->width());
    if (rect.height() <= 0)
        rect.setHeight(m_window->height());

    setGeometryFromApplyConfigure(rect.topLeft(), rect.size());
    m_popup->setPluginPos(QPoint(x, y));
    if (plugin) {
        Q_EMIT plugin->eventGeometry(rect);
    }
}

@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 left some high level feedback:

  • It might be worth clarifying or asserting the relationship between the (x, y) parameters and rect.topLeft() so that setGeometryFromApplyConfigure and setPluginPos remain consistent if future changes alter how rect is computed.
  • If setGeometryFromApplyConfigure has side effects such as triggering repaints or signals, consider adding a brief code comment explaining why it must precede setPluginPos to prevent future reordering from reintroducing the bug.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- It might be worth clarifying or asserting the relationship between the (x, y) parameters and rect.topLeft() so that setGeometryFromApplyConfigure and setPluginPos remain consistent if future changes alter how rect is computed.
- If setGeometryFromApplyConfigure has side effects such as triggering repaints or signals, consider adding a brief code comment explaining why it must precede setPluginPos to prevent future reordering from reintroducing the bug.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, BLumia

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

@18202781743

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

This pr force merged! (status: behind)

@deepin-bot
deepin-bot Bot merged commit 4075dcd into linuxdeepin:master Jul 28, 2026
11 of 12 checks passed
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