[gtk+/wip/chergert/quartz-frame-clock: 210/228] Set timeout to possibly wake up with less delay.



commit 52e2434dc148072886e04bbd3da670b5a79794d2
Author: Christian Hergert <christian hergert me>
Date:   Mon Sep 7 00:54:27 2015 -0700

    Set timeout to possibly wake up with less delay.

 gdk/quartz/gdkdisplaylinksource.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gdk/quartz/gdkdisplaylinksource.c b/gdk/quartz/gdkdisplaylinksource.c
index 202918f..fb47a95 100644
--- a/gdk/quartz/gdkdisplaylinksource.c
+++ b/gdk/quartz/gdkdisplaylinksource.c
@@ -32,8 +32,14 @@ gdk_display_link_source_prepare (GSource *source,
                                  gint    *timeout_)
 {
   GdkDisplayLinkSource *impl = (GdkDisplayLinkSource *)source;
+  gint64 now;
 
-       *timeout_ = -1;
+  now = g_source_get_time (source);
+
+  if (now < impl->presentation_time)
+    *timeout_ = (impl->presentation_time - now) / 1000L;
+  else
+    *timeout_ = -1;
 
   return impl->needs_dispatch;
 }


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