Skip to content

Commit e0cdc92

Browse files
committed
Revert "Adjust Code"
This reverts commit 45dd84a.
1 parent 45dd84a commit e0cdc92

File tree

1 file changed

+42
-50
lines changed

1 file changed

+42
-50
lines changed

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 42 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -307,61 +307,53 @@ private void InitializePosition()
307307
double currentScreenWidth = screen.WorkingArea.Width;
308308
double currentScreenHeight = screen.WorkingArea.Height;
309309

310-
if (!(
311-
_previousScreenWidth == currentScreenWidth &&
312-
_previousScreenHeight == currentScreenHeight &&
313-
_previousDpiX == currentDpi.X &&
314-
_previousDpiY == currentDpi.Y
315-
))
316-
{
317-
if (_previousScreenWidth != 0 && _previousScreenHeight != 0 && _previousDpiX != 0 && _previousDpiY != 0)
318-
{
319-
double widthRatio = currentScreenWidth / _previousScreenWidth;
320-
double heightRatio = currentScreenHeight / _previousScreenHeight;
321-
double dpiXRatio = currentDpi.X / _previousDpiX;
322-
double dpiYRatio = currentDpi.Y / _previousDpiY;
310+
if (_previousScreenWidth != 0 && _previousScreenHeight != 0 && _previousDpiX != 0 && _previousDpiY != 0)
311+
{
312+
double widthRatio = currentScreenWidth / _previousScreenWidth;
313+
double heightRatio = currentScreenHeight / _previousScreenHeight;
314+
double dpiXRatio = currentDpi.X / _previousDpiX;
315+
double dpiYRatio = currentDpi.Y / _previousDpiY;
323316

324-
_settings.WindowLeft *= widthRatio * dpiXRatio;
325-
_settings.WindowTop *= heightRatio * dpiYRatio;
326-
}
317+
_settings.WindowLeft *= widthRatio * dpiXRatio;
318+
_settings.WindowTop *= heightRatio * dpiYRatio;
319+
}
327320

328-
if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation)
329-
{
330-
Top = _settings.WindowTop;
331-
Left = _settings.WindowLeft;
332-
}
333-
else
321+
if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation)
322+
{
323+
Top = _settings.WindowTop;
324+
Left = _settings.WindowLeft;
325+
}
326+
else
327+
{
328+
switch (_settings.SearchWindowAlign)
334329
{
335-
switch (_settings.SearchWindowAlign)
336-
{
337-
case SearchWindowAligns.Center:
338-
Left = HorizonCenter(screen);
339-
Top = VerticalCenter(screen);
340-
break;
341-
case SearchWindowAligns.CenterTop:
342-
Left = HorizonCenter(screen);
343-
Top = VerticalTop(screen);
344-
break;
345-
case SearchWindowAligns.LeftTop:
346-
Left = HorizonLeft(screen);
347-
Top = VerticalTop(screen);
348-
break;
349-
case SearchWindowAligns.RightTop:
350-
Left = HorizonRight(screen);
351-
Top = VerticalTop(screen);
352-
break;
353-
case SearchWindowAligns.Custom:
354-
Left = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X + _settings.CustomWindowLeft, 0).X;
355-
Top = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y + _settings.CustomWindowTop).Y;
356-
break;
357-
}
330+
case SearchWindowAligns.Center:
331+
Left = HorizonCenter(screen);
332+
Top = VerticalCenter(screen);
333+
break;
334+
case SearchWindowAligns.CenterTop:
335+
Left = HorizonCenter(screen);
336+
Top = VerticalTop(screen);
337+
break;
338+
case SearchWindowAligns.LeftTop:
339+
Left = HorizonLeft(screen);
340+
Top = VerticalTop(screen);
341+
break;
342+
case SearchWindowAligns.RightTop:
343+
Left = HorizonRight(screen);
344+
Top = VerticalTop(screen);
345+
break;
346+
case SearchWindowAligns.Custom:
347+
Left = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X + _settings.CustomWindowLeft, 0).X;
348+
Top = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y + _settings.CustomWindowTop).Y;
349+
break;
358350
}
359-
360-
_previousScreenWidth = currentScreenWidth;
361-
_previousScreenHeight = currentScreenHeight;
362-
_previousDpiX = currentDpi.X;
363-
_previousDpiY = currentDpi.Y;
364351
}
352+
353+
_previousScreenWidth = currentScreenWidth;
354+
_previousScreenHeight = currentScreenHeight;
355+
_previousDpiX = currentDpi.X;
356+
_previousDpiY = currentDpi.Y;
365357
}
366358

367359
private void UpdateNotifyIconText()

0 commit comments

Comments
 (0)