Mercurial > sdl-ios-xcode
diff src/video/SDL_video.c @ 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 | e6f2f312780f |
children | 0267b8b1595c |
line wrap: on
line diff
--- a/src/video/SDL_video.c Sun Dec 06 06:21:39 2009 +0000 +++ b/src/video/SDL_video.c Sun Dec 06 08:03:38 2009 +0000 @@ -335,6 +335,41 @@ } int +SDL_GetDisplayBounds(int index, SDL_Rect * rect) +{ + if (!_this) { + SDL_UninitializedVideo(); + return -1; + } + if (index < 0 || index >= _this->num_displays) { + SDL_SetError("index must be in the range 0 - %d", + _this->num_displays - 1); + return -1; + } + if (rect) { + SDL_VideoDisplay *display = &_this->displays[index]; + + if (_this->GetDisplayBounds) { + if (_this->GetDisplayBounds(_this, display, rect) < 0) { + return -1; + } + } else { + /* Assume that the displays are left to right */ + if (index == 0) { + rect->x = 0; + rect->y = 0; + } else { + SDL_GetDisplayBounds(index-1, rect); + rect->x += rect->w; + } + rect->w = display->desktop_mode.w; + rect->h = display->desktop_mode.h; + } + } + return 0; +} + +int SDL_SelectVideoDisplay(int index) { if (!_this) {