Browse Source

linux-capture: Add xcomp func for comparing encoded window IDs

This is cursed. Window ID storage for xcomposite capture is absolutely
cursed. It should not be storing the window handle with this. I'm pretty
sure that whoever wrote it at the time decided to store the god-forsaken
window handle (which does not persist after the window closes) as part
of the ID because they were afraid it might capture the wrong window if
they close OBS and open it up again while the window still exists.

Again, xcomposite capture is absolutely cursed.
Lain 1 year ago
parent
commit
c36575774b
1 changed files with 11 additions and 0 deletions
  1. 11 0
      plugins/linux-capture/xcomposite-input.c

+ 11 - 0
plugins/linux-capture/xcomposite-input.c

@@ -772,6 +772,17 @@ static int cmp_wi(const void *a, const void *b)
 	return strcmp(a_name, b_name);
 }
 
+static inline bool compare_ids(const char *id1, const char *id2)
+{
+	if (!id1 || !id2)
+		return false;
+
+	id1 = strstr(id1, "\r\n");
+	id2 = strstr(id2, "\r\n");
+
+	return id1 && id2 && strcmp(id1, id2) == 0;
+}
+
 static obs_properties_t *xcompcap_props(void *unused)
 {
 	UNUSED_PARAMETER(unused);