Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/game/client/game_controls/vguitextwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ CTextWindow::CTextWindow(IViewPort *pViewPort) : Frame(NULL, PANEL_INFO )
m_szTitle[0] = '\0';
m_szMessage[0] = '\0';
m_szMessageFallback[0] = '\0';
m_szLastURL[0] = '\0';
m_nExitCommand = TEXTWINDOW_CMD_NONE;
m_bShownURL = false;
m_bUnloadOnDismissal = false;
Expand Down Expand Up @@ -151,6 +152,7 @@ void CTextWindow::Reset( void )
m_nContentType = TYPE_TEXT;
m_bShownURL = false;
m_bUnloadOnDismissal = false;
m_szLastURL[0] = '\0';
Update();
}

Expand Down Expand Up @@ -191,7 +193,16 @@ void CTextWindow::ShowURL( const char *URL, bool bAllowUserToDisable )
}

m_pHTMLMessage->SetVisible( true );

// Don't reload the page if we're already displaying this exact URL. Re-opening it
// would discard any navigation the user has done within the MOTD. This path gets
// hit when the viewport calls UpdateAllPanels() -> Update() while the MOTD is still
// open (e.g. when other panels show/hide on the local player's death/respawn).
if ( m_bShownURL && !Q_strcmp( m_szLastURL, URL ) )
return;

m_pHTMLMessage->OpenURL( URL, NULL );
Q_strncpy( m_szLastURL, URL, sizeof( m_szLastURL ) );
m_bShownURL = true;
}

Expand Down Expand Up @@ -425,6 +436,7 @@ void CTextWindow::ShowPanel( bool bShow )
{
m_pHTMLMessage->OpenURL( "about:blank", NULL );
m_bShownURL = false;
m_szLastURL[0] = '\0';
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/game/client/game_controls/vguitextwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class CTextWindow : public vgui::Frame, public IViewPortPanel
int m_nContentType;
bool m_bShownURL;
bool m_bUnloadOnDismissal;
char m_szLastURL[2048]; // the URL currently loaded in m_pHTMLMessage, so we don't needlessly reload it

vgui::TextEntry *m_pTextMessage;

Expand Down