Skip to content

fix: resolve abnormal compositor window size due to popup panel heigh…#1535

Open
yixinshark wants to merge 1 commit intolinuxdeepin:masterfrom
yixinshark:fix-popupSizeChanged
Open

fix: resolve abnormal compositor window size due to popup panel heigh…#1535
yixinshark wants to merge 1 commit intolinuxdeepin:masterfrom
yixinshark:fix-popupSizeChanged

Conversation

@yixinshark
Copy link
Copy Markdown
Contributor

@yixinshark yixinshark commented Mar 26, 2026

…t change

Refactored the QML bindings handling the width and height of the popup window. By introducing requestedWidth and requestedHeight and explicitly passing them to the native window bounds via setWindowGeometry, we prevent uncoordinated and recurrent Wayland resize events from corrupting the compositor window geometries during dynamic plugin panel dimension adjustments.

修复:解决因弹出面板尺寸变化导致顶层合成器显示窗口大小异常的缺陷

重构了处理弹出面板宽高的 QML 绑定逻辑。通过引入 requestedWidth
和 requestedHeight 参数,并通过 setWindowGeometry 显式设置底层原 生窗口状态,可以避免在插件动态调整面板尺寸时,高频和未协调的
Wayland 尺寸挂载事件破坏合成器渲染的窗口几何形状。

Log: resolve abnormal compositor window size due to popup panel height change
Pms: BUG-307129 BUG-336777

Summary by Sourcery

Stabilize popup window geometry updates to prevent compositor window size corruption when popup panel dimensions change.

Bug Fixes:

  • Prevent abnormal compositor window sizes caused by rapid popup panel height and width changes under Wayland.

Enhancements:

  • Introduce requestedWidth/requestedHeight properties and a native setWindowGeometry call to coordinate popup size and position updates more reliably.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: yixinshark

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

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 26, 2026

Reviewer's Guide

Refactors popup panel sizing to use separate requested dimensions and a native setWindowGeometry call, preventing Wayland-driven resize loops from corrupting compositor window geometry when the popup panel size changes.

Sequence diagram for popup window geometry update on panel resize

sequenceDiagram
    participant PluginPanel
    participant PanelPopupQML
    participant PanelPopupWindowQML
    participant PopupWindowCpp
    participant WaylandCompositor

    PluginPanel->>PanelPopupQML: change popup.width and popup.height
    PanelPopupQML->>PanelPopupWindowQML: Binding requestedWidth = popup.width
    PanelPopupQML->>PanelPopupWindowQML: Binding requestedHeight = popup.height

    PanelPopupWindowQML->>PanelPopupWindowQML: onRequestedWidthChanged
    PanelPopupWindowQML->>PanelPopupWindowQML: onRequestedHeightChanged
    PanelPopupWindowQML->>PanelPopupWindowQML: requestUpdateGeometry()

    PanelPopupWindowQML->>PanelPopupWindowQML: updateGeometry()
    alt invalid requested size (<= 10)
        PanelPopupWindowQML->>PanelPopupWindowQML: set width and height to requestedWidth and requestedHeight
    else valid requested size
        PanelPopupWindowQML->>PanelPopupWindowQML: compute newX and newY within screen bounding
        PanelPopupWindowQML->>PopupWindowCpp: setWindowGeometry(newX, newY, requestedWidth, requestedHeight)
        PopupWindowCpp->>PopupWindowCpp: setGeometry(px, py, pw, ph)
        PopupWindowCpp->>WaylandCompositor: update surface geometry
    end
Loading

Class diagram for PopupWindow native geometry control

classDiagram
    class QQuickApplicationWindow {
    }

    class PopupWindow {
        +PopupWindow(parent: QWindow)
        +setWindowGeometry(px: int, py: int, pw: int, ph: int)
        -mouseReleaseEvent(event: QMouseEvent)
    }

    QQuickApplicationWindow <|-- PopupWindow
