Odd coordinates like (-32000, -32000) are saved as EVE Online main window position
This commit is contained in:
@@ -10,6 +10,9 @@ namespace EveOPreview.UI
|
|||||||
public class ThumbnailManager : IThumbnailManager
|
public class ThumbnailManager : IThumbnailManager
|
||||||
{
|
{
|
||||||
#region Private constants
|
#region Private constants
|
||||||
|
private const int WindowPositionThreshold = -5000;
|
||||||
|
private const int WindowSizeThreshold = -5000;
|
||||||
|
|
||||||
private const string ClientProcessName = "ExeFile";
|
private const string ClientProcessName = "ExeFile";
|
||||||
private const string DefaultClientTitle = "EVE";
|
private const string DefaultClientTitle = "EVE";
|
||||||
#endregion
|
#endregion
|
||||||
@@ -473,13 +476,13 @@ namespace EveOPreview.UI
|
|||||||
RECT rect;
|
RECT rect;
|
||||||
WindowManagerNativeMethods.GetWindowRect(process.MainWindowHandle, out rect);
|
WindowManagerNativeMethods.GetWindowRect(process.MainWindowHandle, out rect);
|
||||||
|
|
||||||
int left = Math.Abs(rect.Left);
|
int clientWidth = Math.Abs(rect.Right - rect.Left);
|
||||||
int right = Math.Abs(rect.Right);
|
int clientHeight = Math.Abs(rect.Bottom - rect.Top);
|
||||||
int clientWidth = Math.Abs(left - right);
|
|
||||||
|
|
||||||
int top = Math.Abs(rect.Top);
|
if (!this.IsManageableWindow(rect.Left, rect.Top, clientWidth, clientHeight))
|
||||||
int bottom = Math.Abs(rect.Bottom);
|
{
|
||||||
int clientHeight = Math.Abs(top - bottom);
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ClientLayout clientLayout = new ClientLayout();
|
ClientLayout clientLayout = new ClientLayout();
|
||||||
clientLayout.X = rect.Left;
|
clientLayout.X = rect.Left;
|
||||||
@@ -496,5 +499,16 @@ namespace EveOPreview.UI
|
|||||||
{
|
{
|
||||||
return view.Title != ThumbnailManager.DefaultClientTitle;
|
return view.Title != ThumbnailManager.DefaultClientTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Quick sanity check
|
||||||
|
// EVE Online client can create a window on a really weird position outside of the screen for some reason
|
||||||
|
// In this case we need to just skip such clients
|
||||||
|
private bool IsManageableWindow(int letf, int top, int width, int height)
|
||||||
|
{
|
||||||
|
return (letf >= ThumbnailManager.WindowPositionThreshold)
|
||||||
|
&& (top >= ThumbnailManager.WindowPositionThreshold)
|
||||||
|
&& (width >= ThumbnailManager.WindowSizeThreshold)
|
||||||
|
&& (height >= ThumbnailManager.WindowSizeThreshold);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user