From d2472084a2804bd2e3795051d6e1bf28ad08b0ee Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 6 Jun 2024 06:02:55 +0900 Subject: [PATCH] =?UTF-8?q?Revert=20"When=20using=20the=20=E2=80=9Cremembe?= =?UTF-8?q?r=20last=20position=E2=80=9D=20setting,=20if=20the=20resolution?= =?UTF-8?q?=20or=20dpi=20has=20changed,=20the=20position=20will=20be=20res?= =?UTF-8?q?caled=20proportionally"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 63ce735169afe7cf871d3d2a8eb6086e49fefa9a. --- Flow.Launcher/MainWindow.xaml.cs | 33 +------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 87e818154..6c0889295 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -27,7 +27,6 @@ using DataObject = System.Windows.DataObject; using System.Windows.Media; using System.Windows.Interop; using System.Runtime.InteropServices; -using System.Drawing; namespace Flow.Launcher { @@ -49,10 +48,6 @@ namespace Flow.Launcher private MediaPlayer animationSoundWMP; private SoundPlayer animationSoundWPF; - private double _previousScreenWidth; - private double _previousScreenHeight; - private double _previousDpiX; - private double _previousDpiY; #endregion @@ -293,31 +288,8 @@ namespace Flow.Launcher }; } - private (double X, double Y) GetCurrentDpi(Screen screen) - { - using (Graphics g = Graphics.FromHwnd(IntPtr.Zero)) - { - return (g.DpiX, g.DpiY); - } - } private void InitializePosition() { - var screen = SelectedScreen(); - var currentDpi = GetCurrentDpi(screen); - double currentScreenWidth = screen.WorkingArea.Width; - double currentScreenHeight = screen.WorkingArea.Height; - - if (_previousScreenWidth != 0 && _previousScreenHeight != 0 && _previousDpiX != 0 && _previousDpiY != 0) - { - double widthRatio = currentScreenWidth / _previousScreenWidth; - 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; @@ -325,6 +297,7 @@ namespace Flow.Launcher } else { + var screen = SelectedScreen(); switch (_settings.SearchWindowAlign) { case SearchWindowAligns.Center: @@ -350,10 +323,6 @@ namespace Flow.Launcher } } - _previousScreenWidth = currentScreenWidth; - _previousScreenHeight = currentScreenHeight; - _previousDpiX = currentDpi.X; - _previousDpiY = currentDpi.Y; } private void UpdateNotifyIconText()