Explorar o código

mouse: Restrict GCMouse to macOS Sonoma and later

Cameron Gutman hai 1 mes
pai
achega
060b74a664
Modificáronse 2 ficheiros con 7 adicións e 4 borrados
  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
 ## 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
 GCMouse API to provide raw, unaccelerated mouse input in relative mode. This
 is ideal for games and applications requiring precise 1:1 mouse movement.
 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
 On older macOS versions, SDL falls back to NSEvent-based mouse input, which
 includes system mouse acceleration.
 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
 ```c
 SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE, "1");
 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)
 void Cocoa_InitGCMouse(void)
 {
 {
     @autoreleasepool {
     @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];
             NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
 
 
             cocoa_mouse_connect_observer = [center
             cocoa_mouse_connect_observer = [center
@@ -494,7 +497,7 @@ bool Cocoa_HasGCMouse(void)
 void Cocoa_QuitGCMouse(void)
 void Cocoa_QuitGCMouse(void)
 {
 {
     @autoreleasepool {
     @autoreleasepool {
-        if (@available(macOS 11.0, *)) {
+        if (@available(macOS 14.0, *)) {
             NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
             NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
 
 
             if (cocoa_mouse_connect_observer) {
             if (cocoa_mouse_connect_observer) {