-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Use object properties to configure platform implementations #363
base: master
Are you sure you want to change the base?
Conversation
904da7c
to
524f64f
Compare
From a purely user perspective, this sounds very desirable (e.g. for our WPE snap package). |
524f64f
to
a3fd502
Compare
92e8c4e
to
10b5bbd
Compare
e62433e
to
e027ced
Compare
e027ced
to
ca60557
Compare
ca60557
to
df2ee42
Compare
df2ee42
to
126a761
Compare
126a761
to
7c8d26d
Compare
Add a new cog_apply_properties_from_key_file() function which iterates over writable properties of an object and sets their values from the items of a GKeyFile group with the same names as the properties. The goal is to use this to ease picking configuration options for the different platform modules--as long as they define their settings as properties of some object.
Turn the settings for atomic mode setting and the device scale factor into properties of the CogDrmPlatform class. This allows using cog_apply_properties_from_key_file() to automatically apply the settings from the configuration file. In the future it may be possible to also pass properties when creating an object with cog_platform_new(), and/or via the "params" argument of cog_platform_setup(), and always using the same mechanism (object properties) regardless of where the values come from.
Move the routine from the DRM plugin used to parse a comma-separated key=value set of parameters into cog_key_file_parse_params_string() which sets values into a GKeyFile. This allows building up the final set of options into the configuration object held by CogShell, then using that as canonical source for reading options.
7c8d26d
to
d3c9bc4
Compare
const char *k = g_strstrip(kv[0]); | ||
const char *v = g_strstrip(kv[1]); | ||
|
||
g_key_file_set_value(key_file, group_name, k, v); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
params_string
can contain invalid characters, g_key_file_set_string()
escapes them, g_key_file_set_value()
does not.
You use g_key_file_get_string()
below which unescapes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess they key also needs to be validated, at least for newlines.
This is an initial RFC to steer towards improving how platform modules are configured. The main idea is to turn options into properties of the
CogPlatform
subclass implemented by the platform module.The information about object properties/settings can then be inspected e.g. at run time and used in different ways:
cog_platform_new_with_options()
function.…and probably others.