From 060b74a6647229991d9d4ec310e827782dc4ae28 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 16 May 2026 17:07:56 -0500 Subject: [PATCH] mouse: Restrict GCMouse to macOS Sonoma and later --- docs/README-macos.md | 4 ++-- src/video/cocoa/SDL_cocoamouse.m | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/README-macos.md b/docs/README-macos.md index 79b3a4f868..ea8d14a9d9 100644 --- a/docs/README-macos.md +++ b/docs/README-macos.md @@ -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"); diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index 1cfd23ad3f..21a4f03f0f 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -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) {