mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Refresh LAN tab after starting/stopping local server
After starting/stopping the local server from the main menu, refresh the LAN tab on its next activation, so it immediately shows/hides the started/stopped server without needing a manual refresh. This is not a perfect solution, as the server would not show up when activating the LAN tab immediately after starting the server, because the server needs some time before it will respond to server info requests, but this works well enough unless the hotkeys are used.
This commit is contained in:
parent
2974e5197e
commit
3947ba40b1
|
@ -2354,9 +2354,15 @@ void CMenus::SetMenuPage(int NewPage)
|
||||||
if(NewPage >= PAGE_INTERNET && NewPage <= PAGE_FAVORITE_COMMUNITY_5)
|
if(NewPage >= PAGE_INTERNET && NewPage <= PAGE_FAVORITE_COMMUNITY_5)
|
||||||
{
|
{
|
||||||
g_Config.m_UiPage = NewPage;
|
g_Config.m_UiPage = NewPage;
|
||||||
if(OldPage != NewPage)
|
bool ForceRefresh = false;
|
||||||
|
if(m_ForceRefreshLanPage)
|
||||||
{
|
{
|
||||||
RefreshBrowserTab(false);
|
ForceRefresh = NewPage == PAGE_LAN;
|
||||||
|
m_ForceRefreshLanPage = false;
|
||||||
|
}
|
||||||
|
if(OldPage != NewPage || ForceRefresh)
|
||||||
|
{
|
||||||
|
RefreshBrowserTab(ForceRefresh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,6 +170,7 @@ protected:
|
||||||
|
|
||||||
bool m_JoinTutorial = false;
|
bool m_JoinTutorial = false;
|
||||||
bool m_CreateDefaultFavoriteCommunities = false;
|
bool m_CreateDefaultFavoriteCommunities = false;
|
||||||
|
bool m_ForceRefreshLanPage = false;
|
||||||
|
|
||||||
char m_aNextServer[256];
|
char m_aNextServer[256];
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,7 @@ void CMenus::RenderStartMenu(CUIRect MainView)
|
||||||
if(str_find(aBuf, "/") == 0 || fs_is_file(aBuf))
|
if(str_find(aBuf, "/") == 0 || fs_is_file(aBuf))
|
||||||
{
|
{
|
||||||
m_ServerProcess.m_Process = shell_execute(aBuf, EShellExecuteWindowState::BACKGROUND);
|
m_ServerProcess.m_Process = shell_execute(aBuf, EShellExecuteWindowState::BACKGROUND);
|
||||||
|
m_ForceRefreshLanPage = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -297,6 +298,7 @@ void CMenus::KillServer()
|
||||||
if(kill_process(m_ServerProcess.m_Process))
|
if(kill_process(m_ServerProcess.m_Process))
|
||||||
{
|
{
|
||||||
m_ServerProcess.m_Process = INVALID_PROCESS;
|
m_ServerProcess.m_Process = INVALID_PROCESS;
|
||||||
|
m_ForceRefreshLanPage = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue