@@ -307,61 +307,53 @@ private void InitializePosition()
307
307
double currentScreenWidth = screen . WorkingArea . Width ;
308
308
double currentScreenHeight = screen . WorkingArea . Height ;
309
309
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 ;
323
316
324
- _settings . WindowLeft *= widthRatio * dpiXRatio ;
325
- _settings . WindowTop *= heightRatio * dpiYRatio ;
326
- }
317
+ _settings . WindowLeft *= widthRatio * dpiXRatio ;
318
+ _settings . WindowTop *= heightRatio * dpiYRatio ;
319
+ }
327
320
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 )
334
329
{
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 ;
358
350
}
359
-
360
- _previousScreenWidth = currentScreenWidth ;
361
- _previousScreenHeight = currentScreenHeight ;
362
- _previousDpiX = currentDpi . X ;
363
- _previousDpiY = currentDpi . Y ;
364
351
}
352
+
353
+ _previousScreenWidth = currentScreenWidth ;
354
+ _previousScreenHeight = currentScreenHeight ;
355
+ _previousDpiX = currentDpi . X ;
356
+ _previousDpiY = currentDpi . Y ;
365
357
}
366
358
367
359
private void UpdateNotifyIconText ( )
0 commit comments