menios icon indicating copy to clipboard operation
menios copied to clipboard

Implement mouse cursor rendering

Open pbalduino opened this issue 3 months ago • 0 comments

Summary

Implement mouse cursor rendering for the GUI, including cursor image management, movement, and hit testing for window selection.

Goals

  • Render mouse cursor on screen
  • Update cursor position based on mouse movement
  • Implement cursor themes (arrow, hand, text beam, etc.)
  • Hit testing for window manager
  • Smooth cursor movement

Implementation

Cursor Types

```c enum cursor_type { CURSOR_ARROW, // Default pointer CURSOR_HAND, // Clickable elements CURSOR_TEXT, // Text editing (I-beam) CURSOR_CROSSHAIR, // Precision selection CURSOR_WAIT, // Busy/loading CURSOR_RESIZE_NS, // Resize north-south CURSOR_RESIZE_EW, // Resize east-west CURSOR_RESIZE_NWSE // Resize diagonal };

struct cursor { enum cursor_type type; uint32_t *pixels; // ARGB32 cursor image int width, height; int hotspot_x, hotspot_y; }; ```

Cursor Rendering

Software cursor (render over framebuffer): ```c void cursor_render(struct cursor *cursor, int x, int y) { // Composite cursor over background for (int cy = 0; cy < cursor->height; cy++) { for (int cx = 0; cx < cursor->width; cx++) { uint32_t pixel = cursor->pixels[cy * cursor->width + cx]; if (pixel & 0xFF000000) { // Non-transparent fb_put_pixel(x + cx - cursor->hotspot_x, y + cy - cursor->hotspot_y, pixel); } } } } ```

Timeline

Total: 1-2 weeks

Definition of Done

  • [ ] Cursor renders on screen
  • [ ] Follows mouse movement smoothly
  • [ ] Multiple cursor types supported
  • [ ] Hit testing works for window manager
  • [ ] No visible tearing or flicker

Dependencies

  • #143: PS/2 Mouse Driver (CRITICAL)
  • #399: Input Event System
  • #396: Cairo (for rendering cursor images)

Enables

  • All window manager and compositor work

See docs/road/road_to_gui.md for complete roadmap.

pbalduino avatar Oct 30 '25 22:10 pbalduino