cogl: Add support for reading a cogl.conf config file

When cogl initializes we now check for a cogl/cogl.conf in any of the
system config dirs (determined using $XDG_CONFIG_DIRS on linux) we then
also check the user's config directory (determined using XDG_CONFIG_HOME
on linux) for a cogl/cogl.conf file. Options specified in the user
config file have priority over the system config options.

The config file has an .ini style syntax with a mandatory [global]
section and we currently understand 3 keynames: COGL_DEBUG, COGL_DRIVER
and COGL_RENDERER which have the same semantics as the corresponding
environment variables.

Options set using the environment variables have priority over options
set in the config files. To allow users to undo the enabling of debug
options in config files this patch also adds a check for COGL_NO_DEBUG
environment variable which will disable the specified options which may
have been enabled in config files.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg
2011-08-03 18:15:54 +01:00
parent 5012bcf1d1
commit 2ac4002084
7 changed files with 179 additions and 1 deletions

View File

@ -126,7 +126,7 @@ _cogl_parse_debug_string_for_keys (const char *value,
}
}
static void
void
_cogl_parse_debug_string (const char *value,
gboolean enable,
gboolean ignore_help)
@ -223,6 +223,15 @@ _cogl_debug_check_environment (void)
FALSE /* don't ignore help */);
env_string = NULL;
}
env_string = g_getenv ("COGL_NO_DEBUG");
if (env_string != NULL)
{
_cogl_parse_debug_string (env_string,
FALSE /* disable the flags */,
FALSE /* don't ignore help */);
env_string = NULL;
}
}
static gboolean