Răsfoiți Sursa

cocoa: Check for duplicate proximity events.

Fixes #12137.
Ryan C. Gordon 4 luni în urmă
părinte
comite
91a5598283
1 a modificat fișierele cu 6 adăugiri și 1 ștergeri
  1. 6 1
      src/video/cocoa/SDL_cocoapen.m

+ 6 - 1
src/video/cocoa/SDL_cocoapen.m

@@ -84,7 +84,12 @@ static void Cocoa_HandlePenProximityEvent(SDL_CocoaWindowData *_data, NSEvent *e
             return;  // we ignore other things, which hopefully is right.
         }
 
-        Cocoa_PenHandle *handle = (Cocoa_PenHandle *) SDL_calloc(1, sizeof (*handle));
+        Cocoa_PenHandle *handle = Cocoa_FindPenByDeviceID(devid, toolid);
+        if (handle) {
+            return;  // already have this one.
+        }
+
+        handle = (Cocoa_PenHandle *) SDL_calloc(1, sizeof (*handle));
         if (!handle) {
             return;  // oh well.
         }