mirror of
https://github.com/bitsycore/compose-desktop-native.git
synced 2026-10-05 10:47:26 +00:00
ComposeWindow.kt had grown to 985 lines holding four unrelated concerns. Split
by concern, no behaviour change:
ComposeWindow.kt 337 public surface (ApplicationScope, Window(),
nativeComposeApp, nativeComposeWindow) + main loop
WindowInstance.kt 540 one SDL window: backend, render backend, root host,
recomposer/composition, events, frame pump, teardown
AppRuntime.kt 82 live-window registry + create/destroy lifecycle
FrameTiming.kt 83 virtual/deterministic frame clocks + probe quiescence
WindowAttributes.kt 30 the new attribute bundle
Also pruned 25 imports that no longer applied to what stayed behind.
WINDOW ATTRIBUTES. Window() and nativeComposeWindow() now take the same
parameters as Compose Desktop's Window(): undecorated, transparent, resizable,
enabled, focusable, alwaysOnTop, onPreviewKeyEvent and onKeyEvent. The mutable
ones re-apply whenever they change (DisposableEffect keyed on the bundle);
transparent is creation-only because SDL needs SDL_WINDOW_TRANSPARENT at
SDL_CreateWindow and offers no setter, which WindowAttributes documents.
`enabled = false` drops pointer / key / wheel / text / drop events while the
window keeps rendering, matching Compose Desktop. Key dispatch follows
upstream's order: window preview -> focused content -> window onKeyEvent -> app
shortcut handler -> back navigation.
RAW SDL ACCESS. ComposeNativeWindow.rawSdlHandles() returns a RawSdlHandles data
class of the four opaque pointers (window / renderer / glContext / metalView) so
advanced users can call the sdl3.* cinterop directly. Named for what it is
rather than getRawSdlAccessor(): it hands back handles, not an accessor object,
and it is a snapshot - the KDoc spells out that the pointers die with the window
and which ones are non-null per resolved GpuMode.
Verified by a new `demo --winattrtest` probe, which asserts all four behaviours
rather than eyeballing them:
ATTR undecorated=true resizable=false alwaysOnTop=true focusable=true
RAW gpu=Skia.OpenGL window=true glContext=true renderer=false metalView=false
KEYCHAIN preview=2 onKey=2 (both window handlers saw the down/up pair)
DISABLED preview=2 onKey=2 (unchanged after injecting with enabled=false)
Existing probes still pass (--nav3test, --backtest, --searchesctest).
Records PLAN.md 7c: `demo --multiwintest` segfaults on mingwX64. Confirmed
PRE-EXISTING by stashing this work and reproducing on the previous commit, so
it is not fallout from the split - the probe is just silent on crash, so it had
gone unnoticed.