Skip to content

fix(windows): correct window restoration behavior after minimization - #4110

Merged
leaanthony merged 6 commits into
wailsapp:masterfrom
superDingda:bugfix/4109_restore_minimized_window
Apr 9, 2025
Merged

leaanthony merged 6 commits into
wailsapp:masterfrom
superDingda:bugfix/4109_restore_minimized_window

Conversation

@superDingda

@superDingda superDingda commented Mar 4, 2025 •

Copy link
Copy Markdown
Contributor

Description

After maximizing the window and minimizing it, waking it up through the singleton does not restore maximization

Fixes #4109

Type of change

Please select the option that is relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Wails Doctor          
                                


# Wails
Version | v2.9.2

# System
┌─────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Windows 10 Enterprise                                                    |
| Version      | 2009 (Build: 22631)                                                      |
| ID           | 23H2                                                                     |
| Go Version   | go1.22.9                                                                 |
| Platform     | windows                                                                  |
| Architecture | amd64                                                                    |
| CPU          | 13th Gen Intel(R) Core(TM) i9-13900H                                     |
| GPU 1        | NVIDIA GeForce RTX 3050 4GB Laptop GPU (NVIDIA) - Driver: 31.0.15.2799   |
| GPU 2        | Intel(R) Iris(R) Xe Graphics (Intel Corporation) - Driver: 31.0.101.4575 |
| Memory       | 32GB                                                                     |
└─────────────────────────────────────────────────────────────────────────────────────────┘


# Diagnosis
Optional package(s) installation details:
  - upx : Available at https://upx.github.io/
  - nsis : More info at https://wails.io/docs/guides/windows-installer/

 SUCCESS  Your system is ready for Wails development!

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
  • Windows
  • macOS
  • Linux

If you checked Linux, please specify the distro and version.

Test Configuration

Please paste the output of wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • Bug Fixes
    • Fixed window restoration behavior after minimization, ensuring windows consistently become visible when activated for a more reliable user experience.
  • Documentation
    • Added a new "Fixed" section in the changelog to categorize bug fixes separately, enhancing clarity for users.

@coderabbitai

coderabbitai Bot commented Mar 4, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The change updates the Restore method in the Form struct located in v2/internal/frontend/desktop/windows/winc/form.go. Instead of using the SW_RESTORE flag to restore a minimized window to its previous state, the method now uses the SW_SHOW flag to simply display the window. Additionally, a new "Fixed" section has been added to the changelog in website/src/pages/changelog.mdx, documenting the change in window restoration behavior. There are no changes to any exported or public entities.

Changes

File Change Summary
v2/internal/…/winc/form.go Modified the Restore method to call w32.ShowWindow(fm.hwnd, w32.SW_SHOW) instead of w32.ShowWindow(fm.hwnd, w32.SW_RESTORE), altering window visibility.
website/src/pages/changelog.mdx Added a new section titled "Fixed" documenting the window restoration behavior fix, with an entry attributed to @superDingda and referencing issue #4109.

Assessment against linked issues

Objective Addressed Explanation
Fix abnormal behavior when restoring a minimized Wails window (#[4109]) ✅

Possibly related PRs

  • fix: prevent unnecessary redraws during window minimize/restore #3955: The changes in the main PR, which modify the window restoration behavior in the Restore method of the Form struct, are related to the retrieved PR that addresses flickering issues during window minimize/restore actions, as both involve modifications to window management behavior, albeit in different contexts.

Suggested labels

awaiting feedback

Suggested reviewers

  • leaanthony

Poem

I'm a bunny with a codey beat,
Hopping in changes, oh so neat.
The window now shines in plain sight,
No more restoring from a minimized night.
With a twitch of a whisker, our code feels right! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5df9ac1 and 8dc509f.

📒 Files selected for processing (1)
  • website/src/pages/changelog.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • website/src/pages/changelog.mdx

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@leaanthony

Copy link
Copy Markdown
Member

Thanks 🙏 Please could you add an entry to the changelog located at docs/src/content/docs/changelog.mdx? Thanks!

@leaanthony

Copy link
Copy Markdown
Member

Thanks 🙏 Please could you add an entry to the changelog located at website/src/pages/changelog.mdx?

@superDingda

Copy link
Copy Markdown
Contributor Author

website/src/pages/changelog.mdx

Sorry, I just saw it. Should I add it below this?

## v2.10.1 - 2025-02-24

### Fixed
- Fixed [listenerOff issue](https://github.com/wailsapp/wails/issues/3850) by @leaanthony.
- Fixed issues building with `darwin/universal` target by @leaanthony.

@leaanthony

Copy link
Copy Markdown
Member

Underneath "Unreleased" near the top 👍

@sonarqubecloud

sonarqubecloud Bot commented Apr 9, 2025

Copy link
Copy Markdown

@superDingda

Copy link
Copy Markdown
Contributor Author

@leaanthony Could you please let me know if there are any specific rules or requirements for merging into the master branch?

This is my first time contributing to the project, and I’m still familiarizing myself with the process.
I would appreciate it if you could let me know if there are any adjustments needed for this PR, or if it doesn't meet the conditions for merging yet.

Thank you very much for your guidance and help!

@leaanthony
leaanthony merged commit 5b1caf0 into wailsapp:master Apr 9, 2025
@leaanthony

Copy link
Copy Markdown
Member

All good! And thank you 🙏

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.

[v2]Abnormal behavior when restoring a minimized Wails window on Windows.

2 participants