src/video/cocoa/SDL_cocoamousetap.m
changeset 8054 2a38ef3eeabb
parent 8005 d8edfca6e3c2
child 8093 b43765095a6f
equal deleted inserted replaced
8053:495f4a047be1 8054:2a38ef3eeabb
    61 Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon)
    61 Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon)
    62 {
    62 {
    63     SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)refcon;
    63     SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)refcon;
    64     SDL_Mouse *mouse = SDL_GetMouse();
    64     SDL_Mouse *mouse = SDL_GetMouse();
    65     SDL_Window *window = SDL_GetKeyboardFocus();
    65     SDL_Window *window = SDL_GetKeyboardFocus();
    66     NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
    66     NSWindow *nswindow;
    67     NSRect windowRect;
    67     NSRect windowRect;
    68     CGPoint eventLocation;
    68     CGPoint eventLocation;
    69 
    69 
    70     switch (type)
    70     switch (type)
    71     {
    71     {
    91     if (!(window->flags & SDL_WINDOW_INPUT_GRABBED)) {
    91     if (!(window->flags & SDL_WINDOW_INPUT_GRABBED)) {
    92         return event;
    92         return event;
    93     }
    93     }
    94 
    94 
    95     /* This is the same coordinate system as Cocoa uses. */
    95     /* This is the same coordinate system as Cocoa uses. */
       
    96     nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
    96     eventLocation = CGEventGetUnflippedLocation(event);
    97     eventLocation = CGEventGetUnflippedLocation(event);
    97     windowRect = [nswindow contentRectForFrameRect:[nswindow frame]];
    98     windowRect = [nswindow contentRectForFrameRect:[nswindow frame]];
    98 
    99 
    99     if (!NSPointInRect(NSPointFromCGPoint(eventLocation), windowRect)) {
   100     if (!NSPointInRect(NSPointFromCGPoint(eventLocation), windowRect)) {
   100 
   101