comparison src/video/windx5/SDL_dx5video.c @ 4086:7cd5a59480a4 SDL-1.2

Merged window position fix from windib code
author Sam Lantinga <slouken@libsdl.org>
date Fri, 20 Jul 2007 03:30:41 +0000
parents c75679dce60c
children a1b03ba2fcd0
comparison
equal deleted inserted replaced
4085:51486c979189 4086:7cd5a59480a4
1016 1016
1017 SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current, 1017 SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
1018 int width, int height, int bpp, Uint32 flags) 1018 int width, int height, int bpp, Uint32 flags)
1019 { 1019 {
1020 SDL_Surface *video; 1020 SDL_Surface *video;
1021 int prev_w, prev_h;
1021 HRESULT result; 1022 HRESULT result;
1022 DWORD sharemode; 1023 DWORD sharemode;
1023 DWORD style; 1024 DWORD style;
1024 const DWORD directstyle = 1025 const DWORD directstyle =
1025 (WS_POPUP); 1026 (WS_POPUP);
1101 return(NULL); 1102 return(NULL);
1102 } 1103 }
1103 } 1104 }
1104 1105
1105 /* Fill in part of the video surface */ 1106 /* Fill in part of the video surface */
1107 prev_w = video->w;
1108 prev_h = video->h;
1106 video->flags = 0; /* Clear flags */ 1109 video->flags = 0; /* Clear flags */
1107 video->w = width; 1110 video->w = width;
1108 video->h = height; 1111 video->h = height;
1109 video->pitch = SDL_CalculatePitch(video); 1112 video->pitch = SDL_CalculatePitch(video);
1110 1113
1176 HWND top; 1179 HWND top;
1177 UINT swp_flags; 1180 UINT swp_flags;
1178 const char *window = NULL; 1181 const char *window = NULL;
1179 const char *center = NULL; 1182 const char *center = NULL;
1180 1183
1181 if ( !SDL_windowX && !SDL_windowY ) { 1184 if ( video->w != prev_w || video->h != prev_h ) {
1182 window = SDL_getenv("SDL_VIDEO_WINDOW_POS"); 1185 window = SDL_getenv("SDL_VIDEO_WINDOW_POS");
1183 center = SDL_getenv("SDL_VIDEO_CENTERED"); 1186 center = SDL_getenv("SDL_VIDEO_CENTERED");
1184 if ( window ) { 1187 if ( window ) {
1185 if ( SDL_sscanf(window, "%d,%d", &x, &y) == 2 ) { 1188 if ( SDL_sscanf(window, "%d,%d", &x, &y) == 2 ) {
1186 SDL_windowX = x; 1189 SDL_windowX = x;
1452 0); 1455 0);
1453 if ( video == NULL ) { 1456 if ( video == NULL ) {
1454 SDL_OutOfMemory(); 1457 SDL_OutOfMemory();
1455 return(NULL); 1458 return(NULL);
1456 } 1459 }
1460 prev_w = video->w;
1461 prev_h = video->h;
1457 video->w = width; 1462 video->w = width;
1458 video->h = height; 1463 video->h = height;
1459 video->pitch = 0; 1464 video->pitch = 0;
1460 } 1465 }
1461 video->flags = 0; /* Clear flags */ 1466 video->flags = 0; /* Clear flags */
1579 int x, y; 1584 int x, y;
1580 UINT swp_flags; 1585 UINT swp_flags;
1581 const char *window = NULL; 1586 const char *window = NULL;
1582 const char *center = NULL; 1587 const char *center = NULL;
1583 1588
1584 if ( !SDL_windowX && !SDL_windowY ) { 1589 if ( video->w != prev_w || video->h != prev_h ) {
1585 window = SDL_getenv("SDL_VIDEO_WINDOW_POS"); 1590 window = SDL_getenv("SDL_VIDEO_WINDOW_POS");
1586 center = SDL_getenv("SDL_VIDEO_CENTERED"); 1591 center = SDL_getenv("SDL_VIDEO_CENTERED");
1587 if ( window ) { 1592 if ( window ) {
1588 if ( SDL_sscanf(window, "%d,%d", &x, &y) == 2 ) { 1593 if ( SDL_sscanf(window, "%d,%d", &x, &y) == 2 ) {
1589 SDL_windowX = x; 1594 SDL_windowX = x;