Files
vatrog-vm-vgpu-streamer/src/stream/win32/cursor.h
T
lirent bcf708d3cc feat: add graphics-context sensors to producer contract
Append three host-readable sensor groups to the producer block, ABI
frozen by offset asserts (producer still fits page 0):

- cursor Tier-1 (hotspot, glyph dims, shape identity), published under
  the existing cursor_seq gate
- content_change_ns: monotonic stamp of the last scene-content change
- display geometry on its own cache line under a geom_seq seqlock:
  virtual-desktop bbox, captured-output origin, DPI, refresh

Source the cursor from each backend's existing grab metadata instead of
polling GetCursorInfo in the present pump: DDA from the duplication frame
info pointer position (no extra calls), NvFBC visibility from the grab
info plus one GetCursorInfo per frame for position, GDI from
GetCursorInfo. Position sampling now rides the frame rate, not the pump
tick.

Sample display geometry once at startup and re-sample only on backend
session recreate or a captured-mode change. Drop per-tick cursor
sampling (cursor_sample_pos) from the present loop.

Add src/stream/win32/geometry.{c,h}.
2026-06-19 01:32:28 +03:00

27 lines
1.1 KiB
C

#ifndef VGPU_CURSOR_H
#define VGPU_CURSOR_H
/* cursor.h — win32 GDI cursor sample/compose onto a tight BGRA frame. */
#include <stdint.h>
#include "ctx.h" /* win32 vgpu_ctx (cursor state) */
/* Sample the current cursor (position/shape) into ctx->cursor.
* Returns 1 if anything changed since last sample, else 0. */
int cursor_sample(vgpu_ctx* ctx);
/* Resolve a HCURSOR to a VGPU_CURSOR_ID_* by comparing against the system cursor table
* (LoadCursor(NULL, IDC_*) loaded once on first use). Returns VGPU_CURSOR_ID_UNKNOWN for
* custom cursors. Not hot-path: called only under the shape-change gate. */
int cursor_resolve_id(HCURSOR hc);
/* Extract glyph/hotspot/dims for hc into ctx->cursor, resolve its cursor_id, and record it as
* the current handle. For backends that source position elsewhere (DDA from frame info) and
* only need the shape on a shape-change gate. Caller serializes ctx->cursor writes. */
void cursor_apply_shape(vgpu_ctx* ctx, HCURSOR hc);
/* Alpha/AND-XOR compose the sampled cursor onto a tight BGRA frame. */
void cursor_draw(vgpu_ctx* ctx, uint8_t* bgra, uint32_t width, uint32_t height);
#endif /* VGPU_CURSOR_H */