summaryrefslogtreecommitdiff
path: root/gdk/gdkframetimings.c
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2012-11-14 16:08:08 -0500
committerOwen W. Taylor <otaylor@fishsoup.net>2013-02-14 17:19:50 -0500
commit58b5811d03ded179b285727407b6a6be3d4d0734 (patch)
tree57bb0e1f18a863a6abb1958b871a33b4b784510d /gdk/gdkframetimings.c
parentdc6dedab4dfdff5d067ba9f8c88d6a48cf0af143 (diff)
downloadgtk+-58b5811d03ded179b285727407b6a6be3d4d0734.tar.gz
Add gdk_frame_timings_get/set_slept_before()
Add functions that tell us whether the main loop slept before we drew a frame. Blocking with the frame clock frozen doesn't count as sleeping. We'll use this to advertise to the compositor whether we are drawing as fast as possible (and it should do the same) or timing frames carefully (and it should do the same.) https://bugzilla.gnome.org/show_bug.cgi?id=685460
Diffstat (limited to 'gdk/gdkframetimings.c')
-rw-r--r--gdk/gdkframetimings.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gdk/gdkframetimings.c b/gdk/gdkframetimings.c
index d9354ede4f..a51912baa6 100644
--- a/gdk/gdkframetimings.c
+++ b/gdk/gdkframetimings.c
@@ -23,13 +23,15 @@ struct _GdkFrameTimings
{
guint ref_count;
- gboolean complete;
gint64 frame_counter;
guint64 cookie;
gint64 frame_time;
gint64 drawn_time;
gint64 presentation_time;
gint64 refresh_interval;
+
+ guint complete : 1;
+ guint slept_before : 1;
};
G_DEFINE_BOXED_TYPE (GdkFrameTimings, gdk_frame_timings,
@@ -111,6 +113,23 @@ gdk_frame_timings_set_complete (GdkFrameTimings *timings,
timings->complete = complete;
}
+gboolean
+gdk_frame_timings_get_slept_before (GdkFrameTimings *timings)
+{
+ g_return_val_if_fail (timings != NULL, FALSE);
+
+ return timings->slept_before;
+}
+
+void
+gdk_frame_timings_set_slept_before (GdkFrameTimings *timings,
+ gboolean slept_before)
+{
+ g_return_if_fail (timings != NULL);
+
+ timings->slept_before = slept_before;
+}
+
gint64
gdk_frame_timings_get_frame_time (GdkFrameTimings *timings)
{