Allow setting the default backend from the configuration file
We should allow a configuration file to set up the initial state of the global state, which also implies being able to set the backend. If the allowed backends have already been set programmatically via the clutter_set_windowing_backend(), though, then the application code takes precedence, as we assume that the application author knows better than us what their code supports or requires.
This commit is contained in:
parent
cc31ed77bd
commit
e9b5eb3045
3 changed files with 20 additions and 0 deletions
|
@ -155,6 +155,8 @@ void _clutter_backend_reset_cogl_framebuffer (Clutter
|
|||
|
||||
void clutter_set_allowed_drivers (const char *drivers);
|
||||
|
||||
void clutter_try_set_windowing_backend (const char *drivers);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */
|
||||
|
|
|
@ -1527,6 +1527,13 @@ clutter_set_windowing_backend (const char *backend_type)
|
|||
allowed_backends = g_strdup (backend_type);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_try_set_windowing_backend (const char *backend_type)
|
||||
{
|
||||
if (allowed_backends == NULL)
|
||||
clutter_set_windowing_backend (backend_type);
|
||||
}
|
||||
|
||||
PangoDirection
|
||||
_clutter_backend_get_keymap_direction (ClutterBackend *backend)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
"Backends",
|
||||
&key_error);
|
||||
if (key_error != NULL)
|
||||
g_clear_error (&key_error);
|
||||
else
|
||||
clutter_try_set_windowing_backend (str_value);
|
||||
|
||||
g_free (str_value);
|
||||
|
||||
str_value =
|
||||
g_key_file_get_string (keyfile, ENVIRONMENT_GROUP,
|
||||
"Drivers",
|
||||
|
|
Loading…
Reference in a new issue