Commit graph

104 commits

Author SHA1 Message Date
8bdaa970cc feat: advertise alpha-modifier-v1 (passive surface alpha) 2026-09-10 02:30:55 +10:00
21460bcac9 feat: advertise xdg-system-bell-v1 (log rings at info level) 2026-09-09 22:49:32 +10:00
5b871e447b feat: advertise color-management-v1 (SDR sRGB session) 2026-09-09 22:47:44 +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
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
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
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
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
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
1aa9280696 fix: update remaining wlr-data-control references to ext-data-control
The clipboard bridge backend has been ext-data-control since the
wlr-data-control migration; three comments/log strings still named the
old protocol.  Cosmetic-only, no behavior change.
2026-09-08 07:08:55 +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
0dc782a5d3 build: target wlroots 0.20, pin fallback to 0.20.2
Rename the text_input/input_method manager events and declare the
host-side cursor-shape interfaces wlroots 0.20 no longer exports
via its headers.
2026-09-07 23:37:45 +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
3446b79bb3 session-lock: drop finished lock on unlock so retakeover works; cover unlock teardown 2026-09-04 20:16:45 +10:00
21becaf17b coverage: gcc/gcov line coverage of kick.c unioned over the suite 2026-09-04 18:13:32 +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
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
143a1053c2 session lock: ext-session-lock-v1
Blank the screen and hold input when a lock client (swaylock) grabs
ext_session_lock_manager_v1.  While locked an opaque black rect covers the
output with the lock client's per-output surface floating above it; no
window may take keyboard focus and the compositor grab chords are swallowed
so tabs can't be cycled behind the lock.  kick manages a single output, so a
single lock surface is tracked.  If the lock client dies without unlocking
the screen stays blanked (a deliberate security choice); only a fresh lock
request may take over.  On unlock the previously active tab is refocused.

Includes a wltest --lock mode (binds the manager, locks, draws a buffer on
the lock surface, and optionally --lock-unlock) and two smoke tests:
advertised-globals and lock/surface-config acceptance.
2026-09-03 07:39:25 +10:00
4ea5df0e62 taskbar: foreign toplevel + idle protocols
- wlr-foreign-toplevel-management-v1: per-window handles for taskbars
  with activate/close/maximize/fullscreen requests
- ext-foreign-toplevel-list-v1: compositor-pushed handle list
- ext-idle-notify-v1: client-requested idle notifications
- idle-inhibit-v1: suppress idle while a surface is visible
- wltest --foreign mode (taskbar client, state logging, --foreign-close)
- wltest --idle mode (idle notification + inhibitor testing)
- 5 smoke tests: globals, state roundtrip, close, idle notify, idle inhibit
2026-09-03 01:47:35 +10:00
e539be4338 popup fallback: mount bar menus at output origin only for foreign clients
Parentless xdg_popups (menus opened by layer-shell bars such as
wf-panel-pi) must hang off the output-origin popup tree so they render
flush under the bar instead of being shifted down by the bar's reserved
edge.  But a parentless popup from the active tab's own client (an
in-tab menu whose parent surface was missed) must keep hanging under
that window's tree to preserve its old alignment.

Resolve the popup client's pid and choose the mount accordingly;
same-client popups keep the window tree, foreign clients get the origin
tree.

Also add two KICK_LOG_DEBUG signals the deterministic regression test
keys on: [layer] map pid=N when a layer surface maps (the bar is ready
for input) and [popup] out=x,y geo=w x h pcpid=N with the popup's
scene-exact output position once it maps.  test_smoke.py's
test_panel_menu_flush_under_bar waits on those lines (no pixel diffing,
no fixed sleeps) and asserts the wf-panel-pi menu's output top is flush
under the 52px bar; against a build with the fix reverted it fails with
the menu at y=109.
2026-09-02 10:26:43 +10:00
ebae43242f fix --panel menu offset: mount parentless popups at output origin
Bars (wf-panel-pi) open menus as parentless xdg_popup surfaces. kick's
fallback previously hung them under the active window's scene tree,
which is offset past the bar's reserved edge (server.layout_y), so the
menu rendered a full panel-height too low.

Add a dedicated popup_tree scene tree rooted at the output origin: it is
created at scene setup, kept raised to top alongside layer_tree, and used
as the mount point for parentless popups so their positioner geometry
maps to real output coordinates.
2026-09-01 23:18:12 +10:00
5dc0c76cd1 layer layout: reserve only exclusive-zone surfaces (two-pass, labwc-style)
Replace the layer_reserve_box self-reservation heuristic with labwc's
layers_arrange(): configure exclusive-zone surfaces first (highest layer
down) so they reserve, then the zero-exclusive-zone remainder (lowest
layer up) positioned within the residue without shrinking it.  A transient
zero-ez surface (e.g. a panel notification) no longer resizes the tabs.
2026-09-01 22:31:04 +10:00
5d91d6c766 fix layer-shell crash: unregister commit/destroy listeners on bar teardown
Destroying a wlr-layer-shell surface left kick's commit listener on the
underlying wl_surface's commit signal registered and free'd the kick_layer
without unlinking it, so a late commit during teardown dereferenced freed
memory and corrupted the surface's destroy listener list.  wlroots then
tripped its assertion (wlr_layer_shell_v1.c:54) on the next layer-surface
destroy, crashing kick ~seconds after '--panel' launched (e.g. wf-panel-pi).

