X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=vid_sdl.c;h=b6b005979384f5229f295f858173e2cd4951d544;hb=45740e3e6ca5afe95237d1646dc624a809182b74;hp=8a917822555cd9d84433739569da5f4d6369cb56;hpb=bf7fdc26371e2823650c8af6d78ef1e28513f7eb;p=xonotic%2Fdarkplaces.git diff --git a/vid_sdl.c b/vid_sdl.c index 8a917822..b6b00597 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -341,7 +341,7 @@ void Sys_SendKeyEvents( void ) while( SDL_PollEvent( &event ) ) switch( event.type ) { case SDL_QUIT: - Sys_Quit(); + Sys_Quit(0); break; case SDL_KEYDOWN: case SDL_KEYUP: @@ -371,15 +371,21 @@ void Sys_SendKeyEvents( void ) } // enable/disable sound on focus gain/loss - if (!vid_activewindow && sound_active) + if (!vid_hidden && (vid_activewindow || !snd_mutewhenidle.integer)) { - S_BlockSound (); - sound_active = false; + if (!sound_active) + { + S_UnblockSound (); + sound_active = true; + } } - else if (vid_activewindow && !sound_active) + else { - S_UnblockSound (); - sound_active = true; + if (sound_active) + { + S_BlockSound (); + sound_active = false; + } } } @@ -473,6 +479,7 @@ static void VID_OutputVersion() int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer) { int i; + static int notfirstvideomode = false; int flags = SDL_OPENGL; const char *drivername; @@ -483,7 +490,9 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate We cant switch from one OpenGL video mode to another. Thus we first switch to some stupid 2D mode and then back to OpenGL. */ - SDL_SetVideoMode( 0, 0, 0, 0 ); + if (notfirstvideomode) + SDL_SetVideoMode( 0, 0, 0, 0 ); + notfirstvideomode = true; // SDL usually knows best drivername = NULL; @@ -587,6 +596,9 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate void VID_Shutdown (void) { + // this is needed to retry gamma after a vid_restart + VID_RestoreSystemGamma(); + IN_Activate(false); SDL_QuitSubSystem(SDL_INIT_VIDEO); }