Fix -32000 bug when saving and loading window position

This commit is contained in:
adelikat 2014-06-29 15:04:20 +00:00
parent 27fb2ce9a0
commit edee19e11d
1 changed files with 41 additions and 3 deletions

View File

@ -5,14 +5,51 @@ namespace BizHawk.Client.Common
{
public class ToolDialogSettings
{
private int? _wndx = null;
private int? _wndy = null;
public ToolDialogSettings()
{
SaveWindowPosition = true;
FloatingWindow = true;
}
public int? Wndx { get; set; }
public int? Wndy { get; set; }
[JsonIgnore]
public int? Wndx
{
get { return _wndx; }
set
{
if (value == -32000)
{
_wndx = null;
}
else
{
_wndx = value;
}
}
}
[JsonIgnore]
public int? Wndy
{
get { return _wndy; }
set
{
if (value == -32000)
{
_wndy = null;
}
else
{
_wndy = value;
}
}
}
public int? Width { get; set; }
public int? Height { get; set; }
@ -25,7 +62,8 @@ namespace BizHawk.Client.Common
{
get
{
return SaveWindowPosition && Wndx.HasValue && Wndy.HasValue;
return SaveWindowPosition && Wndx.HasValue && Wndy.HasValue
&& Wndx != -32000 && Wndy != -32000; // Windows OS annoyance, this is saved if the tool was minimized when closing
}
}