[gtk+] GdkGLContextX11: Only set swap interval when it changed



commit dd721acb84ee0965abd37f816fe502f12be05e89
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Nov 5 12:02:18 2014 +0100

    GdkGLContextX11: Only set swap interval when it changed

 gdk/x11/gdkglcontext-x11.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index 2542b01..bc48d4d 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -533,6 +533,7 @@ gdk_x11_gl_context_class_init (GdkX11GLContextClass *klass)
 static void
 gdk_x11_gl_context_init (GdkX11GLContext *self)
 {
+  self->do_frame_sync = TRUE;
 }
 
 gboolean
@@ -1175,12 +1176,15 @@ gdk_x11_display_make_gl_context_current (GdkDisplay   *display,
       screen = gdk_window_get_screen (window);
       do_frame_sync = ! gdk_screen_is_composited (screen);
 
-      context_x11->do_frame_sync = do_frame_sync;
+      if (do_frame_sync != context_x11->do_frame_sync)
+        {
+          context_x11->do_frame_sync = do_frame_sync;
 
-      if (context_x11->do_frame_sync)
-        glXSwapIntervalSGI (1);
-      else
-        glXSwapIntervalSGI (0);
+          if (do_frame_sync)
+            glXSwapIntervalSGI (1);
+          else
+            glXSwapIntervalSGI (0);
+        }
     }
 
   return TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]