Repository navigation
Feat: Share the desktop window logic between the GraalVM and Kotlin/Native paths, with parity checks - #155
Feat: Share the desktop window logic between the GraalVM and Kotlin/Native paths, with parity checks#155b-re-w wants to merge 28 commits into
Conversation
Windows: minimum size, resizable, icon, clipboard, OLE file drop with enter and leave, the caption strip taken into the client area in the window's own procedure (moved from the shim, which no longer subclasses the toolkit's frame), drawn buttons through window actions, and the caret position for the IME candidate window. Linux: CLIPBOARD and PRIMARY selections, text commit events, XIM preedit and commit (callbacks style, falling back to the plain styles and to the plain lookup), XDND file drop, _NET_WM_ICON, minimum size and non-resizable hints, undecorated chrome with a drawn caption and edges that hand the move and resize to the window manager through _NET_WM_MOVERESIZE, display scale from Xft.dpi or GDK_SCALE, and bring to front from a notification press without the toolkit. macOS shares the shell and gains the IME spot. RendererEntryPoints no longer falls back to the toolkit's window on any desktop. AT-SPI is not included; it is built on the Kotlin/Native window in #131. Covers NFR-14 and FR-19 (windows chrome), FR-27 (file drop). scripts/tests/native-window-default.test.sh replaces the macOS only test.
…ed (NFR-14) The X11 window code stays, reached by DXC_X11_WINDOW. Windows and macOS are unchanged. The Linux default flips in a separate change with the Docker and hardware check results.
…FR-14) Unmapped keys answered 0, which is the A key, so control with C, V and X arrived as control with A and selected everything. Letters and digits are mapped to the shared board, the Windows virtual key table gains the same, XDND drops report where the last position said the files were, and a shell test reads the X11 table.
A window with a click counter, two text fields echoed on screen (so shortcuts, paste and undo are visible), the window size class, and a 60 row list with Korean rows. It is its own workspace root so plain cargo run works on every desktop, and it reads the renderer from COMPOSE_RUST_RENDERER_DIR. Prints event: lines.
… feat/win-linux-window-default # Conflicts: # renderer/desktop/c/x11_window.c # renderer/desktop/src/AppKitWindow.kt
… frame is not stretched (NFR-14) The scaling field was left at its zero value from memset, which is DXGI_SCALING_STRETCH. An ordinary resize never shows it, because the buffer is refitted and redrawn at the new size before it is presented, but a frame the resize handler skips (a refit refused, or dragging starting before the swapchain exists) leaves DXGI filling the new client area by stretching the old buffer instead of showing it at its own size.
… feat/win-linux-window-default
… feat/win-linux-window-default
… feat/win-linux-window-default
… feat/win-linux-window-default
… feat/shared-window-logic
…nto feat/shared-window-logic
The GraalVM X11 window mapped key symbols in C and the Kotlin/Native Linux window mapped them in Kotlin, and the two disagreed: the Kotlin/Native table had no letters or digits, so control with C, V, X, Z or A reached the scene as an unknown key. The table is now X11Keys.kt, shared by symlink, and the C window hands the key symbol and state word over untouched, as the Win32 window already does with virtual keys. Covers the shortcut keys (FR-33.6 and the editing shortcuts) on Kotlin/Native Linux.
The GraalVM X11 window kept the preedit run in a wchar_t array in C and decided a key's events in C; the Kotlin/Native window did the same in Kotlin, twice written and not quite alike. The model (PreeditBuffer, ImeSession, keyEventsFor, candidateSpot) moves to ImeComposition.kt, shared by symlink. The C window now passes the key symbol, state word, typed text and the preedit edits through as records, and X11Events turns them into events with that code. A click while composing asks a new dxc_native_ime_reset, which the other two desktops answer with nothing. Behaviour change on the GraalVM X11 window: a plain ASCII key is now one key event carrying its character, as it already was on Kotlin/Native, where the C window also committed it as text.
…window and the GraalVM X11 window LatencyTrace and SyntheticInput were used by the AppKit window only, and LatencyTrace formatted with String.format, which Kotlin/Native does not have. Both are portable now and shared by symlink; the Kotlin/Native Linux window and the GraalVM X11 window feed them (DXC_SYNTH=type,resize, DXC_REPORT_LATENCY), and the summary prints per-phase frame time and typed-letter-to-frame latency. The X11 C window gets a real dxc_native_debug_resize.
…x windows in CI scripts/parity/linux.sh runs the same application on either path with DXC_SYNTH, presses the editing shortcuts and reads the clipboard through the display server, reads the window manager hints, and prints one table of input latency, resize frame time, shortcuts, clipboard, theme, minimum size and icon. static-renderer.yml (Kotlin/Native) and test-graalvm-renderer.yml (GraalVM) both run it and put the table in the job summary.
…and the Kotlin/Native Linux window appkit_resize.h is header-only C with no window system in it, so the X11 window includes it and the Kotlin/Native window reads it through cinterop (a link in renderer/linux/cinterop/include). Both report 'dxc resize: steps= presented= stale= stretched=' under DXC_REPORT_RESIZE, the line the AppKit window already prints, and the parity table reads it. A Kotlin test feeds the header the same sequences appkit-live-resize.test.sh feeds it from C.
…both X11 windows The Kotlin/Native Linux window ignored the smallest size an application asked for and whether the window may be resized: it never told the window manager. NativeWindowOptions moves out of the native image shell into its own file, shared by symlink, and the Kotlin/Native renderer reads its title, size, smallest size and resizable flag from it instead of reading them again. sizeHintsFor is the rule the X11 C window applies to WM_NORMAL_HINTS, written once in Kotlin for the Kotlin/Native window, with a test. The consumer fixture gets a --parity mode that asks for a title and a 300 by 260 smallest size, which the parity table reads back from the server.
…ow's during a resize The parity criterion for a resize is that no frame is drawn at a size other than the window's current one: a background fill, a stretch or the old frame all fail. dxc_resize_present_against judges a presented frame against the window's size read at that moment, and dxc_resize_stale_ratio is the share that failed. The X11 C window reports it through a new dxc_native_note_present (the other two desktops count against their own textures and answer with nothing), the Kotlin/Native window asks the server for the window's size at each present, and both print it on the 'dxc resize:' line. The parity table has a resize_stale_ratio row that has to be zero.
clock_gettime takes its clock id as an unsigned integer there and the constant is a signed one, which stopped the Kotlin/Native macOS module compiling.
…otlin/Native macOS window DXC_SYNTH on the macOS window starts a timer on the main run loop that clicks the first text field, types five letters, takes the window through sixty sizes and ends the run, feeding the same LatencyTrace the other windows feed. The resize header is read through cinterop here too, and each presented frame is judged against the view's size at that moment. scripts/parity/common.sh holds what the Linux and macOS parity scripts share, and macos.sh writes the measured rows; static-renderer.yml and test-graalvm-renderer.yml run it on their macOS jobs.
… over the parity harness Stacked on #165. The window code is the fork's now; the Compose half of what #147 and #155 added is not, and was on neither develop nor #165. - macOS Kotlin/Native: contentMinimum, DockIcon (with ImageBitmap.toNSImage), SystemDarkMonitor fed by the appearance notification, and the fork's MacosClipboard and MacosClipboardManager, so Paste is offered by what the pasteboard holds. - GraalVM macOS: the same DockIcon, contentMinimum and a polled SystemDarkMonitor, the clipboard through TextPasteboard, window options read once by NativeWindowOptions, and the synthetic exit. - The K/N-portable LatencyTrace and SyntheticInput (no String.format, System.nanoTime shim, exit after the resize), the JvmCompatShims they need, and ParityMeasurementTest. - The hand-check app and its consumer fixture changes. Not here, with reasons: NativeWindowShell, the Win32 letter and digit keys and the default window switches depend on #134 (beginNativeWindowDrag, win32ComposeKey, the X11 and Win32 defaults, also #160, #170, #172) and come with it. The GraalVM text menu needs the fork's setTextMenu, which is not in the pinned fork commit yet. The resize header counter on Kotlin/Native is dropped: the fork's FramePresentLog replaces it. Covers FR-33.6 (clipboard and text menu enablement), FR-19 (min size, Dock icon), NFR-14.
… branch They read the numbers LatencyTrace and the resize accounting print, so they stay with the renderer harness rather than going to the fork. Same content as on the #155 branch.
|
Status of the remainder: the Linux and macOS parts landed in the Compose fork in thisisthepy/compose-multiplatform-core-extended#129 (one X11 key and IME model on the GraalVM window, resize counts and scripted drag on both Linux windows, macOS measuring hooks) and #127, and compose-rust #251 repins and adds the glue, the parity CI on both paths and the design doc. The Win32 parts (toolkit-free Win32 default, DXGI_SCALING_NONE, letter-key test) go with the fork's Windows window module work. This PR is closed once that lands too. |
|
Handoff (2026-10-25): Branch: feat/shared-window-logic. State: open; GraalVM smoke test fails on macOS arm64. Closes #151. Next: needs owner/leader triage. Blocked on: owner/leader triage. |
|
Closed during the 2026-11-07 branch consolidation (integrated via #505 or superseded). Branch kept. |
Closes #151
Owner decision 2026-10-04: two window implementations, shared logic, parity tests. Design and the duplication table: docs/design/shared-window-logic.md.
Base: develop plus #128 and #134 (not merged yet, merged in here). Work in progress, commits so far:
Needs a human check on real Linux hardware: typing English and Korean in the GraalVM X11 window (the key-and-commit rule is now the Kotlin/Native one).