[iortcw] 291/497: All: Fix saving window position on exit
Simon McVittie
smcv at debian.org
Fri Sep 8 10:37:10 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit 3ca55c3f86e6c2d2a262450fe3fd254011d5efa0
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date: Thu Feb 12 20:37:51 2015 +0000
All: Fix saving window position on exit
---
MP/code/qcommon/common.c | 4 ++++
MP/code/sdl/sdl_glimp.c | 13 ++++++-------
SP/code/qcommon/common.c | 4 ++++
SP/code/sdl/sdl_glimp.c | 12 +++++-------
4 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/MP/code/qcommon/common.c b/MP/code/qcommon/common.c
index f35a670..54a711f 100644
--- a/MP/code/qcommon/common.c
+++ b/MP/code/qcommon/common.c
@@ -3330,6 +3330,10 @@ Com_Shutdown
=================
*/
void Com_Shutdown( void ) {
+
+ // write config file if anything changed
+ Com_WriteConfiguration();
+
if ( logfile ) {
FS_FCloseFile( logfile );
logfile = 0;
diff --git a/MP/code/sdl/sdl_glimp.c b/MP/code/sdl/sdl_glimp.c
index 85d1f22..afd4359 100644
--- a/MP/code/sdl/sdl_glimp.c
+++ b/MP/code/sdl/sdl_glimp.c
@@ -226,6 +226,7 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
Uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL;
SDL_DisplayMode desktopMode;
int display = 0;
+ int x = SDL_WINDOWPOS_UNDEFINED, y = SDL_WINDOWPOS_UNDEFINED;
ri.Printf( PRINT_ALL, "Initializing OpenGL display\n");
@@ -301,8 +302,6 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
if( SDL_window != NULL )
{
- int x, y;
-
SDL_GetWindowPosition( SDL_window, &x, &y );
ri.Printf( PRINT_DEVELOPER, "Existing window at %dx%d before being destroyed\n", x, y );
SDL_DestroyWindow( SDL_window );
@@ -448,24 +447,24 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
continue;
}
}
- else if ( ( r_windowPosx->integer == 0 ) && ( r_windowPosy->integer == 0 ) )
+ else if ( ( r_windowPosx->integer || r_windowPosy->integer ) && !fullscreen )
{
- if( ( SDL_window = SDL_CreateWindow( CLIENT_WINDOW_TITLE, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
+ if( ( SDL_window = SDL_CreateWindow( CLIENT_WINDOW_TITLE, r_windowPosx->integer, r_windowPosy->integer,
glConfig.vidWidth, glConfig.vidHeight, flags ) ) == 0 )
{
ri.Printf( PRINT_DEVELOPER, "SDL_CreateWindow failed: %s\n", SDL_GetError( ) );
continue;
}
- }
+ }
else
{
- if( ( SDL_window = SDL_CreateWindow( CLIENT_WINDOW_TITLE, r_windowPosx->integer, r_windowPosy->integer,
+ if( ( SDL_window = SDL_CreateWindow( CLIENT_WINDOW_TITLE, x, y,
glConfig.vidWidth, glConfig.vidHeight, flags ) ) == 0 )
{
ri.Printf( PRINT_DEVELOPER, "SDL_CreateWindow failed: %s\n", SDL_GetError( ) );
continue;
}
- }
+ }
if( fullscreen )
{
diff --git a/SP/code/qcommon/common.c b/SP/code/qcommon/common.c
index 3ac7e96..34b496f 100644
--- a/SP/code/qcommon/common.c
+++ b/SP/code/qcommon/common.c
@@ -2869,6 +2869,10 @@ Com_Shutdown
=================
*/
void Com_Shutdown( void ) {
+
+ // write config file if anything changed
+ Com_WriteConfiguration();
+
if ( logfile ) {
FS_FCloseFile( logfile );
logfile = 0;
diff --git a/SP/code/sdl/sdl_glimp.c b/SP/code/sdl/sdl_glimp.c
index 47bc503..1f3cb63 100644
--- a/SP/code/sdl/sdl_glimp.c
+++ b/SP/code/sdl/sdl_glimp.c
@@ -314,8 +314,6 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
if( SDL_window != NULL )
{
- int x, y;
-
SDL_GetWindowPosition( SDL_window, &x, &y );
ri.Printf( PRINT_DEVELOPER, "Existing window at %dx%d before being destroyed\n", x, y );
SDL_DestroyWindow( SDL_window );
@@ -462,24 +460,24 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
continue;
}
}
- else if ( ( r_windowPosx->integer == 0 ) && ( r_windowPosy->integer == 0 ) )
+ else if ( ( r_windowPosx->integer || r_windowPosy->integer ) && !fullscreen )
{
- if( ( SDL_window = SDL_CreateWindow( CLIENT_WINDOW_TITLE, x, y,
+ if( ( SDL_window = SDL_CreateWindow( CLIENT_WINDOW_TITLE, r_windowPosx->integer, r_windowPosy->integer,
glConfig.vidWidth, glConfig.vidHeight, flags ) ) == 0 )
{
ri.Printf( PRINT_DEVELOPER, "SDL_CreateWindow failed: %s\n", SDL_GetError( ) );
continue;
}
- }
+ }
else
{
- if( ( SDL_window = SDL_CreateWindow( CLIENT_WINDOW_TITLE, r_windowPosx->integer, r_windowPosy->integer,
+ if( ( SDL_window = SDL_CreateWindow( CLIENT_WINDOW_TITLE, x, y,
glConfig.vidWidth, glConfig.vidHeight, flags ) ) == 0 )
{
ri.Printf( PRINT_DEVELOPER, "SDL_CreateWindow failed: %s\n", SDL_GetError( ) );
continue;
}
- }
+ }
if( fullscreen )
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list