Remove both the commit and destroy listeners in layer_handle_destroy before
releasing the kick_layer, matching popup/window teardown.  Reproduced the
crash under gdb, verified the fix survives 75s+ with wf-panel-pi, and the
full suite still passes (79 passed).
2026-09-01 20:56:26 +10:00
6adccd6ef6 rename --bar to --panel (argument, identifiers, and log tag) 2026-09-01 18:30:08 +10:00
fd8c41b71f add wlr-layer-shell bar support and fix popup-parent crash
--bar CMD launches an always-on-top layer-shell panel (e.g. waybar) in a
dedicated launch slot.  The bar's footprint reserves the usable area,
shrinking and offsetting maximized tabs below it even when the client never
sends an exclusive zone; the bar's scene tree is held above every window.

Fix a use-after-free in xdg popup handling exposed by panel clients: resolve
a popup's parent by address comparison against kick's live surfaces rather
than dereferencing popup->parent (wlroots may hand a popup whose parent
wl_surface was already freed outside the xdg teardown cascade).  Popups whose
parent is no longer live fall back to the active window's tree so they still
get their initial configure instead of hanging the client.

Bar child stdout/stderr is /dev/null'd unless KICK_LOG is at debug level, so
waybar's chatter no longer pollutes kick's console (same convention as CLI
clients).
2026-09-01 10:38:57 +10:00
fd7ed766ef confirm-before-quit: ask Y/Enter (quit) or N/Escape (cancel) for Ctrl+Alt+Q and host close when more than one window is open 2026-08-31 10:48:04 +10:00
a8e8106761 flaky tests: fix focus-follows and stacked-member Alt+Delete, un-flake the stable suite 2026-08-31 10:02:17 +10:00
4ee153aa00 tab-groups off: give a related window on its own tab real crown, geometry, and close semantics
With --tab-groups off a related window (e.g. gnome-terminal launched from
the shell inside a terminal tab) is given its own fresh tab, but inherited
the grouped-on-parent treatment of --tab-groups on.  It showed on screen
but never took the crown, so the overlay cursor stayed on the tab it was
launched from.  Apart the two cases with the structural ownership test
w->tab == w->parent_tab (on: shares the parent tab; off: owns its own):

- both map handlers promote the own-tab window (set_active_tab) instead of
  entering it without a transition, so the crown and overlay cursor follow
  what is shown;
- own-tab X11 windows get the maximized-tab geometry, not the transient
  float;
- closing an own-tab X11 window tears its tab down instead of ignoring the
  close;
- they log a real [claim] slot rather than [sub] stack, and are re-maximized
  when the host leaves fullscreen.
2026-08-31 09:34:42 +10:00
be45053631 refactor: unify kick_app/kick_tab_group_member into a single kick_window
Windows now own the scene wiring uniformly; a tab is a pure list head of
identical kick_window structs with no privileged "main" member.  X11 and
xdg paths share one map/focus/claim/destroy tail, the tab-group and
external-to-own-tab behaviours ride on a single origin flag, and tab
membership is just window list order.

Bugs fixed in the port:
- pick_successor took -1 as a truthy prefer_right, returning NULL when the
  rightmost tab died and tearing the session down; the parameter is now a
  bool so the misuse cannot recur.
- reorder_active_tab wrote a tab back into its old slot because
  wl_list_insert() inserts AFTER its anchor; the middle-slot case now
  anchors on the predecessor.
- claim_xdg_window left the freshly created scene tree ENABLED (unlike the
  X11 path's explicit disable), so a still-black window of the active tab
  read as "already drawn" and its first map skipped the seat keyboard
  enter -- the fix that makes forwarded keys (and the client fullscreen
  mirror) reach the client in nested sessions.
- the active tab's first map no longer re-announces a fresh active
  transition: the boot crown already owns the tab, so prefer_one stable
  active_count under load.
- restored the "[x11] member associate app=%d" log for grouped windows so
  the old log contract is preserved.
2026-08-31 09:02:47 +10:00
469e31115b tab-groups: let a tab survive when its main surface dies but sub-members live
When the main surface (X11 or XDG) is destroyed, remove the stale main
wrapper from the member list instead of tearing down the whole tab.
Sub-members are the tab's new content; only when the member list is
empty do we finish the destroy.

Changes:
- app_has_window(): also return true for mapped sub-members
- handle_toplevel_destroy / handle_xs_destroy: remove the main wrapper,
  keep app->stack alive, return early if sub-members remain
- member_destroy_common: tear down the tab when the last member goes and
  the main surface is also dead
- set_active_app: hide the old tab's stack unconditionally (not just when
  old->toplevel is set) so a survivor tab is properly hidden on switch

Fixes: libreoffice crash (splash screen destroy triggered exit)
Fixes: black window after closing libreoffice (sub-member teardown missing)
2026-08-27 11:49:54 +10:00
fc89b1ad27 refactor: eliminate three code duplications in kick.c
1. Four identical set_title/set_app_id handlers (toplevel, sub, xdg)
   collapsed into handle_overlay_refresh().

2. Map activation decision extracted to map_should_activate(), shared
   by both the xdg and X11 map handlers.

3. Timer cleanup removed from finish_app_destroy() -- remove_app()
   already handles it unconditionally.
2026-08-27 09:40:12 +10:00
0e8dd8b6f7 refactor: extract sub_detach_xdg/x11_listeners from duplicated listener removal
Three places detached signal listeners from tab-group members:
handle_sub_destroy, handle_sub_x_destroy, and remove_app.  The
remove_app copy had already drifted (missing set_title/set_app_id).
Extract two helpers so the logic lives in one place.
2026-08-27 09:19:28 +10:00