0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

win-capture: Unhook from hidden windows

Currently when a window-capture hooks into a window if the window then
becomes hidden it won't unhook. This means we don't recieve an unhooked
signal even though the window is unreachable by the user.

The behaviour for IsIconic makes sense to stay hooked because it is
still easily accessible by the user.

A common example of an app doing this is Steam, closing steam's main
window actually just hides the window rather than destroying it. This
then means we don't get an unhooked signal when closing the steam window.
This commit is contained in:
Tom Haffenden 2024-04-04 19:40:55 +01:00
parent 206af52467
commit 4cb1514035

View File

@ -635,7 +635,8 @@ static void wc_tick(void *data, float seconds)
if (!obs_source_showing(wc->source))
return;
if (!wc->window || !IsWindow(wc->window)) {
if (!wc->window || !IsWindow(wc->window) ||
!IsWindowVisible(wc->window)) {
if (wc->hooked) {
wc->hooked = false;
@ -686,7 +687,7 @@ static void wc_tick(void *data, float seconds)
wc->previously_failed = false;
reset_capture = true;
} else if (IsIconic(wc->window) || !IsWindowVisible(wc->window)) {
} else if (IsIconic(wc->window)) {
return; /* If HWND is invisible, WGC module can't be initialized successfully */
}