Commit graph

128 commits

Author SHA1 Message Date
f10fff910c test: factor throwaway wltest clients into _run_wl_client (phase 4)
9 uniform throwaway-client sites (late/tag, third tab, globals
prober, layer bars x2, foreign requester, takeover locker, modifiers
and popup-reposition oneshots) go from Popen + try/finally
terminate/wait to with _run_wl_client(sock, *args, **kw):. Deliberately
untouched: host-side wl-copy (host DISPLAY env), frame/menu X11 pairs
and popup a/b (shared/explicit mid-body lifecycles), the probe (custom
DISPLAY + log-file stdio), and the _oneshot_*/_poll_* helpers.
Full suite: 152 passed, 2 skipped.
2026-09-10 01:49:37 +10:00
40be266329 test: factor liveness/crash asserts into helpers (phase 3)
146 assert X.proc.poll() is None spellings (bare, log-tail tails of
varying length, custom operation messages) become _assert_alive(s,
msg): custom messages are preserved up front, the log tail is always
attached. The 4 crash-indicator loops become _assert_no_crash(log)
over the union tuple. Full suite: 152 passed, 2 skipped.
2026-09-09 23:41:00 +10:00
12b7b263bc test: realign paren continuations in with _run_* calls
Mechanical whitespace-only follow-up to phases 1-2: continuation
lines that were paren-aligned to the old s = _spawn_* heads now align
to the with _run_* heads. Verified with git diff -w (empty).
2026-09-09 23:35:30 +10:00
1d3ae67dd8 test: factor out-file polling loops into _wait_out (phase 2)
28 deadline/while/exists polling loops become one-line
assert _wait_out(path, contains, timeout) calls; the helper retries
empty/partial reads and survives exists/read races, and callers keep
their own assert messages (including the live '(missing)' payload
diagnostics). Deliberately untouched: in-loop liveness asserts
(fail-fast under load), pixel/dump/log-touch loops, line-count gates,
XWayland DISPLAY export loops, and the _oneshot_*/_poll_* helpers.
Full suite: 152 passed, 2 skipped.
2026-09-09 23:32:30 +10:00
c9a7fb813b test: factor spawn/close into _run_* context managers (phase 1)
101 single-session sites go from s = _spawn_* + try/finally
s.close() to with _run_*() as s:. Standard boot preambles fold into
wait= (any/any_frame/app0/app0_mapped). Client-cleanup tails are kept
as inner try/finally so kill order is unchanged; the dead
if poll() is None: terminate() after close() is dropped (close already
terminate+wait/kills). Fixtures, kick-in-kick outer/inner pairs and
_run_* internals are untouched. Full suite: 152 passed, 2 skipped.
2026-09-09 23:25:19 +10:00
04e056518a x11: instrument pending-associate/classify chain; mark ready_and_claim flaky
Deeper-X11 instrumentation (permanent, DEBUG): every associate event
now logs surface null/mapped/hooked state, classify logs wid/xpid/pgid
at entry, and pending-map has its own line -- closing the blind spot
between xwm pairing and tab claim.  Plus kick_monotonic_ms() timestamps
on the new lines for stall measurement (prefix-safe for all test
regexes).

Paid off immediately: two stalls autopsied to paired-but-never-mapped
wlr_surfaces (associate ran with surface mapped=0, no map for 15-30s,
classify never invoked -- proven by the absent entry line).  The stall
is therefore upstream of kick classification (X MapNotify delivery /
xwm mapping under -n15), not in it; locating it further needs live
capture during a stall, not post-hoc logs.

test_xwayland_ready_and_claim failed once the same way (paired xmessage
surface never mapped within 15s): marked flaky per the seen-it rule
(passes serially).
2026-09-09 22:31:46 +10:00
52d12bdf2e test: xwayland_alt_delete waits for the reaped launcher, not a fixed poll
The 15s os.kill poll asked for trouble (fixed window on a foreign event
loop).  Replaced with kick's own SIGCHLD reap line ([child] pid N
exited, written unbuffered per reaped child) -- the same signal, event
anchored, 30s backstop only.

Two bugs found along the way, both in the test not the product:
- claim pid != reaped pid (sh -c forks; the claim is the grandchild,
  the reap is the direct-child launcher) -- wait on [launch] app=0's pid.
- [child] uses 'pid ' (space) vs [launch]/[claim] 'pid=' -- the first
  version of this wait matched nothing for 30s, deterministically.
  (Also: earlier validation runs silently deselected this marked test;
  always pass -m flaky when validating marked tests.)

