diff --git a/plugins/win-capture/game-capture.c b/plugins/win-capture/game-capture.c index 693aa2b51..248ead5b2 100644 --- a/plugins/win-capture/game-capture.c +++ b/plugins/win-capture/game-capture.c @@ -1899,7 +1899,7 @@ static bool use_scaling_callback(obs_properties_t *ppts, obs_property_t *p, return true; } -static void insert_preserved_val(obs_property_t *p, const char *val) +static void insert_preserved_val(obs_property_t *p, const char *val, size_t idx) { char *class = NULL; char *title = NULL; @@ -1909,8 +1909,8 @@ static void insert_preserved_val(obs_property_t *p, const char *val) build_window_strings(val, &class, &title, &executable); dstr_printf(&desc, "[%s]: %s", executable, title); - obs_property_list_insert_string(p, 1, desc.array, val); - obs_property_list_item_disable(p, 1, true); + obs_property_list_insert_string(p, idx, desc.array, val); + obs_property_list_item_disable(p, idx, true); dstr_free(&desc); bfree(class); @@ -1918,14 +1918,15 @@ static void insert_preserved_val(obs_property_t *p, const char *val) bfree(executable); } -static bool window_changed_callback(obs_properties_t *ppts, obs_property_t *p, - obs_data_t *settings) +bool check_window_property_setting(obs_properties_t *ppts, obs_property_t *p, + obs_data_t *settings, const char *val, + size_t idx) { const char *cur_val; bool match = false; size_t i = 0; - cur_val = obs_data_get_string(settings, SETTING_CAPTURE_WINDOW); + cur_val = obs_data_get_string(settings, val); if (!cur_val) { return false; } @@ -1942,7 +1943,7 @@ static bool window_changed_callback(obs_properties_t *ppts, obs_property_t *p, } if (cur_val && *cur_val && !match) { - insert_preserved_val(p, cur_val); + insert_preserved_val(p, cur_val, idx); return true; } @@ -1950,6 +1951,13 @@ static bool window_changed_callback(obs_properties_t *ppts, obs_property_t *p, return false; } +static bool window_changed_callback(obs_properties_t *ppts, obs_property_t *p, + obs_data_t *settings) +{ + return check_window_property_setting(ppts, p, settings, + SETTING_CAPTURE_WINDOW, 1); +} + static const double default_scale_vals[] = {1.25, 1.5, 2.0, 2.5, 3.0}; #define NUM_DEFAULT_SCALE_VALS \ diff --git a/plugins/win-capture/window-capture.c b/plugins/win-capture/window-capture.c index 8534016e9..c93bac210 100644 --- a/plugins/win-capture/window-capture.c +++ b/plugins/win-capture/window-capture.c @@ -286,6 +286,11 @@ static bool wc_capture_method_changed(obs_properties_t *props, return true; } +extern bool check_window_property_setting(obs_properties_t *ppts, + obs_property_t *p, + obs_data_t *settings, const char *val, + size_t idx); + static bool wc_window_changed(obs_properties_t *props, obs_property_t *p, obs_data_t *settings) { @@ -294,6 +299,7 @@ static bool wc_window_changed(obs_properties_t *props, obs_property_t *p, update_settings_visibility(props, wc->method); + check_window_property_setting(props, p, settings, "window", 0); return true; }