27
27
using System . Windows . Media ;
28
28
using System . Windows . Interop ;
29
29
using System . Runtime . InteropServices ;
30
- using System . Drawing ;
31
30
32
31
namespace Flow . Launcher
33
32
{
@@ -49,10 +48,6 @@ public partial class MainWindow
49
48
50
49
private MediaPlayer animationSoundWMP ;
51
50
private SoundPlayer animationSoundWPF ;
52
- private double _previousScreenWidth ;
53
- private double _previousScreenHeight ;
54
- private double _previousDpiX ;
55
- private double _previousDpiY ;
56
51
57
52
#endregion
58
53
@@ -293,38 +288,16 @@ private void OnLoaded(object sender, RoutedEventArgs _)
293
288
} ;
294
289
}
295
290
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
- }
303
291
private void InitializePosition ( )
304
292
{
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
-
321
293
if ( _settings . SearchWindowScreen == SearchWindowScreens . RememberLastLaunchLocation )
322
294
{
323
295
Top = _settings . WindowTop ;
324
296
Left = _settings . WindowLeft ;
325
297
}
326
298
else
327
299
{
300
+ var screen = SelectedScreen ( ) ;
328
301
switch ( _settings . SearchWindowAlign )
329
302
{
330
303
case SearchWindowAligns . Center :
@@ -350,10 +323,6 @@ private void InitializePosition()
350
323
}
351
324
}
352
325
353
- _previousScreenWidth = currentScreenWidth ;
354
- _previousScreenHeight = currentScreenHeight ;
355
- _previousDpiX = currentDpi . X ;
356
- _previousDpiY = currentDpi . Y ;
357
326
}
358
327
359
328
private void UpdateNotifyIconText ( )
0 commit comments