'Hide Preview if active window is not EVE client' makes thumbnail blink after switching to a EVE client

This commit is contained in:
Anton Kasyanov
2016-06-05 14:38:35 +03:00
parent 2f53da928b
commit e5b8023190

View File

@@ -96,7 +96,7 @@ namespace EveOPreview.UI
public void RefreshThumbnails() public void RefreshThumbnails()
{ {
IntPtr foregroundWindowHandle = DwmApiNativeMethods.GetForegroundWindow(); IntPtr foregroundWindowHandle = DwmApiNativeMethods.GetForegroundWindow();
Boolean hideAllThumbnails = (this._configuration.HideThumbnailsOnLostFocus && !this.IsClientWindowActive(foregroundWindowHandle)) || !DwmApiNativeMethods.DwmIsCompositionEnabled(); Boolean hideAllThumbnails = (this._configuration.HideThumbnailsOnLostFocus && this.IsNonClientWindowActive(foregroundWindowHandle)) || !DwmApiNativeMethods.DwmIsCompositionEnabled();
this.DisableViewEvents(); this.DisableViewEvents();
@@ -354,17 +354,25 @@ namespace EveOPreview.UI
view.Refresh(); view.Refresh();
} }
private bool IsClientWindowActive(IntPtr windowHandle) private bool IsNonClientWindowActive(IntPtr windowHandle)
{ {
foreach (KeyValuePair<IntPtr, IThumbnailView> entry in _thumbnailViews) // We just don't know ATM
if (windowHandle == IntPtr.Zero)
{ {
if (entry.Value.IsKnownHandle(windowHandle)) return false;
}
foreach (KeyValuePair<IntPtr, IThumbnailView> entry in this._thumbnailViews)
{ {
return true; IThumbnailView view = entry.Value;
if (view.IsKnownHandle(windowHandle))
{
return false;
} }
} }
return false; return true;
} }
private void ThumbnailZoomIn(IThumbnailView view) private void ThumbnailZoomIn(IThumbnailView view)