Skip to content

Expose X11 drawable, visual lookup, and optional XCB helpers - #58

Merged
levovix0 merged 2 commits into
levovix0:masterfrom
elcritch:fix/export-x11-drawable
Oct 7, 2026
Merged

levovix0 merged 2 commits into
levovix0:masterfrom
elcritch:fix/export-x11-drawable

Conversation

@elcritch

@elcritch elcritch commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Expose reusable X11 helpers so consumers can query an existing window's visual and use the optional Xlib/XCB bridge through Siwin alone. FigDraw #97 deletes its siwinx11compat.nim module and uses x11api directly.

  • Re-export Drawable, which already appears in public X11 function signatures.
  • Add getWindowVisualInfo(display, window): XVisualInfo. It returns a value and frees the Xlib query allocation internally, including when the query reports no matches. Its visual pointer remains borrowed from the display. Missing entry points and query failures raise OSError.
  • Add x11XcbConnection(display: PDisplay): pointer. It returns the borrowed connection, or nil when the display or optional bridge is unavailable.

The existing raw bindings and their C ABI remain unchanged.

Validation on FreeBSD amd64 / Nim 2.2.10 with a live X11 display:

  • Focused atlas-run tests runners _x11_api, _x11_size_hints, and _dynlib_loading passed (17 checks total, no skips).
  • Coverage includes the exported drawable type, native visual values, Xlib allocation cleanup on success and empty results, unavailable visual symbols, and missing/native XCB connections.
  • git diff --check passed.

Downstream FigDraw tests passed with these helpers: native Vulkan rendering and frame resources, native X11 visual/XCB queries, an injected Vulkan-attachment failure followed by GLX fallback rendering/screenshot, and a separate OpenGL build/render run (19 checks, no skips).

@elcritch elcritch changed the title Export Drawable from the X11 API Expose X11 drawable, visual lookup, and optional XCB helpers Oct 6, 2026
@levovix0
levovix0 merged commit 78bb49c into levovix0:master Oct 7, 2026
3 checks passed
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.

2 participants