Correct window location saving to take window state into account (negative values)

Related to issue #157.
This commit is contained in:
Travis Nickles 2017-11-22 02:00:51 -06:00
parent 7909e57620
commit 76136c71a9
2 changed files with 13 additions and 4 deletions

View File

@ -2752,9 +2752,18 @@ namespace DS4Windows
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/Profile/formHeight"); Int32.TryParse(Item.InnerText, out formHeight); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/Profile/formLocationX"); Int32.TryParse(Item.InnerText, out formLocationX); }
try {
int temp = 0;
Item = m_Xdoc.SelectSingleNode("/Profile/formLocationX"); Int32.TryParse(Item.InnerText, out temp);
formLocationX = Math.Max(temp, 0);
}
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/Profile/formLocationY"); Int32.TryParse(Item.InnerText, out formLocationY); }
try {
int temp = 0;
Item = m_Xdoc.SelectSingleNode("/Profile/formLocationY"); Int32.TryParse(Item.InnerText, out temp);
formLocationY = Math.Max(temp, 0);
}
catch { missingSetting = true; }
try {

View File

@ -2179,8 +2179,8 @@ namespace DS4Windows
FormHeight = oldsize.Height;
}
FormLocationX = Location.X;
FormLocationY = Location.Y;
FormLocationX = Location.X > 0 ? Location.X : 0;
FormLocationY = Location.Y > 0 ? Location.Y : 0;
if (!string.IsNullOrEmpty(appdatapath))
{