Skip to content

Commit

Permalink
Merge pull request #4083 from clinchergt/remember-netplaywindow-size
Browse files Browse the repository at this point in the history
Make Dolphin remember the NetPlay window size/position
  • Loading branch information
delroth committed Aug 3, 2016
2 parents 3683840 + 7e535b2 commit f30cc4f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
18 changes: 18 additions & 0 deletions Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp
Expand Up @@ -324,6 +324,24 @@ void NetPlaySetupFrame::MakeNetPlayDiag(int port, const std::string& game, bool
trav, centralServer, (u16)centralPort);
if (netplay_client->IsConnected())
{
int winPosX, winPosY, winWidth, winHeight;

// Remember the window size and position for NetWindow
netplay_section.Get("NetWindowPosX", &winPosX, -1);
netplay_section.Get("NetWindowPosY", &winPosY, -1);
netplay_section.Get("NetWindowWidth", &winWidth, 768);
netplay_section.Get("NetWindowHeight", &winHeight, 768 - 128);

if (winPosX == -1 || winPosY == -1)
{
npd->SetSize(768, 768 - 128);
npd->Center();
}
else
{
npd->SetSize(winPosX, winPosY, winWidth, winHeight);
}

npd->Show();
Destroy();
}
Expand Down
15 changes: 12 additions & 3 deletions Source/Core/DolphinWX/NetPlay/NetWindow.cpp
Expand Up @@ -243,13 +243,22 @@ NetPlayDialog::NetPlayDialog(wxWindow* const parent, const CGameListCtrl* const
panel->SetSizerAndFit(main_szr);

main_szr->SetSizeHints(this);
SetSize(768, 768 - 128);

Center();
}

NetPlayDialog::~NetPlayDialog()
{
IniFile inifile;
const std::string dolphin_ini = File::GetUserPath(F_DOLPHINCONFIG_IDX);
inifile.Load(dolphin_ini);
IniFile::Section& netplay_config = *inifile.GetOrCreateSection("NetPlay");

netplay_config.Set("NetWindowPosX", GetPosition().x);
netplay_config.Set("NetWindowPosY", GetPosition().y);
netplay_config.Set("NetWindowWidth", GetSize().GetWidth());
netplay_config.Set("NetWindowHeight", GetSize().GetHeight());

inifile.Save(dolphin_ini);

if (netplay_client)
{
delete netplay_client;
Expand Down

0 comments on commit f30cc4f

Please sign in to comment.