Unmarked after 12/12 at -n15 + serial green.
2026-09-09 21:59:56 +10:00
5ffc051940 test: event-driven hold-to-repeat tests (no wall-clock rate); mark xwayland_alt_delete
hold_alt_down_repeats + alt_tab_hold_repeats asserted repeat COUNTS in
fixed windows -- pure wall-clock.  Now: press -> wait [repeat] start
(new DEBUG lifecycle lines in kbd_repeat_start/cancel; stop logged only
when disarming a live timer) -> wait for ONE synthesized repeat
(count-based, unbounded time) -> release -> wait [repeat] stop ->
immediate count assert (no timer exists post-disarm, so no silence
window needed).  Generous timeouts bound hangs only; slow boxes take
longer without failing a rate.  hold_alt unmarked (6/6 at -n15).

xwayland_alt_delete_closes_x11_tab: 1 failure in 13 runs, no body --
marked flaky per the seen-it rule.

Evidence: -n15 gate clean (153 passed), serial gate clean (153).
2026-09-09 13:30:19 +10:00
e398f90b12 test: migrate host-timed tests to private kick-in-kick hosts; flock clipboard
The 7 host-timed tests failed not (only) on timeouts: autopsy showed
parallel workers stealing each other's live-host clipboard (wl-paste
returns another test's token -- no timeout survives that).

Clipboard x3: the failure is cross-talk on ONE shared host clipboard.
Serialize just those sections with an flock file across xdist workers
(the 45s polls stay as backstops for genuine host slowness -- marks
kept; focus-based backend still needs the real host).

Fullscreen x3 + cursor-shape: migrate to per-test outer-kick hosts
(same xdg/fullscreen/shape protocols, deterministic compositor instead
of GNOME).  No coverage lost (single code path; timing was the only
host variable).  cursor-shape uses deterministic warp-enter; fullscreen
uses tap/chord acks.  Added KICK_REPEAT_DELAY_MS + extra_args to
_spawn_nested_in.  Unmarked after -n15 validation.

hold_alt stays (wall-clock timer).

Evidence: -n15 gate 3x clean (152 passed), serial gate clean (152),
migrated tests 6/6 at -n15.  12 -> 7 flaky.
2026-09-09 13:03:10 +10:00
0babe8832e fix: survive Xwayland SIGKILL without aborting (detach X surface listeners)
Killing the embedded Xwayland server aborted the compositor:
surface_handle_resource_destroy assert (non-empty map listener list)
via wl_client_destroy in the main loop's flush_clients.

Mechanism: the dead server's Wayland client connection is purged before
wlroots' xwm cascade dissociates anything, so wlr_surfaces die with our
map/unmap/commit listeners still attached.

Fix: watch the Xwayland Wayland client (its destroy signal fires before
its resources are purged) and proactively detach surface listeners only
-- across claimed windows, override-redirect windows and unclaimed
pendings -- leaving xsurface-level listeners for the later tab teardown.
Idempotent; later dissociate/xsurface-destroy find clean flags.  The
restart test now also waits for the X11 window's map before killing, so
the crash path (listeners attached at death) is deterministically
exercised instead of raced.

Also re-mark output_mgmt_apply flaky (1 post-fix assertion under -n15;
budgets help but the modeset roundtrip stays load-sensitive).

Evidence: restart test 12/12 at the -n15 repro config (was ~2/9
crashing), detach handler firing on every server death, -n15 gate
clean, serial gate clean (148), flaky set green (11).
2026-09-09 12:23:56 +10:00
dcd6552533 test: fix dead_command, output_mgmt, gestures, xreqs; mark restart/leader/popup flaky
Fixed + unmarked (all green serially, holding at -n15):
- dead_command: wait for the exit line (event) before proc.wait instead
  of a fixed 10s reap timeout.
- output_mgmt_apply: phase on the existing [output] apply line so the
  commit wait covers only client reconfigure lag (30s budgets).
- gestures_roundtrip: cursor-line + [gesture] forward-line acks per
  sequence (offset), single client-file poll; no more resend-on-slow.
- x11_client_requests_driven: phased [xwayland] ready wait (own budget)
  + startup-crown settle/nav.

Hardened, marks kept (host-timed roundtrips): 3 fullscreen tests use
tap_ack/chord_ack + 30s host-configure waits.

Marked flaky (post-fix sightings under load):
- x11_menu_popup (associate never lands in X11-heavy -n15 runs),
- x11_leader (1 claim timeout post-fix),
- xwayland_server_restart_survived (real SIGSEGV in
  wl_display_flush_clients on Xwayland SIGKILL restart -- pre-existing
  race, unrelated to this work; needs a proper fix, not a test tweak).

