comparison src/video/cocoa/SDL_cocoamouse.m @ 3528:59ff7a2beb57

Added an API function to query geometry of multiple monitors: SDL_GetDisplayBounds() Implemented multi-monitor window positions on Windows
author Sam Lantinga <slouken@libsdl.org>
date Sun, 06 Dec 2009 08:03:38 +0000
parents 455a6c47d2c6
children 64ce267332c6
comparison
equal deleted inserted replaced
3527:444cb12cadb6 3528:59ff7a2beb57
65 for (i = 0; i < _this->num_displays; ++i) { 65 for (i = 0; i < _this->num_displays; ++i) {
66 SDL_VideoDisplay *display = &_this->displays[i]; 66 SDL_VideoDisplay *display = &_this->displays[i];
67 SDL_Window *candidate = display->fullscreen_window; 67 SDL_Window *candidate = display->fullscreen_window;
68 68
69 if (candidate) { 69 if (candidate) {
70 SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; 70 SDL_Rect bounds;
71 NSRect rect = Cocoa_DisplayBounds(displaydata->display);
72 71
72 Cocoa_GetDisplayBounds(_this, display, &bounds);
73 point = [NSEvent mouseLocation]; 73 point = [NSEvent mouseLocation];
74 point.x = point.x - rect.origin.x; 74 point.x = point.x - bounds.x;
75 point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - rect.origin.y; 75 point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - bounds.y;
76 if (point.x < 0 || point.x >= candidate->w || 76 if (point.x < 0 || point.x >= candidate->w ||
77 point.y < 0 || point.y >= candidate->h) { 77 point.y < 0 || point.y >= candidate->h) {
78 /* The mouse is out of this fullscreen display */ 78 /* The mouse is out of this fullscreen display */
79 if (mouse->focus == candidate->id) { 79 if (mouse->focus == candidate->id) {
80 SDL_SetMouseFocus(data->mouse, 0); 80 SDL_SetMouseFocus(data->mouse, 0);