From edee19e11d5f8330ca30b76fd4a53109c62f018e Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 29 Jun 2014 15:04:20 +0000 Subject: [PATCH] Fix -32000 bug when saving and loading window position --- .../config/ToolDialogSettings.cs | 44 +++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/BizHawk.Client.Common/config/ToolDialogSettings.cs b/BizHawk.Client.Common/config/ToolDialogSettings.cs index 16bc38a042..549791bca9 100644 --- a/BizHawk.Client.Common/config/ToolDialogSettings.cs +++ b/BizHawk.Client.Common/config/ToolDialogSettings.cs @@ -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 } }