Skip to content

Feat: Open the Win32 toolkit-free window by default, finish the X11 one - #134

Closed
b-re-w wants to merge 18 commits into
developfrom
feat/win-linux-window-default
Closed

b-re-w wants to merge 18 commits into
developfrom
feat/win-linux-window-default

Conversation

@b-re-w

@b-re-w b-re-w commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Refs #132 (closes when the Linux default flips)

Stacked on #128 (macOS), so the diff includes its commits until that merges.

Windows: min size, resizable, icon, clipboard, OLE file drop, modern caption moved from renderer_entry.c into the window procedure, drawn buttons and actions, IME caret spot.
Linux: CLIPBOARD and PRIMARY, text commit, XIM preedit and commit, XDND, icon, min size, undecorated chrome with drawn caption and edges via _NET_WM_MOVERESIZE, display scale, bring to front.
macOS and Windows have no environment variable. Linux stays on the toolkit window by default and reaches the X11 window with DXC_X11_WINDOW; the flip is a separate PR after the Docker X11 check and the owner's hardware check.

Not included: AT-SPI (none existed on the AWT path either; #131 builds it for the Kotlin/Native window and its code is cinterop based, so it cannot be shared with this GraalVM window as is). XIM is written in C here for the same reason.

Needs a person: Korean input with ibus-hangul and fcitx5-hangul, Narrator, copy/paste between apps, resize feel at 100% and 200%, caption drag, double click to maximise, edges.

b-re-w added 2 commits October 4, 2026 18:08
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.
@b-re-w b-re-w changed the title Feat: Open the Win32 and X11 toolkit-free windows by default Feat: Open the Win32 toolkit-free window by default, finish the X11 one Oct 4, 2026
b-re-w added 5 commits October 4, 2026 20:03
…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.
… resize is not black (NFR-14)

Without this style Windows keeps a GDI redirection surface behind the
window for DWM to composite from, separate from the swapchain. A live
resize grows that surface before this window procedure hears about
it, and the growth is not ours to fill: it came up black regardless of
how fast WM_SIZE redrew the swapchain underneath it. The style tells
DWM there is no redirection surface, so what is on screen is this
window's swapchain alone.
@b-re-w

b-re-w commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

리사이즈 중 찌그러짐/검은 화면 두 커밋으로 고쳤습니다.

  1. e9e95f9: DXGI_SCALING_NONE 명시 (memset으로 0이던 Scaling 필드가 STRETCH였음)
  2. ce8739f: WS_EX_NOREDIRECTIONBITMAP 추가

경위: STRETCH를 NONE으로 바꾸자 찌그러짐 대신 검은 영역이 보고됐습니다. WM_SIZE 핸들러에서 dxc_draw_one_frame이 매번 제대로 호출되고(로그로 확인), Skia scene.render()도 새 크기로 매 프레임 다시 그리는데도 검은 영역이 남았습니다. 원인은 CreateWindowExW의 ExStyle이 0이라 DWM이 별도 GDI 리다이렉션 서피스를 쓰고 있었던 것입니다. 라이브 리사이즈 중 그 서피스가 우리 스왑체인보다 먼저 자라서, 새로 노출된 영역은 (내용이 없는) 리다이렉션 서피스에서 채워지고 있었습니다. WS_EX_NOREDIRECTIONBITMAP으로 DWM이 리다이렉션 서피스 없이 스왑체인에서 직접 합성하게 했습니다.

우클릭은 DXC_REPORT_INPUT=1로 이벤트 전달 확인했습니다(kind=2 buttons=2 → kind=3 buttons=0). 컨텍스트 메뉴 부재는 Compose 쪽 범위로 보고 손대지 않았습니다.

입력 echo 지연은 bd0de92(프레임 단위 전송)가 이미 반영돼 있어 별도 수정 안 했습니다. 정확한 수치는 아직 없고, Win32Window.kt에 LatencyTrace/SyntheticInput 연결 작업을 이어서 진행합니다.

…new size

The swapchain is now a composition swapchain held by a visual, so DWM never fills
an unpainted area, and every WM_SIZE draws, presents and commits a frame at the new
size before it returns. Falls back to the window's own swapchain, without
WS_EX_NOREDIRECTIONBITMAP, when DirectComposition cannot be made (NFR-14).
b-re-w added 4 commits October 4, 2026 23:51
dcomp.h declares overloaded COM methods, which a C compiler cannot
parse; win32_window.c is C and f8d0e87's DComp calls would not build
under cl.exe. The device, target and visual now live in
win32_dcomp.cpp, built with no exceptions and no RTTI, and
win32_window.c reaches them through win32_dcomp.h's plain C ABI
(HWND, IUnknown* and int), never including dcomp.h itself.

Wired into build-native-windows.ps1 (a second cl.exe pass with
/std:c++17 /GR-, and dcomp.lib on the link line) and into
test-windows-c.yml so a C-mode compile error on this file surfaces on
a pull request rather than on the next renderer build.

Locally built clean on GraalVM 25.0.4.1, MSVC 14.51.36231.
…(NFR-14)

The same instrumentation AppKitWindow.kt already has: DXC_REPORT_LATENCY
marks for the loop turn, the window's own events, and each drawn frame's
size, plus SyntheticInput's type and click modes through DXC_SYNTH.
scriptedResize and postKey are left unwired: they post through
dxc_native_debug_resize and dxc_native_debug_key, which this platform's
C answers and does nothing, so wiring them would compile and still not
drive a real resize or key press.

Measured with this on a live SendInput drag (20 steps, 200% scale): every
step drew exactly once at its own size, zero stale or skipped frames.
Report in .scratch/resize-measurement-report.md.
b-re-w added a commit that referenced this pull request Oct 4, 2026
… 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.
@b-re-w

b-re-w commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Status: the X11 half of this PR is on develop (the X11 window is the Linux default) and the X11 window code now lives in the Compose fork. The Win32 half (toolkit-free Win32 window by default, DXGI_SCALING_NONE, the letter-key test) has not landed; it goes with the fork's Windows window module (thisisthepy/compose-multiplatform-core-extended#32 and its follow-ups). Left open until that lands.

b-re-w added a commit that referenced this pull request Oct 17, 2026
… macOS and Windows

The merges of thisisthepy/compose-multiplatform-core-extended #132 and #134.
@b-re-w

b-re-w commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

Handoff (2026-10-25): Branch: feat/win-linux-window-default. State: open; no failing checks in the rollup. Refs #132. Next: needs owner/leader triage. Blocked on: owner/leader triage.

@b-re-w

b-re-w commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

Closed during the 2026-11-07 branch consolidation (integrated via #505 or superseded). Branch kept.

@b-re-w b-re-w closed this Nov 7, 2026
@b-re-w
b-re-w deleted the feat/win-linux-window-default branch November 12, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant