Mercurial > sdl-ios-xcode
comparison src/video/cocoa/SDL_cocoawindow.m @ 3409:c8f580ebc96a
Adam Strzelecki to SDL
Sending a patch for fullscreen Mac OS X SDL 1.3 (SVN) Cocoa mouse position handling. In fullscreen mouse coordinates should be relative to SCREEN not to the window, which doesn't really occupy fullscreen.
Without this patch mouse position (especially Y) was totally incorrect (shifted) in fullscreen.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 22 Oct 2009 04:46:11 +0000 |
parents | 4c28a9655933 |
children | 1e45c3012a4f |
comparison
equal
deleted
inserted
replaced
3408:55541ddf13e3 | 3409:c8f580ebc96a |
---|---|
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) ) { | |
243 rect.size.width = CGDisplayPixelsWide(kCGDirectMainDisplay); | |
244 rect.size.height = CGDisplayPixelsHigh(kCGDirectMainDisplay); | |
245 point.y = rect.size.height - point.y; | |
246 } else { | |
247 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); | |
250 } | |
242 point.x = point.x - rect.origin.x; | 251 point.x = point.x - rect.origin.x; |
243 point.y = rect.size.height - (point.y - rect.origin.y); | 252 point.y = rect.size.height - (point.y - rect.origin.y); |
244 if ( point.x < 0 || point.x >= rect.size.width || | 253 if ( point.x < 0 || point.x >= rect.size.width || |
245 point.y < 0 || point.y >= rect.size.height ) { | 254 point.y < 0 || point.y >= rect.size.height ) { |
246 if (mouse->focus != 0) { | 255 if (mouse->focus != 0) { |