Merge pull request #8519 from Robyt3/Client-Browser-Refresh-UiPage-Fix

Fix browser not refreshing if `ui_page` is changed in start menu, refresh LAN tab after starting/stopping local server
This commit is contained in:
Dennis Felsing 2024-06-24 21:03:17 +00:00 committed by GitHub
commit e29409de64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 3 deletions

View file

@ -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(!m_ShowStart && OldPage != NewPage) bool ForceRefresh = false;
if(m_ForceRefreshLanPage)
{ {
RefreshBrowserTab(false); ForceRefresh = NewPage == PAGE_LAN;
m_ForceRefreshLanPage = false;
}
if(OldPage != NewPage || ForceRefresh)
{
RefreshBrowserTab(ForceRefresh);
} }
} }
} }

View file

@ -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];

View file

@ -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
{ {
@ -285,8 +286,8 @@ void CMenus::RenderStartMenu(CUIRect MainView)
if(NewPage != -1) if(NewPage != -1)
{ {
m_MenuPage = NewPage;
m_ShowStart = false; m_ShowStart = false;
SetMenuPage(NewPage);
} }
} }
@ -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;
} }
} }
} }