Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3] fix: fullscreen, unfullscreen, unminise and unmaximise window events … #4130

Open
wants to merge 2 commits into
base: v3-alpha
Choose a base branch
from

Conversation

oSethoum
Copy link
Contributor

@oSethoum oSethoum commented Mar 11, 2025

…weren't being emitted.

Description

Fix events fullscreen, unfullscreen, unminimise and unmaximise not being emitted.

Fixes # (issue)

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?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • 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.

 Wails (v3.0.0-alpha.9)  Wails Doctor

# System

┌───────────────────────────────────────────────────────────────────────────────────────────────┐
| Name              | Windows 10 Pro                                                            |
| Version           | 2009 (Build: 26100)                                                       |
| ID                | 24H2                                                                      |
| Branding          | Windows 11 Pro                                                            |
| Platform          | windows                                                                   |
| Architecture      | amd64                                                                     |
| Go WebView2Loader | true                                                                      |
| WebView2 Version  | 133.0.3065.92                                                             |
| CPU               | 13th Gen Intel(R) Core(TM) i7-1360P                                       |
| GPU 1             | NVIDIA GeForce RTX 3050 4GB Laptop GPU (NVIDIA) - Driver: 32.0.15.7242    |
| GPU 2             | Intel(R) Iris(R) Xe Graphics (Intel Corporation) - Driver: 31.0.101.3688  |
| Memory            | 32GB                                                                      |
└───────────────────────────────────────────────────────────────────────────────────────────────┘

# Build Environment

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Wails CLI      | v3.0.0-alpha.9                                                                                                                                                                                                           |
| Go Version     | go1.24.0
                                                                                                                    |
| -buildmode     | exe
                                                                                                                    |
| -compiler      | gc
                                                                                                                    |
| CGO_CFLAGS     |
                                                                                                                    |
| CGO_CPPFLAGS   |
                                                                                                                    |
| CGO_CXXFLAGS   |
                                                                                                                    |
| CGO_ENABLED    | 1
                                                                                                                    |
| CGO_LDFLAGS    |
                                                                                                                    |
| DefaultGODEBUG | asynctimerchan=1,gotestjsonbuildtext=1,gotypesalias=0,httpservecontentkeepheaders=1,multipathtcp=0,randseednop=0,rsa1024min=0,tls3des=1,tlsmlkem=0,x509keypairleaf=0,x509negativeserial=1,x509rsacrt=0,x509usepolicies=0 |
| GOAMD64        | v1
                                                                                                                    |
| GOARCH         | amd64
                                                                                                                    |
| GOOS           | windows
                                                                                                                    |
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies

┌───────────────────────────┐
| npm  | 10.9.2             |
| NSIS | v3.10              |
└─ * - Optional Dependency ─┘

# Diagnosis

 SUCCESS  Your system is ready for Wails development!

Need documentation? Run: wails3 docs
 ♥   If Wails is useful to you or your company, please consider sponsoring the project: wails3 sponsor

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

  • New Features

    • Enhanced window state notifications now provide real-time updates when transitioning between modes, including exiting maximized, toggling fullscreen, and restoring from a minimized state. These improvements offer a more responsive and interactive experience.
  • Bug Fixes

    • Fixed an issue where certain window events (fullscreen, unfullscreen, unminimise, unmaximise) were not being emitted, ensuring proper event handling during window state changes.

Copy link
Contributor

coderabbitai bot commented Mar 11, 2025

Walkthrough

The changes update the Windows webview window implementation by integrating event emissions into methods handling window state changes. The modifications now emit events when the window is unmaximised, enters fullscreen, exits fullscreen, and when it is restored from a minimized state. This update enhances the event-driven mechanism, providing more granular notifications of window state transitions.

Changes

File Change Summary
v3/.../webview_window_windows.go Added event emissions in the unmaximise, fullscreen, and unfullscreen methods, as well as in WndProc (emitting WindowUnMinimise when restoring from minimized state).
docs/.../changelog.mdx Added entry in the changelog for fixed issues related to the emission of fullscreen, unfullscreen, unminimise, and unmaximise events, fixed by contributor @oSethoum in PR #4130.

Sequence Diagram(s)

sequenceDiagram
    participant UI as Client/UI
    participant W as windowsWebviewWindow
    participant EB as Event Bus

    UI->>W: Trigger window state change (e.g., fullscreen)
    W->>EB: Emit corresponding event (e.g., WindowFullscreen)
    UI->>W: Trigger window state change (e.g., unmaximise)
    W->>EB: Emit corresponding event (e.g., WindowUnMaximise)
    UI->>W: Trigger window state restoration (via WndProc)
    W->>EB: Emit WindowUnMinimise (if restoring from minimized)
Loading

Suggested reviewers

  • leaanthony

Poem

I'm a rabbit with a hop and a cheer,
Watching window events now change gear.
Fullscreen, unmaximise, signals fly—
In every method, events now comply.
Hop into the code, let the changes appear!
🐇🚀


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 635ddf5 and 302c74e.

📒 Files selected for processing (1)
  • docs/src/content/docs/changelog.mdx (1 hunks)
🔇 Additional comments (1)
docs/src/content/docs/changelog.mdx (1)

112-112: Clear and Concise Changelog Entry for Window Event Emission Fix

The newly added changelog entry clearly states that the missing emission of the fullscreen, unfullscreen, unminimise, and unmaximise events has been fixed, with proper attribution to [@oSethoum] and reference to PR [#4130]. This entry is consistent with our project’s documentation standards. Please verify that the corresponding code changes (e.g., in webview_window_windows.go) align with this changelog update.


🪧 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 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.

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.

@oSethoum oSethoum changed the title fix: fullscreen, unfullscreen, unminise and unmaximise window events … [v3] fix: fullscreen, unfullscreen, unminise and unmaximise window events … Mar 11, 2025
@leaanthony
Copy link
Member

Thanks for opening this - it's a great start. I think next we will need to update v3/pkg/application/webview_window_windows.go to map the events to "Common" events.
Please could you also add an entry to the changelog located at docs/src/content/docs/changelog.mdx? Thanks!

@oSethoum
Copy link
Contributor Author

I think the events are mapped somehow because when I tested in the frontend part when events.Windows.Fullscreen was emitted I also received events.Common.Fullscreen, am not sure if the mapping is on the JS part only or is on the go events handling part, I will take a look more to the code and see.

@oSethoum
Copy link
Contributor Author

@leaanthony The events seem to be mapped perfectly. the common events are emitted when emitting specefic platform window events.
image

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.

2 participants