Show the escape key properly when server unavailable.
Fixes #624. Signed-off-by: John Hood <cgull@glup.org>
This commit is contained in:
@@ -186,6 +186,7 @@ void STMClient::init( void )
|
||||
tmp = string( escape_key_name_buf );
|
||||
wstring escape_key_name = std::wstring(tmp.begin(), tmp.end());
|
||||
escape_key_help = L"Commands: Ctrl-Z suspends, \".\" quits, " + escape_pass_name + L" gives literal " + escape_key_name;
|
||||
overlays.get_notification_engine().set_escape_key_string( tmp );
|
||||
}
|
||||
wchar_t tmp[ 128 ];
|
||||
swprintf( tmp, 128, L"Nothing received from server on UDP port %s.", port.c_str() );
|
||||
|
||||
@@ -233,10 +233,9 @@ void NotificationEngine::apply( Framebuffer &fb ) const
|
||||
explanation = reply_message;
|
||||
}
|
||||
|
||||
const static char quit_keystroke[] = " [To quit: Ctrl-^ .]";
|
||||
const static char blank[] = "";
|
||||
|
||||
const char *keystroke_str = show_quit_keystroke ? quit_keystroke : blank;
|
||||
const char *keystroke_str = show_quit_keystroke ? escape_key_string.c_str() : blank;
|
||||
|
||||
if ( message.empty() && (!time_expired) ) {
|
||||
return;
|
||||
|
||||
@@ -145,6 +145,7 @@ namespace Overlay {
|
||||
private:
|
||||
uint64_t last_word_from_server;
|
||||
uint64_t last_acked_state;
|
||||
string escape_key_string;
|
||||
wstring message;
|
||||
bool message_is_network_exception;
|
||||
uint64_t message_expiration;
|
||||
@@ -174,6 +175,13 @@ namespace Overlay {
|
||||
show_quit_keystroke = s_show_quit_keystroke;
|
||||
}
|
||||
|
||||
void set_escape_key_string( const string &s_name )
|
||||
{
|
||||
char tmp[ 128 ];
|
||||
snprintf( tmp, sizeof tmp, " [To quit: %s .]", s_name.c_str() );
|
||||
escape_key_string = tmp;
|
||||
}
|
||||
|
||||
void set_network_exception( const std::exception &e )
|
||||
{
|
||||
wchar_t tmp[ 128 ];
|
||||
|
||||
Reference in New Issue
Block a user