Skip to content

test: a fizzy suite for Wayland frame insets, on the protocol trace - #2

Merged
foxnne merged 1 commit into
fizzy-3.4from
test/fizzy-wayland-insets
Oct 9, 2026
Merged

foxnne merged 1 commit into
fizzy-3.4from
test/fizzy-wayland-insets

Conversation

@foxnne

@foxnne foxnne commented Oct 9, 2026 •

Copy link
Copy Markdown

Part of fizzyedit/fizzy#280 (step A2). Test files only: no library code changes. Run by fizzyedit/sdl_zig#2.

The suite for patch 6, "Wayland: frame insets, for a shadow the application draws round its own decorations" (2d6efde): test/testautomation_fizzy_wayland.c, suite FizzyWayland, plus one line each in testfizzy.c and testautomation_fizzy.h.

How it observes

Each test reconnects SDL's video to the compositor with libwayland's request trace on (WAYLAND_DEBUG=client), stderr redirected to a temporary file and SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR=0, so the window is a plain xdg-shell toplevel. It makes a resizable, borderless window (as fizzy's Linux backend does) with insets left 24, top 6, right 30, bottom 40 round a 400x300 surface. Every side differs, and the top is under the 8-unit input band. It presents frames with the GPU API so the window maps, and writes a mark into the trace at each checkpoint. Afterwards it parses the requests SDL sent on its own objects, found by id with wl_proxy_get_id, plus the toplevel's configure events. It asserts once stderr is back, then logs the trace lines for its objects, so a CI failure can be read without rerunning it. Video is reference-counted, so the suite shuts it down as many times as it was brought up and restores it after.

What it asserts

  • wayland_frameInsetsFloating: xdg_surface.set_window_geometry is the frame, (24, 6, 346, 254). The input region is one wl_region.add, the frame plus a band of min(inset, 8) on each side, (16, 0, 362, 268). The published SDL_PROP_WINDOW_WAYLAND_FRAME_INSET_*_NUMBER are those asked for, and SDL_GetWindowSize is the surface. With min/max 200x150 and 800x600, xdg_toplevel.set_min_size/set_max_size are 146x104 and 746x554, the frame's. After SDL_SetWindowSize(500, 380), geometry, input region and props all follow.
  • wayland_frameInsetsMaximized: the compositor maximizes. The published insets are 0, the surface is the configured size (1024x608), the window geometry is the whole surface, and the input region is nil. After restoring, the window floats at 400x300 and the floating checks pass again.
  • wayland_frameInsetsFullscreen: the same for fullscreen (1024x640).
  • wayland_frameInsetsPopup: for a tooltip popup at (50, 60) of the parent, the positioner's set_anchor_rect is the parent's frame (0, 0, 346, 254) and set_offset is (26, 54), the position minus the parent's left and top insets. SDL reports the popup back at (50, 60).

On a release without the patch the property names are defined in the suite, so it builds there and fails on its checks instead of crashing.

Verified

  • fizzy-3.4 + this suite, headless weston 14.0.2 (Ubuntu 26.04 container, lavapipe), output scale 1 and 2: 4/4 tests, 123/123 asserts pass. https://github.com/fizzyedit/sdl_zig/actions/runs/37970592319 (jobs test-fizzy-wayland-insets (1)/(2)). A1's test-fizzy-linux (wayland) job runs the suite too, and it passes there.
  • release-3.4.16 (fa2c02b) + this suite, same job: all four tests fail, the run exits 1 and nothing crashes. https://github.com/fizzyedit/sdl_zig/actions/runs/37970651360 (throwaway branches, since deleted). Nothing is published (got: -1 (not published)), no set_window_geometry is ever sent (upstream sends none when there is a viewport), the input region is never set, min/max are sent as 200x150 / 800x600, and the popup is anchored to (0, 0, 400, 300) at offset (50, 60).
  • macOS (Cocoa): all four skip, as they're Wayland only. Compiles clean with -Wall -Wextra -Wmissing-prototypes -Wmissing-variable-declarations -Wshadow for x86_64-linux, aarch64-macos and x86_64-windows, against both fork and upstream headers.

Not covered (what headless weston can't do)

  • A floating size set by the compositor. Weston configures a floating toplevel with 0x0 (the client picks its size) at first map, on unmaximize and on leaving fullscreen. That's visible in the trace. Without a seat there's no interactive resize either. So the configure path that adds the insets to a compositor-given frame size (width += il + ir) never runs. Only maximize/fullscreen sizes, where the insets are zero, come from the compositor.
  • Tiled states. Weston never sends tiled_*, so "tiled ⇒ no insets" is untested.
  • libdecor windows being untouched. The suite forces libdecor off.
  • Fractional scale. Scale 2 is an integer output scale. Weston advertises no wp_fractional_scale_v1 here.

The SDL commit needs a permanent tag before sdl_zig's pin on it merges.

🤖 Generated with Claude Code

@foxnne
foxnne force-pushed the test/fizzy-wayland-insets branch 2 times, most recently from 791c2a4 to eb7e688 Compare October 9, 2026 18:03
@foxnne
foxnne changed the base branch from test/fizzy-gpu-suite to fizzy-3.4 October 9, 2026 18:14
The suite for patch 6 ("Wayland: frame insets, for a shadow the application draws round its own
decorations"), `FizzyWayland` in test/testautomation_fizzy_wayland.c. Each test reconnects SDL to
the compositor with libwayland's request trace on (WAYLAND_DEBUG=client), stderr captured to a
file and libdecor off, makes a resizable borderless window with insets 24/6/30/40 round a 400x300
surface, presents into it with the GPU API so it maps, then parses the requests SDL sent on its
own objects (found by id with wl_proxy_get_id) at marks it wrote into the trace:

- floating: xdg_surface.set_window_geometry is the frame, the input region one rectangle, the
  frame and a band of min(inset, 8) round it, the published SDL_PROP_WINDOW_WAYLAND_FRAME_INSET_*
  are those asked for, xdg_toplevel.set_min_size/set_max_size are the frame's, and all of it
  follows SDL_SetWindowSize;
- maximized and fullscreen: the published insets are 0, the surface is the configured size, the
  window geometry the whole surface and the input region nil; restored, the insets come back;
- a tooltip popup's positioner is anchored to the parent's frame, its offset less the parent's
  left and top insets, and SDL reports the popup where it was asked for.

On a release without the patch the properties are defined here, so the suite builds there and
fails on its first checks: nothing is published and no window geometry is sent.

Part of fizzyedit/fizzy#280 (step A2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@foxnne
foxnne force-pushed the test/fizzy-wayland-insets branch from eb7e688 to a518aaf Compare October 9, 2026 18:55
@foxnne
foxnne marked this pull request as ready for review October 9, 2026 19:17
@foxnne
foxnne merged commit a518aaf into fizzy-3.4 Oct 9, 2026
foxnne added a commit to fizzyedit/fizzy that referenced this pull request Oct 9, 2026
…294)

Fixes #289. Part of #280 (steps A1, A2 and A4b landed on the forks).

Moves fizzy's `.sdl` pin to sdl_zig `fizzy-1.0.3+3.4.16-8` (SDL
`fizzy-3.4.16-8`). That brings two things:

**1. The forks carry tests now.** fizzyedit/SDL has fizzy's own suites
on SDL's test harness, one per patch, each failing without its patch.
fizzyedit/sdl_zig runs them with `zig build test-fizzy` in CI: Linux on
lavapipe under Xvfb and headless weston, and the hosted macOS runners,
which have a Metal device.
- fizzyedit/SDL#1 → `fizzy-3.4.16-6` (`4839ede`): the runner, plus patch
1's suite (transparent window claimed on Metal and Vulkan).
- fizzyedit/sdl_zig#1 → `fizzy-1.0.3+3.4.16-6` (`0f6a2a8`): the
`test-fizzy` step.
- fizzyedit/SDL#2 → `fizzy-3.4.16-8` (`a518aaf`), fizzyedit/sdl_zig#2 →
`fizzy-1.0.3+3.4.16-8` (`a02dda8`): patch 6's suite, Wayland frame
insets.
- **How:** it reads libwayland's request trace under headless weston, at
scale 1 and 2.
- **Checks:** geometry, input region, min/max sizes and published insets
while floating; zero insets when maximized or fullscreen; popup
anchoring.
  - **Result:** passes on the fork, and fails on upstream 3.4.16.
  - **Problems it found in patch 6:** five, listed in #280 (C2b).

**2. SDL patch 8: Wayland loads where libxkbcommon is older than 1.10**
(#289).
- **The bug:** built against 1.10+ headers (sdl_zig uses 1.13), SDL
required `xkb_keymap_mod_get_mask()`. On Ubuntu 24.04 (1.6) or Debian 12
(1.5) the whole Wayland driver reported itself unavailable, and fizzy
fell back to X11. Upstream `main` has the same problem.
- **The fix:** the symbol is now optional at runtime, and the masks fall
back to `xkb_keymap_mod_get_index()`, the path SDL already takes when
built against older headers. For standard keymaps both paths give the
same masks.
- **The proof:**
- [red](https://github.com/fizzyedit/sdl_zig/actions/runs/37968707700)
on `ubuntu:24.04` without the patch ("wayland not available");
- [green](https://github.com/fizzyedit/sdl_zig/actions/runs/37971005996)
on 24.04 and 26.04 with it, where a German keymap's Shift, Caps Lock and
AltGr levels come out right.
- **The PRs:** fizzyedit/SDL#3 → `fizzy-3.4.16-7` (`36dda37`);
fizzyedit/sdl_zig#3 → `fizzy-1.0.3+3.4.16-7` (`264af2a`).

`docs/DEPENDENCIES.md` records patch 8, the three suites, sdl_zig's step
and CI jobs, all six tags, and each patch's check at a rebase.

## Verified

On macOS (arm64), in a fresh workspace on `main`:

| Gate | Result |
|---|---|
| `zig build` | 43/43 steps |
| `zig build test` | 75/75 steps |
| `zig build test-integration` | 33/33 steps, 347/347 tests |
| `zig build check-web` | 16/16 steps |
| `zig build test-sdk-version` | 12/12 steps |
| `zig build -Dtarget=x86_64-linux-gnu` | 54/54 steps (builds the
patched Wayland file) |

Not verified: a fizzy binary running on a real Ubuntu 24.04 Wayland
desktop. The evidence is the fork suite in CI containers, built from the
same sdl_zig. The SDK fingerprint doesn't move, since plugins never link
SDL.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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