Net flaky 14 -> 11. Evidence: -n15 gate 2x clean (148 passed),
serial gate clean, flaky set green serially.
2026-09-09 11:49:51 +10:00
f31b781d61 test: mark dead_command, x11_requests_driven, x11_leader, output_mgmt_apply flaky
All four observed failing under parallel load (X11 client startup /
claim races, dead-command explanation timeout, output-mgmt modeset
roundtrip); all pass serially. 14 flaky total.
2026-09-09 10:40:11 +10:00
321a02e1bf test: mark x11_menu_popup flaky; convert remaining fixed sleeps
test_x11_menu_popup_attaches_as_member failed 3x under parallel load
with no diagnosed mechanism: marked flaky per the seen-it-fail rule
(10 flaky total; all pass serially).

Sleep follow-up: fixed sleeps 131 -> 112 (-26 assertion-guarding,
+poll intervals).  Converted the safe remainder with the same
techniques -- cursor-line waits for pointer baselines, tap_ack quorums
for absence guards (function keys, plain keys, minimize/move/resize),
client-file polling for the maximize-refusal roundtrip, dropped the
now-vacuous reorder sleep (consumed chords + stretched repeats leave no
async transition source).  Left deliberately: wall-clock timers (idle,
hold-settle), teardown-survival settles in stable tests, X11 structural
sleeps, rate-limit pokes, poll intervals.

Verified: -n15 gate clean 4x (149 passed), -n15 full run fails only the
10 pre-marked flaky, flaky set green serially.
2026-09-09 10:07:26 +10:00
49612cf992 test: fix (not mark) time-sensitive tests -- full rollout (38 -> 9 flaky)
Mechanisms found by autopsying failing sessions' logs, each fixed with
logging + event-anchored waits instead of sleeps/fixed assumptions:

- Input-consumed acks: new Session.tap_ack/chord_ack snapshot the log
  offset BEFORE sending (send-then-snapshot races a descheduled test and
  misses its own line) and wait for the existing [kbd] press line.
  wait_for_new_after covers release-side effects ([mru] commit).
- Wall-clock repeats displacing exact MRU/cycle/reorder state: a tap whose
  press/release processing spans the 600ms repeat delay catches synthesized
  repeats (autopsied: 3 preview steps from 1 press).  KICK_REPEAT_DELAY_MS
  env override (default 600); all test sessions stretch to 60s except the
  two hold-to-repeat tests, which get private sessions with real repeats.
- Startup-crown flips (last mapper promotes itself): all crown reads
  settled (both maps = quiescence) + relative navigation; black-tab crowns
  log [diag] active slot= (no active app= line) -- waited accordingly.
- Title/data decoupling: [title] now emitted at data sources (map-end with
  final title, post-refocus destroy, renames, focus promotion, subcycle,
  tag-group join), not just overlay draws; premature claim-time hook tried
  and reverted (wrong pick poisons the dedup cache).
- Pointer tests: new [cursor] pos= DEBUG line on warp/motion; dump-poll
  loops become cursor-line + single-dump asserts.  Also fixed a latent
  _spawn_standalone bug: env -i dropped KICK_DUMP_DIR, so parallel
  standalone sessions shared /tmp/host_N.ppm and read each other's dumps.
- Spawn races: _nested_session/no_args retry instant client death.
- X11/layer/modal: settle+nav, map-anchored claims, content dump-polls,
  settle-poll instead of fixed sleeps.

Genuine product race fixed: fork->setpgid window let SIGCHLD-driven
sweep_dead_startup_groups conclude ESRCH on a not-yet-existing group and
drop a LIVE tab (orphaned sleep survivors found on the box).  Parent-side
setpgid + pid-liveness double-check before sweeping.

Remaining 9 flaky (wall-clock timers, host-compositor roundtrips):
gestures, hold_alt, fullscreen x3, clipboard host x3, cursor-shape.

Evidence: -n10 clean 5x (150 passed, ~28s), serial clean (150 passed),
flaky set green (9 passed).
2026-09-09 08:17:55 +10:00
28210eb285 test: fix (not mark) time-sensitive tests -- pilot of the logging technique
Pilot A (input-consumed signal): test_close_black_tab_active_last waits
for [kbd] key=111 state=1 after the chord, proving the compositor
consumed the key before waiting for the effect.  Unmarked flaky.

