Commit graph

30 commits

Author SHA1 Message Date
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
dc2938e5ae wltest: add --layer mode for layer-shell work-area tests
--layer <bg|bottom|top|overlay> creates a zwlr_layer_surface_v1 instead
of an xdg toplevel, with --layer-anchor/--exclusive-zone/--layer-size
control.  Wire the wlr-layer-shell-unstable-v1 client protocol into the
wltest target.  Lets the smoke tests exercise kick's exclusive-zone
work-area computation without depending on an external panel.
2026-09-01 22:31:18 +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
c10845f2c1 route the host window through xdg-shell directly on SSD compositors
libdecor sat on the critical path of every host-window transition even
where it drew nothing: on compositors honoring server-side decorations
(labwc/sway/KDE) it negotiated SSD, then still injected permanent
set_window_geometry hints and batched acks inside its own commit call.
labwc 0.9.8 expires a 100 ms configure deadline under load and answers
"move but keep old size" -- anchoring fullscreen views to stale geometry
forever.

the host window now selects its backend at startup: compositors
advertising zxdg_decoration_manager_v1 get kick-owned xdg_shell objects
with immediate configure acks, an explicit server-side decoration request,
and no geometry hints at all (KICK_LIBDECOR=1 forces the libdecor path);
hosts without the manager -- Mutter/GNOME forces CSD -- keep libdecor
unchanged.  this also restores mirrored fullscreen semantics: a client's
fullscreen request again fullscreens the host window in one step.
2026-08-26 18:19:59 +10:00
e1b137bf30 fix X11 menus and popups: replay late association, respect transient geometry
X11 windows now pair their Wayland surface after membership decisions run
(membership starts at first map), so instantly-mapped transients -- GTK
menu dropdowns -- attached without ever wiring their scene surface: emacs
menus did nothing, silently.  The associate handlers now replay the map
when the surface is already mapped, members join the owner's list before
that replay (show_current walks the list to pick visibility), X11 members
keep their own geometry instead of being stretched maximized, and late
attaches force whole-scene damage so the first frame is never black.

Members render through wlr_scene_subsurface_tree_create; the ctl test feed
gains CTL_CMD_PTR_BUTTON so tests can click for real; tests/xpopup.c
probes the exact menu shape (instantly-mapped managed transient), and a
regression test locks in the attach/replay/focus lifecycle.
2026-08-24 12:09:40 +10:00
08202dc6c3 fix X11 app startup: no forced toolkit backends; X11 windows join tabs at first map
GDK_BACKEND/QT_QPA_PLATFORM forced to wayland stripped toolkits' fallback,
killing X11-only builds like emacs-gtk ('cannot open display' against a
healthy Xwayland). Children now self-select from WAYLAND_DISPLAY/DISPLAY,
and XAUTHORITY is cleared.

Separately, X11 membership decisions moved from window-creation time to
first map: GTK leader windows never map, yet claimed the tab slot at
creation, leaving a permanent black tab while the real frame was demoted
to a stacked member -- and Alt-cycling onto that phantom main member
crashed on wlr_seat_keyboard_notify_enter(NULL). Never-mapped windows now
free silently; keyboard-entry paths guard on live surfaces. New
tests/xleader.c probe (unmapped leader + mapped frame) locks the behaviour
in.
2026-08-24 10:43:41 +10:00
05189128df add XWayland support: X11 apps open as tabs beside Wayland clients 2026-08-21 12:37:28 +10:00
548d6da88e draw window decorations via libdecor so GNOME windows move and resize
The host window previously asked for server-side decoration; Mutter
forces client-side, so the window had no frame at all and could not be
dragged or resized.  Hand the window to libdecor: it negotiates a
server-side bar when the host offers one and otherwise draws its own
titlebar with move/resize/close buttons (GNOME).
2026-08-20 21:22:25 +10:00
f1d92afe19 implement primary selection v1
Advertises zwp_primary_selection_v1 so text editors can publish and
middle-click-paste without a full clipboard roundtrip.  The device-manager
global hooks the seat; the request_set_primary_selection handler installs
the source on the seat (wlroots only emits the request), and the seat's
focus-change/set fan-out delivers the offer to the keyboard-focused tab's
device, mirroring the clipboard path.  No host bridging: the selection
stays within hosted tabs for now.

