Allow overriding the list of Cogl drivers via configuration file

Clutter has a configuration file that can be used to override
various settings, including the ones from environment variables.
This commit is contained in:
Emmanuele Bassi 2015-12-10 16:52:45 +00:00
parent bb23335b5f
commit 407d7ca436
3 changed files with 19 additions and 1 deletions

View File

@ -153,6 +153,7 @@ PangoDirection _clutter_backend_get_keymap_direction (Clutter
void _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend);
void clutter_set_allowed_drivers (const char *drivers);
G_END_DECLS

View File

@ -373,7 +373,7 @@ static const struct {
{ "any", "Default Cogl driver", COGL_DRIVER_ANY },
};
static char *allowed_drivers;
static const char *allowed_drivers;
static gboolean
clutter_backend_real_create_context (ClutterBackend *backend,
@ -1509,3 +1509,9 @@ _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
cogl_set_framebuffer (COGL_FRAMEBUFFER (backend->dummy_onscreen));
}
void
clutter_set_allowed_drivers (const char *drivers)
{
allowed_drivers = g_strdup (drivers);
}

View File

@ -221,6 +221,17 @@ clutter_config_read_from_key_file (GKeyFile *keyfile)
if (!g_key_file_has_group (keyfile, ENVIRONMENT_GROUP))
return;
str_value =
g_key_file_get_string (keyfile, ENVIRONMENT_GROUP,
"Drivers",
&key_error);
if (key_error != NULL)
g_clear_error (&key_error);
else
clutter_set_allowed_drivers (str_value);
g_free (str_value);
bool_value =
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
"ShowFps",