mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge a8e755e561 into 8d042d2134
This commit is contained in:
commit
bff8f77e81
1 changed files with 11 additions and 15 deletions
|
|
@ -179,8 +179,8 @@ public partial class SettingWindow
|
|||
// Ensure window does not exceed screen boundaries
|
||||
top = Math.Max(top, SystemParameters.VirtualScreenTop);
|
||||
left = Math.Max(left, SystemParameters.VirtualScreenLeft);
|
||||
top = Math.Min(top, SystemParameters.VirtualScreenHeight - ActualHeight);
|
||||
left = Math.Min(left, SystemParameters.VirtualScreenWidth - ActualWidth);
|
||||
top = Math.Min(top, SystemParameters.VirtualScreenTop + SystemParameters.VirtualScreenHeight - ActualHeight);
|
||||
left = Math.Min(left, SystemParameters.VirtualScreenLeft + SystemParameters.VirtualScreenWidth - ActualWidth);
|
||||
|
||||
Top = top;
|
||||
Left = left;
|
||||
|
|
@ -191,23 +191,19 @@ public partial class SettingWindow
|
|||
// Adjust window position if it exceeds screen boundaries
|
||||
top = Math.Max(top, SystemParameters.VirtualScreenTop);
|
||||
left = Math.Max(left, SystemParameters.VirtualScreenLeft);
|
||||
top = Math.Min(top, SystemParameters.VirtualScreenHeight - ActualHeight);
|
||||
left = Math.Min(left, SystemParameters.VirtualScreenWidth - ActualWidth);
|
||||
top = Math.Min(top, SystemParameters.VirtualScreenTop + SystemParameters.VirtualScreenHeight - ActualHeight);
|
||||
left = Math.Min(left, SystemParameters.VirtualScreenLeft + SystemParameters.VirtualScreenWidth - ActualWidth);
|
||||
}
|
||||
|
||||
private static bool IsPositionValid(double top, double left)
|
||||
{
|
||||
foreach (var screen in MonitorInfo.GetDisplayMonitors())
|
||||
{
|
||||
var workingArea = screen.WorkingArea;
|
||||
|
||||
if (left >= workingArea.Left && left < workingArea.Right &&
|
||||
top >= workingArea.Top && top < workingArea.Bottom)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
// Use SystemParameters (DIP units) to match the coordinate system of Window.Top/Left.
|
||||
// MonitorInfo.WorkingArea uses physical pixels which can differ from DIP units when DPI
|
||||
// scaling is active, leading to incorrect results on high-DPI or mixed-DPI setups.
|
||||
return left >= SystemParameters.VirtualScreenLeft &&
|
||||
left < SystemParameters.VirtualScreenLeft + SystemParameters.VirtualScreenWidth &&
|
||||
top >= SystemParameters.VirtualScreenTop &&
|
||||
top < SystemParameters.VirtualScreenTop + SystemParameters.VirtualScreenHeight;
|
||||
}
|
||||
|
||||
private double WindowLeft()
|
||||
|
|
|
|||
Loading…
Reference in a new issue