Skip to content

Commit

Permalink
fix blank window bug #40
Browse files Browse the repository at this point in the history
  • Loading branch information
hecomi committed Oct 16, 2021
1 parent 5e5b334 commit 268882a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Assets/uWindowCapture/Examples/Window List/UwcWindowList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ void OnWindowAdded(UwcWindow window)

window.RequestCaptureIcon();
window.RequestCapture(CapturePriority.Low);

listItem.OnClick();
}

void OnWindowRemoved(UwcWindow window)
{
UwcWindowListItem listItem;
items_.TryGetValue(window.id, out listItem);
if (listItem) {
listItem.RemoveWindow();
Destroy(listItem.gameObject);
}
}
Expand Down
23 changes: 17 additions & 6 deletions Assets/uWindowCapture/Examples/Window List/UwcWindowListItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,27 @@ void Update()

public void OnClick()
{
var manager = list.windowTextureManager;
if (windowTexture == null) {
windowTexture = manager.AddWindowTexture(window);
image_.color = selected;
AddWindow();
} else {
manager.RemoveWindowTexture(window);
windowTexture = null;
image_.color = notSelected;
RemoveWindow();
}
}

void AddWindow()
{
var manager = list.windowTextureManager;
windowTexture = manager.AddWindowTexture(window);
image_.color = selected;
}

public void RemoveWindow()
{
var manager = list.windowTextureManager;
manager.RemoveWindowTexture(window);
windowTexture = null;
image_.color = notSelected;
}
}

}

0 comments on commit 268882a

Please sign in to comment.