Minimizing and then restoring EVE window makes its thumbnail tiny
This commit is contained in:
@@ -85,7 +85,7 @@ namespace EveOPreview.UI
|
|||||||
foreach (KeyValuePair<IntPtr, IThumbnailView> entry in this._thumbnailViews)
|
foreach (KeyValuePair<IntPtr, IThumbnailView> entry in this._thumbnailViews)
|
||||||
{
|
{
|
||||||
entry.Value.Size = size;
|
entry.Value.Size = size;
|
||||||
entry.Value.Refresh();
|
entry.Value.Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ThumbnailSizeChanged?.Invoke(size);
|
this.ThumbnailSizeChanged?.Invoke(size);
|
||||||
@@ -139,7 +139,7 @@ namespace EveOPreview.UI
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
view.Refresh();
|
view.Refresh(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,9 +322,15 @@ namespace EveOPreview.UI
|
|||||||
DwmApiNativeMethods.SetForegroundWindow(id);
|
DwmApiNativeMethods.SetForegroundWindow(id);
|
||||||
|
|
||||||
int style = DwmApiNativeMethods.GetWindowLong(id, DwmApiNativeMethods.GWL_STYLE);
|
int style = DwmApiNativeMethods.GetWindowLong(id, DwmApiNativeMethods.GWL_STYLE);
|
||||||
|
// If the window was minimized then its thumbnail should be reset
|
||||||
if ((style & DwmApiNativeMethods.WS_MINIMIZE) == DwmApiNativeMethods.WS_MINIMIZE)
|
if ((style & DwmApiNativeMethods.WS_MINIMIZE) == DwmApiNativeMethods.WS_MINIMIZE)
|
||||||
{
|
{
|
||||||
DwmApiNativeMethods.ShowWindowAsync(id, DwmApiNativeMethods.SW_SHOWNORMAL);
|
DwmApiNativeMethods.ShowWindowAsync(id, DwmApiNativeMethods.SW_SHOWNORMAL);
|
||||||
|
IThumbnailView view;
|
||||||
|
if (this._thumbnailViews.TryGetValue(id, out view))
|
||||||
|
{
|
||||||
|
view.Refresh(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._configuration.EnableClientLayoutTracking)
|
if (this._configuration.EnableClientLayoutTracking)
|
||||||
@@ -348,7 +354,7 @@ namespace EveOPreview.UI
|
|||||||
|
|
||||||
this.SetThumbnailsSize(view.Size);
|
this.SetThumbnailsSize(view.Size);
|
||||||
|
|
||||||
view.Refresh();
|
view.Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThumbnailViewMoved(IntPtr id)
|
private void ThumbnailViewMoved(IntPtr id)
|
||||||
@@ -362,7 +368,7 @@ namespace EveOPreview.UI
|
|||||||
|
|
||||||
this._configuration.SetThumbnailLocation(view.Title, this._activeClientTitle, view.Location);
|
this._configuration.SetThumbnailLocation(view.Title, this._activeClientTitle, view.Location);
|
||||||
|
|
||||||
view.Refresh();
|
view.Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsNonClientWindowActive(IntPtr windowHandle)
|
private bool IsNonClientWindowActive(IntPtr windowHandle)
|
||||||
@@ -391,7 +397,7 @@ namespace EveOPreview.UI
|
|||||||
this.DisableViewEvents();
|
this.DisableViewEvents();
|
||||||
|
|
||||||
view.ZoomIn(ViewZoomAnchorConverter.Convert(this._configuration.ThumbnailZoomAnchor), this._configuration.ThumbnailZoomFactor);
|
view.ZoomIn(ViewZoomAnchorConverter.Convert(this._configuration.ThumbnailZoomAnchor), this._configuration.ThumbnailZoomFactor);
|
||||||
view.Refresh();
|
view.Refresh(false);
|
||||||
|
|
||||||
this.EnableViewEvents();
|
this.EnableViewEvents();
|
||||||
}
|
}
|
||||||
@@ -401,7 +407,7 @@ namespace EveOPreview.UI
|
|||||||
this.DisableViewEvents();
|
this.DisableViewEvents();
|
||||||
|
|
||||||
view.ZoomOut();
|
view.ZoomOut();
|
||||||
view.Refresh();
|
view.Refresh(false);
|
||||||
|
|
||||||
this.EnableViewEvents();
|
this.EnableViewEvents();
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@ namespace EveOPreview
|
|||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(true);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
// TODO Switch to another container that provides signed assemblies
|
// TODO Switch to another container that provides signed assemblies
|
||||||
IIocContainer container = new LightInjectContainer();
|
IIocContainer container = new LightInjectContainer();
|
||||||
@@ -31,7 +31,7 @@ namespace EveOPreview
|
|||||||
.RegisterService<IConfigurationStorage, ConfigurationStorage>()
|
.RegisterService<IConfigurationStorage, ConfigurationStorage>()
|
||||||
.RegisterInstance<IApplicationConfiguration>(new ApplicationConfiguration());
|
.RegisterInstance<IApplicationConfiguration>(new ApplicationConfiguration());
|
||||||
|
|
||||||
controller.Run<EveOPreview.UI.MainPresenter>();
|
controller.Run<MainPresenter>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -114,7 +114,7 @@ namespace EveOPreview.UI
|
|||||||
{
|
{
|
||||||
this.IsActive = false;
|
this.IsActive = false;
|
||||||
|
|
||||||
this.UnregisterThumbnail();
|
this.UnregisterThumbnail(this._thumbnailHandle);
|
||||||
|
|
||||||
this._overlay.Close();
|
this._overlay.Close();
|
||||||
base.Close();
|
base.Close();
|
||||||
@@ -215,15 +215,18 @@ namespace EveOPreview.UI
|
|||||||
this.Location = this._baseLocation;
|
this.Location = this._baseLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public new void Refresh()
|
public void Refresh(bool forceRefresh)
|
||||||
{
|
{
|
||||||
if (this._isThumbnailSetUp == false)
|
// To prevent flickering the old broken thumbnail is removed AFTER the new shiny one is created
|
||||||
|
IntPtr obsoleteThumbnailHanlde = forceRefresh ? this._thumbnailHandle : IntPtr.Zero;
|
||||||
|
|
||||||
|
if ((this._isThumbnailSetUp == false) || forceRefresh)
|
||||||
{
|
{
|
||||||
this.RegisterThumbnail();
|
this.RegisterThumbnail();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sizeChanged = this._isSizeChanged;
|
bool sizeChanged = this._isSizeChanged || forceRefresh;
|
||||||
bool locationChanged = this._isPositionChanged;
|
bool locationChanged = this._isPositionChanged || forceRefresh;
|
||||||
|
|
||||||
if (sizeChanged)
|
if (sizeChanged)
|
||||||
{
|
{
|
||||||
@@ -239,6 +242,11 @@ namespace EveOPreview.UI
|
|||||||
this._isSizeChanged = false;
|
this._isSizeChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (obsoleteThumbnailHanlde != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
this.UnregisterThumbnail(obsoleteThumbnailHanlde);
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.IsOverlayEnabled)
|
if (!this.IsOverlayEnabled)
|
||||||
{
|
{
|
||||||
if (this._isOverlayVisible)
|
if (this._isOverlayVisible)
|
||||||
@@ -320,10 +328,12 @@ namespace EveOPreview.UI
|
|||||||
// // do smth cool?
|
// // do smth cool?
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//if (e.Button == MouseButtons.Middle)
|
if (e.Button == MouseButtons.Middle)
|
||||||
//{
|
{
|
||||||
// // do smth cool?
|
//// Trigger full thumbnail refresh
|
||||||
//}
|
//this.UnregisterThumbnail();
|
||||||
|
//this.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -343,11 +353,14 @@ namespace EveOPreview.UI
|
|||||||
this._isThumbnailSetUp = true;
|
this._isThumbnailSetUp = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UnregisterThumbnail()
|
private void UnregisterThumbnail(IntPtr thumbnailHandle)
|
||||||
{
|
{
|
||||||
if (this._thumbnailHandle != IntPtr.Zero)
|
try
|
||||||
|
{
|
||||||
|
DwmApiNativeMethods.DwmUnregisterThumbnail(thumbnailHandle);
|
||||||
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
{
|
{
|
||||||
DwmApiNativeMethods.DwmUnregisterThumbnail(this._thumbnailHandle);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@ namespace EveOPreview.UI
|
|||||||
void ZoomIn(ViewZoomAnchor anchor, int zoomFactor);
|
void ZoomIn(ViewZoomAnchor anchor, int zoomFactor);
|
||||||
void ZoomOut();
|
void ZoomOut();
|
||||||
|
|
||||||
void Refresh();
|
void Refresh(bool forceRefresh);
|
||||||
|
|
||||||
Action<IntPtr> ThumbnailResized { get; set; }
|
Action<IntPtr> ThumbnailResized { get; set; }
|
||||||
Action<IntPtr> ThumbnailMoved { get; set; }
|
Action<IntPtr> ThumbnailMoved { get; set; }
|
||||||
|
Reference in New Issue
Block a user