comparison src/SDL_compat.c @ 3098:5f372cef955d

Date: Thu, 05 Feb 2009 17:27:54 +0100 From: Stefan Klug Subject: [SDL] SDL_SetVideoMode compatibility fix SDL_SetVideoMode(0,0,0,flags) used to be valid in SDL 1.2 Attached is a patch to replicate this behaviour in SDL 1.3 Cheers Stefan
author Sam Lantinga <slouken@libsdl.org>
date Mon, 23 Mar 2009 05:37:45 +0000
parents 0e821769fc51
children 7f684f249ec9
comparison
equal deleted inserted replaced
3097:0d12e8f1de3c 3098:5f372cef955d
492 if (!SDL_GetVideoDevice()) { 492 if (!SDL_GetVideoDevice()) {
493 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { 493 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
494 return NULL; 494 return NULL;
495 } 495 }
496 } 496 }
497
498 SDL_GetDesktopDisplayMode(&desktop_mode);
499
500 if (width == 0) {
501 width = desktop_mode.w;
502 }
503 if (height == 0) {
504 height = desktop_mode.h;
505 }
497 506
498 /* See if we can simply resize the existing window and surface */ 507 /* See if we can simply resize the existing window and surface */
499 if (SDL_ResizeVideoMode(width, height, bpp, flags) == 0) { 508 if (SDL_ResizeVideoMode(width, height, bpp, flags) == 0) {
500 return SDL_PublicSurface; 509 return SDL_PublicSurface;
501 } 510 }
565 if (window_flags & SDL_WINDOW_BORDERLESS) { 574 if (window_flags & SDL_WINDOW_BORDERLESS) {
566 surface_flags |= SDL_NOFRAME; 575 surface_flags |= SDL_NOFRAME;
567 } 576 }
568 577
569 /* Set up the desired display mode */ 578 /* Set up the desired display mode */
570 SDL_GetDesktopDisplayMode(&desktop_mode);
571 desktop_format = desktop_mode.format; 579 desktop_format = desktop_mode.format;
572 if (desktop_format && ((flags & SDL_ANYFORMAT) 580 if (desktop_format && ((flags & SDL_ANYFORMAT)
573 || (bpp == SDL_BITSPERPIXEL(desktop_format)))) { 581 || (bpp == SDL_BITSPERPIXEL(desktop_format)))) {
574 desired_format = desktop_format; 582 desired_format = desktop_format;
575 } else { 583 } else {