Pilot B (data-source logging): [title] was only emitted from overlay
draw passes, so title tests needed Alt held + live frames.  tab_row_title
is now also called at the data-source points where the topmost window's
title can change -- end of the map handler (first commit carries the
final title with tab assigned and focus settled), after refocus in
window_destroy_common, on set_title renames, and on the focus-promotion
path -- so row titles are log-observable with no overlay frames.
test_sub_windows_stack_mode_row_title_follows_top drops the Alt hold and
is unmarked.  (A premature hook at claim time was tried and reverted: the
title has not arrived yet there, and resolving with the wrong pick
poisons that window's dedup cache and kills the later fallback line.)

Startup-crown races (found when full-suite validation failed 9-19 tests
that pass in isolation): each tab's first map promotes it, so under load
the LAST mapper steals the crown and neither the transient
wait_any_active read nor 'settled crown == 1' holds.  Five tests now
settle (both tabs mapped = quiescence: no more first-maps, no more
promotions) and navigate relatively: alt_tab_walks/commit/1/repeats and
the sigkill-trap test.

-n10 clean 3x (123 passed, ~21s); serial clean (123 passed).
2026-09-08 22:26:30 +10:00
d8332db375 test: de-flake the suite for parallel runs (-n10 clean 4x, ~25s)
Parallel runs (-n10, needed since -n20 overwhelms the desktop
compositor) exposed load-sensitive tests as failures. Fix the
fixable, mark the rest flaky (all marked tests pass serially;
./test.sh -m flaky stays green in ~33s):

Systemic fixes (free on success -- poll loops exit early):
- Session poll-loop timeouts retuned for loaded boxes: wait_for
  15->20s, wait_any_active/active_frame 10->20s, wait_app_active/
  wait_surface_mapped 10->15s, wait_active/change 3->10s,
  cycle_ack 5->15s; drop explicit 3s waits onto the new defaults.
- Startup-crown race: wait_any_active could catch a transient crown
  while the other tab was still pending, so four tests now settle
  both maps before reading the crown; alt_shift_t quiesces maps
  before snapshotting the transition count.
- Pointer-constraint and output-mgmt poll deadlines 5/20->15/30s
  (per-iteration dump+parse cost under load, not logic).

Flaky marks (all pass serially; fail only via load timing -- key
chords/taps landing in shifted state, overlay/pixel timing, host
roundtrips over the shared desktop compositor, X11 startup races,
repeat-rate wall clocks, multi-client dances):
hold_alt, arrows_reorder, sub_windows x4, fullscreen x3,
clipboard x3, pointer x3, screen_mode, layer x2, x11 x3,
startup-crown, modal, quit, plain_delete, cycle_wraps,
function_keys, alt_delete x2, tab_death, gestures_roundtrip,
modifier_super, no_args, alt_shift_move, close_black_tab,
output_mgmt_apply, screen_mode_sets_output_size.
2026-09-08 13:38:47 +10:00
7e2bb18a85 test: parallel-safe suite (xdist), shared globals session, KICK_DUMP_DIR
Make ./test.sh -n4 work (~47s vs ~156s serial):

- kick.c: KICK_DUMP_DIR env override for frame-dump .ppm paths
  (default /tmp); per-boot dump_seq counters no longer collide
  across concurrent compositors.
- tests: every spawn gets a unique log file and a per-session dump
  directory owned by the Session (close removes the tree instead of
  globbing /tmp, which raced parallel workers' live dumps).
- 14 protocol-globals tests share one module-scoped keeper session
  via short-lived --globals-out clients instead of 14 boots.
- Two presence-waits converted from fixed sleeps to event waits.
- Harden the fullscreen round-trip: wait for seat keyboard focus
  ([diag] kbd-enter, new debug line in window_enter) before tapping
  F -- map alone does not guarantee enter under load and the tap was
  silently dropped.

Serial remains the deterministic gate (documented in test.sh and
README): a few pre-existing timing-sensitive tests can still flake
under parallel load; they pass alone and serially.
2026-09-08 12:02:02 +10:00
a593d83b37 tests: drive kick sockets over ext-data-control instead of wl-clipboard
Stock wl-clipboard only speaks the legacy zwlr_data_control protocol
kick no longer offers (removed in wlroots 0.20), and its wl_data_device
fallback needs a focus serial a surfaceless tool never receives, so the
six clipboard tests poll-timed-out on hosts where kick is the data-control
endpoint (e.g. labwc).

wltest gains --clipboard-set/--clipboard-demand-expect,
--dc-primary-set/--dc-primary-demand-expect and --dc-clear over
ext-data-control-v1 (no focus or serial needed; setters exit 0 on
cancel like wl-copy -f), and the tests use them on kick sockets while
wl-copy/wl-paste stay on the real-host side.
2026-09-08 11:19:22 +10:00
f146cd5d1b test: share one compositor across globals tests, per-spawn logs
Booting a fresh kick per globals assertion wastes a spawn each for
zero benefit: the advertised global set is static and these tests read
only the --globals-out file. A module-scoped globals_session fixture
boots one keeper compositor; each of the 11 globals tests runs a
short-lived --globals-out client against its socket instead
(11 spawns -> 1).

Groundwork for future parallel runs: every spawn now gets a unique
log file (_fresh_log) instead of sharing /tmp/tabtest.log, so workers
can no longer unlink or interleave each other's logs.

Also convert two presence-waits from fixed sleeps to event waits
(x11 popup attach waits for the associate line; maximize-refusal waits
for the first configure line): faster and immune to latency under
load. Crash-guard and timeout-crossing sleeps are deliberately
untouched.
2026-09-08 10:54:51 +10:00
7c77a3beaf feat: implement wl_fixes, xdg-toplevel-tag, color-representation (wlroots 0.20)
Three of the four protocols new in wlroots 0.20 (ext-workspace has no
meaningful mapping onto kick's tab model, so it stays out):

- wl_fixes (core, v1): advertise the global; wlroots serves
  destroy_registry itself. Clients like Firefox use it to tear down
  registries without tripping protocol errors.

- xdg-toplevel-tag-v1: record each window's tag + translated
  description ([tag] log line per change), show 'title [tag]' in the
  overlay, and with --tab-groups on stack an unmapped external window
  onto the tab whose window carries the same tag (browser-style tag
  groups). Tags arriving before claim wait in a pending list keyed by
  toplevel; mapped windows never move.

- color-representation-v1: advertise an explicit SDR sRGB set
  (premultiplied-electrical alpha, identity coefficients in full
  range) rather than the renderer's query, which reports empty on
  GLES2; wlroots validates client values against it.

Tests: wltest gains --tag-set/--tag-desc and --color-probe/--color-out
(bind-time listener, since the manager bursts on bind); the globals
test covers all three new globals; new tag, tag-grouping and color
round-trip tests; README documents all three.
2026-09-08 10:22:50 +10:00
ccbc782177 migrate screen capture from wlr-screencopy to ext-image-copy-capture
The wlr-screencopy unstable protocol is deprecated; its superseding
staging protocols ext-image-copy-capture-v1 and
ext-image-capture-source-v1 ship in wayland-protocols.  Migrate:

- advertise wlr_ext_image_copy_capture_manager_v1 and
  wlr_ext_output_image_capture_source_manager_v1 instead of the
  wlr_screencopy_manager_v1 global (wlroots runs the whole session/frame
  flow off the output commit path, so no listener wiring is needed)
- rewrite wltest --screencopy for the new client flow: bind the capture
  managers, create an output capture source, open a copy-capture session,
  wait for the constraint batch (buffer_size/shm_format/done), then attach
  a shm buffer and ask for one frame
- generate the two client stubs from wayland-protocols and drop the
  bundled wlr-screencopy-unstable-v1.xml
- update the globals test to the new interface names

Existing wl_data_device-based clipboard bridge code is unaffected.
2026-09-08 06:49:39 +10:00
592a2a036e migrate clipboard bridge from wlr-data-control to ext-data-control
The wlr-data-control unstable protocol is deprecated; its superseding
staging protocol ext-data-control-v1 ships in wayland-protocols.
Migrate the host-side clipboard/primary bridge to it:

- bind ext_data_control_manager_v1 version 1 instead of zwlr_manager
  (ext-data-control v1 always supports primary selection, so the
  dc_primary_supported gate is dropped and the registry bind is plain)
- rename all zwlr_data_control_* to ext_data_control_* types/calls
- generate ext-data-control-v1 from wayland-protocols and drop the
  bundled wlr-data-control-unstable-v1.xml
- update README and test log-message expectations

wltest --screencopy is unaffected; the screencopy migration is separate.
2026-09-08 00:37:52 +10:00
1f35f90a95 Alt+Tab / Alt+1 walks a window-level MRU stack, commits on release
Prefix+Tab and prefix+1 preview the session's windows most-recently-used
first: each press steps to the next window after the shown one in server.mru
order, wrapping at the bottom, without mutating the stack until the modifier
is released. Releasing after navigating commits the shown window to the
front; a bare hold leaves the order untouched. Focus changes with the
modifier up move the entered window to the front immediately.

Alt+1 is the chord that survives hosts like GNOME, which grab Alt+Tab,
Alt+Esc and Alt+Backtick (the latter via the metacity-era switch_group
default) before a nested compositor ever sees them; Alt+Tab is kept for
hosts that leave it free. Windows join the stack least-recent on allocation
and are removed on teardown; reachable stops mirror cycle_tab (live or
pending-claim, not closing). Holding the chord repeats via the existing
synthesized-repeat machinery.

Tests cover stepping, commit-on-release, the Alt+1 synonym, and hold-to-
repeat.
2026-09-06 23:52:03 +10:00
ca7f1f2852 tests: cover quit dialog, constraint/text-input/dialog teardown, virtual abs+mods, mgmt probe 2026-09-05 10:59:49 +10:00
32de4866a6 tests: cover X11 requests, OR move, Xwayland restart, idle release; fix inhibitor destroy 2026-09-05 10:24:49 +10:00
b004cfb66c tests: cover data-control clipboard/primary bridge via kick-in-kick; ignore SIGPIPE 2026-09-04 20:47:12 +10:00
7d2bda5800 tests: cover overlay icon desktop/PNG/SVG/absolute/missing paths 2026-09-04 20:20:44 +10:00
3446b79bb3 session-lock: drop finished lock on unlock so retakeover works; cover unlock teardown 2026-09-04 20:16:45 +10:00
7955e98150 tests: cover taskbar activate/maximize/fullscreen requests 2026-09-04 19:57:15 +10:00
b0858e15be tests: cover client maximize/minimize/move/resize, popup reposition, true SIGKILL escalation 2026-09-04 19:49:08 +10:00
21becaf17b coverage: gcc/gcov line coverage of kick.c unioned over the suite 2026-09-04 18:13:32 +10:00
9d1e3e802c smoke tests: gate on surface map / painted frame before capture
Two more tests had the same latent race fixed for
test_standalone_headless_virtual_pointer_motion_click: injecting an
end-to-end capture too soon after wait_any_active/[claim], when the
surface may not be mapped/composited yet, so the event/capture is
silently lost under load.

- test_touch_delivery_to_client: dropped its time.sleep(1.0) and now
  waits on wait_surface_mapped(0) before the touch down/motion/up, so a
  pick never races surface mapping.
- test_standalone_headless_output_power_blank: waits on
  wait_active_frame() before the baseline screencopy, so the ',content'
  assert never sees the pre-map black placeholder.
2026-09-04 12:27:41 +10:00
7194e59e8c smoke test: wait for surface map before virtual pointer motion/click
test_standalone_headless_virtual_pointer_motion_click fired its virtual
pointer motion+click straight after wait_any_active, which only means the
window object exists -- before its Wayland surface has necessarily mapped
(still the black placeholder, surface=0x0).  A pointer event landing
before the surface maps reaches no surface, so --pointer-out logged no
'enter'/'button' and the test intermittently failed under load (the race
documented in wait_surface_mapped).  Wait on the [diag] map line first,
matching the other input-injecting tests.
2026-09-04 12:21:37 +10:00
05c3e5dd2b tests: anchor layer bars left+right so they map
A zero width without the opposite edge anchors is a protocol error,
so wlroots killed the test bar before it mapped and the exclusive
test failed (800 -> 800) while the zero-exclusive sibling passed
vacuously. Both bars now anchor left+right, the zero-exclusive test
asserts [layer] map so it cannot pass without a mapped bar, and
wltest documents the anchor rule.
2026-09-04 11:05:26 +10:00
d8164ce315 protocols: expose output-management, honor resizes standalone
Advertise zwlr_output_manager_v1 with the single head, published on
setup and re-published from the commit path whenever the size lands
(resizes apply lazily, so the commit -- not the request -- is where
the new size becomes observable).

Client sizes apply standalone through the normal resize path (tabs
reflow, swapchain follows); nested refuses anything but the live
size since the host owns the geometry. Disabling, scale and
transform changes are refused; superseded configs are destroyed
after feedback.

Standalone output_resize now owns the canvas size so client resizes
reach the lazy modeset. wltest gains --output-mgmt; smoke tests
cover the global, head listing, and an 800x600 apply with tab
reflow.
2026-09-04 10:52:16 +10:00
fcd3bca53b protocols: prefer xdg-toplevel-icon artwork in the overlay
Advertise xdg_toplevel_icon_manager_v1 (28px, the overlay draw size)
and use the largest uploaded buffer as the tab's overlay texture.
The desktop-file guesser stays as the fallback -- and the only source
for X11 windows -- so every window still gets an icon; clearing the
icon drops back to guessing.

wltest gains --icon; smoke tests cover the global and the end-to-end
protocol-icon preference.
2026-09-04 10:35:34 +10:00
50a660860d protocols: honor tearing hints and fractional scale
Drive the output commit's async-flip flag from the shown surface's
tearing hint (a real tearing flip on DRM; correctly ignored on
headless/nested), with per-object hint tracking that requests a frame
on change. Notify each surface of the output scale at claim so
clients never guess preferred_scale.

wltest gains --tearing and --fractional-out (plus linking the two
protocol stubs it now uses); smoke tests cover the async commit
transition and the notified scale value.
2026-09-04 10:21:30 +10:00
8a71a062ce protocols: forward pointer-gestures swipe/pinch/hold
Advertise zwp_pointer_gestures_v1 (v3, with hold) and fan libinput
touchpad gestures out to the client holding seat pointer focus.
The stdin test feed gains swipe/pinch/hold messages driving the same
forwarders in any mode (nested has no host gesture source).

wltest gains --gesture-log plus swipe/pinch/hold feed helpers; smoke
tests cover the global and an exact-value round trip of every gesture
and cancel path.
2026-09-04 10:13:13 +10:00
b189318124 protocols: support xdg-dialog modal toplevels
Advertise xdg_wm_dialog_v1 and mirror each dialog object onto its
window. A modal dialog demands attention: on map (or when set modal
while mapped) its tab is shown and it takes window focus, in both
--tab-groups modes; placement itself is unchanged and session lock
still wins.

wltest gains --dialog-modal/--extra-modal/--extra-delay; smoke tests
cover the global, the background-modal steal with tab-groups on, and
the own-tab steal with tab-groups off.
2026-09-04 10:00:34 +10:00
42853dcc18 protocols: honor wlr-gamma-control for night-light tools
Advertise zwlr_gamma_control_manager_v1 and commit client ramps to
the single output (reset when the control goes away); other outputs
and failed commits fail the control so clients retry. Outputs with
no LUT (headless/nested) are failed by wlroots itself.

wltest gains a --gamma mode reporting gamma_size/failed; smoke tests
cover the global and the clean headless failure path.
2026-09-04 09:43:04 +10:00
b9194addf4 protocols: input-method relay, content-type, single-pixel
Advertise zwp_text_input_manager_v3 + zwp_input_method_manager_v2 and
relay the focused field to the in-session IME and back (enter/leave on
seat keyboard focus, keyboard-grab forwarding, IME popups above tabs).

Also advertise wp_content_type_manager_v1 (logged on map) and
wp_single_pixel_buffer_manager_v1 (scaled via viewporter).

wltest gains --text-input/--input-method/--content-type/--single-pixel
modes; smoke tests cover globals, the IME round trip, focus follow,
single-pixel rendering and the content-type log line.
2026-09-04 09:37:13 +10:00
a7a38fadca x11: guard set_class NULL app_id/title for taskbar handles
Deleting a window's WM_CLASS emits set_class with class==NULL while the
title is set; handle_xs_set_class passed the raw NULLs into
wlr_foreign_toplevel_handle_v1_set_app_id / ext update_state, which
strdup(NULL) -> SIGSEGV (exit 139; UBSan flags the nonnull argument
first). The sibling set_title handler and every other mirror site use
foreign_str(); apply the same guard here.

Add tests/xclass.c (title set, WM_CLASS set-then-deleted probe) and a
headless smoke test asserting the compositor survives the delete with
no crash indicators (fails pre-fix: compositor dead).
2026-09-04 08:39:37 +10:00
35ce107a23 tests: nested xdg popup chain client + kill-mid-chain coverage
Add a --popup wltest mode (toplevel + popup P1 + nested sub-popup P2,
each buffer-backed so all three map) and a headless smoke test proving
a full chain maps, the client can be kill -9'd mid-chain, and a fresh
chain maps afterwards with the compositor alive and crash-free.

Writing the mode exposed two client-side protocol bugs in wltest
itself (both fixed here): the final get_popup+commit batch was never
flushed (dispatch_pending+poll neither sends), and the hold loop never
READ new events (dispatch_pending drains only the already-read queue),
so the nested popup's configure -- proven sent via server WAYLAND_DEBUG
-- starved unread and P2 never mapped. The hold loop now roundtrips
periodically, which reads, dispatches and flushes.

Investigated as a potential live_popups use-after-free (submenu scene
outliving its parent): wlroots cascades child-popup destruction on
parent teardown and kick removes entries on popup destroy, so no stale
scene reference survives; 6 kill cycles under ASan/UBSan stayed clean.
No compositor change needed.
2026-09-04 08:24:02 +10:00
6c5df47bf0 x11: clear or_focus_owner when its tab is destroyed
An override-redirect menu that takes keyboard focus stashes the active
tab in server.or_focus_owner; dismissing the menu later reactivates it.
If the owner tab was closed first, the release activated freed memory
(heap-use-after-free in set_active_tab via tab_current_window, caught
by ASan: free in remove_tab <- drop_tab <- window_destroy_common <-
handle_xs_destroy; use in or_window_focus_release <- or_handle_unmap).

Clear the stash in remove_tab (the single live tab-free choke point),
so the release drops keyboard focus instead.  Without ASan the bug is
silent (stale memory usually still mapped), which is why it survived:
repro needs a focus-stealing OR menu (real menus paint content; an
unpainted probe never completes the wl map handshake).

Add tests/xormenu.c (frame + OR menu in separate processes, after the
xpopup pattern) and a headless smoke test driving the exact sequence:
menu takes focus, owner tab closed, menu dismissed, compositor alive
and crash-indicator-free.
2026-09-03 23:24:46 +10:00
9ea0766bd3 xdg-activation: focus windows by token
Let launchers focus existing windows via xdg-activation-v1.  On
request_activate, find the kick window owning the surface and switch to
its tab (set_active_tab + window_enter, both gated on session_locked so
activation can never bypass the lock screen).

Add a --activate wltest mode (two windows; second steals focus, then a
token activates the first) and two smoke tests proving the global is
advertised and the inactive window receives an activated configure.
2026-09-03 14:11:11 +10:00
0475216913 virtual-input: feed zwp_virtual_keyboard/pointer into the seat
Let synthesised input (wtype & co.) drive the compositor through the
exact same paths as real devices: virtual keys flow through
process_key_event (so Alt+Up tab-cycles, chords swallow under lock/
inhibit), virtual pointer motion/buttons drive native_ptr_* and the
seat.  A missing client keymap falls back to the server's so modifiers
resolve; cleanup uses resource-destroy listeners (run before wlroots'
finish asserts).

Add --virtual-key (code:state sequence with xkbcommon us keymap),
--virtual-motion/--virtual-click, and --pointer-out (window logs pointer
events) wltest modes; three smoke tests prove the globals are advertised,
a virtual Alt+Up cycles tabs, and virtual motion+click reach the window.
2026-09-03 14:08:04 +10:00
146f9b6b5c output-power: honor zwlr_output_power_management_v1
Let a client (wlopm) blank/unblank the single output.  OFF overwrites the
composited scene buffer with opaque black before commit (a dedicated
render-pass fill in both render paths), so the committed frame is truly
dark rather than a stale scene frame.  ON forces a full scene repaint
(the swapchain recycles the black buffer, so without whole-damage it
would re-commit stale black) and resumes normal compositing.

Extend --screencopy to report full-buffer blackness (black vs content),
add a --power on|off wltest mode, and three smoke tests: the global is
advertised, and a power off/on cycle blanks then restores the visible
window (verified via screencopy).
2026-09-03 14:01:02 +10:00
45df9d4818 shortcuts-inhibit: honor zwp_keyboard_shortcuts_inhibit_v1
Let a focused fullscreen client (game/VM) grab the compositor's keyboard
shortcuts.  New inhibitors for the focused surface activate immediately;
a lazy sync at grab-chord time (de)activates across focus changes so all
focus paths are covered without extra listeners.  While honored, the
tab/window grab chords are swallowed in process_key_event (quit and VT
switch stay live so a stuck client can't trap the session).

Add a --inhibit wltest mode (window + inhibitor, reports active) and two
smoke tests asserting the global is advertised and the inhibitor becomes
active on the focused surface.
2026-09-03 13:56:56 +10:00
c64a10e8d9 protocols: advertise tearing-control + fractional-scale
Add wp_tearing_control_manager_v1 and wp_fractional_scale_manager_v1 as
pass-through advertisements for client convenience (games, HiDPI).  kick
drives a vsynced scene at scale 1.0, so nothing is honoured: a new
tearing object is only logged at DEBUG.  Bundle the output-power XML
locally too (needed by a later commit) and generate the server headers
the wlroots headers' quoted includes require.
2026-09-03 13:54:25 +10:00
044c7543bb screencopy: advertise wlr-screencopy-unstable-v1
Composite the scene and let wlroots run the whole capture flow off the
output commit path: the manager is created in server init and every
commit carrying a rendered buffer becomes a copyable frame (both the
standalone and nested render paths already commit a buffer, and
wlr_output_update_needs_frame drives the render gate).

Bundle the wlr-screencopy XML locally (a copy of the one vendored in the
pinned wlroots subproject) since Meson forbids the parent project from
referencing a nested subproject's files; add a --screencopy wltest mode
that captures the output into a shm buffer and reports the frame
geometry, plus two smoke tests asserting the global is advertised and a
rendered frame is delivered.
2026-09-03 07:57:59 +10:00