mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-29 02:03:03 +08:00
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
This commit is contained in:
committed by
Georges Basile Stavracas Neto
parent
c5f1446ab3
commit
1249ebe53d
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user