src/video/cocoa/SDL_cocoamouse.m
changeset 5371 fc3d3d580777
parent 5262 b530ef003506
child 5376 183ec2d4485c
     1.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Sun Feb 20 23:51:59 2011 -0800
     1.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Mon Feb 21 10:50:53 2011 -0800
     1.3 @@ -49,62 +49,7 @@
     1.4  void
     1.5  Cocoa_HandleMouseEvent(_THIS, NSEvent *event)
     1.6  {
     1.7 -    int i;
     1.8 -    NSPoint point = { 0, 0 };
     1.9 -    SDL_Window *window;
    1.10 -    SDL_Window *focus = SDL_GetMouseFocus();
    1.11 -
    1.12 -    /* See if there are any fullscreen windows that might handle this event */
    1.13 -    window = NULL;
    1.14 -    for (i = 0; i < _this->num_displays; ++i) {
    1.15 -        SDL_VideoDisplay *display = &_this->displays[i];
    1.16 -        SDL_Window *candidate = display->fullscreen_window;
    1.17 -
    1.18 -        if (candidate) {
    1.19 -            SDL_Rect bounds;
    1.20 -
    1.21 -            Cocoa_GetDisplayBounds(_this, display, &bounds);
    1.22 -            point = [NSEvent mouseLocation];
    1.23 -            point.x = point.x - bounds.x;
    1.24 -            point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - bounds.y;
    1.25 -            if ((point.x >= 0 && point.x < candidate->w) &&
    1.26 -                (point.y >= 0 && point.y < candidate->h)) {
    1.27 -                /* This is it! */
    1.28 -                window = candidate;
    1.29 -                break;
    1.30 -            } else if (candidate == focus) {
    1.31 -                SDL_SetMouseFocus(NULL);
    1.32 -            }
    1.33 -        }
    1.34 -    }
    1.35 -
    1.36 -    if (!window) {
    1.37 -        return;
    1.38 -    }
    1.39 -
    1.40 -    switch ([event type]) {
    1.41 -    case NSLeftMouseDown:
    1.42 -    case NSOtherMouseDown:
    1.43 -    case NSRightMouseDown:
    1.44 -        SDL_SendMouseButton(window, SDL_PRESSED, ConvertMouseButtonToSDL([event buttonNumber]));
    1.45 -        break;
    1.46 -    case NSLeftMouseUp:
    1.47 -    case NSOtherMouseUp:
    1.48 -    case NSRightMouseUp:
    1.49 -        SDL_SendMouseButton(window, SDL_RELEASED, ConvertMouseButtonToSDL([event buttonNumber]));
    1.50 -        break;
    1.51 -    case NSScrollWheel:
    1.52 -        Cocoa_HandleMouseWheel(window, event);
    1.53 -        break;
    1.54 -    case NSLeftMouseDragged:
    1.55 -    case NSRightMouseDragged:
    1.56 -    case NSOtherMouseDragged: /* usually middle mouse dragged */
    1.57 -    case NSMouseMoved:
    1.58 -        SDL_SendMouseMotion(window, 0, (int)point.x, (int)point.y);
    1.59 -        break;
    1.60 -    default: /* just to avoid compiler warnings */
    1.61 -        break;
    1.62 -    }
    1.63 +    /* We're correctly using views even in fullscreen mode now */
    1.64  }
    1.65  
    1.66  void