Skip to content

fix: update m_preMaxFlag when window state changes#673

Merged
max-lvs merged 1 commit into
linuxdeepin:release/eaglefrom
Resurgamz:release/eagle
May 13, 2026
Merged

fix: update m_preMaxFlag when window state changes#673
max-lvs merged 1 commit into
linuxdeepin:release/eaglefrom
Resurgamz:release/eagle

Conversation

@Resurgamz
Copy link
Copy Markdown

@Resurgamz Resurgamz commented May 13, 2026

Add m_preMaxFlag update in changeEvent to ensure tray icon restores correct window size after manual resize operations.

修复窗口状态改变时未更新最大化标志位的问题,确保托盘打开时能正确恢复窗口大小。

Log: 修复托盘打开窗口大小异常的问题
Bug: https://pms.uniontech.com/bug-view-244221.html
Influence: 用户调整窗口大小后,通过托盘打开窗口时能正确恢复之前的大小

Summary by Sourcery

Bug Fixes:

  • Fix incorrect window size restoration when reopening the player from the system tray after manually resizing the window.

Add m_preMaxFlag update in changeEvent to ensure tray icon restores
correct window size after manual resize operations.

修复窗口状态改变时未更新最大化标志位的问题,确保托盘打开时能正确恢复窗口大小。

Log: 修复托盘打开窗口大小异常的问题
Bug: https://pms.uniontech.com/bug-view-244221.html
Influence: 用户调整窗口大小后,通过托盘打开窗口时能正确恢复之前的大小
@deepin-ci-robot
Copy link
Copy Markdown

Hi @Resurgamz. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

CLA Assistant Lite bot:
提交邮箱中包含我们的合作伙伴,但您似乎并非合作伙伴的成员或对接人,请联系相关对接人将您添加至组织之中,或由其重新发起 Pull Request。
The commit email domain belongs to one of our partners, but it seems you are not yet a member of the current organization, please contact the contact person to add you to the organization or let them submit the Pull Request.

zhangjiarui seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 13, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the main window’s changeEvent handler so that the pre-maximized-state flag (m_preMaxFlag) is kept in sync with window state changes, while avoiding interference with minimize-to-tray behavior, ensuring that restoring the window from the tray uses the correct size/maximized state after manual resizes.

Flow diagram for updated window state change handling

flowchart TD
    A[QEvent_WindowStateChange received in changeEvent] --> B[stopAnimation on m_playQueueWidget]
    B --> C{isMinimized}
    C -->|true| D[m_preMaxFlag unchanged]
    C -->|false| E[set m_preMaxFlag = isMaximized]
    E --> F[Tray restore uses m_preMaxFlag to restore window size]
    D --> F
Loading

File-Level Changes

Change Details Files
Keep the pre-maximized-state flag in sync on window state changes without affecting minimize-to-tray logic.
  • Add logic in changeEvent to update the pre-maximized-state flag when the window state changes and the window is not minimized
  • Guard the m_preMaxFlag update with an isMinimized check to avoid conflicts with tray minimize behavior
src/music-player/mainFrame/mainframe.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:

  • Consider casting event to QWindowStateChangeEvent and using its oldState()/newState() to drive m_preMaxFlag updates, so you explicitly track transitions (e.g., avoid relying on isMinimized() checks that happen after the state change).
  • The new comment is helpful; consider expanding it slightly to clarify how this logic interacts with the tray minimize/restore path so future maintainers understand why minimization is treated specially.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider casting `event` to `QWindowStateChangeEvent` and using its `oldState()`/`newState()` to drive `m_preMaxFlag` updates, so you explicitly track transitions (e.g., avoid relying on `isMinimized()` checks that happen after the state change).
- The new comment is helpful; consider expanding it slightly to clarify how this logic interacts with the tray minimize/restore path so future maintainers understand why minimization is treated specially.

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: max-lvs, Resurgamz

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

@max-lvs max-lvs merged commit d1b4054 into linuxdeepin:release/eagle May 13, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants