Bläddra i källkod

mouse: Restrict GCMouse to macOS Sonoma and later

Cameron Gutman 2 dagar sedan
förälder
incheckning
060b74a664
2 ändrade filer med 7 tillägg och 4 borttagningar
  1. 2 2
      docs/README-macos.md
  2. 5 2
      src/video/cocoa/SDL_cocoamouse.m

+ 2 - 2
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");

+ 5 - 2
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) {