]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_agl.c
added r_renderview cvar (similar to scr_refresh but disables only 3D
[xonotic/darkplaces.git] / vid_agl.c
index b08b10dd8ce4c483f5a908c326d2aa0bf7843d8b..c5c55fa2b710ffc72d34e009abe5a0acedbf1908 100644 (file)
--- a/vid_agl.c
+++ b/vid_agl.c
@@ -78,7 +78,7 @@ static WindowRef window;
 
 static double originalMouseSpeed = -1.0;
 
-io_connect_t IN_GetIOHandle()
+io_connect_t IN_GetIOHandle(void)
 {
        io_connect_t iohandle = MACH_PORT_NULL;
        kern_return_t status;
@@ -219,7 +219,7 @@ void VID_Finish (void)
                        Con_Printf("ERROR: can't %s vsync\n", vid_usevsync ? "activate" : "deactivate");
        }
 
-       if (r_render.integer)
+       if (!vid_hidden)
        {
                CHECKGLERROR
                if (r_speeds.integer == 2 || gl_finish.integer)
@@ -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;
+               }
        }
 }
 
@@ -1122,8 +1130,26 @@ void IN_Move (void)
 {
 }
 
+static bool GetDictionaryBoolean(CFDictionaryRef d, const void *key)
+{
+    CFBooleanRef ref = (CFBooleanRef) CFDictionaryGetValue(d, key);
+    if(ref)
+        return CFBooleanGetValue(ref);
+    return false;
+}
+
+long GetDictionaryLong(CFDictionaryRef d, const void *key)
+{
+       long value = 0;
+    CFNumberRef ref = (CFNumberRef) CFDictionaryGetValue(d, key);
+    if(ref)
+        CFNumberGetValue(ref, kCFNumberLongType, &value);
+    return value;
+}
+
 size_t VID_ListModes(vid_mode_t *modes, size_t maxcount)
 {
+       CGDirectDisplayID mainDisplay = CGMainDisplayID();
        CFArrayRef vidmodes = CGDisplayAvailableModes(mainDisplay);
        CFDictionaryRef thismode;
        unsigned int n = CFArrayGetCount(vidmodes);