]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_sdl.c
moved many cl_ prefixed variables into cl. or cls.
[xonotic/darkplaces.git] / vid_sdl.c
index 9f86830566634d44d0f5cb832a1ea5cb6c7682f0..65d4bcb7913e0d54468477ba481499d0a3e47b92 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -346,11 +346,13 @@ static void VID_SetCaption()
                return;
 
        icon = LoadIcon( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_ICON1 ) );
-#ifndef WIN64
-       SetClassLong( info.window, GCL_HICON, (LONG) icon );
-#else
-       SetClassLongPtr( info.window, GCLP_HICON, (LONG_PTR)icon );
+#ifndef SetClassLongPtr
+#define SetClassLongPtr SetClassLong
+#endif
+#ifndef GCLP_HICON
+#define GCLP_HICON GCL_HICON
 #endif
+       SetClassLongPtr( info.window, GCLP_HICON, (LONG_PTR)icon );
 }
 #else
 static void VID_SetCaption()
@@ -481,7 +483,7 @@ int VID_GetGamma (unsigned short *ramps)
        return !SDL_GetGammaRamp( ramps, ramps + 256, ramps + 512);
 }
 
-void VID_Finish (void)
+void VID_Finish (qboolean allowmousegrab)
 {
        Uint8 appstate;
        qboolean vid_usemouse;
@@ -493,13 +495,15 @@ void VID_Finish (void)
        //react on appstate changes
        appstate = SDL_GetAppState();
 
-       if( !( appstate & SDL_APPMOUSEFOCUS ) || !( appstate & SDL_APPINPUTFOCUS ) )
+       vid_hidden = !(appstate & SDL_APPACTIVE);
+
+       if( vid_hidden || !( appstate & SDL_APPMOUSEFOCUS ) || !( appstate & SDL_APPINPUTFOCUS ) )
                vid_activewindow = false;
        else
                vid_activewindow = true;
 
        vid_usemouse = false;
-       if( vid_mouse.integer && !key_consoleactive && !cls.demoplayback )
+       if( allowmousegrab && vid_mouse.integer && !key_consoleactive && !cls.demoplayback )
                vid_usemouse = true;
        if( vid_isfullscreen )
                vid_usemouse = true;