Skip to content

Commit ec4df1c

Browse files
committed
fix: window size restoration bodge
1 parent c5580e2 commit ec4df1c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/XIVLauncher/Windows/MainWindow.xaml.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public partial class MainWindow : Window
3636
private Headlines _headlines;
3737
private BitmapImage[] _bannerBitmaps;
3838
private int _currentBannerIndex;
39+
private bool _everShown = false;
3940

4041
class BannerDotInfo
4142
{
@@ -184,7 +185,7 @@ private async Task SetupHeadlines()
184185
}
185186
}
186187

187-
private const int CURRENT_VERSION_LEVEL = 1;
188+
private const int CURRENT_VERSION_LEVEL = 2;
188189

189190
private void SetDefaults()
190191
{
@@ -242,6 +243,11 @@ private void SetDefaults()
242243

243244
break;
244245

246+
// 5.12.2022: Bad main window placement when using auto-launch
247+
case 1:
248+
App.Settings.MainWindowPlacement = null;
249+
break;
250+
245251
default:
246252
throw new ArgumentOutOfRangeException();
247253
}
@@ -344,6 +350,8 @@ public void Initialize()
344350

345351
Show();
346352
Activate();
353+
354+
_everShown = true;
347355
}
348356

349357
private void BannerCard_MouseUp(object sender, MouseButtonEventArgs e)
@@ -598,6 +606,9 @@ private void SettingsControl_OnCloseMainWindowGracefully(object sender, EventArg
598606

599607
private void MainWindow_OnClosing(object sender, CancelEventArgs e)
600608
{
609+
if (!_everShown)
610+
return;
611+
601612
try
602613
{
603614
PreserveWindowPosition.SaveWindowPosition(this);
@@ -613,6 +624,11 @@ protected override void OnSourceInitialized(EventArgs e)
613624
try
614625
{
615626
PreserveWindowPosition.RestorePosition(this);
627+
628+
// Restore the size of the window to what we expect it to be
629+
// There's no better way to do it that doesn't make me wanna off myself
630+
Width = 845;
631+
Height = 376;
616632
}
617633
catch (Exception ex)
618634
{

0 commit comments

Comments
 (0)