This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to tag 1.51
in repository iortcw.

commit b3b521e10ce770742b32a342e3a7f803b2af7a97
Author: MAN-AT-ARMS <[email protected]>
Date:   Tue Feb 7 22:54:11 2017 -0500

    All: Optimized Alt-Enter patch by SmileTheory
---
 MP/code/sdl/sdl_glimp.c | 26 ++++++++++++++++++--------
 SP/code/sdl/sdl_glimp.c | 26 ++++++++++++++++++--------
 2 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/MP/code/sdl/sdl_glimp.c b/MP/code/sdl/sdl_glimp.c
index 45627ad..fa405d1 100644
--- a/MP/code/sdl/sdl_glimp.c
+++ b/MP/code/sdl/sdl_glimp.c
@@ -908,7 +908,7 @@ void GLimp_EndFrame( void )
 
        if( r_fullscreen->modified )
        {
-               int         fullscreen;
+               qboolean    fullscreen;
                qboolean    needToToggle;
 
                // Find out the current state
@@ -926,16 +926,26 @@ void GLimp_EndFrame( void )
 
                if( needToToggle )
                {
-                       // Need the vid_restart here since r_fullscreen is only 
latched
-                       if( fullscreen ) {
-                               Com_Printf( "Switching to windowed rendering\n" 
);
-                               ri.Cmd_ExecuteText(EXEC_APPEND, 
"vid_restart\n");
-                       } else {
+                       // Always issue a vid_restart when going to windowed 
instead of calling SDL_SetWindowFullscreen()
+                       // Otherwise sdl_input.c::IN_ProcessEvents() will catch 
a SDL_WINDOWEVENT_RESIZED event
+                       // That will alter user resolution cvars and issue a 
vid_restart anyway
+                       qboolean needVidRestart = qtrue;
+ 
+                       if (!fullscreen)
+                       {
+                               // Issue a vid_restart if 
SDL_SetWindowFullscreen() doesn't work
+                               needVidRestart = 
SDL_SetWindowFullscreen(SDL_window, SDL_WINDOW_FULLSCREEN) < 0;
                                Com_Printf( "Switching to fullscreen 
rendering\n" );
-                               ri.Cmd_ExecuteText(EXEC_APPEND, 
"vid_restart\n");
+                       }
+                       else
+                       {
+                               Com_Printf( "Switching to windowed rendering\n" 
);
                        }
 
-                       ri.IN_Restart( );
+                       if (needVidRestart)
+                               ri.Cmd_ExecuteText(EXEC_APPEND, 
"vid_restart\n");
+ 
+                       ri.IN_Restart( );
                }
 
                r_fullscreen->modified = qfalse;
diff --git a/SP/code/sdl/sdl_glimp.c b/SP/code/sdl/sdl_glimp.c
index 45627ad..fa405d1 100644
--- a/SP/code/sdl/sdl_glimp.c
+++ b/SP/code/sdl/sdl_glimp.c
@@ -908,7 +908,7 @@ void GLimp_EndFrame( void )
 
        if( r_fullscreen->modified )
        {
-               int         fullscreen;
+               qboolean    fullscreen;
                qboolean    needToToggle;
 
                // Find out the current state
@@ -926,16 +926,26 @@ void GLimp_EndFrame( void )
 
                if( needToToggle )
                {
-                       // Need the vid_restart here since r_fullscreen is only 
latched
-                       if( fullscreen ) {
-                               Com_Printf( "Switching to windowed rendering\n" 
);
-                               ri.Cmd_ExecuteText(EXEC_APPEND, 
"vid_restart\n");
-                       } else {
+                       // Always issue a vid_restart when going to windowed 
instead of calling SDL_SetWindowFullscreen()
+                       // Otherwise sdl_input.c::IN_ProcessEvents() will catch 
a SDL_WINDOWEVENT_RESIZED event
+                       // That will alter user resolution cvars and issue a 
vid_restart anyway
+                       qboolean needVidRestart = qtrue;
+ 
+                       if (!fullscreen)
+                       {
+                               // Issue a vid_restart if 
SDL_SetWindowFullscreen() doesn't work
+                               needVidRestart = 
SDL_SetWindowFullscreen(SDL_window, SDL_WINDOW_FULLSCREEN) < 0;
                                Com_Printf( "Switching to fullscreen 
rendering\n" );
-                               ri.Cmd_ExecuteText(EXEC_APPEND, 
"vid_restart\n");
+                       }
+                       else
+                       {
+                               Com_Printf( "Switching to windowed rendering\n" 
);
                        }
 
-                       ri.IN_Restart( );
+                       if (needVidRestart)
+                               ri.Cmd_ExecuteText(EXEC_APPEND, 
"vid_restart\n");
+ 
+                       ri.IN_Restart( );
                }
 
                r_fullscreen->modified = qfalse;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/iortcw.git

_______________________________________________
Pkg-games-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to