[RFC] Use object properties to configure platform implementations#363
Draft
[RFC] Use object properties to configure platform implementations#363
Conversation
904da7c to
524f64f
Compare
This was referenced Jan 17, 2023
|
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
TingPing
reviewed
Feb 14, 2025
| 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); |
Member
There was a problem hiding this comment.
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.
Member
There was a problem hiding this comment.
I guess they key also needs to be validated, at least for newlines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
CogPlatformsubclass 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.