main: Add a sync-to-vblank global flag

It replaces the per-backend CLUTTER_VBLANK environment variable.
This commit is contained in:
Emmanuele Bassi 2011-11-04 16:35:38 +00:00
parent 80fdbeb954
commit e8562089f6
2 changed files with 23 additions and 0 deletions

View File

@ -155,6 +155,7 @@ static gboolean clutter_fatal_warnings = FALSE;
static gboolean clutter_disable_mipmap_text = FALSE; static gboolean clutter_disable_mipmap_text = FALSE;
static gboolean clutter_use_fuzzy_picking = FALSE; static gboolean clutter_use_fuzzy_picking = FALSE;
static gboolean clutter_enable_accessibility = TRUE; static gboolean clutter_enable_accessibility = TRUE;
static gboolean clutter_sync_to_vblank = TRUE;
static guint clutter_default_fps = 60; static guint clutter_default_fps = 60;
@ -302,6 +303,16 @@ clutter_config_read_from_key_file (GKeyFile *keyfile)
else else
clutter_enable_accessibility = bool_value; 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 = int_value =
g_key_file_get_integer (keyfile, ENVIRONMENT_GROUP, g_key_file_get_integer (keyfile, ENVIRONMENT_GROUP,
"DefaultFps", "DefaultFps",
@ -1725,6 +1736,10 @@ pre_parse_hook (GOptionContext *context,
if (env_string) if (env_string)
clutter_use_fuzzy_picking = TRUE; 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); return _clutter_backend_pre_parse (backend, error);
} }
@ -3699,3 +3714,9 @@ clutter_check_windowing_backend (const char *backend_type)
#endif #endif
return FALSE; return FALSE;
} }
gboolean
_clutter_get_sync_to_vblank (void)
{
return clutter_sync_to_vblank;
}

View File

@ -211,6 +211,8 @@ void _clutter_id_to_color (guint id,
ClutterActor * _clutter_get_actor_by_id (ClutterStage *stage, ClutterActor * _clutter_get_actor_by_id (ClutterStage *stage,
guint32 actor_id); guint32 actor_id);
gboolean _clutter_get_sync_to_vblank (void);
/* use this function as the accumulator if you have a signal with /* use this function as the accumulator if you have a signal with
* a G_TYPE_BOOLEAN return value; this will stop the emission as * a G_TYPE_BOOLEAN return value; this will stop the emission as
* soon as one handler returns TRUE * soon as one handler returns TRUE