toolkit: make NativeControl the single native-control currency; Surface publishes it - #440
Merged
Conversation
…ce publishes it
WalkNative now returns []NativeControl — a flat descriptor (kind, key, geometry,
value, and on-change/on-activate/on-claim callbacks) — instead of a *Native
placement. A Native widget adapts to one through (*Native).control, wiring the
value and callbacks to its observables, so a host speaks one shape whether the
app is a widget tree or a self-rendering Surface.
Surface gains a Controls func() []NativeControl field and a NativeControls()
method, the exact parallel to Elements/Damage: a Surface-based app (which has no
walkable widget tree) publishes its native controls the same way it publishes its
accessibility. A host backend type-asserts interface{ NativeControls() []NativeControl }
on its root, or falls back to WalkNative, and reconciles the same descriptors.
This is the immediate-mode-friendly shape the reader needs: it describes its
controls each frame, and the retained OS controls live in the backend, keyed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #438 (Native), driven by the news reader's real integration: its root is a self-rendering `toolkit.Surface`, which has no walkable widget tree, so `WalkNative` alone cannot reach its controls. This makes a flat descriptor the single currency both a widget tree and a Surface produce.
What changes
Why
This is the immediate-mode-friendly shape the reader needs: it describes its controls each frame; the retained OS controls live in the backend, keyed. The consumer — go-widgets/window's cocoa `syncNative`, reworked to reconcile descriptors — lands alongside (both the widget-tree and the Surface-provider paths are proven by on-device live tests).
100% package coverage retained; full suite green.