RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process
Input
Per-device pointer settings:
Pointerowns its stable identity and a monotonic live token. Settings resolves the token on every callback; no UI state may retain a device pointer.persistentIdrejects missing/ambiguous identities. Hotplug and reload both callapplyPointerDevice, resolving[[input_device]]overrides over[input]defaults. Do not reapply bare global pointer values later. Identity collisions reset those peers to defaults and stay ambiguous for their remaining connection lifetimes.tests/input_persistence.pyuses a noninstalled backend fixture; physical touchpad/mouse scroll feel and libinput DWT pairing still need manual checks.Text input/IME (
text_input.zig):syncFocusis the only enter path. IM grabs replace client delivery only (bindings, hardware keys and shell/lock UI win); an IM's own virtual keyboard bypasses its grab. While an overlay owns new input, modifier updates and the release of keys the grab already received still reach it, and the IM's virtual keyboard never counts as a physical modifier source (it only echoes forwarded state). Lock/auth reject virtual input. IPCGetTextInputnever returns text. Candidate popups follow the client's committed cursor rectangle: wlroots'active_featuresonly snapshots the enabling commit, so a rectangle sent later (Chromium's order) needscursor_rectangle_seen.Layouts: layout-zero fallback is for binding lookup only; text uses the active XKB state.
Input sources (
input_sources.zig,input_sources/): the config's layouts (XKB groups, at most four) plus Fcitx5's methods, read and switched over D-Bus, never written. The active group is global: switching sets it on every keyboard with the config keymap; a keyboard that switches itself (agrp:toggle,layouts.observe) moves it and the others follow from an idle callback, never inside their own modifiers signal. Fcitx has no current-method signal: any signal from its unique name re-asksCurrentInputMethod. The lock types with layouts only (cycleLayouts).tests/input_sources.pyuses a fake Fcitx on a private session bus.Shell key repeat: one
shell_repeatper keyboard; a new shell target needs aShellTargetcase, a freeable panel callsforgetShellTarget. Return, Escape, Tab and modifier chords never repeat.Pointer constraints (
pointer_constraints.zig): every client motion path callsclientMotionthensync. Active only with pointer and keyboard focus; new compositor input modes go inmotionReachesClientorcandidate.sendDeactivateddestroys oneshots synchronously: clearactivefirst.Pointer warp (
pointer_warp.zig, wp_pointer_warp_v1; Wine's SetCursorPos): honoured only while the target's surface tree has pointer focus andmotionReachesClient, with a seat serial for that client, inside the surface; never through a lock, only within a confinement. It skipsclientMotionon purpose (a warp is no relative delta) but runsprocessCursorMotion, the frame andsynclikewarpCursor.The switcher owns the pointer while it is up: opening it clears pointer focus and shows the arrow (a client's hidden or text cursor would otherwise stay, since no motion reaches it), unless a press or grab is in progress. User-driven ends go through
Switcher.close, which re-runsprocessCursorMotion; forced teardowns callcancelalone.Shortcuts inhibit gates only the switcher, screenshot shortcuts and final dispatch; hardware keys, VT switching, System Monitor and open panels still win. System Monitor dismisses transient input owners and revokes the focused client's inhibitor; lock/auth and shortcut capture keep priority.
Drag dodge (
drag_dodge.zig) slides a file manager aside throughToplevel.setDodge, a presentation-only offset added inapplyVisualTransform. Never fold it intox/y/move_x(it would grow the canvas, reach IPC and saved layouts, and outlive the drag). Anything that stops showing a window mustclearDodgeit (detachInputdoes).Touch/tablet use their own protocol only when
directInputReachesClients(); otherwise they emulate the pointer (send your ownpointerNotifyFrame). Touchscreens map tooutput_nameor the built-in panel.Wheel debounce (
wheel_debounce.zig) runs incursorAxis, beforeprocessAxis, on detented.wheelevents only. IPCscrolland automation sequences (virtual.zig) enterprocessAxisas.continuousand never reach it, so cover it with unit tests.Lid: native power policy takes logind’s lid inhibitor and owns lid actions. Docked panels leave the layout; undocked panels blank without removing the last output. Never also request undocked sleep without the inhibitor.