mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-15 15:15:51 +01:00
* All changes are complete. Here's a summary of what was implemented for issue #3896: ## Summary Added four new WebKit2 load-change events for Linux to match WebKitGTK's documented load-change signals: ### New Events | Event | ID | WebKit Signal | Description | |-------|-----|---------------|-------------| | `WindowLoadStarted` | 1059 | `WEBKIT_LOAD_STARTED` | Fired when page load begins | | `WindowLoadRedirected` | 1060 | `WEBKIT_LOAD_REDIRECTED` | Fired when a redirect occurs | | `WindowLoadCommitted` | 1061 | `WEBKIT_LOAD_COMMITTED` | Fired when load is committed | | `WindowLoadFinished` | 1062 | `WEBKIT_LOAD_FINISHED` | Fired when load completes | ### Files Modified 1. **`v3/pkg/events/events.go`** - Added new event types to `linuxEvents` struct and updated all platform event IDs (Mac, Windows, iOS shifted by +4 to accommodate new Linux events) 2. **`v3/pkg/events/events_linux.h`** - Added C defines for new events 3. **`v3/pkg/application/linux_cgo.go`** - Updated `handleLoadChanged()` to dispatch all four load events 4. **`v3/UNRELEASED_CHANGELOG.md`** - Documented the new feature ### Backward Compatibility - The existing `WindowLoadChanged` event (1058) continues to fire on `WEBKIT_LOAD_FINISHED` for backward compatibility - `WindowLoadFinished` also fires on `WEBKIT_LOAD_FINISHED` for consistent naming with the new events Would you like me to commit these changes? * These are the remaining changes that need to be committed - the generator properly updated: 1. `events.txt` - source of truth for events 2. `event_types.ts` - TypeScript runtime types for JS/TS clients 3. `events_darwin.h` - Mac C header with updated event IDs 4. `events_ios.h` - iOS C header with updated event IDs These are the final changes needed on top of the previous commit. Would you like me to commit these changes? * chore: add new Linux WebKit2 load events to known_events.go Add WindowLoadStarted, WindowLoadRedirected, WindowLoadCommitted, and WindowLoadFinished to the known events registry. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * docs: add Linux WebKit2 load events to events-reference guide Document the new WindowLoadStarted, WindowLoadRedirected, WindowLoadCommitted, and WindowLoadFinished events in the Linux Events section of the events reference guide. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Update UNRELEASED_CHANGELOG * refactor(linux): remove deprecated WindowLoadChanged event Remove the legacy WindowLoadChanged event and replace all internal references with WindowLoadFinished. This simplifies the event system by having granular events (LoadStarted, LoadRedirected, LoadCommitted, LoadFinished) rather than a generic LoadChanged that fired on any state. - Remove WindowLoadChanged from events.go and event_types.ts - Update linux_cgo.go to only fire WindowLoadFinished - Update webview_window_linux.go hooks to use WindowLoadFinished - Regenerate runtime bundles and known_events - Update events documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: add breaking change note for WindowLoadChanged removal 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
58 lines
2.4 KiB
Go
58 lines
2.4 KiB
Go
package events
|
|
|
|
import "runtime"
|
|
|
|
var defaultWindowEventMapping = map[string]map[WindowEventType]WindowEventType{
|
|
"windows": {
|
|
Windows.WindowClosing: Common.WindowClosing,
|
|
Windows.WindowInactive: Common.WindowLostFocus,
|
|
Windows.WindowClickActive: Common.WindowFocus,
|
|
Windows.WindowActive: Common.WindowFocus,
|
|
Windows.WindowMaximise: Common.WindowMaximise,
|
|
Windows.WindowMinimise: Common.WindowMinimise,
|
|
Windows.WindowRestore: Common.WindowRestore,
|
|
Windows.WindowUnMaximise: Common.WindowUnMaximise,
|
|
Windows.WindowUnMinimise: Common.WindowUnMinimise,
|
|
Windows.WindowFullscreen: Common.WindowFullscreen,
|
|
Windows.WindowUnFullscreen: Common.WindowUnFullscreen,
|
|
Windows.WindowShow: Common.WindowShow,
|
|
Windows.WindowHide: Common.WindowHide,
|
|
Windows.WindowDidMove: Common.WindowDidMove,
|
|
Windows.WindowDidResize: Common.WindowDidResize,
|
|
Windows.WindowSetFocus: Common.WindowFocus,
|
|
Windows.WindowKillFocus: Common.WindowLostFocus,
|
|
Windows.WindowDPIChanged: Common.WindowDPIChanged,
|
|
},
|
|
"darwin": {
|
|
Mac.WindowDidResignKey: Common.WindowLostFocus,
|
|
Mac.WindowDidBecomeKey: Common.WindowFocus,
|
|
Mac.WindowDidMiniaturize: Common.WindowMinimise,
|
|
Mac.WindowDidDeminiaturize: Common.WindowUnMinimise,
|
|
Mac.WindowDidEnterFullScreen: Common.WindowFullscreen,
|
|
Mac.WindowDidExitFullScreen: Common.WindowUnFullscreen,
|
|
Mac.WindowMaximise: Common.WindowMaximise,
|
|
Mac.WindowUnMaximise: Common.WindowUnMaximise,
|
|
Mac.WindowDidMove: Common.WindowDidMove,
|
|
Mac.WindowDidResize: Common.WindowDidResize,
|
|
Mac.WindowDidZoom: Common.WindowMaximise,
|
|
Mac.WindowShow: Common.WindowShow,
|
|
Mac.WindowHide: Common.WindowHide,
|
|
Mac.WindowZoomIn: Common.WindowZoomIn,
|
|
Mac.WindowZoomOut: Common.WindowZoomOut,
|
|
Mac.WindowZoomReset: Common.WindowZoomReset,
|
|
Mac.WindowShouldClose: Common.WindowClosing,
|
|
},
|
|
"linux": {
|
|
Linux.WindowDeleteEvent: Common.WindowClosing,
|
|
Linux.WindowFocusIn: Common.WindowFocus,
|
|
Linux.WindowFocusOut: Common.WindowLostFocus,
|
|
Linux.WindowDidMove: Common.WindowDidMove,
|
|
Linux.WindowDidResize: Common.WindowDidResize,
|
|
Linux.WindowLoadFinished: Common.WindowShow,
|
|
},
|
|
}
|
|
|
|
func DefaultWindowEventMapping() map[WindowEventType]WindowEventType {
|
|
platform := runtime.GOOS
|
|
return defaultWindowEventMapping[platform]
|
|
}
|