-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Make Windows window class configurable #3682
[v3] Make Windows window class configurable #3682
Conversation
WalkthroughThe recent changes enhance the Windows application by introducing a dynamic Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App as Application
participant Options as WindowsOptions
User->>App: Start Application
App->>Options: Check WndClass
alt WndClass is empty
Options-->>App: Set WndClass to "WailsWebviewWindow"
else WndClass is provided
Options-->>App: Use provided WndClass
end
App->>App: Initialize Window with ClassName
App-->>User: Launch Application Window
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (6)
- v3/pkg/application/application.go (1 hunks)
- v3/pkg/application/application_options.go (1 hunks)
- v3/pkg/application/application_windows.go (2 hunks)
- v3/pkg/application/mainthread_windows.go (1 hunks)
- v3/pkg/application/systemtray_windows.go (1 hunks)
- v3/pkg/application/webview_window_windows.go (1 hunks)
Additional comments not posted (6)
v3/pkg/application/mainthread_windows.go (1)
37-37
: Enhancement: Dynamic window class configuration.The use of
w32.MustStringToUTF16Ptr(m.parent.options.Windows.WndClass)
allows for dynamic configuration of the window class name, enhancing flexibility. Ensure that the default value is correctly set and documented.v3/pkg/application/application_options.go (1)
185-187
: Enhancement: AddedWndClass
toWindowsOptions
.The addition of the
WndClass
field allows for configurable window class names, improving flexibility. Ensure that the default value "WailsWebviewWindow" is correctly set and documented.v3/pkg/application/systemtray_windows.go (1)
153-153
: Enhancement: Dynamic window class configuration in system tray.The use of
w32.MustStringToUTF16Ptr(globalApplication.options.Windows.WndClass)
allows for dynamic configuration of the window class name, enhancing flexibility and maintainability. Ensure that the default value is correctly set and documented.v3/pkg/application/application_windows.go (1)
211-211
: Ensure the default value forWndClass
is set.The assignment of
m.windowClass.ClassName
now relies onm.parent.options.Windows.WndClass
. Ensure that the default value is properly set elsewhere in the codebase to avoid potential nil dereference or empty string issues.Verification successful
Default value for
WndClass
is properly set.The code in
v3/pkg/application/application.go
ensures thatWndClass
is assigned a default value of "WailsWebviewWindow" if it is initially empty. This addresses the concern about potential nil dereference or empty string issues.
v3/pkg/application/application.go
: Default assignment ofWndClass
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the default value for `WndClass` is set in the codebase. # Test: Search for the default assignment of `WndClass`. Expect: Default value assignment to ensure non-empty string. rg --type go --word-regexp 'WndClass' -A 5Length of output: 2799
v3/pkg/application/application.go (1)
171-173
: Good use of default value assignment forWndClass
.This change ensures that a default window class name is assigned, improving robustness and preventing potential issues with uninitialized values.
v3/pkg/application/webview_window_windows.go (1)
252-252
: Dynamic window class name enhances flexibility.The use of
globalApplication.options.Windows.WndClass
allows for a configurable window class name, which is a significant improvement for flexibility.Ensure that this change is compatible with all scenarios where the window class name is utilized.
Verification successful
Consistent Usage of Configurable Window Class Name
The
WndClass
field is consistently used across multiple files in the codebase, ensuring compatibility with the configurable window class name feature. The default value assignment inapplication.go
further ensures robustness. No issues found with the current implementation.
- Files with
WndClass
usage:
v3/pkg/application/mainthread_windows.go
v3/pkg/application/webview_window_windows.go
v3/pkg/application/systemtray_windows.go
v3/pkg/application/application_windows.go
v3/pkg/application/application.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the configurable window class name across the codebase. # Test: Search for all occurrences of `WndClass` usage. Expect: Consistent usage of the configurable class name. rg --type go --word-regexp 'WndClass' -A 5Length of output: 2799
Thanks 🙏 Please could you add an entry to the changelog located at |
fd8accd
to
590cdcc
Compare
Quality Gate passedIssues Measures |
Updated changelog, force-pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (7)
- mkdocs-website/docs/en/changelog.md (1 hunks)
- v3/pkg/application/application.go (1 hunks)
- v3/pkg/application/application_options.go (1 hunks)
- v3/pkg/application/application_windows.go (2 hunks)
- v3/pkg/application/mainthread_windows.go (1 hunks)
- v3/pkg/application/systemtray_windows.go (1 hunks)
- v3/pkg/application/webview_window_windows.go (1 hunks)
Files skipped from review as they are similar to previous changes (6)
- v3/pkg/application/application.go
- v3/pkg/application/application_options.go
- v3/pkg/application/application_windows.go
- v3/pkg/application/mainthread_windows.go
- v3/pkg/application/systemtray_windows.go
- v3/pkg/application/webview_window_windows.go
Additional comments not posted (1)
mkdocs-website/docs/en/changelog.md (1)
20-21
: Changelog entry is well-structured.The addition of the "Window class name option" is correctly documented under the "Added" section. It includes proper attribution and a link to the pull request, ensuring clarity and traceability.
Description
This patch makes the window class configurable on Windows. Kept the current hard-coded value as default.
This can come handy for example in NSIS installer scripts, where we want to check if an instance of the app is running using FindWindow with an own window class.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
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
.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:
website/src/pages/changelog.mdx
with details of this PRSummary by CodeRabbit
New Features
WndClass
property to enhance the flexibility of Windows application options.Bug Fixes
Documentation