[clutter] main: Add a sync-to-vblank global flag



commit e8562089f692f5fa8bbf8c646d3c508244fd3d14
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Fri Nov 4 16:35:38 2011 +0000

    main: Add a sync-to-vblank global flag
    
    It replaces the per-backend CLUTTER_VBLANK environment variable.

 clutter/clutter-main.c    |   21 +++++++++++++++++++++
 clutter/clutter-private.h |    2 ++
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index 503a6b0..ca46633 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -155,6 +155,7 @@ static gboolean clutter_fatal_warnings       = FALSE;
 static gboolean clutter_disable_mipmap_text  = FALSE;
 static gboolean clutter_use_fuzzy_picking    = FALSE;
 static gboolean clutter_enable_accessibility = TRUE;
+static gboolean clutter_sync_to_vblank       = TRUE;
 
 static guint clutter_default_fps             = 60;
 
@@ -302,6 +303,16 @@ clutter_config_read_from_key_file (GKeyFile *keyfile)
   else
     clutter_enable_accessibility = bool_value;
 
+  bool_value =
+    g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
+                            "SyncToVblank",
+                            &key_error);
+
+  if (key_error != NULL)
+    g_clear_error (&key_error);
+  else
+    clutter_sync_to_vblank = bool_value;
+
   int_value =
     g_key_file_get_integer (keyfile, ENVIRONMENT_GROUP,
                             "DefaultFps",
@@ -1725,6 +1736,10 @@ pre_parse_hook (GOptionContext  *context,
   if (env_string)
     clutter_use_fuzzy_picking = TRUE;
 
+  env_string = g_getenv ("CLUTTER_VBLANK");
+  if (g_strcmp0 (env_string, "none") == 0)
+    clutter_sync_to_vblank = FALSE;
+
   return _clutter_backend_pre_parse (backend, error);
 }
 
@@ -3699,3 +3714,9 @@ clutter_check_windowing_backend (const char *backend_type)
 #endif
   return FALSE;
 }
+
+gboolean
+_clutter_get_sync_to_vblank (void)
+{
+  return clutter_sync_to_vblank;
+}
diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h
index eff0b31..017d54e 100644
--- a/clutter/clutter-private.h
+++ b/clutter/clutter-private.h
@@ -211,6 +211,8 @@ void            _clutter_id_to_color            (guint         id,
 ClutterActor *  _clutter_get_actor_by_id        (ClutterStage *stage,
                                                  guint32       actor_id);
 
+gboolean        _clutter_get_sync_to_vblank     (void);
+
 /* use this function as the accumulator if you have a signal with
  * a G_TYPE_BOOLEAN return value; this will stop the emission as
  * soon as one handler returns TRUE



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