vx11
UNIX X11 bindings for V, with generated raw APIs and native helpers for windows, events, drawing, properties, and resource ownership. No V package dependencies.
Coverage
The core maps public function declarations from Xlib.h, Xutil.h,
Xresource.h, and XKBlib.h, including XKB, resource databases, input methods,
font sets, images, and keysyms. It also wraps XImage operation macros.
Bindings are generated from installed headers; each wrapper and constant names
its C counterpart in a comment.
Native helpers provide connections, windows, graphics contexts, checked event accessors, copied properties, and event loops accepting functions, closures, or bound methods. Generated connection methods also expose advanced Xlib calls.
Optional imports add their own library dependencies:
| Import | Coverage |
|---|---|
vx11.xinerama |
Complete public Xinerama API; monitor snapshots and activity checks |
vx11.shape |
Complete public SHAPE API; window regions and shape events |
vx11.screensaver |
Complete public MIT-SCREEN-SAVER API; idle time, state, and notifications |
vx11.randr |
Complete public XRandR 1.6 API; outputs, CRTCs, modes, monitors, gamma, properties, and events (details) |
vx11.composite |
Complete public XComposite API; cached window previews (details) |
vx11.render |
Complete public XRender 0.11 API; pictures, compositing, gradients, transforms, filters, glyph sets, and cursors (details) |
vx11.xft |
All non-variadic Xft calls; native UTF-8 text, positioned glyphs, and font helpers |
vx11.fontconfig |
All non-variadic fontconfig.h calls and constants; patterns, matching, listing, charsets, languages, and application fonts |
XInput2 is not provided. Fontconfig's FreeType bridge (fcfreetype.h) is not
bound, so vx11.fontconfig needs no FreeType headers.
Text shaping, bidi ordering, and automatic fallback layout remain application
responsibilities.
Getting started
Install V, a C compiler, libX11, and its development headers. Optional modules
need their corresponding development libraries; Xft/Fontconfig also use
pkg-config and FreeType headers. Core vx11 links only libX11.
Try some examples:
v run examples/hello.v
v run examples/events.v
v run examples/xft_text.v
See the example gallery for runnable demos and screenshots.
Native handles share ownership state and close idempotently. Release graphics
contexts, Xft draw contexts, and fonts before windows, then close the connection.
Native returned strings and arrays are copied V values. Raw calls retain Xlib's
ownership rules and asynchronous errors; native helpers validate local inputs
but do not catch every server error. C-backed types preserve the UNIX ABI,
including C long widths for XIDs and property storage.
Development
The generated bindings are committed; the generator is not part of this repository.
v -check -shared .
v test bindings_test.v
v -o /tmp/vx11-integration tests/integration.v
xvfb-run -a /tmp/vx11-integration
Additional integration coverage lives in tests/, composite/tests/,
randr/tests/, and render/tests/. See AGENTS.md for extension
and text test commands. Tested on Linux x86-64.
MIT licensed; bundled X11-derived material retains its accompanying notices.