Mercurial > sdl-ios-xcode
comparison src/video/cocoa/SDL_cocoawindow.m @ 3517:e7eec78e4b92
Fixed mouse events for fullscreen windows on Mac OS X
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 03 Dec 2009 08:33:39 +0000 |
parents | 8fde6aeb58df |
children | 455a6c47d2c6 |
comparison
equal
deleted
inserted
replaced
3516:72e70a8c30d5 | 3517:e7eec78e4b92 |
---|---|
233 SDL_Mouse *mouse; | 233 SDL_Mouse *mouse; |
234 NSPoint point; | 234 NSPoint point; |
235 | 235 |
236 index = _data->videodata->mouse; | 236 index = _data->videodata->mouse; |
237 mouse = SDL_GetMouse(index); | 237 mouse = SDL_GetMouse(index); |
238 | 238 point = [theEvent locationInWindow]; |
239 point = [NSEvent mouseLocation]; | 239 point.y = window->h - point.y; |
240 if ( (window->flags & SDL_WINDOW_FULLSCREEN) ) { | |
241 NSRect rect = CGDisplayBounds(_data->display); | |
242 | |
243 point.x = point.x - rect.origin.x; | |
244 point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - rect.origin.y; | |
245 } else { | |
246 point.x = point.x - window->x; | |
247 point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - window->y; | |
248 } | |
249 if ( point.x < 0 || point.x >= window->w || | 240 if ( point.x < 0 || point.x >= window->w || |
250 point.y < 0 || point.y >= window->h ) { | 241 point.y < 0 || point.y >= window->h ) { |
251 if (mouse->focus != 0) { | 242 if (mouse->focus != 0) { |
252 SDL_SetMouseFocus(index, 0); | 243 SDL_SetMouseFocus(index, 0); |
253 } | 244 } |