support mute-when-idle properly
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 19 Aug 2009 06:11:51 +0000 (06:11 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 19 Aug 2009 06:11:51 +0000 (06:11 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9124 d7cf8633-e32d-0410-b094-e92efae38249

vid_agl.c

index 0c0fd7a..b8201b6 100644 (file)
--- a/vid_agl.c
+++ b/vid_agl.c
@@ -473,13 +473,21 @@ static void VID_AppFocusChanged(qboolean windowIsActive)
                        VID_RestoreSystemGamma();
        }
 
-       if (sound_active != windowIsActive)
+       if (windowIsActive || !snd_mutewhenidle.integer)
        {
-               sound_active = windowIsActive;
-               if (sound_active)
+               if (!sound_active)
+               {
                        S_UnblockSound ();
-               else
+                       sound_active = true;
+               }
+       }
+       else
+       {
+               if (sound_active)
+               {
                        S_BlockSound ();
+                       sound_active = false;
+               }
        }
 }