src/video/cocoa/SDL_cocoamouse.m
changeset 7593 20298a0d8631
parent 7465 1bcf7aac5623
child 7792 b8d4be87970a
     1.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Wed Aug 07 14:00:41 2013 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Wed Aug 07 16:29:15 2013 -0700
     1.3 @@ -25,6 +25,7 @@
     1.4  #include "SDL_assert.h"
     1.5  #include "SDL_events.h"
     1.6  #include "SDL_cocoamouse.h"
     1.7 +#include "SDL_cocoamousetap.h"
     1.8  
     1.9  #include "../../events/SDL_mouse_c.h"
    1.10  
    1.11 @@ -94,6 +95,8 @@
    1.12          cursor = SDL_calloc(1, sizeof(*cursor));
    1.13          if (cursor) {
    1.14              cursor->driverdata = nscursor;
    1.15 +        } else {
    1.16 +            [nscursor release];
    1.17          }
    1.18      }
    1.19  
    1.20 @@ -266,6 +269,8 @@
    1.21      mouse->SetRelativeMouseMode = Cocoa_SetRelativeMouseMode;
    1.22  
    1.23      SDL_SetDefaultCursor(Cocoa_CreateDefaultCursor());
    1.24 +
    1.25 +    Cocoa_InitMouseEventTap(mouse->driverdata);
    1.26  }
    1.27  
    1.28  void
    1.29 @@ -313,6 +318,10 @@
    1.30  {
    1.31      SDL_Mouse *mouse = SDL_GetMouse();
    1.32      if (mouse) {
    1.33 +        if (mouse->driverdata) {
    1.34 +            Cocoa_QuitMouseEventTap(((SDL_MouseData*)mouse->driverdata));
    1.35 +        }
    1.36 +
    1.37          SDL_free(mouse->driverdata);
    1.38      }
    1.39  }