comparison src/video/cocoa/SDL_cocoawindow.m @ 3414:1e45c3012a4f

Adam Strzelecki to SDL I think something is wrong (look at the fix patch below): (1) NSRect rect shouldn't be initialized with contentRectForFrameRect: at the top of the function, contentRectForFrameRect is called in non-fullscreen case anyway (1st @@) (2) I think you've left two lines that should be removed completely (2nd @@)
author Sam Lantinga <slouken@libsdl.org>
date Fri, 23 Oct 2009 04:08:32 +0000
parents c8f580ebc96a
children e829b6098435
comparison
equal deleted inserted replaced
3413:4b1f10cfd304 3414:1e45c3012a4f
231 { 231 {
232 SDL_Window *window = SDL_GetWindowFromID(_data->windowID); 232 SDL_Window *window = SDL_GetWindowFromID(_data->windowID);
233 int index; 233 int index;
234 SDL_Mouse *mouse; 234 SDL_Mouse *mouse;
235 NSPoint point; 235 NSPoint point;
236 NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]]; 236 NSRect rect;
237 237
238 index = _data->videodata->mouse; 238 index = _data->videodata->mouse;
239 mouse = SDL_GetMouse(index); 239 mouse = SDL_GetMouse(index);
240 240
241 point = [NSEvent mouseLocation]; 241 point = [NSEvent mouseLocation];
242 if ( (window->flags & SDL_WINDOW_FULLSCREEN) ) { 242 if ( (window->flags & SDL_WINDOW_FULLSCREEN) ) {
243 rect.size.width = CGDisplayPixelsWide(kCGDirectMainDisplay); 243 rect.size.width = CGDisplayPixelsWide(kCGDirectMainDisplay);
244 rect.size.height = CGDisplayPixelsHigh(kCGDirectMainDisplay); 244 rect.size.height = CGDisplayPixelsHigh(kCGDirectMainDisplay);
245 point.x = point.x - rect.origin.x;
245 point.y = rect.size.height - point.y; 246 point.y = rect.size.height - point.y;
246 } else { 247 } else {
247 rect = [_data->window contentRectForFrameRect:[_data->window frame]]; 248 rect = [_data->window contentRectForFrameRect:[_data->window frame]];
248 point.x = point.x - rect.origin.x;
249 point.y = rect.size.height - (point.y - rect.origin.y); 249 point.y = rect.size.height - (point.y - rect.origin.y);
250 } 250 }
251 point.x = point.x - rect.origin.x;
252 point.y = rect.size.height - (point.y - rect.origin.y);
253 if ( point.x < 0 || point.x >= rect.size.width || 251 if ( point.x < 0 || point.x >= rect.size.width ||
254 point.y < 0 || point.y >= rect.size.height ) { 252 point.y < 0 || point.y >= rect.size.height ) {
255 if (mouse->focus != 0) { 253 if (mouse->focus != 0) {
256 SDL_SetMouseFocus(index, 0); 254 SDL_SetMouseFocus(index, 0);
257 } 255 }