src/video/cocoa/SDL_cocoawindow.m
changeset 8261 841b66e4397a
parent 8260 028ed8da2524
child 8284 a2910aa6c056
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Tue Feb 25 17:27:41 2014 -0800
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Wed Feb 26 11:35:02 2014 -0800
     1.3 @@ -39,6 +39,15 @@
     1.4  #include "SDL_cocoamouse.h"
     1.5  #include "SDL_cocoaopengl.h"
     1.6  
     1.7 +/* #define DEBUG_COCOAWINDOW */
     1.8 +
     1.9 +#ifdef DEBUG_COCOAWINDOW
    1.10 +#define DLog(fmt, ...) printf("%s: " fmt "\n", __func__, ##__VA_ARGS__)
    1.11 +#else
    1.12 +#define DLog(...) do { } while (0)
    1.13 +#endif
    1.14 +
    1.15 +
    1.16  @interface SDLWindow : NSWindow
    1.17  /* These are needed for borderless/fullscreen windows */
    1.18  - (BOOL)canBecomeKeyWindow;
    1.19 @@ -735,6 +744,8 @@
    1.20              CGSetLocalEventsSuppressionInterval(0.0);
    1.21              CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
    1.22              CGSetLocalEventsSuppressionInterval(0.25);
    1.23 +
    1.24 +            Cocoa_HandleMouseWarp(cgpoint.x, cgpoint.y);
    1.25  #endif
    1.26          }
    1.27      }
    1.28 @@ -1411,6 +1422,10 @@
    1.29          SDL_GetMouseState(&x, &y);
    1.30          cgpoint.x = window->x + x;
    1.31          cgpoint.y = window->y + y;
    1.32 +
    1.33 +        Cocoa_HandleMouseWarp(cgpoint.x, cgpoint.y);
    1.34 +
    1.35 +        DLog("Returning cursor to (%g, %g)", cgpoint.x, cgpoint.y);
    1.36          CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
    1.37      }
    1.38