From dd31bf5ac2a692617d478478d36c733586b93cf8 Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Tue, 14 May 2024 00:42:00 +0200 Subject: Draw a cursor, handle the lid, and everything a real config needs Groundwork for actually daily-driving this: porting the user's Hyprland config exposed what srdwm couldn't yet express, and testing on a bare TTY exposed something worse. A visible mouse cursor. Nothing drew a pointer at all - on a bare TTY the mouse was simply invisible. It hid because the nested backend runs inside another compositor, which draws a cursor over srdwm's window; only the DRM backend, i.e. the actual session path, was affected. A built-in arrow is now composited above everything on the output the pointer is on. It's a reviewable ASCII bitmap rather than an XCursor theme: a cursor that is always present beats a prettier one that sometimes isn't, the same reasoning as decoration.rs's font fallback. Client-set cursor surfaces and named shapes are still not rendered, so an app asking for an I-beam gets the arrow. Lid switch. libinput switch events are handled and surfaced to config as srd.on("lid_closed"/"lid_open", fn), so closing the lid can lock and suspend instead of doing nothing. Config-driven additions, each needed by a binding in the ported config and none of which existed: fullscreen (Window.fullscreen was a dead field -- declared, never read or written), directional window move that swaps with the neighbour and reorders the stack so tiling follows, focus cycling, modifier+drag to move/resize anywhere in a window rather than only by the titlebar, modifier+scroll to change workspace, and 8 XF86 media/power keysyms taken from the system's own XF86keysym.h. The keysym tables are hand-maintained in both directions and a key missing from either fails silently, so a round-trip test now covers every one the configs bind. Verified in the QEMU VM: a bare-TTY screendump shows a recognisable arrow at the pointer position (113 white fill + 58 black outline pixels at screen centre, where the pointer starts). --- docs/IMPLEMENTATION_STATUS.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'docs/IMPLEMENTATION_STATUS.md') diff --git a/docs/IMPLEMENTATION_STATUS.md b/docs/IMPLEMENTATION_STATUS.md index 35635c0..6b2579b 100644 --- a/docs/IMPLEMENTATION_STATUS.md +++ b/docs/IMPLEMENTATION_STATUS.md @@ -513,6 +513,29 @@ built them: `WAYLAND_DEBUG=1` protocol tracing and fixing real bugs - see the Wayland backend section above for the full account. +- ✅ **Mouse cursor** (`crates/wayland/src/cursor.rs`). Previously **nothing + drew a pointer at all** - invisible mouse on a bare TTY. It hid because + the nested backend runs inside another compositor, which draws a cursor + over srdwm's window; only the DRM backend is affected, and only when run + as a real session. A built-in arrow (a reviewable ASCII bitmap, no XCursor + theme dependency, same reasoning as `decoration.rs`'s font fallback) is + now composited above everything on the output the pointer is on. + `CursorImageStatus::Hidden` is honoured. **Not** yet done: rendering a + client's own cursor surface or a named shape, so an app asking for an + I-beam still gets the arrow. + **Verified in the QEMU VM**: screendump of a bare-TTY session shows a + recognisable arrow at the pointer position - 113 white fill + 58 black + outline pixels at screen centre, where the pointer starts. +- ✅ **Lid switch**: libinput switch events are handled and surfaced to + config as `srd.on("lid_closed"/"lid_open", fn)`, so a session can lock and + suspend on lid close. Previously there was no switch handling at all. +- ✅ **Fullscreen** (`srd.window.fullscreen()`), **directional window move** + (`srd.window.move("left")`, swaps with the neighbour), **focus cycling** + (`srd.window.next()`/`prev()`), **modifier+drag move/resize anywhere in a + window**, **modifier+scroll workspace switching**, and 8 more `XF86` + media/power keysyms. All were needed to port a real Hyprland config and + none existed before. + ## Not implemented anywhere yet All three protocols originally identified as blocking srdwm-wayland from -- cgit v1.2.3