mouse: Restrict GCMouse to macOS Sonoma and later

This commit is contained in:
Cameron Gutman
2026-05-16 17:07:56 -05:00
committed by Sam Lantinga
parent 5e483dc166
commit 060b74a664
2 changed files with 7 additions and 4 deletions
+2 -2
View File
@@ -253,14 +253,14 @@ 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
On macOS 14.0 (Sonoma) 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:
To use accelerated (system-scaled) mouse movement on macOS 14.0+, set the hint:
```c
SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE, "1");
+5 -2
View File
@@ -452,7 +452,10 @@ static void Cocoa_OnGCMouseDisconnected(GCMouse *mouse)
void Cocoa_InitGCMouse(void)
{
@autoreleasepool {
if (@available(macOS 11.0, *)) {
// These APIs are available starting in macOS Big Sur, but we don't enable
// GCMouse until Sonoma due to broken motion and button events on MacBooks
// running Monterey and Ventura.
if (@available(macOS 14.0, *)) {
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
cocoa_mouse_connect_observer = [center
@@ -494,7 +497,7 @@ bool Cocoa_HasGCMouse(void)
void Cocoa_QuitGCMouse(void)
{
@autoreleasepool {
if (@available(macOS 11.0, *)) {
if (@available(macOS 14.0, *)) {
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
if (cocoa_mouse_connect_observer) {