Skip to content

Add XNEdit workload with Xft text input#21

Merged
jserv merged 1 commit into
mainfrom
xnedit
Jun 24, 2026
Merged

Add XNEdit workload with Xft text input#21
jserv merged 1 commit into
mainfrom
xnedit

Conversation

@jserv

@jserv jserv commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Bring up XNEdit (Motif NEdit fork) as a libx11-compat workload exercising Xft/fontconfig text rendering, and fix the interactive keyboard and Xft paths it surfaced.

Keyboard/input:

  • XKeysymToKeycode round-trips through XkbKeycodeToKeysym so SDL scancode keys (e.g. SDLK_EXECUTE) no longer alias onto ASCII keycodes; resolves shifted punctuation to its base key.
  • Single usShiftPairs[] table drives shiftedKeysym/unshiftedPunctuation, feeding XkbLookupKeySym and XkbKeysymToModifiers for US-layout symbols.
  • Xutf8LookupString guards NULL events and reports overflow lengths; appendKeysymUtf8 encodes ASCII/Latin-1/Unicode keysyms to UTF-8.
  • XTestFakeKeyEvent threads held modifiers.

Xft/font:

  • Extend XftDrawSetClipRectangles, FcCharSet/FcObjectSet overflow guards.
  • normalizeGlyphAlpha rescales blended glyph alpha for legible text.

Summary by cubic

Adds XNEdit as a Motif workload via libx11-compat with libXt-compat and SDL_ttf‑backed libXft-compat, validating Unicode text rendering through Xft/fontconfig. Wires XNEdit into the differential CI and fixes keyboard, Xft/drawing, color, and build issues surfaced by the editor.

  • New Features

    • Build XNEdit via mk/xnedit.mk; add docs, screenshot, and smoke/differential UI replays (startup, UTF‑8 fixture, typing).
    • Add scripts/run-xnedit-differential-tests.py; include XNEdit in the GitHub differential workflow; map replay keycodes to xdotool; screenshot capture falls back to the renderer when needed.
  • Bug Fixes

    • Keyboard/input: round‑trip KeySym↔KeyCode via XkbLookupKeySym; single US Shift‑pairs table; Xutf8LookupString overflow reporting and UTF‑8 encoding for ASCII/Latin‑1/Unicode; XTestFakeKeyEvent threads held modifiers; libXt-compat patch sets XInput focus; release active grabs when windows become unviewable.
    • Xft/font/drawing: implement XftDrawSetClipRectangles; safer fontconfig stubs (FcCharSet, FcObjectSet, FcUtf8ToUcs4, listing/match) with overflow guards; normalize blended glyph alpha; codepoint‑aware font fallback; mixed‑charset open falls back to a base font when host fonts are missing; add a text‑stamp cache and present path to avoid non‑idempotent re‑blends, flushing stamps on unmap/reparent.
    • Colors/display: support X11 rgb: color parsing; optional LIBX11_COMPAT_SCREEN_GEOMETRY override.
    • Build/CI: fix libXt patch staging parallel‑build race; silence benign SDL3 typedef redefinition; clear MAKEFLAGS/MFLAGS for the upstream system XNEdit build in differential runs.

Written for commit 888a076. Summary will update on new commits.

Review in cubic

cubic-dev-ai[bot]

This comment was marked as resolved.

@jserv jserv force-pushed the xnedit branch 2 times, most recently from a472e6e to 61fa9cf Compare June 24, 2026 02:43
Bring up XNEdit (Motif NEdit fork) as a libx11-compat workload exercising
Xft/fontconfig text rendering, and fix the interactive keyboard and Xft
paths it surfaced.

Keyboard/input:
- XKeysymToKeycode round-trips through XkbKeycodeToKeysym so SDL scancode
  keys (e.g. SDLK_EXECUTE) no longer alias onto ASCII keycodes; resolves
  shifted punctuation to its base key.
- Single usShiftPairs[] table drives shiftedKeysym/unshiftedPunctuation,
  feeding XkbLookupKeySym and XkbKeysymToModifiers for US-layout symbols.
- Xutf8LookupString guards NULL events and reports overflow lengths;
  appendKeysymUtf8 encodes ASCII/Latin-1/Unicode keysyms to UTF-8.
- XTestFakeKeyEvent threads held modifiers.

Xft/font:
- Extend XftDrawSetClipRectangles, FcCharSet/FcObjectSet overflow guards.
- normalizeGlyphAlpha rescales blended glyph alpha for legible text.

libXt parallel-build race (osiris, xfig jobs):
- The new LIBXT_PATCH_STAMP recipe runs `fetch --force`, which removes and
  re-stages util/makestrs.c. The host makestrs compile only depended on the
  headers stamp, so under -j it could read makestrs.c mid-restage and fail
  with "no such file". Depend on the staged makestrs.c (which carries the
  patch-stamp prerequisite) so the compile is ordered after the re-stage.

Xft mixed-charset open (build, debug-build, sanitize, sdl3 jobs):
- openFallbackForCharSet returned NULL when no single host font covered the
  whole requested charset (e.g. Latin + CJK on a box without a CJK font),
  making XftFontOpenPattern wrongly refuse a renderable pattern. Real Xft
  returns a base font and resolves the rest per glyph, so fall back to the
  best-effort family font instead of NULL.
- test-xft-link's mixed-charset case hard-required a CJK glyph, which is not
  portable; minimal CI images carry no CJK font. Require the ASCII glyph
  always and assert CJK coverage only when the host can render it.
@jserv jserv merged commit 638eba3 into main Jun 24, 2026
16 checks passed
@jserv jserv deleted the xnedit branch June 24, 2026 12:21
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