@@ -61,9 +61,7 @@ private void MainForm_Load(object sender, EventArgs e)
61
61
{
62
62
UpdateWindowTitle ( ) ;
63
63
64
- ToolStripItem [ ] CreateWindowSizeFactorSubmenus ( )
65
64
{
66
- var items = new ToolStripItem [ WINDOW_SCALE_MAX ] ;
67
65
for ( int i = 1 ; i <= WINDOW_SCALE_MAX ; i ++ )
68
66
{
69
67
long quotient = Math . DivRem ( i , 10 , out long remainder ) ;
@@ -73,11 +71,9 @@ ToolStripItem[] CreateWindowSizeFactorSubmenus()
73
71
Text = $ "{ ( quotient > 0 ? quotient : "" ) } &{ remainder } x"
74
72
} ;
75
73
temp . Click += this . WindowSize_Click ;
76
- items [ i - 1 ] = temp ;
74
+ WindowSizeSubMenu . DropDownItems . Insert ( i - 1 , temp ) ;
77
75
}
78
- return items ;
79
76
}
80
- WindowSizeSubMenu . DropDownItems . AddRange ( CreateWindowSizeFactorSubmenus ( ) ) ;
81
77
82
78
foreach ( var ( appliesTo , coreNames ) in Config . CorePickerUIData )
83
79
{
@@ -603,20 +599,17 @@ _argParser.SocketAddress is var (socketIP, socketPort)
603
599
CheatList . Changed += Tools . UpdateCheatRelatedTools ;
604
600
RewireSound ( ) ;
605
601
606
- // Workaround for windows, location is -32000 when minimized, if they close it during this time, that's what gets saved
607
- if ( Config . MainWndx == - 32000 )
608
- {
609
- Config . MainWndx = 0 ;
610
- }
611
-
612
- if ( Config . MainWndy == - 32000 )
602
+ if ( Config . SaveWindowPosition )
613
603
{
614
- Config . MainWndy = 0 ;
615
- }
604
+ if ( Config . MainWindowPosition is Point position )
605
+ {
606
+ Location = position ;
607
+ }
616
608
617
- if ( Config . MainWndx != - 1 && Config . MainWndy != - 1 && Config . SaveWindowPosition )
618
- {
619
- Location = new Point ( Config . MainWndx , Config . MainWndy ) ;
609
+ if ( Config . MainWindowSize is Size size && ! Config . ResizeWithFramebuffer )
610
+ {
611
+ Size = size ;
612
+ }
620
613
}
621
614
622
615
if ( Config . MainFormStayOnTop ) TopMost = true ;
@@ -1395,8 +1388,12 @@ public void TakeScreenshot(string path)
1395
1388
AddOnScreenMessage ( $ "{ fi . Name } saved.") ;
1396
1389
}
1397
1390
1398
- public void FrameBufferResized ( )
1391
+ public void FrameBufferResized ( bool forceWindowResize = false )
1399
1392
{
1393
+ if ( ! Config . ResizeWithFramebuffer && ! forceWindowResize )
1394
+ {
1395
+ return ;
1396
+ }
1400
1397
// run this entire thing exactly twice, since the first resize may adjust the menu stacking
1401
1398
for ( int i = 0 ; i < 2 ; i ++ )
1402
1399
{
@@ -2422,20 +2419,16 @@ private void SaveConfig(string path = "")
2422
2419
{
2423
2420
if ( Config . SaveWindowPosition )
2424
2421
{
2425
- if ( Config . MainWndx != - 32000 ) // When minimized location is -32000, don't save this into the config file!
2426
- {
2427
- Config . MainWndx = Location . X ;
2428
- }
2429
-
2430
- if ( Config . MainWndy != - 32000 )
2422
+ if ( WindowState is FormWindowState . Normal )
2431
2423
{
2432
- Config . MainWndy = Location . Y ;
2424
+ Config . MainWindowPosition = Location ;
2425
+ Config . MainWindowSize = Size ;
2433
2426
}
2434
2427
}
2435
2428
else
2436
2429
{
2437
- Config . MainWndx = - 1 ;
2438
- Config . MainWndy = - 1 ;
2430
+ Config . MainWindowPosition = null ;
2431
+ Config . MainWindowSize = null ;
2439
2432
}
2440
2433
2441
2434
Config . LastWrittenFrom = VersionInfo . MainVersion ;
@@ -2591,7 +2584,7 @@ private void IncreaseWindowSize()
2591
2584
Config . SetWindowScaleFor ( Emulator . SystemId , windowScale ) ;
2592
2585
}
2593
2586
AddOnScreenMessage ( $ "Screensize set to { windowScale } x") ;
2594
- FrameBufferResized ( ) ;
2587
+ FrameBufferResized ( forceWindowResize : true ) ;
2595
2588
}
2596
2589
2597
2590
private void DecreaseWindowSize ( )
@@ -2603,7 +2596,7 @@ private void DecreaseWindowSize()
2603
2596
Config . SetWindowScaleFor ( Emulator . SystemId , windowScale ) ;
2604
2597
}
2605
2598
AddOnScreenMessage ( $ "Screensize set to { windowScale } x") ;
2606
- FrameBufferResized ( ) ;
2599
+ FrameBufferResized ( forceWindowResize : true ) ;
2607
2600
}
2608
2601
2609
2602
private static readonly int [ ] SpeedPercents = { 1 , 3 , 6 , 12 , 25 , 50 , 75 , 100 , 150 , 200 , 300 , 400 , 800 , 1600 , 3200 , 6400 } ;
0 commit comments