Vsync waits on systems that support GLX_EXT_swap_control
authorDerek Foreman <foremande@gmail.com>
Fri, 25 Jun 2010 16:29:12 +0000 (12:29 -0400)
committerDana Jansens <danakj@orodu.net>
Sat, 26 Jun 2010 23:30:52 +0000 (01:30 +0200)
openbox/composite.c

index 6e52ead0af26b6d166fba146d7fb40dfeca63b95..7efe0b3b8ca3cc34f39e313f992e330d8feb251e 100644 (file)
@@ -335,6 +335,14 @@ gboolean composite_enable(void)
     /* register our screen redraw callback */
     composite_idle_source = g_idle_add(composite, NULL);
 
+    //Attempt to enable vsync
+    if (GLXEW_EXT_swap_control) {
+        GLXDrawable drawable = glXGetCurrentDrawable();
+        glXSwapIntervalEXT(obt_display, drawable, 1);
+    } else {
+        ob_debug_type(OB_DEBUG_CM, "Vsync control not available.");
+    }
+
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     glXSwapBuffers(obt_display, composite_overlay);
     glMatrixMode(GL_PROJECTION);