comparison 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
comparison
equal deleted inserted replaced
3527:444cb12cadb6 3528:59ff7a2beb57
333 } 333 }
334 return _this->num_displays; 334 return _this->num_displays;
335 } 335 }
336 336
337 int 337 int
338 SDL_GetDisplayBounds(int index, SDL_Rect * rect)
339 {
340 if (!_this) {
341 SDL_UninitializedVideo();
342 return -1;
343 }
344 if (index < 0 || index >= _this->num_displays) {
345 SDL_SetError("index must be in the range 0 - %d",
346 _this->num_displays - 1);
347 return -1;
348 }
349 if (rect) {
350 SDL_VideoDisplay *display = &_this->displays[index];
351
352 if (_this->GetDisplayBounds) {
353 if (_this->GetDisplayBounds(_this, display, rect) < 0) {
354 return -1;
355 }
356 } else {
357 /* Assume that the displays are left to right */
358 if (index == 0) {
359 rect->x = 0;
360 rect->y = 0;
361 } else {
362 SDL_GetDisplayBounds(index-1, rect);
363 rect->x += rect->w;
364 }
365 rect->w = display->desktop_mode.w;
366 rect->h = display->desktop_mode.h;
367 }
368 }
369 return 0;
370 }
371
372 int
338 SDL_SelectVideoDisplay(int index) 373 SDL_SelectVideoDisplay(int index)
339 { 374 {
340 if (!_this) { 375 if (!_this) {
341 SDL_UninitializedVideo(); 376 SDL_UninitializedVideo();
342 return (-1); 377 return (-1);