mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +01:00
* Refactor Manager API to use singular naming convention This is a RENAME-ONLY exercise that converts the Wails v3 Manager API from plural to singular naming for better consistency and clarity. ## Changes Applied ### API Transformations: - `app.Windows.*` → `app.Window.*` - `app.Events.*` → `app.Event.*` - `app.ContextMenus.*` → `app.ContextMenu.*` - `app.KeyBindings.*` → `app.KeyBinding.*` - `app.Dialogs.*` → `app.Dialog.*` - `app.Menus.*` → `app.Menu.*` - `app.Screens.*` → `app.Screen.*` ### Files Updated: - **Core Application**: 22 files in `v3/pkg/application/` - **Examples**: 43+ files in `v3/examples/` - **Documentation**: 13 files in `docs/src/content/docs/` - **CLI Tests**: 1 file in `v3/internal/commands/` ### Critical Constraints Preserved: - ✅ Event string constants unchanged (e.g., "windows:WindowShow") - ✅ Platform event names preserved (events.Windows, events.Mac, etc.) - ✅ TypeScript API remains compatible - ✅ All functionality intact ### Verification: - ✅ All examples build successfully (`task test:examples` passes) - ✅ Application package compiles without errors - ✅ Documentation reflects new API patterns ## Benefits - **Improved Clarity**: Singular names are more intuitive (`app.Window` vs `app.Windows`) - **Better Consistency**: Aligns with Go naming conventions - **Enhanced Developer Experience**: Clearer autocomplete and API discovery 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix generator testcases and add cross-platform test cleanup - Update 28 generator testcase files to use singular API (app.Window.New() vs app.Windows.New()) - Add cross-platform cleanup system with Go script to remove test artifacts - Add test:all task with comprehensive testing and automatic cleanup - Fix cleanup to target files vs directories correctly (preserves source directories) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix remaining Windows CI failures by updating all plural API usage to singular Fixed the last remaining instances of old plural Manager API usage: - tests/window-visibility-test/main.go: Updated all app.Windows -> app.Window and app.Menus -> app.Menu - internal/templates/_common/main.go.tmpl: Updated app.Windows -> app.Window and app.Events -> app.Event - pkg/services/badge/badge_windows.go: Updated app.Windows -> app.Window (Windows-specific fix) These fixes address the Windows CI failures where platform-specific files still used the old API. The tests didn't catch this locally because Windows-specific files only compile on Windows. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| assets | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| README.md | ||
| TESTING_GUIDE.md | ||
Window Visibility Test - Issue #2861
This example demonstrates and tests the fixes implemented for Wails v3 Issue #2861 regarding application windows not showing on Windows 10 Pro due to efficiency mode.
Problem Background
On Windows systems, the "efficiency mode" feature could prevent Wails applications from displaying windows properly. This occurred because:
- WebView2 NavigationCompleted events could be delayed or missed in efficiency mode
- Window visibility was gated behind WebView2 navigation completion
- No fallback mechanisms existed for delayed or failed navigation events
Solution Implemented
The fix implements a robust cross-platform window visibility pattern:
Windows Improvements
- ✅ Decouple window container from WebView state - Windows show immediately
- ✅ 3-second timeout fallback - Shows WebView if navigation is delayed
- ✅ Efficiency mode prevention - Sets WebView2
IsVisible=trueper Microsoft guidance - ✅ Enhanced state tracking - Proper visibility state management
Cross-Platform Consistency
- ✅ macOS - Already robust, documented best practices
- ✅ Linux - Added missing show/hide methods for both CGO and purego builds
Test Scenarios
This example provides comprehensive testing for:
1. Basic Window Tests
- Normal Window: Standard window creation - should appear immediately
- Delayed Content Window: Simulates heavy content loading (like Vue.js apps)
- Hidden → Show Test: Tests delayed showing after initial creation
2. Stress Tests
- Multiple Windows: Creates 3 windows simultaneously
- Rapid Creation: Creates windows in quick succession
3. Critical Issue #2861 Test
- Efficiency Mode Test: Specifically designed to reproduce and verify the fix
- Tests window container vs content loading timing
- Includes heavy content simulation
How to Run
cd /path/to/wails/v3/examples/window-visibility-test
wails dev
Testing Instructions
What to Look For
- Immediate Window Appearance - Windows should appear within 100ms of clicking buttons
- Progressive Loading - Content may load progressively, but window container visible immediately
- No Efficiency Mode Issues - Windows appear even if Task Manager shows "efficiency mode"
- Consistent Cross-Platform Behavior - Similar behavior on Windows, macOS, and Linux
How to Test
- Note the current time displayed in the app
- Click any test button or use menu items
- Immediately observe if a window appears (should be within 100ms)
- Wait for content to load and check reported timing
- Try multiple tests in sequence to test robustness
- Test both buttons and menu items for comprehensive coverage
Expected Results
- ✅ Window containers appear immediately upon button click
- ✅ Content loads progressively within 2-3 seconds
- ✅ No blank or invisible windows, even under efficiency mode
- ✅ Activity log shows sub-100ms window creation times
- ✅ All test scenarios work consistently
Manual Testing Checklist
Windows 10 Pro (Primary Target)
- Test with efficiency mode enabled in Task Manager
- Create windows while system is under load
- Test rapid window creation scenarios
- Verify WebView2 content loads after container appears
- Check activity log for sub-100ms creation times
Windows 11
- Verify consistent behavior with Windows 10 Pro fixes
- Test efficiency mode scenarios
- Validate timeout fallback mechanisms
macOS
- Confirm existing robust behavior maintained
- Test all window creation scenarios
- Verify no regressions introduced
Linux
- Test both CGO and purego builds
- Verify new show/hide methods work correctly
- Test window positioning and timing
Technical Implementation Details
Window Creation Flow
1. User clicks button → JavaScript calls Go backend
2. Go creates WebviewWindow → Sets properties
3. Go calls window.Show() → IMMEDIATE window container display
4. WebView2 starts navigation → Progressive content loading
5. Timeout fallback ensures WebView shows even if navigation delayed
Key Code Changes
- Windows:
/v3/pkg/application/webview_window_windows.go - macOS:
/v3/pkg/application/webview_window_darwin.go - Linux:
/v3/pkg/application/webview_window_linux.go,linux_cgo.go,linux_purego.go
Reporting Test Results
When testing, please report:
- Platform & OS Version (e.g., "Windows 10 Pro 21H2", "macOS 13.1", "Ubuntu 22.04")
- Window Creation Timing (from activity log)
- Any Delayed or Missing Windows
- Efficiency Mode Status (Windows only - check Task Manager)
- Content Loading Behavior (immediate container vs progressive content)
- Any Error Messages in activity log or console
Sample Test Report Format
Platform: Windows 10 Pro 21H2
Efficiency Mode: Enabled
Results:
- Normal Window: ✅ Appeared immediately (<50ms)
- Delayed Content: ✅ Container immediate, content loaded in 2.1s
- Multiple Windows: ✅ All 3 appeared simultaneously
- Critical Test: ✅ Window appeared immediately, content progressive
Notes: No issues observed, all windows visible immediately
Architecture Notes
This example demonstrates the preferred window visibility pattern for web-based desktop applications:
- Separate Concerns: Window container vs web content readiness
- Immediate Feedback: Users see window immediately
- Progressive Enhancement: Content loads and appears when ready
- Robust Fallbacks: Multiple strategies for edge cases
- Cross-Platform Consistency: Same behavior on all platforms