mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Adjust Code
This commit is contained in:
parent
ae0ec8ecf2
commit
45dd84a3fa
1 changed files with 52 additions and 44 deletions
|
|
@ -307,53 +307,61 @@ namespace Flow.Launcher
|
||||||
double currentScreenWidth = screen.WorkingArea.Width;
|
double currentScreenWidth = screen.WorkingArea.Width;
|
||||||
double currentScreenHeight = screen.WorkingArea.Height;
|
double currentScreenHeight = screen.WorkingArea.Height;
|
||||||
|
|
||||||
if (_previousScreenWidth != 0 && _previousScreenHeight != 0 && _previousDpiX != 0 && _previousDpiY != 0)
|
if (!(
|
||||||
|
_previousScreenWidth == currentScreenWidth &&
|
||||||
|
_previousScreenHeight == currentScreenHeight &&
|
||||||
|
_previousDpiX == currentDpi.X &&
|
||||||
|
_previousDpiY == currentDpi.Y
|
||||||
|
))
|
||||||
{
|
{
|
||||||
double widthRatio = currentScreenWidth / _previousScreenWidth;
|
if (_previousScreenWidth != 0 && _previousScreenHeight != 0 && _previousDpiX != 0 && _previousDpiY != 0)
|
||||||
double heightRatio = currentScreenHeight / _previousScreenHeight;
|
|
||||||
double dpiXRatio = currentDpi.X / _previousDpiX;
|
|
||||||
double dpiYRatio = currentDpi.Y / _previousDpiY;
|
|
||||||
|
|
||||||
_settings.WindowLeft *= widthRatio * dpiXRatio;
|
|
||||||
_settings.WindowTop *= heightRatio * dpiYRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation)
|
|
||||||
{
|
|
||||||
Top = _settings.WindowTop;
|
|
||||||
Left = _settings.WindowLeft;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (_settings.SearchWindowAlign)
|
|
||||||
{
|
{
|
||||||
case SearchWindowAligns.Center:
|
double widthRatio = currentScreenWidth / _previousScreenWidth;
|
||||||
Left = HorizonCenter(screen);
|
double heightRatio = currentScreenHeight / _previousScreenHeight;
|
||||||
Top = VerticalCenter(screen);
|
double dpiXRatio = currentDpi.X / _previousDpiX;
|
||||||
break;
|
double dpiYRatio = currentDpi.Y / _previousDpiY;
|
||||||
case SearchWindowAligns.CenterTop:
|
|
||||||
Left = HorizonCenter(screen);
|
|
||||||
Top = VerticalTop(screen);
|
|
||||||
break;
|
|
||||||
case SearchWindowAligns.LeftTop:
|
|
||||||
Left = HorizonLeft(screen);
|
|
||||||
Top = VerticalTop(screen);
|
|
||||||
break;
|
|
||||||
case SearchWindowAligns.RightTop:
|
|
||||||
Left = HorizonRight(screen);
|
|
||||||
Top = VerticalTop(screen);
|
|
||||||
break;
|
|
||||||
case SearchWindowAligns.Custom:
|
|
||||||
Left = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X + _settings.CustomWindowLeft, 0).X;
|
|
||||||
Top = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y + _settings.CustomWindowTop).Y;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_previousScreenWidth = currentScreenWidth;
|
_settings.WindowLeft *= widthRatio * dpiXRatio;
|
||||||
_previousScreenHeight = currentScreenHeight;
|
_settings.WindowTop *= heightRatio * dpiYRatio;
|
||||||
_previousDpiX = currentDpi.X;
|
}
|
||||||
_previousDpiY = currentDpi.Y;
|
|
||||||
|
if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation)
|
||||||
|
{
|
||||||
|
Top = _settings.WindowTop;
|
||||||
|
Left = _settings.WindowLeft;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (_settings.SearchWindowAlign)
|
||||||
|
{
|
||||||
|
case SearchWindowAligns.Center:
|
||||||
|
Left = HorizonCenter(screen);
|
||||||
|
Top = VerticalCenter(screen);
|
||||||
|
break;
|
||||||
|
case SearchWindowAligns.CenterTop:
|
||||||
|
Left = HorizonCenter(screen);
|
||||||
|
Top = VerticalTop(screen);
|
||||||
|
break;
|
||||||
|
case SearchWindowAligns.LeftTop:
|
||||||
|
Left = HorizonLeft(screen);
|
||||||
|
Top = VerticalTop(screen);
|
||||||
|
break;
|
||||||
|
case SearchWindowAligns.RightTop:
|
||||||
|
Left = HorizonRight(screen);
|
||||||
|
Top = VerticalTop(screen);
|
||||||
|
break;
|
||||||
|
case SearchWindowAligns.Custom:
|
||||||
|
Left = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X + _settings.CustomWindowLeft, 0).X;
|
||||||
|
Top = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y + _settings.CustomWindowTop).Y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_previousScreenWidth = currentScreenWidth;
|
||||||
|
_previousScreenHeight = currentScreenHeight;
|
||||||
|
_previousDpiX = currentDpi.X;
|
||||||
|
_previousDpiY = currentDpi.Y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateNotifyIconText()
|
private void UpdateNotifyIconText()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue