[windows] Add support for click-through overlay window#3667
Conversation
WalkthroughThe recent changes enhance mouse event management across multiple Changes
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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- v3/pkg/application/webview_window.go (2 hunks)
- v3/pkg/application/webview_window_windows.go (1 hunks)
Additional comments not posted (4)
v3/pkg/application/webview_window.go (2)
1238-1243: LGTM! The function is well-implemented.The
IsIgnoreMouseEventsfunction is correctly checking if the window is ignoring mouse events and ensures thread safety.
1245-1252: LGTM! The function is well-implemented.The
SetIgnoreMouseEventsfunction correctly sets whether the window should ignore mouse events and ensures thread safety.v3/pkg/application/webview_window_windows.go (2)
1765-1768: LGTM! The function is well-implemented.The
isIgnoreMouseEventsfunction correctly checks if the window is set to ignore mouse events by evaluating theWS_EX_TRANSPARENTflag.
1770-1778: LGTM! The function is well-implemented.The
setIgnoreMouseEventsfunction correctly sets whether the window should ignore mouse events by modifying the extended window style.
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- mkdocs-website/docs/en/changelog.md (2 hunks)
Additional comments not posted (1)
mkdocs-website/docs/en/changelog.md (1)
47-47: Entry forSetIgnoreMouseEventslooks good.The addition of the
SetIgnoreMouseEventsfunction is accurately documented and follows the format of the changelog.
|
Thanks for this. I'm going to push some fixes for Mac and Linux support. |
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- mkdocs-website/docs/en/changelog.md (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- mkdocs-website/docs/en/changelog.md
There was a problem hiding this comment.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
v3/examples/ignore-mouse/main.go (1)
3-8: Review imports for relevance.The imports are minimal and relevant to the functionality demonstrated. The
_ "embed"import is unused in the current code.Consider removing unused imports to keep the code clean.
- _ "embed"
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- v3/examples/ignore-mouse/README.md (1 hunks)
- v3/examples/ignore-mouse/main.go (1 hunks)
Files skipped from review due to trivial changes (1)
- v3/examples/ignore-mouse/README.md
Additional comments not posted (4)
v3/examples/ignore-mouse/main.go (4)
10-18: Initialize application with appropriate options.The application is initialized with options, including a Mac-specific option. This is appropriate for cross-platform considerations.
20-26: Create webview window with initial options.The webview window is created with specified dimensions, title, URL, and mouse event handling option. This demonstrates the intended usage of the new feature.
28-29: Demonstrate setting and checking ignore mouse events.The code sets the
IgnoreMouseEventsto true and logs the state. This effectively demonstrates the new functionality.
31-35: Error handling for application run.The error handling for
app.Run()is appropriate, logging a fatal error if the application fails to start.
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- v3/examples/ignore-mouse/main.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- v3/examples/ignore-mouse/main.go
There was a problem hiding this comment.
Actionable comments posted: 1
Outside diff range, codebase verification and nitpick comments (8)
v3/pkg/application/window.go (2)
39-39: Add documentation forIsIgnoreMouseEvents.Consider adding a comment to document the purpose and usage of the
IsIgnoreMouseEventsmethod for better clarity.// IsIgnoreMouseEvents checks if mouse events are ignored for the window.
67-67: Add documentation forSetIgnoreMouseEvents.Consider adding a comment to document the purpose and usage of the
SetIgnoreMouseEventsmethod for better clarity.// SetIgnoreMouseEvents sets whether the window should ignore mouse events.v3/pkg/application/webview_window_linux.go (2)
47-47: Consider initializingignoreMouseEventsexplicitly.While it's initialized to
falseby default, explicitly setting it can improve code clarity.ignoreMouseEvents: false,
373-375: Add documentation forisIgnoreMouseEvents.Consider adding a comment to document the purpose and usage of the
isIgnoreMouseEventsmethod for better clarity.// isIgnoreMouseEvents returns true if mouse events are ignored.v3/pkg/application/webview_window_darwin.go (4)
769-772: Add documentation forisIgnoreMouseEvents.Consider adding a comment to document the purpose and usage of the
isIgnoreMouseEventsfunction for better clarity.// isIgnoreMouseEvents checks if the NSWindow is set to ignore mouse events.
774-777: Add documentation forsetIgnoreMouseEvents.Consider adding a comment to document the purpose and usage of the
setIgnoreMouseEventsfunction for better clarity.// setIgnoreMouseEvents sets whether the NSWindow should ignore mouse events.
1309-1311: Add documentation forisIgnoreMouseEventsmethod.Consider adding a comment to document the purpose and usage of the
isIgnoreMouseEventsmethod for better clarity.// isIgnoreMouseEvents returns true if the NSWindow is ignoring mouse events.
1313-1315: Add documentation forsetIgnoreMouseEventsmethod.Consider adding a comment to document the purpose and usage of the
setIgnoreMouseEventsmethod for better clarity.// setIgnoreMouseEvents sets whether the NSWindow should ignore mouse events.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (6)
- v3/examples/window/main.go (2 hunks)
- v3/pkg/application/webview_window.go (2 hunks)
- v3/pkg/application/webview_window_darwin.go (4 hunks)
- v3/pkg/application/webview_window_linux.go (3 hunks)
- v3/pkg/application/webview_window_windows.go (2 hunks)
- v3/pkg/application/window.go (2 hunks)
Files skipped from review due to trivial changes (1)
- v3/examples/window/main.go
Files skipped from review as they are similar to previous changes (2)
- v3/pkg/application/webview_window.go
- v3/pkg/application/webview_window_windows.go
| func (w *linuxWebviewWindow) setIgnoreMouseEvents(ignore bool) { | ||
| w.ignoreMouseEvents = ignore | ||
|
|
||
| if ignore { | ||
| C.gtk_widget_set_events((*C.GtkWidget)(unsafe.Pointer(w.window)), C.GDK_ENTER_NOTIFY_MASK|C.GDK_LEAVE_NOTIFY_MASK) | ||
| } else { | ||
| C.gtk_widget_set_events((*C.GtkWidget)(unsafe.Pointer(w.window)), C.GDK_ALL_EVENTS_MASK) | ||
| } | ||
| } |
There was a problem hiding this comment.
Ensure proper error handling in setIgnoreMouseEvents.
Consider adding error handling or logging in case setting the GTK widget events fails.
// Example of adding logging
if ignore {
if err := C.gtk_widget_set_events((*C.GtkWidget)(unsafe.Pointer(w.window)), C.GDK_ENTER_NOTIFY_MASK|C.GDK_LEAVE_NOTIFY_MASK); err != nil {
log.Error("Failed to set GTK widget events for ignoring mouse events:", err)
}
} else {
if err := C.gtk_widget_set_events((*C.GtkWidget)(unsafe.Pointer(w.window)), C.GDK_ALL_EVENTS_MASK); err != nil {
log.Error("Failed to set GTK widget events for handling all events:", err)
}
}There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- v3/pkg/application/webview_window.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- v3/pkg/application/webview_window.go
|
follow-up to wailsapp#3667 but does not behave as expected
follow-up to wailsapp#3667 but does not behave as expected
follow-up to wailsapp#3667 but does not behave as expected
follow-up to wailsapp#3667 but does not behave as expected
follow-up to wailsapp#3667 but does not behave as expected
* [windows] Add support for click-through overlay window * update changelog * setIgnoreMouseEvents - exemple * fix - remove unused import * Add macOS+Linux support. Update example. * Fix SetIgnoreMouseEvents before window created. --------- Co-authored-by: Lea Anthony <lea.anthony@gmail.com>



IsIgnoreMouseEventsimplementation for windowsisignore := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{}).IsIgnoreMouseEvents()SetIgnoreMouseEventsimplementation for windowsapp.NewWebviewWindowWithOptions(application.WebviewWindowOptions{}).SetIgnoreMouseEvents(false)Summary by CodeRabbit
New Features
Documentation
SetIgnoreMouseEventsfeature for better user awareness of functionality changes.