Commit graph

5,451 commits

Author SHA1 Message Date
Claude
d5a2571256
fix(docs): add missing guides/dev/project-structure page
The sidebar in astro.config.mjs links to /guides/dev/project-structure
but the content file didn't exist, causing a 404. Create the page with
documentation covering the default project layout, key files (main.go,
services, frontend/, Taskfile.yml, build/), and generated files.

https://claude.ai/code/session_01WnjTaa94a8XmYdjzQTBjUD
2026-03-09 18:47:42 +00:00
github-actions[bot]
bb4fbf9574 chore(v3): bump to v3.0.0-alpha.74 and update changelog [skip ci] v3.0.0-alpha.74 2026-03-01 03:10:56 +00:00
Lea Anthony
5d6e9872d4
fix(systray): highlight status item and ensure popup appears above other windows on macOS (#4913)
* fix(systray): highlight status item and ensure popup appears above other windows on macOS

Fixes #4910

This commit addresses two issues with the systray-menu example on macOS:

1. System tray icon not in selected state upon clicking:
   - Added systemTraySetHighlight() function to control the NSStatusBarButton highlight state
   - Set highlight:YES before showing menus via popUpStatusItemMenu
   - Added onAttachedWindowShown/Hidden hooks for managing highlight with attached windows
   - Note: For attached windows, the highlight may briefly flash due to macOS
     NSStatusBarButton behavior where mouse-up clears highlight state

2. Popup doesn't display on top of other windows:
   - Set window level to NSPopUpMenuWindowLevel when positioning systray popup windows
   - Call orderFrontRegardless to ensure the window appears in front

The fix adds onAttachedWindowShown() and onAttachedWindowHidden() to the
systemTrayImpl interface to allow platform-specific handling when the
attached window visibility changes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add changelog entry for systray fixes (#4910)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: trigger fresh CI run

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Simplify systray fix - remove unused window highlight code

Remove onAttachedWindowShown/Hidden interface methods and systemTraySetHighlight
function since they only worked for menus, not attached windows. The menu
highlight (set before popUpStatusItemMenu) and window level fixes remain.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(v3/macos): use native menu tracking for systray highlight and focus (#4910)

Replace popUpStatusItemMenu: (which never provided native highlighting)
with a local NSEvent monitor that temporarily sets statusItem.menu before
the button processes mouse-down events. This lets macOS handle menu
tracking natively, which:

- Keeps the status bar button highlighted while the menu is open
- Does not activate the app or steal focus from other windows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-28 16:09:43 +11:00
Lea Anthony
b4b0b90fff
fix(v3/docs): correct invalid runtime sub-path imports (#4989)
* fix(v3/docs): correct invalid runtime sub-path imports in documentation

The @wailsio/runtime package only exports "." and "./plugins/*" in its
package.json exports field. Documentation examples incorrectly used
sub-path imports like @wailsio/runtime/dialogs, /events, /window, etc.
which don't resolve at runtime. Updated all examples to use the correct
namespace import pattern (e.g., import { Dialogs } from '@wailsio/runtime').

Fixes wailsapp/wails#0000

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(v3/docs): correct invalid direct imports across remaining doc files

Fix imports that reference non-existent direct exports from
@wailsio/runtime. The package exports namespace objects (Events,
Window, Clipboard, etc.), not individual functions. Updated all
docs to use the correct namespace pattern:

- Events: On/Once/Off/OffAll/Emit → Events.On/Events.Emit/etc.
- Window: WindowMinimise/WindowClose → Window.Minimise/Window.Close
- Dialogs: OnEvent/Emit → Events.On/Events.Emit
- System: invoke → System.invoke
- Removed non-existent Platform import

Files: events.mdx, frameless.mdx, system.mdx, custom.mdx,
v2-to-v3.mdx, window.mdx, architecture.mdx, bridge.mdx,
events-reference.mdx, binding-system.mdx

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: update UNRELEASED_CHANGELOG.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 16:08:41 +11:00
Zach Botterman
78e701fd54
feat(v3): Modal windows (macOS) (#4839)
* modal window

* thread safety

* update docs

* windows support

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2026-02-28 15:21:10 +11:00
github-actions[bot]
972bb6faa3 chore(v3): bump to v3.0.0-alpha.73 and update changelog [skip ci] v3.0.0-alpha.73 2026-02-27 03:04:44 +00:00
StupidBear
6ad671f34d
fix (darwin/v3) can't minimise in frameless (#5016)
* fix v3 can't minimise in frameless

* update UNRELEASED_CHANGELOG
2026-02-26 10:10:42 +00:00
github-actions[bot]
4aaec93fbb chore(v3): bump to v3.0.0-alpha.72 and update changelog [skip ci] v3.0.0-alpha.72 2026-02-16 03:10:09 +00:00
Lea Anthony
b2be682176
fix(v3): exclude node_modules from build:frontend sources glob (#4983)
* fix(v3): exclude node_modules from build:frontend sources glob

The `sources: "**/*"` glob in the build:frontend task causes go-task
to enumerate and checksum every file in node_modules during up-to-date
checking. With heavy dependencies (e.g. MUI), this means 50-100k+ files
are statted, causing 20-30 minute hangs especially on Windows/NTFS.

Fixes #4939

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs(v3): add changelog entry for #4939 fix

* chore: trigger CI re-run with fixed workflow

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:00:20 +11:00
Lea Anthony
bb5f0edc8b chore(ci): remove Claude Code Review workflows
These workflows require paid Anthropic API keys.
Removing to avoid unnecessary CI failures and costs.
2026-02-15 14:56:19 +11:00
Lea Anthony
347044f4ea fix(ci): temporarily disable Claude Code Review until secret is configured
The workflow requires ANTHROPIC_API_KEY secret to be set in repository settings.
Without it, the action attempts OIDC authentication which fails.

To enable:
1. Go to https://github.com/wailsapp/wails/settings/secrets/actions
2. Add ANTHROPIC_API_KEY with your Anthropic API key
3. Remove the 'if: false' condition from the workflow file

Refs: https://github.com/anthropics/claude-code-action
2026-02-15 14:45:00 +11:00
Lea Anthony
355d91707c fix(ci): correct Claude Code Review action configuration
- Use ANTHROPIC_API_KEY environment variable instead of invalid claude_code_oauth_token parameter
- Remove unsupported plugin parameters
- Update permissions to allow PR comments (pull-requests: write)
- Simplify prompt to standard code review request

Fixes the OIDC token error by using the correct action configuration.
Refs: https://github.com/anthropics/claude-code-action
2026-02-15 14:41:37 +11:00
Lea Anthony
8f191372c4 Add Claude Code GitHub Workflow (#4988)
* "Claude PR Assistant workflow"

* "Claude Code Review workflow"
2026-02-14 00:58:45 +11:00
github-actions[bot]
20d368a700 chore(v3): bump to v3.0.0-alpha.71 and update changelog [skip ci] v3.0.0-alpha.71 2026-02-10 03:11:14 +00:00
Lea Anthony
8eaed8c5f6
fix(linux): remove Screen typedef collision with X11 Xlib.h (#4979)
* fix(linux): remove unused C Screen typedef that collides with X11 Xlib.h

The GTK4 backend includes <gdk/x11/gdkx.h> for X11 window positioning,
which pulls in <X11/Xlib.h>. Xlib defines its own `Screen` typedef,
conflicting with the identically-named struct in linux_cgo_gtk4.h.

The C Screen struct was unused - the Go code constructs Go Screen structs
directly from GDK monitor data, never referencing C.Screen.

Fixes #4957

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* ci: run GTK4 build and tests on all v3-alpha PRs

The GTK4 CI steps were gated on github.head_ref == 'feature/webkit-gtk6-support',
meaning no other branch ever ran GTK4 compilation checks. This allowed the
Screen typedef collision to slip through undetected.

Now that GTK4 support has been merged, run GTK4 dependency installation,
example builds, and test suite on every PR targeting v3-alpha.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add GTK4 Screen typedef fix to unreleased changelog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix changelog

* fix changelog

* fix(ci): pass BUILD_TAGS through to go build in test:example:linux

The GTK4 CI step ran BUILD_TAGS=gtk4 task test:examples but the
Taskfile task ignored the env var, always building with no -tags flag.
Use shell parameter expansion so BUILD_TAGS flows through to go build.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:44:03 +11:00
Lea Anthony
eacc8a0a20
chore(v3): update github.com/jaypipes/ghw to v0.21.3 (#4977)
* chore(v3): update github.com/jaypipes/ghw to v0.21.3

Bumps ghw from v0.21.2 to v0.21.3, bringing cpuinfo parsing fixes
and snapshot handling improvements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update changelog

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:07:30 +11:00
Zach Botterman
1a5c6dceee
fix(v3): Dock ops sync and add GetBadge method (#4838)
* dock fixes and get method

* update changelog

* async -> sync

* cleanup iOS and darwin set call

* handle potential errors
2026-02-09 21:03:45 +11:00
github-actions[bot]
52d0b30549 chore(v3): bump to v3.0.0-alpha.70 and update changelog [skip ci] v3.0.0-alpha.70 2026-02-09 03:10:32 +00:00
Lea Anthony
e999741e9b
fix(v3/macos): guard InvisibleTitleBarHeight and fix top-corner resize shaking (#4962)
* fix(v3/macos): guard InvisibleTitleBarHeight and fix top-corner resize shaking (#4960)

- Only apply InvisibleTitleBarHeight when the native drag area is actually
  hidden (frameless window or transparent title bar presets like HiddenInset).
  Previously it was applied unconditionally, which could swallow clicks near
  the top of standard windows.

- Skip drag initiation when the click is near the left/right window edges
  within the invisible title bar zone. This prevents conflict between
  dragging and native top-corner resizing, which caused window content to
  shake/jitter.

Fixes #4960

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: update InvisibleTitleBarHeight docs and changelog (#4960)

Document that InvisibleTitleBarHeight only applies to frameless or
transparent title bar windows, and add changelog entries for the
guard and edge-detection fixes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 07:35:35 +11:00
Lea Anthony
bbc4e532c4
docs: document automatic enum generation in binding generator (#4973)
* docs: document automatic enum generation in binding generator (#4972)

Add dedicated Enums page covering string/integer/type-alias enums,
$zero values, struct field typing, imported package enums, supported
types, and limitations. Fix inaccurate enum section in Data Models
page and add both Data Models and Enums to sidebar navigation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add enum generation changelog entry (#4972)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: address review feedback on enum documentation

- Add bool → false to $zero value table
- Fix title.String() → string(title) in imported package example
- Clarify $zero defaults apply to class output, not interfaces
- Improve iota limitation wording for clarity

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 21:45:23 +11:00
github-actions[bot]
e01d0feb22 chore(v3): bump to v3.0.0-alpha.69 and update changelog [skip ci] v3.0.0-alpha.69 2026-02-08 03:10:46 +00:00
Lea Anthony
4097aa363b
feat(v3): add -tags flag to wails3 build command (#4968)
Allow users to pass custom build tags via `wails3 build -tags gtk4`
instead of requiring Taskfile modifications. Tags are forwarded as
EXTRA_TAGS to platform Taskfiles and appended to the go build command
alongside the existing production tag.

Works for both native and Docker cross-compilation builds.

Closes #4957

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 18:48:34 +11:00
Lea Anthony
716507b488
fix(linux/gtk4): window position, max size, and show/hide on X11 (#4965)
* fix(linux/gtk4): window position, max size, and show/hide on X11 (#4957)

- Use gtk_window_present() in windowShow() to properly restore windows
  after hide instead of gtk_widget_set_visible() which could leave
  windows minimized
- Add X11-conditional window position get/set using XTranslateCoordinates
  and XMoveWindow, gated behind GDK_IS_X11_DISPLAY runtime checks and
  GDK_WINDOWING_X11 compile-time guards. Wayland continues to return 0,0
  gracefully since position is not available there.
- Implement max window size enforcement via notify::default-width/height
  signal handlers that clamp dimensions, replacing the removed
  gtk_window_set_geometry_hints from GTK3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: treat skipped cross-compile job as success in CI

The cross_compile_results job treats "skipped" as a failure, but the
cross_compile job is legitimately skipped when the PR hasn't been
approved yet. Accept "skipped" alongside "success".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 16:27:20 +11:00
github-actions[bot]
18a9d79446 chore(v3): bump to v3.0.0-alpha.68 and update changelog [skip ci] v3.0.0-alpha.68 2026-02-07 03:01:28 +00:00
Lea Anthony
208639b5c7 fix(ci): add libwayland-dev to Linux CI dependencies
Ubuntu 24.04 no longer transitively installs libwayland-server.so.0
via libwebkit2gtk-4.1-dev, causing all Linux template tests to fail
with "cannot open shared object file". Add libwayland-dev explicitly
to all workflow files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 13:55:31 +11:00
Lea Anthony
b498907629 fix: treat skipped cross-compile job as success in CI
The cross_compile_results job treats "skipped" as a failure, but the
cross_compile job is legitimately skipped when the PR hasn't been
approved yet. Accept "skipped" alongside "success".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 12:05:08 +11:00
GitHub Actions
59cadb7aa0 [skip ci] Publish @wailsio/runtime v3.0.0-alpha.80 2026-02-06 12:06:49 +00:00
Fabio Massaioli
09b57a21c4
fix(v3/generator): Fix generation of mapped types with enum keys (#4943)
* Fix rendering of map types in binding generator

* Add support for numeric map keys in binding generator

* Add test case for enum map keys

* Update UNRELEASED_CHANGELOG.md

* Add testdata for enum map keys

* Update binding generator testdata

* Update UNRELEASED_CHANGELOG.md

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2026-02-06 12:05:28 +00:00
Lea Anthony
5dc3e21699
feat(linux): GTK4 + WebKitGTK 6.0 support (opt-in via -tags gtk4) (#4958)
* chore: add WebKitGTK 6.0/GTK4 epic and beads issue tracking

Initialize beads (bd) issue tracker with comprehensive epic for
WebKitGTK 6.0 / GTK4 support as the new default for Wails v3 Linux.

Epic: wails-webview2gtk6-t4e (40 tasks)
- GTK4/WebKit6 as default (no build tag needed)
- GTK3/WebKit4.1 via -tags gtk3 for legacy
- Docker container with both library sets for cross-compilation
- Comprehensive test strategy including benchmarks
- task build:linux (GTK4) and task build:linux:gtk3 (legacy)

* feat(linux): add WebKitGTK 6.0 / GTK4 support infrastructure [WIP]

Architecture change for modern Linux desktop support:
- GTK4/WebKitGTK 6.0 is the new DEFAULT (no build tag)
- GTK3/WebKit2GTK 4.1 is LEGACY (requires -tags gtk3)

Changes:
- Add gtk3 build constraint to existing GTK3 CGO files
- Create GTK4 stub implementations (linux_cgo_gtk4.go, application_linux_gtk4.go)
- Create WebKitGTK 6.0 asset server stubs (webkit6.go, request/responsewriter)

Known limitations (documented):
- Window positioning is NO-OP on GTK4/Wayland (protocol limitation)
- Menu system needs GMenu/GAction rewrite (stub only)
- Some methods have TODO markers for full implementation

This establishes the build infrastructure for GTK4 support.
Full implementation requires GTK4 dev environment for testing.

* docs: add implementation tracker for WebKitGTK 6.0/GTK4 work

- Create IMPLEMENTATION.md to track progress, decisions, and API differences
- Update AGENTS.md with instructions to maintain IMPLEMENTATION.md
- Document Phase 1 completion and remaining phases

* feat(linux): update doctor and capabilities for GTK4/WebKitGTK 6.0 support

- Update all 7 package managers (apt, dnf, pacman, zypper, emerge, eopkg, nixpkgs)
  to check for GTK4/WebKitGTK 6.0 as primary dependencies
- Mark GTK3/WebKit2GTK packages as optional/legacy
- Add GTKVersion and WebKitVersion fields to Capabilities struct
- Create capabilities_linux_gtk3.go for legacy build path
- Update IMPLEMENTATION.md to mark Phase 2 complete

GTK4 packages are now checked by default. Legacy GTK3 packages
are marked optional and only needed when building with -tags gtk3.

* feat(linux): implement GTK4 window management and event handling

- Add GtkEventController-based event handling for GTK4:
  - GtkEventControllerFocus for focus in/out
  - GtkGestureClick for button press/release
  - GtkEventControllerKey for keyboard events
- Implement window drag/resize using GdkToplevel API
- Add complete drag-and-drop support with GtkDropTarget
- Fix window state detection (minimized, maximized, fullscreen)
- Fix size() to properly return window dimensions in GTK4
- Update IMPLEMENTATION.md to mark Phase 3 complete

GTK4 uses a fundamentally different event model with controllers
instead of direct signal handlers. This commit implements all the
necessary event handling for window management.

* feat(linux): implement GTK4 menu system with GMenu/GAction

Phase 4 of WebKitGTK 6.0/GTK4 implementation.

GTK4 completely replaces the menu system. GTK3's GtkMenu/GtkMenuItem
are replaced by:
- GMenu: Menu model (data structure, not a widget)
- GMenuItem: Individual menu item in the model
- GSimpleAction: Action triggered when menu item is activated
- GSimpleActionGroup: Container for actions, attached to widgets
- GtkPopoverMenuBar: Menu bar widget created from GMenu model

Key changes:
- linux_cgo_gtk4.go: Added C helpers and Go functions for GMenu/GAction
  - menuActionActivated() callback for action triggers
  - menuItemNewWithId/menuCheckItemNewWithId/menuRadioItemNewWithId
  - set_action_enabled/set_action_state for state management
- menu_linux_gtk4.go: GTK4 menu processing (processMenu, addMenuItem)
- menuitem_linux_gtk4.go: GTK4 menu item handling and role menus
- menu_linux.go: Added gtk3 build tag
- menuitem_linux.go: Added gtk3 build tag

Deferred to future work:
- Context menus with GtkPopoverMenu
- Keyboard accelerators with GtkShortcut

* feat(linux): add missing CGO exports for GTK4 asset server

Phase 5 of WebKitGTK 6.0/GTK4 implementation.

The GTK4 CGO file was missing two critical exports that existed in the
GTK3 version:

1. onProcessRequest - Handles WebKit URI scheme requests. This callback
   is registered with webkit_web_context_register_uri_scheme and routes
   asset requests to the webviewRequests channel for processing.

2. sendMessageToBackend - Handles JavaScript to Go communication. This
   is called when JavaScript sends messages via the webkit user content
   manager, enabling the IPC bridge.

The asset server files (webkit6.go, request_linux_gtk4.go,
responsewriter_linux_gtk4.go) were already complete from Phase 1.
WebKitGTK 6.0 uses the same URI scheme handler API as WebKitGTK 4.1.

* build(linux): add GTK4 support to Docker and Taskfile

Phase 6 of WebKitGTK 6.0/GTK4 implementation.

Docker containers (Ubuntu 24.04):
- Install both GTK4/WebKitGTK 6.0 (default) and GTK3/WebKit2GTK 4.1 (legacy)
- Build scripts support BUILD_TAGS environment variable
- Default build uses GTK4, BUILD_TAGS=gtk3 uses legacy GTK3

Taskfile targets:
- test:example:linux - Build with GTK4 (default)
- test:example:linux:gtk3 - Build with GTK3 (legacy)
- test:examples:linux:docker:x86_64 - Docker build with GTK4
- test:examples:linux:docker:x86_64:gtk3 - Docker build with GTK3
- test:examples:linux:docker:arm64 - Docker build with GTK4 (ARM64)
- test:examples:linux:docker:arm64:gtk3 - Docker build with GTK3 (ARM64)

This allows testing both the new GTK4 default and legacy GTK3 builds.

* feat(linux): implement GTK4 dialog system with GtkFileDialog and GtkAlertDialog

Phase 8 of WebKitGTK 6.0/GTK4 implementation.

GTK4 completely replaced the dialog APIs. GTK3's GtkFileChooserDialog
and gtk_dialog_run() are deprecated/removed in GTK4.

File Dialogs (GtkFileDialog):
- gtk_file_dialog_open() for single file selection
- gtk_file_dialog_open_multiple() for multiple files
- gtk_file_dialog_select_folder() for folder selection
- gtk_file_dialog_save() for save dialogs
- Filters use GListStore of GtkFileFilter objects
- All operations are async with GAsyncResult callbacks

Message Dialogs (GtkAlertDialog):
- gtk_alert_dialog_choose() with button array
- Configurable default and cancel button indices
- Async response via callback

Implementation:
- Request ID tracking for async callback matching
- fileDialogCallback/alertDialogCallback C exports
- runChooserDialog/runQuestionDialog Go wrappers
- runOpenFileDialog/runSaveFileDialog convenience functions

* feat(linux): implement GTK4 keyboard accelerators for menu items

Add keyboard accelerator support using gtk_application_set_accels_for_action():

- Add namedKeysToGTK map with GDK keysym values for special keys
- Add parseKeyGTK() to convert key names to GDK keysyms
- Add parseModifiersGTK() to convert Wails modifiers to GDK modifier masks
- Add acceleratorToGTK() for full accelerator conversion
- Add setMenuItemAccelerator() Go wrapper calling C helpers
- Integrate accelerator setting in newMenuItemImpl, newCheckMenuItemImpl,
  and newRadioMenuItemImpl during menu item creation
- Update setAccelerator() method on linuxMenuItem to use new function

Completes Phase 9 of GTK4 implementation.

* refactor(linux): extract GTK4 C code to separate files and fix WebKitGTK 6.0 API

Extract C code from linux_cgo_gtk4.go to dedicated C files for better
IDE support and maintainability:
- linux_cgo_gtk4.h: Function declarations and type definitions
- linux_cgo_gtk4.c: C implementations for GTK4/WebKitGTK 6.0

WebKitGTK 6.0 API fixes:
- webkit_web_view_new_with_user_content_manager() removed
  -> Use create_webview_with_user_content_manager() with g_object_new()
- WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND removed
  -> Default to ALWAYS (only ALWAYS/NEVER available in 6.0)
- WebKitJavascriptResult replaced with JSCValue in callbacks
  -> sendMessageToBackend now receives JSCValue* directly

Also:
- Remove duplicate show()/hide() methods (use shared file)
- Remove duplicate startResize() (wrong signature)
- Add set_app_menu_model() setter for C global variable access
- Fix webview.Scheme reference to use hardcoded 'wails' string

Note: Some pre-existing compilation errors remain in the codebase
that are unrelated to this refactoring.

* fix(linux): resolve GTK4 compilation errors and add missing platform methods

- Add missing App methods: logPlatformInfo, platformEnvironment, fatalHandler
- Add missing linuxApp methods: hide, show, on, isOnMainThread, getAccentColor
- Add missing CGO functions: getPrimaryScreen, openDevTools, enableDevTools, handleLoadChanged
- Fix options.Linux nil check (struct not pointer)
- Fix runSaveFileDialog return type to match interface
- Fix registerWindow signature to accept pointer type
- Fix GdkRGBA to use float instead of double
- Add webview import for asset request handling
- Add sanity check task to Taskfile for quick compilation verification

* fix(linux): resolve GTK3/GTK4 symbol conflict in operatingsystem package

- Add gtk3 build tag to webkit_linux.go to prevent GTK3 linking in GTK4 builds
- Create webkit_linux_gtk4.go with GTK4/WebKitGTK 6.0 pkg-config
- Move app initialization from init() to newPlatformApp() for cleaner setup
- Fixes runtime crash: 'GTK 2/3 symbols detected in GTK 4 process'

* docs: update implementation tracker for GTK3/GTK4 symbol conflict fix

* fix(linux): add GTK4 activation gate to prevent window creation before app activation

GTK4 requires the application to be 'activated' before gtk_application_window_new()
can be called. This adds a synchronization mechanism:

- Add activated channel and sync.Once to linuxApp struct
- Mark application as activated in activateLinux callback
- Wait for activation in WebviewWindow.Run() before creating windows

Fixes SIGSEGV crash when creating windows on GTK4.

* feat(linux): add primary menu style option and fix GTK4 menu issues

- Add LinuxMenuStyle option for MenuBar vs PrimaryMenu (hamburger) display
- Fix menu separators using GMenu sections instead of separator items
- Fix radio button styling with proper string-valued stateful actions
- Fix app not terminating when last window closed
- Fix Window→Zoom to toggle maximize instead of webview zoom
- Add build constraints to .c/.h files for GTK3 compatibility
- Document MenuStyle option in window reference docs
- Update implementation tracker with session changes

* chore(examples): use PrimaryMenu style in menu example

* feat(linux): implement Systray API v2 with smart defaults and window options

- Add smart defaults for systray click behavior:
  - Window only: left-click toggles window
  - Menu only: right-click shows menu
  - Window + Menu: left-click toggles, right-click shows menu

- Add HideOnEscape and HideOnFocusLost window options:
  - HideOnEscape: hides window when Escape key pressed
  - HideOnFocusLost: hides window on focus lost (auto-disabled on
    focus-follows-mouse WMs like Hyprland, Sway, i3)

- Add WebviewWindow.RegisterKeyBinding() public method

- Fix Linux systray handlers:
  - Activate() now calls clickHandler (was doubleClickHandler)
  - SecondaryActivate() calls rightClickHandler or opens menu
  - ItemIsMenu always false to let handlers control behavior

- Add environment_linux.go with compositor detection:
  - detectCompositor(), detectFocusFollowsMouse(), isTilingWM()
  - Cursor position detection for Hyprland/Sway

- Add comprehensive manual test suite in v3/test/manual/systray/
  - window-only, menu-only, window-menu, custom-handlers, hide-options
  - Builds for both GTK3 and GTK4
  - README with test matrix for different environments

- Update systray-basic example to use new options

* feat: add doctor-ng package with modern TUI for system diagnostics

Introduces a new pkg/doctor-ng package with a clean public API designed
for reuse by both CLI and future GUI tools. Features include:

- Public API types (Report, SystemInfo, Dependency, DiagnosticResult)
- Platform-specific dependency detection (Linux, macOS, Windows)
- Package manager support (apt, dnf, pacman, emerge, eopkg, nixpkgs, zypper)
- Modern TUI using bubbletea/lipgloss with:
  - Interactive dependency navigation (j/k keys)
  - Install missing dependencies prompt (i key)
  - Refresh/rescan capability (r key)
- Non-interactive mode for CI/scripts (-n flag)

The new command is available as 'wails3 doctor-ng' for testing while
the existing 'wails3 doctor' command remains unchanged.

* fix(doctor-ng): stabilize display order, conditional cursor, add copy to clipboard

- Sort platform extras alphabetically to prevent bouncing
- Only show dependency cursor when there are missing deps to act on
- Add 'c' key to copy sanitized report to clipboard
- Update help text to be contextual based on system state

* feat(doctor-ng): add package manager detection for macOS/Windows, remove unused code

- macOS: detect homebrew, macports, nix; show in platform extras
- Windows: detect winget, scoop, choco; show in platform extras
- Remove unused tui/install.go (replaced by tea.ExecProcess)
- Remove unused stateInstall/viewInstall from model.go
- Remove j/k navigation from help (cursor was already removed)

* feat(cli): add wails3 tool capabilities command

Checks system build capabilities via pkg-config:
- GTK4 and WebKitGTK 6.0 availability
- GTK3 and WebKit2GTK 4.1 availability
- Recommends gtk4 or gtk3 based on what's installed

Output is JSON for easy parsing by Taskfile/scripts.

* fix(linux/gtk4): avoid checkptr errors when building with -race

Go's race detector enables checkptr, which flags storing integers
as pointers (a common GLib/C pattern using GINT_TO_POINTER).

Changes:
- Change signal_connect to accept uintptr_t instead of void* for data
- Change enableDND/disableDND to accept uintptr_t instead of gpointer
- Replace unsafe.Pointer(uintptr(id)) with C.uintptr_t(id) in Go code
- Replace g_object_set/get_data for menu item IDs with Go-side map
- Pass 0 instead of nil for unused signal data parameters

This allows building with 'go build -race' for debugging without
triggering 'checkptr: pointer arithmetic computed bad pointer value'
fatal errors.

* fix(examples/dialogs): use window menu for GTK4 compatibility

GTK4 requires menus to be set on windows, not the application.
Use LinuxMenuStylePrimaryMenu to show menu in header bar.

* test(linux): add manual dialog test suite

Comprehensive test programs for GTK4 dialogs:
- message-info, message-question, message-warning, message-error
- file-open, file-open-multi, file-save, file-directory

Each test has multiple test cases accessible via menu.
Use 'go-task build:gtk4' or 'go-task build:gtk3' to build.

* fix(linux/gtk4): fix file dialog hang by not prematurely freeing dialog

GtkFileDialog is async - gtk_file_dialog_select_folder() returns
immediately and the callback fires later. The defer g_object_unref
was freeing the dialog before the user could interact with it.

GTK manages the dialog lifecycle internally for async operations.

* fix: add mutex to protect runtimeLoaded and pendingJS from races

Multiple goroutines access runtimeLoaded and pendingJS concurrently:
- ExecJS reads/writes from window event handlers
- HandleMessage writes when runtime becomes ready
- InitiateFrontendDropProcessing reads/writes during drag-drop

Added pendingJSMutex to synchronize access. Also changed HandleMessage
to copy pending slice before releasing lock to avoid holding it during
InvokeSync calls.

* fix(linux/gtk4): fix dialog deadlock and alert dialog lifecycle

- dialogs_linux.go: Change InvokeAsync to go func() to prevent deadlock
  when show() is called - runQuestionDialog uses InvokeAsync internally
  and blocks on channel, which deadlocks if caller is also using InvokeAsync
- linux_cgo_gtk4.c: Remove premature g_object_unref from show_alert_dialog
  as GtkAlertDialog is async and GTK manages the lifecycle
- linux_cgo_gtk4.c: Add DEBUG_LOG macro for compile-time debug output
  (CGO_CFLAGS="-DWAILS_GTK_DEBUG" go build ...)
- linux_cgo_gtk4.c: Handle cancelled-with-no-error case in file dialogs
- linux_cgo_gtk4.go: Fix runQuestionDialog to use options.Title as message
- linux_cgo_gtk4.go: Add default OK button when no buttons specified

* feat(linux/gtk4): implement custom message dialogs with proper styling

GTK4's GtkAlertDialog lacks icon support and visual differentiation.
This implements a custom GtkWindow-based dialog with:

- Escape key triggers cancel button via GtkEventControllerKey
- Enter key activates default button via gtk_window_set_default_widget
- Custom icons from bytes with gtk_image_set_pixel_size (64px max)
- Symbolic icons for info/warning/error/question dialogs
- 300px minimum width for better short message appearance
- Proper memory cleanup via message_dialog_cleanup()
- close-request returns cancel button index or -1

* fix(linux/gtk4): use native size for custom dialog icons

Custom icons now display at their native size.
Built-in symbolic icons remain at 32px as designed.

* fix(linux/gtk4): implement native file drag-and-drop

Use GtkDropControllerMotion and GtkDropTarget with GTK_PHASE_CAPTURE
to intercept file drops before WebKit's internal GtkDropTargetAsync
handler in the bubble phase.

- Add on_drop_accept to filter for GDK_TYPE_FILE_LIST
- Add motion controller for enter/leave/motion events
- Set capture phase so our handlers run before WebKit's
- Both controllers attached to WebKitWebView widget

* docs: update implementation tracker and dialog docs

- Update IMPLEMENTATION.md with GTK4 dialog progress
- Add GTK4 dialog documentation to reference docs
- Fix RLock -> Lock in cleanup to allow window modification
- Simplify manual dialog test menus (remove nested submenus)

* fix(linux/gtk4): parse runtime call params from query string

WebKitGTK 6.0 sends POST data as URL query parameters for custom URI
schemes instead of in the request body. Add fallback to parse object,
method, and args from query params when body is empty.

* fix(linux): fallback to application menu when no window menu set

Windows without an explicit Linux.Menu option now inherit the
application-level menu set via app.Menu.Set().

* fix(linux/gtk4): implement sync clipboard API

GTK4 uses async clipboard operations. Implement clipboard_get_text_sync
which iterates the GLib main context until the async read completes.
This avoids deadlock when called from the main thread (e.g., menu handlers).

* fix(linux/gtk4): DPI scaling and menu duplication fixes

- Implement proper DPI scaling using gdk_monitor_get_scale (GTK 4.14+)
  for fractional scaling support on Linux/GTK4
- Calculate PhysicalBounds correctly by multiplying logical coords by scale
- Fix menu items duplicating when creating new windows by adding
  processed flag to prevent re-processing menus
- Add safe type assertion helpers in screen example to prevent crashes
- Add CSS to prevent text selection during drag in screen example
- Document tiling WM limitations (Hyprland, Sway, i3) in official docs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(tests): add GTK3 vs GTK4 benchmark suite

Add comprehensive benchmark suite for comparing GTK3 and GTK4 performance
in Wails applications. Benchmarks cover:

- Screen enumeration and primary screen query
- Window create/destroy, resize, show/hide operations
- Menu creation (simple, complex, with accelerators)
- Event emit and receive timing
- Dialog setup

Includes comparison tool for side-by-side analysis of results.

Usage:
  go build -tags gtk3 -o benchmark-gtk3 .
  go build -tags gtk4 -o benchmark-gtk4 .
  ./benchmark-gtk3 && ./benchmark-gtk4
  go run compare.go benchmark-GTK3-*.json benchmark-GTK4-*.json

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(examples): add WebView API compatibility checker

Cross-platform example that tests and reports which Web APIs are
available in the current WebView engine. Tests 200+ APIs across
categories:

- Storage (localStorage, IndexedDB, Cache API, File System)
- Network (Fetch, WebSocket, WebTransport, SSE)
- Media (Web Audio, MediaRecorder, Speech APIs)
- Graphics (Canvas, WebGL, WebGL2, WebGPU)
- Device (Geolocation, Sensors, Bluetooth, USB, Serial)
- Workers (Web Workers, Service Workers, Shared Workers)
- Performance (Observers, Timing APIs)
- Security (Web Crypto, WebAuthn, Credentials)
- UI/DOM (Custom Elements, Shadow DOM, Clipboard)
- CSS (CSSOM, Container Queries, Modern Selectors)
- JavaScript (ES Modules, BigInt, Private Fields)

Useful for understanding API availability differences between:
- WebKitGTK (Linux) vs WebView2 (Windows) vs WKWebView (macOS)
- GTK3/WebKit2GTK 4.1 vs GTK4/WebKitGTK 6.0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(examples): add Web API examples demonstrating browser capabilities

Add 15 interactive Web API examples in v3/examples/web-apis/:
- Storage: localStorage, IndexedDB
- Network: Fetch API, WebSocket
- Media: Canvas 2D, WebGL, Web Audio
- Device: Geolocation, Clipboard, Fullscreen
- Security: WebCrypto
- Notifications API
- Workers: Web Workers
- Observers: Intersection Observer, Resize Observer

Each example includes an interactive demo with API documentation
and feature detection to help developers understand what's
available in WebView environments.

Also updates webview-api-check with autorun support for
automated API compatibility testing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(examples): add 26 more Web API examples

Expand web-apis examples from 15 to 41 total, covering:

Storage: sessionStorage, Cache API, Page Visibility
Network: XMLHttpRequest, EventSource (SSE), Beacon API
Media: MediaDevices, MediaRecorder, Speech Synthesis
Device: Device Orientation, Vibration, Gamepad
Performance: Performance API, Mutation Observer
UI/DOM: Web Components, Pointer Events, Selection, Dialog
Messaging: Drag and Drop, Broadcast Channel, History API
Data: Streams, File API, Blob, Share, Permissions

Each example includes interactive demos, API detection,
and follows the consistent dark-themed styling pattern.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: update changelog with full web-api examples count

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(examples): simplify beacon demo with local server

Replace the complex beacon demo with a simpler version that includes:
- Local HTTP server on port 9999 that receives beacon data
- Go service to retrieve and display received beacons
- Quick buttons for common beacon types (pageview, click, error, timing)
- Live display of received beacon data with auto-refresh
- Clear explanation of how the demo works

This makes the demo more educational by showing both the sending
and receiving sides of the Beacon API.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(examples): streamline beacon demo UI

Revert to original standalone implementation with httpbin.org endpoint
but with a compact two-column layout that fits without scrolling:
- Left: endpoint config, data type selector, data input, example buttons
- Right: stats (sent/queued/failed/bytes), auto-unload option, event log

Features retained: String/JSON/FormData/Blob data types, analytics/error/
timing examples, auto-beacon on page unload.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(examples): streamline blob demo with tabbed layout

Redesign blob demo to fit without scrolling using:
- Three-column layout: Create | Stored Blobs | Output
- Tabbed interface for blob creation (Text/JSON/Binary/SVG)
- Compact blob list with download and delete actions
- Operations panel for conversions and slicing
- Feature badges showing API support status

Reduced from 846 lines to 349 lines while keeping core functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(examples): fix dropdown styling in blob demo

Style select option elements with dark background to match theme.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(examples): add MDN links to demo titles

Link API names in titles to their MDN documentation pages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(examples): streamline broadcast-channel with Wails windows

Redesign broadcast-channel demo for Wails environment:
- Replace browser tabs with Wails windows via WindowService
- Compact two-column layout: Channel/Send | Messages
- "Open New Window" button creates new Wails window
- Each window gets unique ID for message tracking
- Join/leave notifications when windows open/close
- Quick message buttons, ping all, stats display
- MDN link in title

Reduced from 737 lines to 245 lines.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(examples): simplify broadcast-channel to use multiple app instances

Remove WindowService that required generated bindings. Instead, instruct
users to run multiple instances of the app to test cross-window messaging.
BroadcastChannel API works across windows of the same origin.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(examples): add API feature badges to broadcast-channel demo

Show supported features: BroadcastChannel, postMessage, close,
onmessage, onmessageerror, MessageChannel - consistent with other demos.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(examples): add multi-window support to broadcast-channel demo

Use Wails runtime.js and WindowService to open new windows for
cross-window BroadcastChannel API testing. Streamlined UI with
feature detection badges and MDN link.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(linux): make GTK4 opt-in via -tags gtk4, keep GTK3 as default

This change inverts the build tag logic so that:
- GTK3/WebKit2GTK 4.1 is the stable default (no tag required)
- GTK4/WebKitGTK 6.0 is experimental opt-in via `-tags gtk4`

This allows the branch to be merged into v3-alpha without breaking
existing apps, while enabling early adopters to test GTK4 support.

Changes:
- Updated 20 Go files: `gtk3` → `!gtk4`, `!gtk3` → `gtk4`
- Updated IMPLEMENTATION.md to reflect new build strategy
- Updated benchmark README with correct build commands
- Added GTK4_FEEDBACK_ISSUE.md template for community testing
- Added Armaan's signing guide link to docs

Build commands after this change:
  go build ./v3/...            # GTK3 (default)
  go build -tags gtk4 ./v3/... # GTK4 (experimental)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(linux): rename capabilities files to follow naming convention

Renamed for consistency with other GTK3/GTK4 file pairs:
- capabilities_linux.go (default, GTK3)
- capabilities_linux_gtk4.go (opt-in, GTK4)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(linux/gtk4): add experimental notice with feedback issue link

When building with -tags gtk4, the app now displays a notice at startup
directing users to the feedback issue for reporting problems.

Issue: https://github.com/wailsapp/wails/issues/4957

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* ci(linux): add GTK4 testing for webkit-gtk6-support branch

- Fix box alignment in experimental notice
- Add GTK4 dependency installation for this branch only
- Run Go tests with both default (GTK3) and -tags gtk4
- Build examples with both GTK versions
- Build templates with both GTK versions

The GTK4 tests only run when PR source branch is feature/webkit-gtk6-support.
This ensures existing PRs are not affected while enabling full GTK4 CI coverage.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(doctor): make GTK3 primary, GTK4 experimental in package checks

Updated all 7 package managers to match new build tag strategy:
- GTK3/WebKit2GTK 4.1 → primary (required for default builds)
- GTK4/WebKitGTK 6.0 → optional/experimental (for -tags gtk4)

Affected: apt, dnf, pacman, zypper, emerge, eopkg, nixpkgs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(dialogs): fix GTK3/GTK4 documentation to reflect default behavior

GTK3 is the default, GTK4 is opt-in via -tags gtk4. Updated the dialogs
documentation to clarify this instead of suggesting GTK3 is opt-in.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(examples): escape HTML in web-apis examples to prevent DOM XSS

Add escapeHtml() helper function and escape all user-controlled or
dynamic values before inserting them into innerHTML to address CodeQL
security alerts.

Files fixed:
- beacon: escape log type, message, and class names
- eventsource: escape time and type in log entries
- file-api: escape file name, size, and type
- mediadevices: escape time, type, and message in log entries
- selection: escape text content before applying highlight regex
- share: escape file name, size, and type in file list
- speech-synthesis: escape time, type, and message in log entries
- web-components: escape title and color in shadow DOM template

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(linux): correct GTK4 build tags and Taskfile for GTK3 default

- Fix build tags in linux_cgo_gtk4.c and linux_cgo_gtk4.h from
  `!gtk3` to `gtk4` to match the Go file constraints
- Update Taskfile.yaml to reflect GTK3 as default, GTK4 as opt-in
- Rename test:example:linux:gtk3 to test:example:linux:gtk4
- Comment out GTK4 tests in test:examples since CI doesn't have GTK4 deps

This fixes the CI failure where GTK4 C files were being compiled
by default due to incorrect build constraints.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(systemtray): add missing defaultClickHandler method

Add the defaultClickHandler method that was in v3-alpha but not
properly merged. This method is called from systemtray_darwin.go
when handling tray icon clicks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(tests): add linux build constraint to gtk4-benchmark

The gtk4-benchmark test is Linux-only but was missing a build
constraint on main.go, causing build failures on macOS/Windows.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* ci(linux): skip hanging GTK4 service tests in CI

The service startup/shutdown tests hang in GTK4 CI environment due to
display initialization issues with xvfb. Skip these specific tests for
now while keeping other GTK4 tests running.

Skipped tests:
- TestServiceStartup
- TestServiceShutdown
- TestServiceStartupShutdown

The *Error variants of these tests still run as they fail fast before
the hang occurs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* ci(linux): skip all service tests for GTK4 in CI

All service tests hang in GTK4 CI because they require a fully
functional GTK4 display that xvfb cannot provide. Skip all tests
matching "TestService" pattern.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* ci(linux): remove unsupported GTK4 template build test

The wails build command doesn't support the -tags flag yet.
GTK4 compilation is already verified by Go tests, so this
additional template build step is not necessary.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix Copilot review feedback on PR #4958

- Use JSON.stringify() for onclick handlers in storage examples to safely
  handle keys with quotes (sessionstorage, localstorage)
- Guard DeviceOrientationEvent check to prevent ReferenceError on
  unsupported browsers (device-orientation)
- Add type assertion check for Bounds to prevent panic on malformed
  JSON (screens.go)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 21:55:45 +11:00
github-actions[bot]
bb92e82663 chore(v3): bump to v3.0.0-alpha.67 and update changelog [skip ci] v3.0.0-alpha.67 2026-02-04 03:04:44 +00:00
Wilko
247ce87fe7
fix(v3): App Exposé shows “ghost” window after calling App.Window.Current() (#4947)
* fix(macOS): run getCurrentWindowID on main thread and add nil checks

AppKit must be used on the main thread. getCurrentWindowID could be called from arbitrary Go goroutines, so dispatch to the main queue when not already on the main thread. Also guard NSApp, window, and delegate with nil checks and fall back to mainWindow when keyWindow is nil to avoid wrong or missing window ID.

* Update UNRELEASED_CHANGELOG.md

* Update UNRELEASED_CHANGELOG.md

* Update UNRELEASED_CHANGELOG.md

* fix: consistent indentation and changelog formatting

- Convert spaces to tabs in getCurrentWindowID() for codebase consistency
- Move changelog entry below the <!-- Bug fixes --> comment

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 07:41:14 +11:00
Abdelhadi Seddar
7f2b5b7a6f
[v3]docs: Corrected Listening to Events In Javascript (#4949)
* [v3]docs: Corrected Listening to Events In Javascript

After using the wails3 an dfollowing docs, I found Events being mostly correct except this, hope it helps others who use the docs.

Signed-off-by: Abdelhadi Seddar <91424903+AbdelhadiSeddar@users.noreply.github.com>

* [v3] docs: Replaced all Instances of `Event`

Commit according to CodeRabbit's Input

Signed-off-by: Abdelhadi Seddar <91424903+AbdelhadiSeddar@users.noreply.github.com>

* [v3]docs Fixed inconsistencies in last docs commit

According to CodeRabbit's Review

Signed-off-by: Abdelhadi Seddar <91424903+AbdelhadiSeddar@users.noreply.github.com>

* [v3] docs: use `const` for variables in event listener examples.

Signed-off-by: Abdelhadi Seddar <91424903+AbdelhadiSeddar@users.noreply.github.com>

---------

Signed-off-by: Abdelhadi Seddar <91424903+AbdelhadiSeddar@users.noreply.github.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2026-02-04 07:30:37 +11:00
Lea Anthony
30ffbba060
feat(v3): add file-input-test example for #4862 (#4950)
* feat(v3): add file-input example for issue #4862

Minimal example demonstrating HTML file input functionality:
- Single file selection
- Multiple file selection
- Files or directories (webkitdirectory)
- Accept filter (note: not enforced by macOS)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(example): use JS runtime dialog API instead of Go backend

Update file-input example to use wails.Dialogs.OpenFile() from the
JS runtime instead of a custom Go FileService backend. This demonstrates
the recommended approach for dialog functionality.

Fixes #4862

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(example): use generated bindings for dialog API

Update file-input example to use proper generated bindings instead
of inline JS runtime calls. The example now demonstrates:
- HTML file input elements (single, multiple, webkitdirectory)
- Wails Dialog API via generated FileService bindings

Fixes #4862

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add changelog entry for macOS file input fix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 07:29:15 +11:00
Lea Anthony
c0d2c1e237
fix(runtime): file drop not working with @wailsio/runtime npm module (#4953)
* fix(runtime): use internal path for HandlePlatformFileDrop

The Go backend was calling window.wails.Window.HandlePlatformFileDrop()
for native file drops on macOS/Linux. This only worked with the bundled
runtime which sets window.wails = Runtime.

When using the @wailsio/runtime npm module, window.wails is an empty
object because the npm module only exports via ES modules and registers
the handler at window._wails.handlePlatformFileDrop.

Changed the Go code to call the internal path that both runtime
distributions set up: window._wails.handlePlatformFileDrop()

Also added a test case that uses the npm module to verify the fix.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add changelog entry for npm runtime DND fix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: add built frontend dist for dnd-npm-runtime test

Required for go:embed to work in CI.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: update README to reflect pre-built frontend

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 07:25:09 +11:00
Fabio Massaioli
801acd01df
fix(v3/generator): binding generation for cross-package type aliases (#4948)
* Add test case for aliases of imported types

* Replace `typeutil.Map` with object-keyed map in `addTypeImpl` method

* Replace `typeutil.Map` with object-keyed map in `needsCreateImpl` method

* Update UNRELEASED_CHANGELOG.md

* Update binding generator test data

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2026-02-04 07:05:04 +11:00
github-actions[bot]
0143928943 chore(v3): bump to v3.0.0-alpha.66 and update changelog [skip ci] v3.0.0-alpha.66 2026-02-03 03:07:03 +00:00
Lea Anthony
cef60037fd fix(v3): implement file picker for input type=file on macOS (#4862)
Add WKUIDelegate protocol support to handle runOpenPanelWithParameters
delegate method, which is required for <input type="file"> elements to
work in WKWebView on macOS. This was a regression from V2 which had
this implementation.

Changes:
- Add WKUIDelegate to WebviewWindowDelegate protocol list
- Set UIDelegate on WKWebView during window creation
- Implement runOpenPanelWithParameters to show NSOpenPanel for file selection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 06:59:57 +11:00
ddmoney420
1f45359485
fix(v3/linux): fix OpenFileDialog crash from GTK thread violation (#4926)
* fix(v3/linux): fix OpenFileDialog crash from GTK thread violation

The runChooserDialog function had a race condition that caused GTK
assertion failures and crashes on Linux:

1. InvokeAsync scheduled gtk_dialog_run on the GTK thread
2. After dialog closed, a goroutine was spawned OFF the GTK thread
3. gtk_widget_destroy was called immediately (before goroutine ran)
4. Goroutine tried to call gtk_file_chooser_get_filenames on destroyed widget

Fix:
- Extract filenames on GTK thread BEFORE destroying widget
- Call gtk_widget_destroy on GTK thread AFTER extraction
- Goroutine only handles sending Go strings (no GTK calls)

Fixes #3683

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add changelog entry for OpenFileDialog crash fix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: properly free all filenames to prevent memory leak

When more than 1024 files are selected, the previous code leaked memory
because g_slist_free() only frees list nodes, not the data pointers.
Now we iterate through ALL entries, freeing each filename string.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor: remove arbitrary 1024 file selection limit

GTK's gtk_file_chooser_get_filenames() has no documented maximum.
The limit was arbitrary and unnecessary.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add comment about no file selection limit

Consistent with Windows/macOS behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: ddmoney420 <ddmoney420@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2026-02-03 06:09:40 +11:00
ddmoney420
a572244e62
fix(v3): add nil check to Focus() to prevent SIGSEGV after Hide (#4922)
* fix(v3): add nil check to Focus() to prevent SIGSEGV after Hide

The Focus() method was missing a nil/destroyed check on w.impl,
causing a SIGSEGV when Focus() is called on a window that has been
hidden and potentially destroyed (e.g., when clicking the dock icon
after hiding the window on macOS).

This aligns Focus() with Show() and Hide() which already have proper
guards against nil/destroyed window implementations.

Fixes #4890

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add changelog entry for Focus() nil check fix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: ddmoney420 <ddmoney420@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2026-02-02 10:10:36 +00:00
Lea Anthony
37e57f679d
fix(v3/windows): Move browser flags to application-level options (#4559) (#4946)
* fix(v3/windows): Move browser flags to application-level options (#4559)

WebView2 shares a single browser environment per user data path, so
browser flags (EnabledFeatures, DisabledFeatures, AdditionalBrowserArgs)
must be set at application level, not per-window.

Changes:
- Add EnabledFeatures, DisabledFeatures, AdditionalBrowserArgs to
  application.Options.Windows
- Mark per-window equivalents in WindowsWindow as deprecated
- Update webview_window_windows.go to read from app-level options

This fixes the crash when opening a second window with different
browser flags.

Fixes #4559

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: address PR review comments

- Remove incorrectly added WebviewGpuPolicy field from WindowsOptions
  (it's a Linux-specific option that already exists in LinuxWindow)
- Clarify changelog: AdditionalLaunchArgs was renamed to AdditionalBrowserArgs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor!: remove per-window browser flags (breaking change)

BREAKING CHANGE: Remove EnabledFeatures, DisabledFeatures, and
AdditionalLaunchArgs from per-window WindowsWindow options.

Use application-level options instead:
- Options.Windows.EnabledFeatures
- Options.Windows.DisabledFeatures
- Options.Windows.AdditionalBrowserArgs

These flags apply globally to the shared WebView2 environment,
so per-window configuration was never actually supported.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add documentation for application-level browser flags

- Document EnabledFeatures, DisabledFeatures, AdditionalBrowserArgs
- Add examples showing how to configure WebView2 browser flags
- Explain that these flags apply globally to all windows
- Update application API reference with platform-specific options

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: simplify browser flags documentation

Remove unnecessary warnings and overly prescriptive comments.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: clarify that AdditionalBrowserArgs requires -- prefix

Chromium command-line switches require the -- prefix.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 20:49:08 +11:00
Fabio Massaioli
04d99e376c
[v3] Fix global state in Collector.IsVoidAlias predicate (#4941)
* Accept obscure update to package-lock.json

* Make global state local in Collector.IsVoidAlias predicate

* Add protection against potential nil dereference

* Update test data

* Fix typo in doc comment

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update UNRELEASED_CHANGELOG.md

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-02-02 09:44:56 +00:00
ddmoney420
5d0dd30685
fix(v3): guard dispatchWailsEvent against race condition on reload (#4925)
* fix(v3): guard dispatchWailsEvent against race condition on reload

When the page is reloaded, the WindowLoadFinished event can fire before
the JavaScript runtime has mounted dispatchWailsEvent on window._wails.
This causes a TypeError: window._wails.dispatchWailsEvent is not a function.

This fix adds a guard to check if window._wails and dispatchWailsEvent
exist before attempting to call the function. If the runtime isn't ready,
the event is silently skipped (which is correct since there's no handler).

Fixes #4872

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: Add changelog entry for #4872

---------

Co-authored-by: ddmoney420 <ddmoney420@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2026-02-02 20:00:18 +11:00
Lea Anthony
8b99993faa docs: Add changelog entry for #4925
Fix race condition causing TypeError during page reload.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 19:57:15 +11:00
Lea Anthony
fa06d48497
feat(v3): Add UseApplicationMenu option for cross-platform menu support (#4944)
* feat(v3): Add UseApplicationMenu option for cross-platform menu support

Add `UseApplicationMenu` option to `WebviewWindowOptions` that allows
windows on Windows and Linux to inherit the application menu set via
`app.Menu.Set()`.

This provides a simpler cross-platform approach:
- On macOS: No effect (app menu is always global)
- On Windows/Linux: Window displays the application menu

Benefits:
- Eliminates need for platform-specific menu code
- Per-window opt-in maintains backwards compatibility
- Explicit window menus still take priority

Updated:
- webview_window_options.go: Added UseApplicationMenu bool field
- webview_window_windows.go: Check UseApplicationMenu when no window menu set
- webview_window_linux.go: Check UseApplicationMenu when no window menu set
- examples/dialogs: Use UseApplicationMenu instead of conditional SetMenu
- examples/menu: Use UseApplicationMenu instead of explicit SetMenu
- docs: Updated menu and window options documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: Remove incorrect 'Menu Options' section header

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 19:51:31 +11:00
Ndianabasi Udonkang
470c929b42
Make menus to be displayed on Windows OS in v3\examples\dialogs (#4928)
* fix: make menus to be displayed on Windows OS in `v3\examples\dialogs`

* refactor: use cross-platform user home dir in `v3/examples/dialogs/main.go`

* fix: handle os.UserHomeDir() error with fallback to os.TempDir()

* fix: use = instead of := for err (already declared)

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2026-02-02 19:41:35 +11:00
Lea Anthony
f4ff0c0fde docs: add changelog entry for #3631 fix 2026-02-02 19:02:07 +11:00
Lea Anthony
b16458f121 fix(darwin): prevent panic on empty Icon slice in dialogs
Change nil checks to length checks before accessing Icon[0] to prevent
panic when Icon is an empty slice rather than nil.

Fixes #3631

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 19:01:41 +11:00
ddmoney420
19b2ec7fbe
fix(v3/linux): use g_bytes_new instead of g_bytes_new_static for Go slices (#4923)
* fix(v3): add nil check to Focus() to prevent SIGSEGV after Hide

The Focus() method was missing a nil/destroyed check on w.impl,
causing a SIGSEGV when Focus() is called on a window that has been
hidden and potentially destroyed (e.g., when clicking the dock icon
after hiding the window on macOS).

This aligns Focus() with Show() and Hide() which already have proper
guards against nil/destroyed window implementations.

Fixes #4890

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(v3/linux): use g_bytes_new instead of g_bytes_new_static for Go slices

g_bytes_new_static expects truly static data that is never freed or
moved, but Go's garbage collector can move or free slice memory at any
time. This causes SIGSEGV crashes in the GTK event loop when the GC
runs and frees memory that GTK still references.

The fix replaces g_bytes_new_static with g_bytes_new, which copies the
data to C-owned memory that is safe from Go's GC.

Also fixes memory leak in setIcon() by adding proper g_bytes_unref and
g_object_unref calls for the GBytes and stream objects.

Changes:
- linux_cgo.go: Replace g_bytes_new_static with g_bytes_new (4 places)
- linux_cgo.go: Add cleanup in setIcon() for gbytes and stream
- linux_purego.go: Add gBytesNew binding and use it instead of static

Fixes #4864

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(linux): add empty slice guards to prevent panic

Adds guards to check for empty slices before taking &slice[0] which
would panic on empty input. Affects setIcon(), menuItemAddProperties(),
menuItemSetBitmap(), and runQuestionDialog() in both CGO and purego.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: ddmoney420 <ddmoney420@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2026-02-02 07:57:34 +00:00
Lea Anthony
77cb9866a2 Revert "fix(linux): add empty slice guards to prevent panic in icon/bitmap handling"
This reverts commit 05cbe108de.
2026-02-02 18:36:55 +11:00
Lea Anthony
05cbe108de fix(linux): add empty slice guards to prevent panic in icon/bitmap handling
Adds guards to check for empty slices before taking &slice[0] which would
panic. Affects setIcon(), menuItemAddProperties(), menuItemSetBitmap(),
and runQuestionDialog() in both CGO and purego implementations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 18:36:26 +11:00