Pure-Go X11 windowing backend (sovereign wire protocol, present, input, Run loop) - #1
Merged
Conversation
… cov) Pure-Go, CGO=0, stdlib-only implementation of the X11 core protocol (v11.0) spoken directly over a byte stream: wire encoder/decoder (both byte orders), connection setup handshake, MIT-MAGIC-COOKIE-1 Xauthority parsing/matching, keycode->keysym mapping, request/reply/error/event demux, PutImage with RGBA->wire pixel conversion + max-request tiling. Transport-agnostic Conn (io.ReadWriteCloser) exercised in-process against a scripted fake server: 100.0% statement coverage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- window.Open (linux): dial $DISPLAY unix socket, MIT-MAGIC-COOKIE-1 auth, handshake, CreateWindow (TrueColor via CopyFromParent) + WM_NAME/WM_CLASS + WM_PROTOCOLS/WM_DELETE_WINDOW, CreateGC, MapWindow, GetKeyboardMapping. - Non-linux Open stub returns ErrUnsupported (cross-builds stay green). - Present: painter.PixelPainter -> RGBA buffer -> PutImage (visual pixel packing + max-request tiling); presentRect damage path ready for scene damage. - Input: Expose/Key/Button/Motion/Configure/ClientMessage -> toolkit.Event; keycode->keysym via fetched keymap; WM_DELETE_WINDOW closes. - Window.Run host loop: layout/draw/present + event dispatch + resize relayout. - cmd/windowdemo example; README; CI (CGO=0, 6-arch qemu, 100% x11 cov gate, darwin stub lane, Xvfb live-integration lane). - Root windowing logic tested in-process vs scripted fake X server. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Date: 2026-08-08
A pure-Go, CGO=0, zero-non-stdlib-dependency X11 windowing backend for the go-widgets toolkit. The X11 core protocol (v11.0) is implemented from scratch over the unix socket — no Xlib, no XCB, no cgo — mirroring the sovereign transport+codec approach of
go-freedesktop/dbus.Phases
internal/x11): byte-order-parametric encoder/decoder (l/B), setup handshake (protocol 11.0), MIT-MAGIC-COOKIE-1 Xauthority parsing/matching, Setup reply parse (roots/visuals/depths/resource-id base+mask/keycodes), sequence tracking, request/reply/error/event demux. 100% statement coverage, both byte orders, error branches included.CreateWindow(TrueColor via CopyFromParent) +WM_NAME/WM_CLASS+WM_PROTOCOLS=WM_DELETE_WINDOW,MapWindow,CreateGC,PutImage(ZPixmap; RGBA→visual pixel packing; max-request tiling).presentRectdamage path ready for scene damage.Expose|Key*|Button*|MotionNotify|ConfigureNotify|ClientMessage→toolkit.Event; keycode→keysym viaGetKeyboardMapping;Window.Run(root)host loop (layout/draw/present + dispatch + resize relayout).Non-linux
OpenreturnsErrUnsupported(cross-builds stay green); the transport-agnostic windowing logic is exercised in-process vs a scripted fake X server.Verification
internal/x11: 100% coverage.internal/x11, native amd64/arm64, qemu riscv64/loong64/ppc64le/s390x (big-endian on s390x), darwin stub lane, Xvfb live-integration lane (present pattern →importcapture → assert pixels;xdotoolclick+key → assert dispatchedtoolkit.Event).Wayland is a separate future backend, out of scope here.
🤖 Generated with Claude Code