Loading

File-Level Changes

Change Details Files
Introduce separate requested popup dimensions and drive geometry updates from them instead of from the actual window size.
  • Add requestedWidth and requestedHeight properties on the popup window root item with sensible initial values.
  • Update geometry calculation logic to use requestedWidth/requestedHeight instead of width/height when validating sizes and computing bounding positions.
  • Reset requestedWidth/requestedHeight alongside width/height when closing the popup window.
frame/qml/PanelPopupWindow.qml
Route panel content size into requested dimensions and apply them atomically via a native window geometry setter to avoid uncoordinated Wayland resizes.
  • Change bindings from popupWindow.width/height to popupWindow.requestedWidth/requestedHeight so size changes flow into the requested dimension properties rather than directly resizing the window.
  • Add onRequestedWidthChanged/onRequestedHeightChanged handlers to trigger geometry recomputation instead of listening to width/height changes.
  • Compute x/y with new requested dimensions and invoke setWindowGeometry(x, y, requestedWidth, requestedHeight) to update the underlying window in one step.
frame/qml/PanelPopupWindow.qml
frame/qml/PanelPopup.qml
Expose a native API to set window geometry atomically from QML.
  • Add Q_INVOKABLE setWindowGeometry(int px, int py, int pw, int ph) to PopupWindow and implement it to call setGeometry(px, py, pw, ph).
frame/popupwindow.h
frame/popupwindow.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

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

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:

  • The 10 sentinel used for requestedWidth/requestedHeight and the <= 10 checks appears in multiple places; consider extracting a named constant or using a more explicit sentinel (e.g., 0 or undefined plus an isValid check) to make the intent clearer and avoid magic numbers.
  • The width/height reset logic in reset() and the early-return condition in updateGeometryer both depend on the same sentinel semantics; it may be cleaner to centralize this reset/initialization behavior in a helper so that the lifecycle of requested vs. actual size is easier to follow and less error-prone.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `10` sentinel used for `requestedWidth`/`requestedHeight` and the `<= 10` checks appears in multiple places; consider extracting a named constant or using a more explicit sentinel (e.g., 0 or undefined plus an `isValid` check) to make the intent clearer and avoid magic numbers.
- The width/height reset logic in `reset()` and the early-return condition in `updateGeometryer` both depend on the same sentinel semantics; it may be cleaner to centralize this reset/initialization behavior in a helper so that the lifecycle of requested vs. actual size is easier to follow and less error-prone.

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.

@yixinshark yixinshark force-pushed the fix-popupSizeChanged branch 2 times, most recently from dc1e982 to 77f9df4 Compare March 26, 2026 08:17
…t change

Refactored the QML bindings handling the width and height of the
popup window. By introducing requestedWidth and requestedHeight
and explicitly passing them to the native window bounds via
setWindowGeometry, we prevent uncoordinated and recurrent Wayland
resize events from corrupting the compositor window geometries
during dynamic plugin panel dimension adjustments.

修复:解决因弹出面板尺寸变化导致顶层合成器显示窗口大小异常的缺陷

重构了处理弹出面板宽高的 QML 绑定逻辑。通过引入 requestedWidth
和 requestedHeight 参数,并通过 setWindowGeometry 显式设置底层原
生窗口状态,可以避免在插件动态调整面板尺寸时,高频和未协调的
Wayland 尺寸挂载事件破坏合成器渲染的窗口几何形状。

Log: resolve abnormal compositor window size due to popup panel height change
Pms: BUG-307129 BUG-336777
@yixinshark yixinshark force-pushed the fix-popupSizeChanged branch from 77f9df4 to 587efce Compare March 27, 2026 03:36
return
currentItem = null
root.requestedWidth = 10
root.requestedHeight = 10
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

    root.width = 10
    root.height = 10

设置宽度的地方是不是应该都去掉,改成root.setWindowGeometry(

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