Some more changes for BUG-2017, this simplified some of the code and adds different logic for Windows 10 apps.

This commit is contained in:
Robin 2016-09-04 22:23:42 +02:00
commit c0d18c952c
3 changed files with 43 additions and 34 deletions

View file

@ -461,9 +461,11 @@ namespace Greenshot.Helpers {
return null;
}
Thread getWindowDetailsThread = new Thread(RetrieveWindowDetails);
getWindowDetailsThread.Name = "Retrieve window details";
getWindowDetailsThread.IsBackground = true;
Thread getWindowDetailsThread = new Thread(RetrieveWindowDetails)
{
Name = "Retrieve window details",
IsBackground = true
};
getWindowDetailsThread.Start();
return getWindowDetailsThread;
}
@ -471,21 +473,7 @@ namespace Greenshot.Helpers {
private void RetrieveWindowDetails() {
LOG.Debug("start RetrieveWindowDetails");
// Start Enumeration of "active" windows
List<WindowDetails> allWindows = new List<WindowDetails>(WindowDetails.GetMetroApps());
allWindows.AddRange(WindowDetails.GetAllWindows());
foreach (WindowDetails window in allWindows) {
// Window should be visible and not ourselves
if (!window.Visible) {
continue;
}
// Skip empty
Rectangle windowRectangle = window.WindowRectangle;
Size windowSize = windowRectangle.Size;
if (windowSize.Width == 0 || windowSize.Height == 0) {
continue;
}
foreach (var window in WindowDetails.GetVisibleWindows()) {
// Make sure the details are retrieved once
window.FreezeDetails();