wltest gains --primary-set <text> and --primary-demand <file>.  The setter
defers its set_selection until a seat-granted serial arrives (wlroots
rejects serials it never handed out), the demander pulls the payload over a
pipe polling both the pipe and the display socket (the compositor forwards
the fd to the owning tab, whose reply arrives with no display event of
ours).  The smoke test cycles between the two tabs so the setter gets a
serial and the demander is refocused to flush the offer, then verifies the
payload lands in the file.
2026-08-19 19:36:56 +10:00
3eda7016e6 implement pointer constraints and relative pointer
Adds zwp_pointer_constraints_v1 and zwp_relative_pointer_v1 so games and
creative apps can grab the cursor and get raw relative motion.  The
focused surface's constraint is activated/deactivated on seat pointer
focus change; LOCKED pins the pointer to its activation position and
CONFINED clamps it to the constraint region (empty region = the whole
surface), applied through wlr_cursor_warp so the rendered arrow follows.
Relative deltas are forwarded from the real input paths: native
standalone motion sends the raw delta, nested mode derives it from
consecutive host positions.

meson generates the pointer-constraints protocol header (the system
wlroots header quotes it) and the wltest client stacks.  wltest gains
--constrain locked|confined plus --confine-rect, and two smoke tests
verify the cursor stays pinned under LOCKED and clamped to the region
under CONFINED.
2026-08-19 18:49:35 +10:00
9e9f4e3174 apply and forward cursor-shape-v1 requests, with per-tab cache
Nested clients that switch the pointer cursor's shape now keep a correct
cursor over kick's window: advertise wp_cursor_shape_manager_v1, apply the
requested shape to the compositor cursor in standalone mode, and forward it
to the host pointer in nested mode via a hand-rolled client call (kick stays
a single C file, so the generated client header is not included).  Shapes
are cached per tab and reset to default on tab switch so a text cursor never
leaks between apps.  Legacy wl_pointer.set_cursor surfaces are not bridged.

The ctl pointer feed now also drives the nested seat directly, so the harness
can give a nested client a pointer enter.  wltest gains --cursor-shape and an
explicit flush (wl_display_dispatch does not flush queued requests), plus the
now-required frame handler.  New tests cover apply, tab-switch reset, and
nested forwarding; tail of README documents the protocol and its limits.
2026-08-19 15:08:31 +10:00
3ccae6cbe1 rename project to kick (repo, binary, socket, env) 2026-08-19 11:46:25 +10:00
0f296d50d6 generate Wayland protocol stubs at build time 2026-08-19 09:54:11 +10:00
b8875f7292 Show per-tab app icons in the Alt-hold overlay 2026-08-14 12:55:42 +10:00
db6bbac84c Draw passive Alt-hold tab-title overlay with FreeType text 2026-08-14 12:39:51 +10:00
d05ded946b Add bidirectional clipboard bridge with text prefetch
Bridge the nested wlroots seat's clipboard with the host compositor.
Uses wlr-data-control when the host exposes it, otherwise a focus-based
wl_data_device fallback (Mutter). Text selections are eagerly prefetched
at mirror time so every paste is served instantly from a compositor-side
buffer instead of paying the host source's latency per paste; non-text
MIMEs keep the zero-copy live relay.

Also fix a critical bug: prefetch_fd was zero-initialized instead of -1,
so the first bridge_prefetch_cancel() closed stdin, breaking the test
event feed and spinning the main loop on EBADF.
2026-08-10 11:29:07 +10:00
5052a9b3ba Fix Debian x64 build: drop nonexistent libwlroots-dev, build wlroots 0.19.1 without -Werror
Debian >= trixie packages wlroots versioned (libwlroots-0.20-dev,
pkg-config wlroots-0.20), which falls outside the >=0.19,<0.20 pin, so
the bundled 0.19.1 source build is used. Fix the README apt line
accordingly and build the wlroots subproject with werror=false so the
newer libinput (1.31.3) enum LIBINPUT_SWITCH_KEYPAD_SLIDE is only a
warning, not a fatal -Werror=switch error.
2026-08-10 09:25:52 +10:00
2b034f990f Add stdin event feed and smoke test suite
Compositor: read raw keyboard records from stdin and dispatch them into
the real host_kbd_key/host_kbd_modifiers handlers, so keybindings (F11,
Ctrl+PageUp/Down, F9/F10 dumps) can be driven without a focused host
window or wtype. Binary wire: 1|u32 key|u32 state, 2|u32 mods|...

Tests: tests/wltest.c solid-colour xdg_toplevel client, plus a pytest
suite (tests/test_smoke.py) that launches nested instances per test and
feeds events through the new channel. test.sh runs it. F11 fullscreen
toggle now logs its new state.
2026-08-10 07:29:10 +10:00
6b049debf0 Build with meson; portable wlroots fallback (pinned wrap) + README 2026-08-09 12:46:14 +10:00