Mercurial > sdl-ios-xcode
diff src/video/cocoa/SDL_cocoamodes.m @ 3500:4b594623401b
Work in progress on multi-display support:
* Added display parameter to many internal functions so video modes can be set on displays that aren't the public current one.
* The fullscreen mode is associated with fullscreen windows - not displays, so different windows more naturally have a mode associated with them based on their width and height. It's no longer necessary to specify a fullscreen mode, a default one will be picked automatically for fullscreen windows.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 01 Dec 2009 05:57:15 +0000 |
parents | 00cace2d9080 |
children | 919d88c202cf |
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoamodes.m Mon Nov 30 21:04:25 2009 +0000 +++ b/src/video/cocoa/SDL_cocoamodes.m Tue Dec 01 05:57:15 2009 +0000 @@ -190,18 +190,18 @@ static void AddDisplayMode(const void *moderef, void *context) { - SDL_VideoDevice *_this = (SDL_VideoDevice *) context; + SDL_VideoDisplay *display = (SDL_VideoDisplay *) context; SDL_DisplayMode mode; if (GetDisplayMode(moderef, &mode)) { - SDL_AddDisplayMode(_this->current_display, &mode); + SDL_AddDisplayMode(display, &mode); } } void -Cocoa_GetDisplayModes(_THIS) +Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display) { - SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata; + SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; CFArrayRef modes; CFRange range; @@ -211,13 +211,13 @@ } range.location = 0; range.length = CFArrayGetCount(modes); - CFArrayApplyFunction(modes, range, AddDisplayMode, _this); + CFArrayApplyFunction(modes, range, AddDisplayMode, display); } int -Cocoa_SetDisplayMode(_THIS, SDL_DisplayMode * mode) +Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) { - SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata; + SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; CGDisplayFadeReservationToken fade_token = kCGDisplayFadeReservationInvalidToken; CGError result; @@ -279,21 +279,17 @@ void Cocoa_QuitModes(_THIS) { - int i, saved_display; + int i; - saved_display = _this->current_display; for (i = 0; i < _this->num_displays; ++i) { SDL_VideoDisplay *display = &_this->displays[i]; if (display->current_mode.driverdata != display->desktop_mode.driverdata) { - _this->current_display = i; - Cocoa_SetDisplayMode(_this, &display->desktop_mode); + Cocoa_SetDisplayMode(_this, display, &display->desktop_mode); } } CGReleaseAllDisplays(); ShowMenuBar(); - - _this->current_display = saved_display; } /* vi: set ts=4 sw=4 expandtab: */