Sfoglia il codice sorgente

win-capture: Fix window capture capturing random windows

This is due to the property view widget not having an item to select, so
it selects the first one, but we want to have specific text for this
anyway, so changing it here is still appropriate. (I don't want to touch
the properties view widget right now for the sake of my sanity)
Lain 1 anno fa
parent
commit
e9c8e10729

+ 1 - 0
plugins/win-capture/data/locale/en-US.ini

@@ -42,6 +42,7 @@ Mode="Mode"
 CaptureAudio="Capture Audio (BETA)"
 CaptureAudio.TT="When enabled, creates an \"Application Audio Capture\" source that automatically updates to the currently captured window/application.\nNote that if Desktop Audio is configured, this could result in doubled audio."
 AudioSuffix="Audio"
+SelectAWindow="[Select a window to capture]"
 
 # Generic compatibility messages
 Compatibility.GameCapture.Admin="%name% may require OBS to be run as admin to use Game Capture."

+ 9 - 0
plugins/win-capture/window-capture.c

@@ -567,6 +567,15 @@ static obs_properties_t *wc_properties(void *data)
 	p = obs_properties_add_list(ppts, "window", TEXT_WINDOW,
 				    OBS_COMBO_TYPE_LIST,
 				    OBS_COMBO_FORMAT_STRING);
+
+	/* Add "[Select a window]" on first use to prevent the properties list
+	 * widget from selecting the first one in the list automatically */
+	if (wc && (!wc->title || !wc->class || !wc->executable)) {
+		obs_property_list_add_string(
+			p, obs_module_text("SelectAWindow"), "");
+		obs_property_list_item_disable(p, 0, true);
+	}
+
 	ms_fill_window_list(p, EXCLUDE_MINIMIZED, NULL);
 	obs_property_set_modified_callback(p, wc_window_changed);