Base GCMouse raw input implementation

Fix duplicate button/scroll events when GCMouse active

Fix duplicate events and add thread-safe atomic for GCMouse

Fix GCMouse relative mode sync when connected after mode enabled

Respect SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE in GCMouse handler

Fix variable shadowing in GCMouse motion handler
This commit is contained in:
Edgar J San Martin
2025-12-30 17:15:47 -05:00
committed by Sam Lantinga
parent a48dee5ac1
commit ad91384704
5 changed files with 284 additions and 10 deletions

View File

@@ -246,6 +246,22 @@ You are free to modify your Cocoa app with generally no consequence
to SDL. You cannot, however, easily change the SDL window itself.
Functionality may be added in the future to help this.
## Raw Mouse Input
On macOS 11.0 (Big Sur) and later, SDL uses the Game Controller framework's
GCMouse API to provide raw, unaccelerated mouse input in relative mode. This
is ideal for games and applications requiring precise 1:1 mouse movement.
On older macOS versions, SDL falls back to NSEvent-based mouse input, which
includes system mouse acceleration.
To use accelerated (system-scaled) mouse movement on macOS 11.0+, set the hint:
```c
SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE, "1");
```
# Bug reports
Bugs are tracked at [the GitHub issue tracker](https://github.com/libsdl-org/SDL/issues/).