1
0
mirror of synced 2024-11-28 08:00:50 +01:00
WACVR/Assets/uWindowCapture/Runtime/UwcAltTabWindowTextureManager.cs
2022-05-16 23:38:40 +02:00

33 lines
780 B
C#

using UnityEngine;
namespace uWindowCapture
{
public class UwcAltTabWindowTextureManager : UwcWindowTextureManager
{
void Start()
{
UwcManager.onWindowAdded.AddListener(OnWindowAdded);
UwcManager.onWindowRemoved.AddListener(OnWindowRemoved);
foreach (var pair in UwcManager.windows) {
OnWindowAdded(pair.Value);
}
}
void OnWindowAdded(UwcWindow window)
{
if (window.parentWindow != null) return; // handled by UwcWindowTextureChildrenManager
if (!window.isVisible || !window.isAltTabWindow || window.isBackground) return;
window.RequestCapture();
AddWindowTexture(window);
}
void OnWindowRemoved(UwcWindow window)
{
RemoveWindowTexture(window);
}
}
}