From 2fbd54958d0074aae5e17fb1aa009ff91294ddba Mon Sep 17 00:00:00 2001 From: gxalpha Date: Fri, 28 Apr 2023 13:33:18 +0200 Subject: [PATCH] UI: Only defer property updates for input and transition sources Deferring properties was only ever made for input and transition sources. As other property dialogs do not have an "Ok" button that would cause an update to happen, if the deferred flag was set the callback would never be called. Also clarifies the docs to reflect this. --- UI/properties-view.cpp | 22 ++++++++++++++++++---- docs/sphinx/reference-properties.rst | 4 +++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/UI/properties-view.cpp b/UI/properties-view.cpp index b69f31023..f82680426 100644 --- a/UI/properties-view.cpp +++ b/UI/properties-view.cpp @@ -88,19 +88,33 @@ Q_DECLARE_METATYPE(media_frames_per_second); void OBSPropertiesView::ReloadProperties() { + deferUpdate = false; if (weakObj || rawObj) { OBSObject strongObj = GetObject(); void *obj = strongObj ? strongObj.Get() : rawObj; - if (obj) + if (obj) { properties.reset(reloadCallback(obj)); + + if (obs_obj_get_type(obj) == OBS_OBJ_TYPE_SOURCE) { + enum obs_source_type type = obs_source_get_type( + (obs_source_t *)obj); + if (type == OBS_SOURCE_TYPE_INPUT || + type == OBS_SOURCE_TYPE_TRANSITION) { + uint32_t flags = + obs_properties_get_flags( + properties.get()); + deferUpdate = + (flags & + OBS_PROPERTIES_DEFER_UPDATE) != + 0; + } + } + } } else { properties.reset(reloadCallback((void *)type.c_str())); obs_properties_apply_settings(properties.get(), settings); } - uint32_t flags = obs_properties_get_flags(properties.get()); - deferUpdate = (flags & OBS_PROPERTIES_DEFER_UPDATE) != 0; - RefreshProperties(); } diff --git a/docs/sphinx/reference-properties.rst b/docs/sphinx/reference-properties.rst index fc3c3e43c..19a6d1d74 100644 --- a/docs/sphinx/reference-properties.rst +++ b/docs/sphinx/reference-properties.rst @@ -51,7 +51,9 @@ General Functions - OBS_PROPERTIES_DEFER_UPDATE - A hint that tells the front-end to defers updating the settings until the user has finished editing all properties rather than - immediately updating any settings + immediately updating any settings. Currently only + works for properties of input and transition sources, + this flag is a no-op for other properties at this time. ---------------------