summaryrefslogtreecommitdiffhomepage
path: root/.rules/plan/phase-09-cursor.md
blob: 11d301fc8a51125d003f919d80ef58d7e915dce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Phase 9 — Cursor Rendering

---

## Step 9.1 — Render the cursor in the compositor

Since compositing may obscure the hardware cursor in certain
configurations, render it ourselves:

1. Call `XFixesGetCursorImage(dpy)` to get the current cursor bitmap
   (ARGB pixel data, width, height, hotspot).
2. Convert to a raylib `Texture2D`.
3. Draw it at the pointer position each frame (query with
   `XQueryPointer()`).
4. Optionally call `XFixesHideCursor()` on the root and draw our own
   cursor exclusively.

Subscribe to cursor change notifications:

```c
XFixesSelectCursorInput(dpy, root, XFixesDisplayCursorNotifyMask);
```

Cache the cursor texture and only update it when an
`XFixesCursorNotify` event fires (cursor shape changed — e.g., from
arrow to text beam when hovering over `xterm`).

**Verify:** The cursor is visible and correct when moving over composited
windows. Cursor changes (e.g., text cursor in xterm, resize arrows at
window edges) are reflected. No flickering or offset.