Fix multiple windows interfering

This commit is contained in:
glax 2024-04-16 05:00:52 +02:00
parent 3f0c0bf7b8
commit 5f4af37c34

View File

@ -30,14 +30,14 @@ public class Blur
windowManager.WindowZOrderChanged += WindowManagerOnWindowZOrderChanged;
}
private void UpdateBlurs(WindowInfo[]? windowInfos = null, IntPtr[]? zOrder = null)
private void UpdateBlurs()
{
if (!enabledScenes.Contains(currentScene))
return;
if (!_websocket.IsConnected)
return;
windowInfos ??= windowManager.WindowInfos;
zOrder ??= windowManager.WindowZOrder;
WindowInfo[] windowInfos = windowManager.WindowInfos;
IntPtr[] zOrder = windowManager.WindowZOrder;
bool maximixedWindowReached = false;
@ -58,7 +58,7 @@ public class Blur
}
foreach(IntPtr blurredWindow in windowHandleSceneItems.Keys.ToArray())
if(!windowInfos.Any(w => w.WindowHandle == blurredWindow))
if(windowInfos.All(w => w.WindowHandle != blurredWindow))
DeleteBlur(blurredWindow);
}
@ -184,7 +184,7 @@ public class Blur
Console.WriteLine($"Z-order changed {DateTime.UtcNow:O}");
Console.WriteLine($"{"Z",3} | {"hWnd",8} | {"PID",8} | {"Name",17} | {"Window Title",-17} | {"Vis",-8} | {"State",-13} | Rectangle");
Console.WriteLine(prnt);
UpdateBlurs(zOrder: neworder);
UpdateBlurs();
}
private void WindowManagerOnWindowsChanged(WindowInfo[] before, WindowInfo[] after)
@ -194,7 +194,7 @@ public class Blur
prnt += $"{windowInfo}\n";
Console.WriteLine($"Windows changed {DateTime.UtcNow:O}");
Console.WriteLine(prnt);
UpdateBlurs(windowInfos: after);
UpdateBlurs();
}
private void WebsocketOnDisconnected(object? sender, ObsDisconnectionInfo e)