srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/wayland/src/cursor.rs
AgeCommit message (Collapse)AuthorFilesLines
2026-08-30Use as_chunks for fixed-size pixel iterationHEADmainsrdusr1-1/+1
2026-08-30Indent doc list continuationssrdusr1-3/+3
2024-12-24Accumulate wayland-crate additions: capture rendering, focus/Space sync, VT ↵srdusr1-92/+150
resume, plumbing Bundles the remaining wayland-crate changes built up here, touching both backends (udev and winit) and the shared input/rendering code: - udev/capture.rs: off-screen Pixman render of an arbitrary (not necessarily on-screen) workspace's window content to a PPM file -- what crates/core's capture-request queue drives, for a workspace switcher's thumbnail previews. wlr-screencopy structurally can't do this (it can only see what an output is presenting), which is why this exists as a separate render path rather than reusing it. - input::focus_window now also raises the window in smithay's own Space, not just core's stacking order - Space is what actually renders on top and what pointer hit-testing reads, so any focus path that skipped this (an IPC "focus" dispatch, concretely) left a window genuinely focused while still rendering, and receiving clicks, underneath whatever was already topmost. Both backends' poll loops now re-sync this after any IPC mutation. - udev/session.rs's VT-switch resume fix (drains a stale pending page flip before reasserting CRTCs) already has its own earlier, cleanly isolated commit - not duplicated here. - Assorted decoration/cursor/rounded-corners/output-management/ screencopy/XWayland changes and their cross-backend wiring. Coarser than the repo's usual one-purpose-per-commit convention, deliberately - see the core-crate sweep commit's own message for why.
2024-08-08Fix a stale comment in cursor.rs's own shape-fallback dispatchsrdusr1-1/+2
Named Pointer/Crosshair/Move/text/four resize-direction shapes all have dedicated art now, but the comment picking Pointer/Crosshair as its examples of "shapes we don't draw" predates that - misleading about this file's own current behavior. Swapped in shapes that genuinely still fall back to the arrow (Grab, Wait, Help, NotAllowed).
2024-06-01cursor: load the real XCursor theme arrow instead of always drawing the ↵srdusr1-17/+152
built-in bitmap The compositor's own pointer - over decorations and the desktop, and as the fallback for any named shape with no dedicated art - was always the hand-rasterized 24px ARROW bitmap, regardless of what theme the rest of the session was using. Confirmed live (by the AGS peer session) that this machine's actual GTK cursor theme is Sweet-cursors at size 24 (both gtk-3.0 and gtk-4.0 settings.ini, and gsettings, agree), installed and present, but nothing read it - XCURSOR_THEME/XCURSOR_SIZE aren't set on this work either, so even naive env-based theme loading would have found nothing. load_theme_arrow (cursor.rs) now resolves a theme name and size -- XCURSOR_THEME/XCURSOR_SIZE first, falling back to GTK's own gtk-cursor-theme-name/-size out of settings.ini, since that's what's actually authoritative in practice here - and loads left_ptr via the `xcursor` crate (the same one anvil and other smithay compositors use), picking whichever nominal size the theme ships is closest to the target. XCursor pixel data comes back as straight RGBA off disk; only the channel order needs converting to the BGRA every other buffer in this file uses for Fourcc::Argb8888 (see arrow_bitmap's own byte order) - the data is already premultiplied alpha per the file format spec, same as everything else built here, so no premultiplication step. Falls back to the existing built-in bitmap arrow on any failure (theme/icon missing, corrupt file, a pixel count that doesn't match the declared dimensions) - same "always present beats prettier but sometimes absent" reasoning the built-in arrow's own doc comment already gave for not doing this at all, kept intact as the fallback rather than replaced. The built-in arrow's hotspot was implicitly (0, 0) - its tip, baked into where render_elements positioned it. A real theme's hotspot is data (CursorBuffers::arrow_hotspot), not necessarily the bitmap's corner, so both `_ =>` arrow arms in render_elements now subtract it like every other named shape already does. Verified live on this machine: resolves theme="Sweet-cursors" size=24 from settings.ini, loads a real 30x30 left_ptr image with hotspot (4,4) -- checked with a temporary probe test, removed before committing. Two lightweight unit tests (rgba_to_bgra_*) cover the channel-reorder byte math without needing a theme installed, so they run everywhere. cargo build --workspace, cargo clippy -p srdwm-wayland (0 new warnings), cargo test -p srdwm-wayland cursor (13/13), cargo test -p srdwm-core (111/111) all pass. Known remaining gap, not addressed here: the loaded size still doesn't track output scale (a HiDPI output gets whatever size settings.ini says regardless of scale factor) - MemoryRenderBuffer's own scale param is hardcoded to 1 throughout this file already, a pre-existing limitation this change doesn't touch.
2024-05-30Fix decoration drift during animated transitions; checkpoint ↵srdusr1-15/+458
IPC/global-menu/output-management work Border/titlebar decoration was built from Window.geometry (the animation's final target) in both wayland backends' render loops, while sync_geometry already draws a window's actual content at window_anims' interpolated rect during any maximize/fullscreen/open-slide tween. Border and content read two different rectangles for the whole transition, so the border visibly detached from the window it was outlining - reported as "borders aren't flush." Both udev.rs and winit.rs now read the same animated rect for titlebar placement, border-strip placement, and the occlusion test against later windows in stacking order. Verified: cargo build --workspace, cargo clippy (0 new warnings), cargo test -p srdwm-core (111/111). Also checkpoints substantial protocol/IPC work from prior sessions that had accumulated uncommitted: gtk-shell1 support (gtk_shell.rs, the vendored gtk-shell.xml, xwayland.rs's X11-side mirror) backing the global app menu; zwlr_foreign_toplevel_manager_v1 (foreign_toplevel.rs) broadcasting distinct maximized/minimized/fullscreen/activated state per window; output_management (ext-output-management + layer-shell exclusive-zone reservation tracking); workspace.rs and context_menu.rs; a Unix-socket IPC crate (platform/src/ ipc.rs) and a `srd` control-CLI crate (crates/ctl); xkb_config.rs; and a theme module (core/src/theme.rs). A peer session working the AGS shell concurrently verified several of these live against a running srdwm: the global menu rendering a real app's File/Edit menu over gtk-shell1, and foreign-toplevel correctly reporting maximized and fullscreen as independent, non-simultaneous states with the geometry each implies (maximize stops at a reserved top bar and past a dock; fullscreen reaches the true monitor edge).
2024-05-29Config at ~/.config/srd; cursor shapes, key repeat, pin, mouse defaultssrdusr1-13/+46
Config path drops a level: ~/.config/srd, not ~/.config/srdwm/srd, which said the same thing twice. No other user-facing path had the same problem -- srdwm reads the config dir and writes nothing else. Cursor shapes. A client's own cursor surface is now rendered with the hotspot it declared, so an I-beam over text or a hand over a link shows the app's image instead of srdwm's arrow. The built-in arrow stays as the fallback when no client has set one, over decorations and the desktop. Named shapes still fall back to the arrow; most toolkits set a surface. Decorations and cursors now share one OverlayElement type, since render_output takes a single custom-element slice. Key repeat (srd.bind_repeat, Hyprland's binde). Held volume, brightness and switcher keys repeat at the seat's own rate rather than firing once. Driven from the poll loop, not a timer source: the winit backend has no calloop loop of its own, and poll_events already runs continuously in both backends. Repeat stops when *that* key is released, not when any key is. Always-on-top / pin, for the picture-in-picture and HUD rules that used it. Window::always_on_top was another declared-but-never-read field. Enforced in WindowManager's stacking order rather than at render time, so every consumer of stacking_order gets it and none can forget to honour it. Mouse-only window management, checked end to end: drag the titlebar to move, drag any edge or corner to resize, titlebar buttons to close/maximise/ minimise, click to focus, drag to a screen edge to snap, and now double-click the titlebar to maximise. The resize grab band went from 6px to 10px - a hairline is genuinely hard to hit with a mouse, which is why Hyprland ships extend_border_grab_area. Also removed the emoji status markers from docs/IMPLEMENTATION_STATUS.md.
2024-05-14Draw a cursor, handle the lid, and everything a real config needssrdusr1-0/+171
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).