From: H.G.Muller Date: Tue, 9 Sep 2014 14:49:18 +0000 (+0200) Subject: Fix Chat window for Xaw build X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=ca218df6e665995a11015980f86003d915de9812;p=xboard.git Fix Chat window for Xaw build The ICS output field and Hide button are removed from the ICS Interaction window, to make it similar to the old Chat window. This required adding some tests in the handlers of this window, to prevent segfaults due to accessing it. --- diff --git a/dialogs.c b/dialogs.c index 4de988b..3640866 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1959,7 +1959,7 @@ ChatOK (int n) void DelayedSetText () { - SetWidgetText(&chatOptions[CHAT_IN], tmpLine, ChatDlg); + SetWidgetText(&chatOptions[CHAT_IN], tmpLine, -1); // leave focus on chat-partner field! SetInsertPos(&chatOptions[CHAT_IN], strlen(tmpLine)); } @@ -1976,6 +1976,7 @@ ChatSwitch (int n) { int i, j; char *v; + if(chatOptions[CHAT_ICS].type == Skip) hidden = 0; // In Xaw there is no ICS pane we can hide behind Show(&chatOptions[CHAT_PANE], 0); // show if(hidden) ScheduleDelayedEvent(DelayedScroll, 50); // Awful! else ScheduleDelayedEvent(DelayedSetText, 50); @@ -2037,7 +2038,7 @@ NewChat (char *name) void ConsoleWrite(char *message, int count) { - if(shellUp[ChatDlg]) { + if(shellUp[ChatDlg] && chatOptions[CHAT_ICS].type != Skip) { // in Xaw this is a no-op AppendColorized(&chatOptions[CHAT_ICS], message, count); SetInsertPos(&chatOptions[CHAT_ICS], 999999); } diff --git a/usystem.c b/usystem.c index 9223480..baba353 100644 --- a/usystem.c +++ b/usystem.c @@ -657,7 +657,7 @@ OutputToProcess (ProcRef pr, char *message, int count, int *outError) { static int line = 0; ChildProc *cp = (ChildProc *) pr; - int outCount; + int outCount = count; if (pr == NoProc) { diff --git a/xaw/xboard.c b/xaw/xboard.c index f90fe06..c0239a4 100644 --- a/xaw/xboard.c +++ b/xaw/xboard.c @@ -990,6 +990,9 @@ main (int argc, char **argv) char *p; int forceMono = False; + extern Option chatOptions[]; // FIXME: adapt Chat window, removing ICS pane and Hide button + chatOptions[6].type = chatOptions[10].type = Skip; + srandom(time(0)); // [HGM] book: make random truly random setbuf(stdout, NULL); diff --git a/xaw/xoptions.c b/xaw/xoptions.c index 5caa95a..e183cf2 100644 --- a/xaw/xoptions.c +++ b/xaw/xoptions.c @@ -273,12 +273,29 @@ SetTextColor (char **cnames, int fg, int bg, int attr) void AppendColorized (Option *opt, char *message, int count) { + if(!opt->handle) return; AppendText(opt, message); } void Show (Option *opt, int hide) { + static Dimension h; + Arg args[16]; + Dimension v; + int j=0; +return; // FIXME: it would be nice if the Chat window did have an ICS pane we could hide behind +printf("Show(%d) %x\n", hide, opt->handle); + if(!opt->handle) return; + if(hide) { // make sure original size is saved + XtSetArg(args[j], XtNheight, &v); j++; + XtGetValues(opt->handle, args, j); + if(v != 1) h = v; + } +printf("h = %d\n",h); + j = 0; + XtSetArg(args[j], XtNheight, hide ? 1 : h); j++; + XtSetValues(opt->handle, args, j); } void