Repository navigation
Closed
Description
Context
Line numbers are at 4aea100 (main).
- No public API lets a desktop window ignore the pointer.
WindowOptions(core/window.go:34-54) andPanelOptions(core/window.go:58-68) have no such field, and thedesktoppackage has no setter.mobile.OverlayOptions.Passive(core/overlay.go:71) does it for Android overlays only. - The macOS backend already uses
setIgnoresMouseEvents:internally, for the permission guide panel while it is dragged (internal/platform/macos/permissionguide.go:627,:689), so the mechanism is there but not exposed. - Windows sets no
WS_EX_TRANSPARENT/WS_EX_LAYEREDon any app window (internal/platform/windows/windows.go:631-637), and nothing answersWM_NCHITTESTwithHTTRANSPARENTfor empty areas. - NSH has a window-wide switch:
WindowAttributes.pointer_eventswithWindowPointerEvents::None("Presses and the pointer go through it to what is below. Needs thewindowscapability'soverlay",crates/nsh-core/src/desktop/window.rs:109-118), implemented on Windows withWS_EX_LAYERED | WS_EX_TRANSPARENT(crates/nsh-platform-windows/src/shell.rs:235-238).
Why it matters
With a transparent window (the companion issue on transparent windows), the window's rectangle is still a dead zone for the user: clicks on the empty corners around a desktop pet, a HUD or a screen annotation layer hit the app instead of the window below. Two behaviours are needed:
- Whole window: a passive overlay (a HUD, a "do not disturb" pet, an annotation layer while not editing) takes no pointer at all.
- Where nothing is drawn: a desktop pet must still take presses, drags and right clicks on the character, while presses on the transparent area around it reach the window below. A window-wide switch alone cannot do this: once the window takes no pointer the app never hears that the pointer came back over the character, so it cannot switch itself back on.
Proposal
type WindowPointerEvents uint8
const (
// WindowPointerAuto: the window takes the pointer (default).
WindowPointerAuto WindowPointerEvents = iota
// WindowPointerNone: every press and the pointer go through to what is below.
WindowPointerNone
// WindowPointerPainted: the window takes the pointer only over views that draw something or have handlers; elsewhere it goes through.
WindowPointerPainted
)
func SetWindowPointerEvents(cx *core.Scope, p WindowPointerEvents)plus a WindowOptions / PanelOptions field for the initial value, gated by Access as NSH gates it.
- macOS:
setIgnoresMouseEvents:forNone; forPainted, togglingignoresMouseEventsfrom a hit test of the pointer location (a global mouse-moved monitor, or a tracking area). - Windows:
WS_EX_LAYERED | WS_EX_TRANSPARENTforNone;WM_NCHITTESTreturningHTTRANSPARENTover the empty areas forPainted(or togglingWS_EX_TRANSPARENTfrom the same hit test, sinceHTTRANSPARENTonly passes to windows of the same thread). - Linux: an empty input region (
gdk_surface_set_input_region) forNone, and the input region set to the painted views' bounds forPainted.
Acceptance
- With
WindowPointerNone, presses, scrolls and hovering over the window reach the window below on macOS, Windows and Linux. - With
WindowPointerPaintedon a transparent window holding one 200x200 view in a 600x400 window, a press on the view reaches the app (includingWindowDragandOnContextMenu), and a press on the empty area reaches the window below. - Switching modes at run time takes effect without reopening the window.
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat(desktop): let the pointer through windows
feat(desktop): let the pointer through windows