fix: cursor grab restore on focus + desktop gamepad camera input #806

Merged
SakulFlee merged 2 commits from fix/mouse-input-broken into main 2026-09-24 20:02:44 +00:00
Owner

Fix 0 — CursorGrabState survives focus loss as the desired grab state and is re-applied on focus regain (fixes dead mouse-look after alt-tab on Wayland), seeding the input surface size. Phase A — desktop gilrs sticks/triggers wired into the camera controller.

Fix 0 — CursorGrabState survives focus loss as the desired grab state and is re-applied on focus regain (fixes dead mouse-look after alt-tab on Wayland), seeding the input surface size. Phase A — desktop gilrs sticks/triggers wired into the camera controller.
Treat CursorGrabState as the desired state instead of a snapshot of the
OS grab:

- Focused(false) releases the OS grab (so Wayland doesn't keep pointer
  constraints active for an unfocused window) but no longer clears
  CursorGrabState.
- Focused(true) re-applies the grab and hides the cursor when the
  desired state is grabbed, so mouse-look survives alt-tab and
  unfocused startups: Wayland only delivers mouse-motion device events
  while a pointer constraint is active, and nothing else re-acquired
  it after focus regain.
- resumed() seeds InputState::surface_size from the surface config so
  mouse-delta normalization works even if no initial Resized event ever
  arrives.
- Grab application goes through a shared helper that downgrades
  NotSupported (Android/iOS have no pointer constraints) from an error
  to a debug log.
feat: wire desktop gamepad sticks into the camera controller
All checks were successful
Lint / lint (pull_request) Successful in 4m31s
b1a34534a2
- sys_camera_controller: the left stick moves (via
  InputState::movement_vector, which prefers stick deflection and falls
  back to WASD) and the right stick looks (via InputState::view_vector,
  scaled by dt into angular speed because a stick reports its position,
  not impulses like mouse deltas). movement_vector/view_vector had been
  dead code since orbital_camera_controller was removed.
- Poll gilrs before taking InputSnapshot and running the schedules, so
  gamepad input reaches game systems the same frame instead of one
  frame late.
- Gilrs::new() failure no longer panics at startup: the runtime logs a
  warning and continues without gamepad support.
SakulFlee changed title from fix/mouse-input-broken to fix: cursor grab restore on focus + desktop gamepad camera input 2026-09-24 19:59:24 +00:00
Sign in to join this conversation.
No description provided.