Skip to content

feat(desktop): let the pointer through windows - #577

Merged
houko merged 2 commits into
mainfrom
feat/window-pointer-events
Nov 17, 2026
Merged

houko merged 2 commits into
mainfrom
feat/window-pointer-events

Conversation

@houko

@houko houko commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #568.

Desktop windows and panels can now let the pointer through to the windows below them.

  • desktop.SetWindowPointerEvents, with WindowOptions.PointerEvents and PanelOptions.PointerEvents for the initial value. Switching modes at run time takes effect without reopening the window.
  • WindowPointerNone: every press, wheel turn and hover goes through the window.
  • WindowPointerPainted: the window takes the pointer only where a view under the pointer draws something, hears the pointer or drags the window (driver.Painted); elsewhere it goes through, the title bar the system draws included.
  • Code held by an Access needs AccessOverlay, as NSH's windows capability's overlay grants pointerEvents: none.

Per platform:

  • macOS: ignoresMouseEvents; a painted window toggles it from a 60 Hz main run loop timer and the views' hit test.
  • Windows: the window becomes layered and toggles WS_EX_TRANSPARENT, from a timer for a painted window.
  • Linux: the surface's input region, empty or the painted views' bounds, set again in each frame after GTK sets its own.

Docs (architecture, public en/zh services), the nsgo skill, the roadmap and the changelog are updated.

Targets

  • macOS: compiled and vetted; the native tests for the pointer mode ran on a headless Mac. No hand check of a press reaching the window below.
  • Windows: cross-compiled and vetted only. There is no Windows machine; the updated native test was not run.
  • Linux (arm64, x64): compiled and vetted only. GTK native tests can't run on the headless build host.
  • Shared code (core, internal/driver, desktop, nsgotest): tests run.
  • iOS, tvOS, watchOS, Android, Web: compiled only; the API is desktop-only and these targets are unaffected.

The roadmap row records the hand acceptance check (a real press, wheel or hover reaching the window below) as remaining for macOS, Windows and Linux.

Screenshots

None: the change is pointer routing between windows and changes nothing that is drawn.

Verification

Implementation:

  • ubuild mise exec [email protected] -- go tool nsgo check -target linux_x64 && go tool nsgo check -target windows_x64: exit 0.
  • rbuild mise exec [email protected] -- go tool nsgo check -target all: exit 0. Every target listed passed: macos, windows, linux (arm64 and x64), ios, tvos, watchos (device and simulator), android_arm64, web.
  • ubuild mise exec [email protected] -- go tool nsgo test on ./core (663 passed), ./internal/driver (134 passed), ./desktop (1 passed), ./nsgotest (71 passed): all 0 failed.
  • rbuild mise exec [email protected] -- go tool nsgo test ./internal/platform/macos -- -run 'TestWindowPointerEventsFollowTheMode|TestRefFocusUsesNativeKeyboardStops' -v: 2 passed.
  • gofmt is clean on every file touched.

After review fixes:

  • ubuild mise exec [email protected] -- go tool nsgo check -target windows_x64,linux_x64: exit 0; catalogs and vet passed, plus vet for windows_x64 and linux_x64.
  • The Windows changes were only cross-compiled and vetted; the updated native test (system_native_test.go) was not run.
  • The Linux change was only vetted.
  • gofmt -l reports nothing in the changed files.

Second review (docs and skill only, no code change):

  • ubuild mise exec [email protected] -- go tool nsgo check -target all: exit 0 (every target but the Apple mobile ones, which need Xcode).
  • ubuild mise exec [email protected] -- go tool nsgo test on ./core (663 passed), ./internal/driver (134), ./nsgotest (71), ./internal/moduletest (9, TestSkills included), ./desktop (1): 0 failed.
  • rbuild mise exec [email protected] -- go tool nsgo test -run '^TestWindowPointerEventsFollowTheMode$' ./internal/platform/macos: passed.

Not done: an acceptance check by hand on any OS.

Checklist

  • Conventional Commit title.
  • Changelog, architecture docs, public documentation (en, zh), the nsgo skill and roadmap updated.
  • No new dependencies or third-party assets.

@github-actions github-actions Bot added enhancement New feature or request size/L documentation Improvements or additions to documentation macOS Windows Linux core conflict Conflicts with the base branch; resolve it first labels Nov 17, 2026
Add desktop.SetWindowPointerEvents with WindowOptions.PointerEvents and PanelOptions.PointerEvents: WindowPointerNone lets every press, wheel turn and hover through a window to the windows below it, and WindowPointerPainted only where no view under the pointer draws something, hears the pointer or drags the window (driver.Painted). Code an Access holds needs AccessOverlay, as NSH's windows capability's overlay grants pointerEvents none.

macOS sets ignoresMouseEvents, a painted window toggling it from a 60 Hz main run loop timer and the views' hit test; Windows makes the window layered and toggles WS_EX_TRANSPARENT, from a timer for a painted window; Linux sets the surface's input region, empty or the painted views' bounds, again in each frame after GTK set its own.

Refs #568
…nter through, and teach the skill pointer events
@houko
houko force-pushed the feat/window-pointer-events branch from efc1c45 to 1c43bd5 Compare November 17, 2026 11:09
@houko
houko merged commit 5f2f930 into main Nov 17, 2026
9 of 14 checks passed
@houko
houko deleted the feat/window-pointer-events branch November 17, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict Conflicts with the base branch; resolve it first core documentation Improvements or additions to documentation enhancement New feature or request Linux macOS size/L Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Desktop windows that let the pointer through: the whole window, or where it draws nothing

1 participant