libobs: Fix apply_settings & remove_by_name for groups
'obs_properties_apply_settings' and 'obs_properties_remove_by_name' would incorrectly ignore property groups and not call the callbacks or remove the property, resulting in quite glitchy UI. This fix works by splitting the internal logic of ...apply_settings into an extra function to call, while keeping the API the same. The change to ...remove_by_name is to simply recursively going into the group content with the same function call.
This commit is contained in:
parent
ae83c857d7
commit
a1cc453996
@ -336,27 +336,44 @@ void obs_properties_remove_by_name(obs_properties_t *props, const char *name)
|
||||
break;
|
||||
}
|
||||
|
||||
if (cur->type == OBS_PROPERTY_GROUP) {
|
||||
obs_properties_remove_by_name(
|
||||
obs_property_group_content(cur), name);
|
||||
}
|
||||
|
||||
prev = cur;
|
||||
cur = cur->next;
|
||||
}
|
||||
}
|
||||
|
||||
void obs_properties_apply_settings_internal(obs_properties_t *props,
|
||||
obs_data_t *settings,
|
||||
obs_properties_t *realprops)
|
||||
{
|
||||
struct obs_property *p;
|
||||
|
||||
p = props->first_property;
|
||||
while (p) {
|
||||
if (p->type == OBS_PROPERTY_GROUP) {
|
||||
obs_properties_apply_settings_internal(
|
||||
obs_property_group_content(p), settings,
|
||||
realprops);
|
||||
}
|
||||
if (p->modified)
|
||||
p->modified(realprops, p, settings);
|
||||
else if (p->modified2)
|
||||
p->modified2(p->priv, realprops, p, settings);
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
|
||||
void obs_properties_apply_settings(obs_properties_t *props,
|
||||
obs_data_t *settings)
|
||||
{
|
||||
struct obs_property *p;
|
||||
|
||||
if (!props)
|
||||
return;
|
||||
|
||||
p = props->first_property;
|
||||
while (p) {
|
||||
if (p->modified)
|
||||
p->modified(props, p, settings);
|
||||
else if (p->modified2)
|
||||
p->modified2(p->priv, props, p, settings);
|
||||
p = p->next;
|
||||
}
|
||||
obs_properties_apply_settings_internal(props, settings, props);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
Loading…
x
Reference in New Issue
Block a user