mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
Clamps window size and position (#25267)
Adds a floor value for size (320x240) and position (0x0)
This commit is contained in:
@@ -62,7 +62,12 @@ namespace RegistryPreview
|
|||||||
SizeInt32 size;
|
SizeInt32 size;
|
||||||
size.Width = (int)jsonSettings.GetNamedNumber("appWindow.Size.Width");
|
size.Width = (int)jsonSettings.GetNamedNumber("appWindow.Size.Width");
|
||||||
size.Height = (int)jsonSettings.GetNamedNumber("appWindow.Size.Height");
|
size.Height = (int)jsonSettings.GetNamedNumber("appWindow.Size.Height");
|
||||||
appWindow.Resize(size);
|
|
||||||
|
// check to make sure the size values are reasonable before attempting to restore the last saved size
|
||||||
|
if (size.Width >= 320 && size.Height >= 240)
|
||||||
|
{
|
||||||
|
appWindow.Resize(size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reposition the window
|
// reposition the window
|
||||||
@@ -71,7 +76,12 @@ namespace RegistryPreview
|
|||||||
PointInt32 point;
|
PointInt32 point;
|
||||||
point.X = (int)jsonSettings.GetNamedNumber("appWindow.Position.X");
|
point.X = (int)jsonSettings.GetNamedNumber("appWindow.Position.X");
|
||||||
point.Y = (int)jsonSettings.GetNamedNumber("appWindow.Position.Y");
|
point.Y = (int)jsonSettings.GetNamedNumber("appWindow.Position.Y");
|
||||||
appWindow.Move(point);
|
|
||||||
|
// check to make sure the move values are reasonable before attempting to restore the last saved location
|
||||||
|
if (point.X >= 0 && point.Y >= 0)
|
||||||
|
{
|
||||||
|
appWindow.Move(point);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user