Skip to content

Feat: Make the X11 window the Linux default (NFR-14) - #160

Closed
b-re-w wants to merge 24 commits into
developfrom
feat/linux-x11-default
Closed

b-re-w wants to merge 24 commits into
developfrom
feat/linux-x11-default

Conversation

@b-re-w

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

Copy link
Copy Markdown
Member

Closes #156

Based on #134 (feat/win-linux-window-default); that merges first. Reverts 5d2bce0 so Linux opens the X11 window with no variable, updates the CHANGELOG and the hand-check README; the native-window-default test (no DXC_*_WINDOW variable, X11 window for Linux, no toolkit fallback) passes again.

Docker check (Ubuntu 24.04 arm64, Xvfb, openbox, ibus-hangul): typing, Korean, CLIPBOARD and PRIMARY both ways, ctrl+c/v/x/z, caption drag, edge and corner resize, XDND drop all pass. Middle click and shift+Insert pasted nothing at first; fixed in x11_window.c and re-run.

b-re-w added 23 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.
…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.
…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).
…election (NFR-14)

Linux now opens the toolkit-free X11 window with no environment variable, like Win32 and macOS. Docker check on Ubuntu 24.04 with Xvfb, openbox and ibus-hangul: typing, Korean composition, CLIPBOARD and PRIMARY both ways, ctrl+c/v/x/z, caption and edge drag, XDND drop all pass. The check found that the middle button and shift+Insert pasted nothing, so the X11 window now pastes PRIMARY on middle click and CLIPBOARD on shift+Insert, and tracks ownership of each selection separately.

Closes #156
…nsert and shift+Delete work (NFR-14)

A paste longer than one event was cut at the event size, and the Kotlin read refused a clipboard over 64 KiB. The X11 window now keeps the pasted text whole and hands it out as commit events a piece at a time; the Kotlin read takes up to 4 MiB from the heap. Insert joins the shared key reader, so Compose's own shift+Insert, ctrl+Insert and shift+Delete shortcuts apply and the hand-made shift+Insert paste is gone.
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.
…he window holds (NFR-14)

A paste longer than one event was handed out in pieces, each a commit. The window now holds the text and sends one event saying it waits; the renderer takes all of it in one call and commits it as a single edit.
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 4, 2026

Copy link
Copy Markdown
Member Author

Superseded by #172, which carries the Linux half of this branch on develop without the Windows work. #134 keeps the Windows part.

@b-re-w b-re-w closed this Oct 4, 2026
@b-re-w
b-re-w deleted the feat/linux-x11-default branch October 17, 2026 06:43
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