[clutter/wip/wayland-for-demo: 13/15] paused
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/wayland-for-demo: 13/15] paused
- Date: Wed, 5 Mar 2014 15:21:17 +0000 (UTC)
commit e639123095a8f518b6f97ff823702cf3dc5ac6a6
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Feb 28 10:15:45 2014 -0500
paused
clutter/clutter-main.c | 24 ++++++++++++++++++++++++
clutter/clutter-main.h | 2 ++
clutter/clutter-master-clock.c | 15 +++++++++++++++
clutter/clutter-master-clock.h | 2 ++
4 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index 925a77a..eea8125 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -4041,3 +4041,27 @@ _clutter_diagnostic_message (const char *format, ...)
g_free (fmt);
}
+
+/**
+ * clutter_set_paused:
+ * @paused: Whether Clutter should be paused
+ *
+ * This allows clients to pause Clutter. Pausing Clutter effectively
+ * makes it stop processing events, redrawing, and other things until
+ * it's been unpaused. This is useful when using the EGLNative backend
+ * to ensure that Clutter doesn't do anything when VT switched away.
+ *
+ * It can also be helpful for debugging purposes.
+ *
+ * You can pause Clutter by passing %TRUE, and unpause Clutter by
+ * passing %FALSE.
+ *
+ * Since: 1.18
+ */
+void
+clutter_set_paused (gboolean paused)
+{
+ ClutterMasterClock *master_clock = _clutter_master_clock_get_default ();
+
+ _clutter_master_clock_set_paused (master_clock, paused);
+}
diff --git a/clutter/clutter-main.h b/clutter/clutter-main.h
index b7c8565..14c5139 100644
--- a/clutter/clutter-main.h
+++ b/clutter/clutter-main.h
@@ -143,6 +143,8 @@ ClutterTextDirection clutter_get_default_text_direction (void);
guint clutter_get_default_frame_rate (void);
+void clutter_set_paused (gboolean paused);
+
G_END_DECLS
#endif /* _CLUTTER_MAIN_H__ */
diff --git a/clutter/clutter-master-clock.c b/clutter/clutter-master-clock.c
index 104ea0c..9aa9c3e 100644
--- a/clutter/clutter-master-clock.c
+++ b/clutter/clutter-master-clock.c
@@ -92,6 +92,8 @@ struct _ClutterMasterClock
*/
guint idle : 1;
guint ensure_next_iteration : 1;
+
+ guint paused : 1;
};
struct _ClutterMasterClockClass
@@ -142,6 +144,9 @@ master_clock_is_running (ClutterMasterClock *master_clock)
stages = clutter_stage_manager_peek_stages (stage_manager);
+ if (master_clock->paused)
+ return FALSE;
+
if (master_clock->timelines)
return TRUE;
@@ -635,6 +640,7 @@ clutter_master_clock_init (ClutterMasterClock *self)
self->idle = FALSE;
self->ensure_next_iteration = FALSE;
+ self->paused = FALSE;
#ifdef CLUTTER_ENABLE_DEBUG
self->frame_budget = G_USEC_PER_SEC / 60;
@@ -739,3 +745,12 @@ _clutter_master_clock_ensure_next_iteration (ClutterMasterClock *master_clock)
master_clock->ensure_next_iteration = TRUE;
}
+
+void
+_clutter_master_clock_set_paused (ClutterMasterClock *master_clock,
+ gboolean paused)
+{
+ g_return_if_fail (CLUTTER_IS_MASTER_CLOCK (master_clock));
+
+ master_clock->paused = !!paused;
+}
diff --git a/clutter/clutter-master-clock.h b/clutter/clutter-master-clock.h
index 211f378..771a26d 100644
--- a/clutter/clutter-master-clock.h
+++ b/clutter/clutter-master-clock.h
@@ -43,6 +43,8 @@ void _clutter_master_clock_remove_timeline (Clutter
ClutterTimeline *timeline);
void _clutter_master_clock_start_running (ClutterMasterClock *master_clock);
void _clutter_master_clock_ensure_next_iteration (ClutterMasterClock *master_clock);
+void _clutter_master_clock_set_paused (ClutterMasterClock *master_clock,
+ gboolean paused);
void _clutter_timeline_advance (ClutterTimeline *timeline,
gint64 tick_time);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]