ソースを参照

linux-capture: Fixup window name/class checking

There were a couple mistakes here that caused the fallback checks other
than window ID to fail to ever return valid results. This restores this
functionality that was broken since the c++/c transition.

fixes #7404
Kurt Kartaltepe 3 年 前
コミット
1249ebe53d
1 ファイル変更5 行追加6 行削除
  1. 5 6
      plugins/linux-capture/xcomposite-input.c

+ 5 - 6
plugins/linux-capture/xcomposite-input.c

@@ -310,11 +310,10 @@ xcb_window_t xcomp_find_window(xcb_connection_t *conn, Display *disp,
 	char *wcls = bzalloc(strEnd - thirdStr + 1);
 	memcpy(wname, secondStr, secondMark - secondStr);
 	memcpy(wcls, thirdStr, strEnd - thirdStr);
-	xcb_window_t wid = (xcb_window_t)strtol(str, NULL, 10);
+	ret = (xcb_window_t)strtol(str, NULL, 10);
 
 	// first try to find a match by the window-id
-	if (da_find(tlw, &wid, 0) != DARRAY_INVALID) {
-		ret = wid;
+	if (da_find(tlw, &ret, 0) != DARRAY_INVALID) {
 		goto cleanup2;
 	}
 
@@ -325,8 +324,8 @@ xcb_window_t xcomp_find_window(xcb_connection_t *conn, Display *disp,
 
 		struct dstr cwname = xcomp_window_name(conn, disp, cwin);
 		struct dstr cwcls = xcomp_window_class(conn, cwin);
-		bool found = (strcmp(wname, cwname.array) == 0 &&
-			      strcmp(wcls, cwcls.array));
+		bool found = strcmp(wname, cwname.array) == 0 &&
+			     strcmp(wcls, cwcls.array) == 0;
 
 		dstr_free(&cwname);
 		dstr_free(&cwcls);
@@ -345,7 +344,7 @@ cleanup2:
 	bfree(wcls);
 cleanup1:
 	da_free(tlw);
-	return wid;
+	return ret;
 }
 
 void xcomp_cleanup_pixmap(Display *disp, struct xcompcap *s)