From: H.G.Muller Date: Thu, 10 Mar 2016 12:03:55 +0000 (+0100) Subject: Suppress echo of password in ICS Chat window (GTK) X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=4247eefccb8916d045dccd2d63a4b78f8c5cdf45;p=xboard.git Suppress echo of password in ICS Chat window (GTK) The GTK version uses the set_visibility GTK call to switch echoing of the ICS input widget. In Xaw this is a dummy. EchoOn/Off had to be moved to dialogs.c for this. --- diff --git a/dialogs.c b/dialogs.c index 3279a5f..ca9f71c 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2156,6 +2156,25 @@ ConsoleAutoPopUp (char *buf) } else PopUpMoveDialog(*buf); } +static Boolean noEcho; + +void +EchoOn () +{ + if(!noEcho) return; + system("stty echo"); + WidgetEcho(&chatOptions[CHAT_IN], 1); + noEcho = False; +} + +void +EchoOff () +{ + system("stty -echo"); + WidgetEcho(&chatOptions[CHAT_IN], 0); + noEcho = True; +} + //--------------------------------- Game-List options dialog ------------------------------------------ char *strings[LPUSERGLT_SIZE]; diff --git a/dialogs.h b/dialogs.h index a2f5979..15c2725 100644 --- a/dialogs.h +++ b/dialogs.h @@ -200,6 +200,7 @@ void GameListOptionsPopUp P((DialogClass parent)); void RefreshColor P((int source, int n)); void SendString P((char *p)); void DisplayHelp P((char *name)); +void WidgetEcho P((Option *opt, int n)); // in ngamelist.c int GameListClicks P((int direction)); diff --git a/gtk/xoptions.c b/gtk/xoptions.c index 5c6f91f..8fff39b 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -255,6 +255,12 @@ SetDialogTitle (DialogClass dlg, char *title) } void +WidgetEcho (Option *opt, int n) +{ + gtk_entry_set_visibility(opt->handle, n); +} + +void SetWidgetFont (GtkWidget *w, char **s) { PangoFontDescription *pfd; diff --git a/usystem.c b/usystem.c index a469fe7..77efb60 100644 --- a/usystem.c +++ b/usystem.c @@ -267,22 +267,6 @@ ParseIcsTextColors () SetTextColor(cnames, textColors[ColorNormal].fg - 30, textColors[ColorNormal].bg - 40, -2); // kludge to announce background color to front-end } -static Boolean noEcho; - -void -EchoOn () -{ - system("stty echo"); - noEcho = False; -} - -void -EchoOff () -{ - system("stty -echo"); - noEcho = True; -} - char *oldICSInteractionTitle; void @@ -294,7 +278,7 @@ ShutDownFrontEnd () if (saveSettingsOnExit) SaveSettings(settingsFileName); unlink(gameCopyFilename); unlink(gamePasteFilename); - if(noEcho) EchoOn(); + EchoOn(); } void diff --git a/xaw/xoptions.c b/xaw/xoptions.c index 8d91577..1c517ac 100644 --- a/xaw/xoptions.c +++ b/xaw/xoptions.c @@ -181,6 +181,11 @@ SetWidgetState (Option *opt, int state) } void +WidgetEcho (Option *opt, int state) +{ +} + +void SetWidgetLabel (Option *opt, char *buf) { Arg arg;