Skip to content

Commit d247208

Browse files
committed
Revert "When using the “remember last position” setting, if the resolution or dpi has changed, the position will be rescaled proportionally"
This reverts commit 63ce735.
1 parent 4f16a11 commit d247208

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
using System.Windows.Media;
2828
using System.Windows.Interop;
2929
using System.Runtime.InteropServices;
30-
using System.Drawing;
3130

3231
namespace Flow.Launcher
3332
{
@@ -49,10 +48,6 @@ public partial class MainWindow
4948

5049
private MediaPlayer animationSoundWMP;
5150
private SoundPlayer animationSoundWPF;
52-
private double _previousScreenWidth;
53-
private double _previousScreenHeight;
54-
private double _previousDpiX;
55-
private double _previousDpiY;
5651

5752
#endregion
5853

@@ -293,38 +288,16 @@ private void OnLoaded(object sender, RoutedEventArgs _)
293288
};
294289
}
295290

296-
private (double X, double Y) GetCurrentDpi(Screen screen)
297-
{
298-
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
299-
{
300-
return (g.DpiX, g.DpiY);
301-
}
302-
}
303291
private void InitializePosition()
304292
{
305-
var screen = SelectedScreen();
306-
var currentDpi = GetCurrentDpi(screen);
307-
double currentScreenWidth = screen.WorkingArea.Width;
308-
double currentScreenHeight = screen.WorkingArea.Height;
309-
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;
316-
317-
_settings.WindowLeft *= widthRatio * dpiXRatio;
318-
_settings.WindowTop *= heightRatio * dpiYRatio;
319-
}
320-
321293
if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation)
322294
{
323295
Top = _settings.WindowTop;
324296
Left = _settings.WindowLeft;
325297
}
326298
else
327299
{
300+
var screen = SelectedScreen();
328301
switch (_settings.SearchWindowAlign)
329302
{
330303
case SearchWindowAligns.Center:
@@ -350,10 +323,6 @@ private void InitializePosition()
350323
}
351324
}
352325

353-
_previousScreenWidth = currentScreenWidth;
354-
_previousScreenHeight = currentScreenHeight;
355-
_previousDpiX = currentDpi.X;
356-
_previousDpiY = currentDpi.Y;
357326
}
358327

359328
private void UpdateNotifyIconText()

0 commit comments

Comments
 (0)