comparison src/video/windib/SDL_dibvideo.c @ 4085:51486c979189 SDL-1.2

> Hi Ryan, > I checked the list you linked to, but did not see any reference to whether > the Win32 window centering bug was fixed... Has that been addressed at all? > I refer to the bug where, unless one has globally set the > SDL_WINDOW_CENTERED variable in the OS, only the 1st window that is created > will be centered. Subsequent calls to SetVideoMode will create a window tha t > shares the same upper-left corner location. I'm working on that now, thanks for reporting it. What I'm doing is if the width and height are the same, I'm leaving the window position alone, but if they're different they will respect the positioning environment variables.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 20 Jul 2007 03:25:40 +0000
parents fda6e33893b7
children 1859647893b8
comparison
equal deleted inserted replaced
4084:70e77cbba87c 4085:51486c979189
466 466
467 SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current, 467 SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
468 int width, int height, int bpp, Uint32 flags) 468 int width, int height, int bpp, Uint32 flags)
469 { 469 {
470 SDL_Surface *video; 470 SDL_Surface *video;
471 int prev_w, prev_h;
471 Uint32 prev_flags; 472 Uint32 prev_flags;
472 DWORD style; 473 DWORD style;
473 const DWORD directstyle = 474 const DWORD directstyle =
474 (WS_POPUP); 475 (WS_POPUP);
475 const DWORD windowstyle = 476 const DWORD windowstyle =
529 } 530 }
530 } 531 }
531 532
532 /* Fill in part of the video surface */ 533 /* Fill in part of the video surface */
533 prev_flags = video->flags; 534 prev_flags = video->flags;
535 prev_w = video->w;
536 prev_h = video->h;
534 video->flags = 0; /* Clear flags */ 537 video->flags = 0; /* Clear flags */
535 video->w = width; 538 video->w = width;
536 video->h = height; 539 video->h = height;
537 video->pitch = SDL_CalculatePitch(video); 540 video->pitch = SDL_CalculatePitch(video);
538 541
772 HWND top; 775 HWND top;
773 UINT swp_flags; 776 UINT swp_flags;
774 const char *window = NULL; 777 const char *window = NULL;
775 const char *center = NULL; 778 const char *center = NULL;
776 779
777 if ( !SDL_windowX && !SDL_windowY ) { 780 if ( video->w != prev_w || video->h != prev_h ) {
778 window = SDL_getenv("SDL_VIDEO_WINDOW_POS"); 781 window = SDL_getenv("SDL_VIDEO_WINDOW_POS");
779 center = SDL_getenv("SDL_VIDEO_CENTERED"); 782 center = SDL_getenv("SDL_VIDEO_CENTERED");
780 if ( window ) { 783 if ( window ) {
781 if ( SDL_sscanf(window, "%d,%d", &x, &y) == 2 ) { 784 if ( SDL_sscanf(window, "%d,%d", &x, &y) == 2 ) {
782 SDL_windowX = x; 785 SDL_windowX = x;