1 [The patch is further down.]
5 - Fixed a bug in the networking read loop
6 (conn.c:newNetData). The loop around the read()
7 breaks when taken more than once. Results were
8 damaged game/player lists and garbage in the
11 - Fixed a bug in the bPropW handling in the rc-file.
12 Small windows sizes were not stored. [Note: When
13 starting cgoban (with an old config file) the first
14 time after applying the patch windows will be half
15 the wide that they used to be.]
17 - Fixed a bug when inserting text into a text window.
18 The passed width was wrong so that it forces a line
19 break of the string when it was not neccesary.
21 - Inserted a missing str_clip(cmdBuild,0) into
24 - Fixed a bug in CTRL-D handling of the tbin widget.
25 (SEGV when pressed on last char in last line (not
28 - NNGS guest login sometimes hang. Server sends "#> "
29 (two spaces) which was not recognized as a prompt.
34 - Added cross mark support (on board, in sgf files, in
37 - Added support for "titled games". IGS send a "Game
38 is titled: ...." for each move of a titled game.
39 These were shown in the terminal window. I forward
40 these titles to the goban widget where they will be
41 displayed in the title box.
43 - Added the player names into the timer/score boxes.
44 The rows of black/white stones are reduced to a
45 single stone and the player's name and rank are
46 shown right of that stone. (That was done after I
47 noticed that the names may not be visible in titled
50 - Optional (compile time support) for a fixed width
51 font in the terminal window. IGS output assumes a
52 fixed width font and the ASCII-graphics, tables, and
53 help files will be messed up with proportional fonts.
54 Change the TBIN_FONTNUM define in
55 wmslib/src/but/tbin.h.
57 - Made the game list window a little bit larger so that
58 3-digit game numbers will fit into the first column.
60 - In the game list window the common values of some
61 fields (board size=19, move number=0, handicap=0,
62 observers=0) are replaced by a single dot. Not only
63 makes this the window cleaner, it's also easier to
64 look for special games (unusual board size, high
67 - Added a key (XK_Insert) to insert the current
70 - The resource name changed to "CGoban" from
71 "Basicwin". That way the window manager can properly
74 - Added a '-connect <name>' command line option and
75 changed the '-nngs/igs' option slightly. '-connect'
76 looks for the given name in the setup's server list
77 and uses that server entry to connect to.
78 '-nngs/igs' has become a shortcut for '-connect
79 NNGS/IGS'. (Original -nngs/igs took always the
80 first/second entry of the list whatever server that
82 (TODO: gmpSetup still has the same problem).
84 - '-connect/-igs/-nngs' does an autologin without
85 putting up the username/password requester. Old
86 behaviour selectable by #if. (I'm not sure if the
87 cliData_decRef(cd) in src/main.c:connect_to is
88 required. It seems to be but even without everything
89 seems to work correct...)
91 - When playing/observing the say/kibitz input box is
92 activated by default. (Pressing RETURN on an empty
93 line still switches back to 'browse-game-mode'. And
94 the input box is empty on start...)
96 - Use the bold font for the remaining time / score.
97 (And added some space too.)
99 - Put Helvetica as the first font in the font lists.
100 The serif fonts are too hard to read with these low
103 - I removed all these strange cursor shapes (annoying,
104 especially with the different hotspot locations).
106 - Made the idle cursor look dull (recolored to some
109 - Made the scroll speed faster (8 lines/second instead
113 Ciao, ET. <froese@gmx.de>
116 diff -ru cgoban-1.9.12-orig/src/cgbuts.c cgoban-1.9.12-et1/src/cgbuts.c
117 --- cgoban-1.9.12-orig/src/cgbuts.c Tue Jan 25 05:40:24 2000
118 +++ cgoban-1.9.12-et1/src/cgbuts.c Mon May 13 22:52:48 2002
123 - XSetLineAttributes(dpy, gc, lw, LineSolid, CapButt, JoinMiter);
124 + XSetLineAttributes(dpy, gc, lw, LineSolid, CapProjecting, JoinMiter);
125 + /* all of them require abs coordinates */
129 if (piece == goStone_black)
130 butEnv_setXFg(env, BUT_WHITE);
131 @@ -490,35 +493,43 @@
137 + XDrawLine(dpy, win->win, gc, x+off, y+off, x+2*off, y+2*off);
138 + XDrawLine(dpy, win->win, gc, x+2*off, y+off, x+off, y+2*off);
140 case goMark_triangle:
141 - points[0].x = x+w/2 - win->xOff;
142 - points[0].y = y+lw - win->yOff;
143 - points[1].x = x+((w*0.9330127)-(lw*0.8660254)+0.5) - win->xOff;
144 - points[1].y = y+((w*0.75)-(lw*0.5)+0.5) - win->yOff;
145 - points[2].x = x+((w*0.0669873)+(lw*0.8660254)+0.5) - win->xOff;
146 + #define SIN60 0.8660254038
148 + points[0].x = x+w/2;
149 + points[0].y = y+lw-1;
150 + points[1].x = x+(w*(0.5+SIN60/2) - lw*SIN60 + 0.5);
151 + points[1].y = y+(w*(0.5+COS60/2) - lw*COS60 + 0.5);
152 + points[2].x = x+(w*(0.5-SIN60/2) + lw*SIN60 - 0.5);
153 points[2].y = points[1].y;
154 points[3] = points[0];
155 XDrawLines(dpy, win->win, gc, points, 4, CoordModeOrigin);
159 - off = (int)(w*0.14644661+lw*0.5+0.5);
160 - XDrawRectangle(dpy, win->win, gc, x + off - win->xOff, y + off - win->yOff,
161 - w-off*2-(lw&1),w-off*2-(lw&1));
162 + #define SIN45 0.7071067812
163 + off = w*(1-SIN45) + lw + 1;
164 + XDrawRectangle(dpy, win->win, gc, x + off/2, y + off/2, w-off, w-off);
166 case goMark_lastMove:
169 - XDrawArc(dpy, win->win, gc, x + off - win->xOff, y + off - win->yOff,
170 + XDrawArc(dpy, win->win, gc, x + off, y + off,
171 w-off*2-1,w-off*2-1, 0,360*64);
176 if (markType == goMark_smBlack)
177 - cgbuts_drawp(b, win, goStone_black, FALSE, x+(w+1)/4,y+(w+1)/4, w/2,
178 + cgbuts_drawp(b, win, goStone_black, FALSE, x+off,y+off, w/2,
179 stoneVersion, dx,dy,dw,dh);
181 - cgbuts_drawp(b, win, goStone_white, FALSE, x+(w+1)/4,y+(w+1)/4, w/2,
182 + cgbuts_drawp(b, win, goStone_white, FALSE, x+off,y+off, w/2,
183 stoneVersion, dx,dy,dw,dh);
187 assert(markAux >= 0);
190 - if ((markAux > 99) && (w < butEnv_fontH(env, 0) * 2))
191 + if ((markAux > 99) && (w < butEnv_fontH(env, 1) * 2))
192 sprintf(text, "%02d", markAux % 100);
194 sprintf(text, "%d", markAux);
195 diff -ru cgoban-1.9.12-orig/src/cgbuts.h cgoban-1.9.12-et1/src/cgbuts.h
196 --- cgoban-1.9.12-orig/src/cgbuts.h Tue Jan 25 05:40:24 2000
197 +++ cgoban-1.9.12-et1/src/cgbuts.h Sun Apr 21 20:04:13 2002
201 goMark_none, goMark_lastMove, goMark_ko,
202 - goMark_triangle, goMark_square, goMark_circle,
203 + goMark_cross, goMark_triangle, goMark_square, goMark_circle,
204 goMark_letter, goMark_number, goMark_smWhite, goMark_smBlack
206 #define goMark_max (goMark_ko + 1)
207 diff -ru cgoban-1.9.12-orig/src/cgoban.c cgoban-1.9.12-et1/src/cgoban.c
208 --- cgoban-1.9.12-orig/src/cgoban.c Thu Feb 28 04:34:35 2002
209 +++ cgoban-1.9.12-et1/src/cgoban.c Mon May 13 14:46:31 2002
211 {"board.showCoords", "t", NULL, CLPSETUP_SHOWBOOL|CLPSETUP_BOOL, NULL},
213 {"edit", "", "Edit SGF file", CLPSETUP_NOSAVE, NULL},
214 + {"connect", "", "Connect to given server", CLPSETUP_NOSAVE, NULL},
215 {"nngs", "f", "Connect to NNGS", CLPSETUP_BOOL|CLPSETUP_NOSAVE, NULL},
216 {"igs", "f", "Connect to IGS", CLPSETUP_BOOL|CLPSETUP_NOSAVE, NULL},
217 {"iconic", "f", NULL, CLPSETUP_BOOL|CLPSETUP_NOSAVE, NULL},
219 {"help.y", "", NULL, 0, NULL},
220 {"help.w", "28.284271", NULL, 0, NULL},
221 {"help.h", "40.0", NULL, 0, NULL},
222 - {"game.rules", "0", NULL, 0, checkRules},
223 + {"game.rules", "1", NULL, 0, checkRules},
224 {"game.size", "19", NULL, 0, checkSize},
225 {"game.komi", "5.5", NULL, 0, checkKomi},
226 {"game.handicap", "0", NULL, 0, checkHandicap},
228 {"local.x", "", NULL, 0, NULL},
229 {"local.y", "", NULL, 0, NULL},
230 {"local.bProp", "1.0", NULL, 0, checkBProp},
231 - {"local.bPropW", "1.0", NULL, 0, checkBProp},
232 + {"local.bPropW", "2.0", NULL, 0, checkBProp},
233 {"local.sgfName", "game.sgf", NULL, 0, NULL},
234 {"edit.x", "", NULL, 0, NULL},
235 {"edit.y", "", NULL, 0, NULL},
236 @@ -118,13 +119,13 @@
237 {"edit.toolW", "0.0", NULL, 0, NULL},
238 {"edit.toolH", "0.0", NULL, 0, NULL},
239 {"edit.bProp", "1.0", NULL, 0, checkBProp},
240 - {"edit.bPropW", "1.0", NULL, 0, checkBProp},
241 + {"edit.bPropW", "2.0", NULL, 0, checkBProp},
242 {"edit.sgfName", "seigen-minoru.sgf", NULL, 0, NULL},
243 {"edit.infoX", "", NULL, 0, NULL},
244 {"edit.infoY", "", NULL, 0, NULL},
245 {"edit.infoW", "1.0", NULL, 0, NULL},
246 {"edit.infoH", "1.0", NULL, 0, NULL},
247 - {"setup.timeType", "2", NULL, 0, checkTimeType},
248 + {"setup.timeType", "3", NULL, 0, checkTimeType},
249 {"setup.mainTime", "30:00", NULL, 0, checkTimeValue},
250 {"setup.igsBYTime", "10:00", NULL, 0, checkTimeValue},
251 {"setup.igsBYStones", "25", NULL, 0, checkBYStones},
252 @@ -189,13 +190,13 @@
253 {"client.x", "", NULL, 0, NULL},
254 {"client.y", "", NULL, 0, NULL},
255 {"client.bProp", "1.0", NULL, 0, checkBProp},
256 - {"client.bPropW", "1.0", NULL, 0, checkBProp},
257 + {"client.bPropW", "2.0", NULL, 0, checkBProp},
258 {"client.numberKibitz", "f", NULL, CLPSETUP_BOOL, NULL},
259 {"client.noTypo", "f", NULL, CLPSETUP_BOOL, NULL},
260 {"client.look.x", "", NULL, 0, NULL},
261 {"client.look.y", "", NULL, 0, NULL},
262 {"client.look.bProp", "1.0", NULL, 0, checkBProp},
263 - {"client.look.bPropW", "1.0", NULL, 0, checkBProp},
264 + {"client.look.bPropW", "2.0", NULL, 0, checkBProp},
265 {"client.saykib", "1", NULL, 0, NULL},
266 {"client.warnLimit", "30", NULL, 0, NULL},
267 {"abut.fsel.x", "", NULL, 0, NULL},
269 butEnv_setFont(cg->env, 1, msg_labelFonts,
271 butEnv_setFont(cg->env, 2, msg_bFonts, cg->fontH);
272 + butEnv_setFont(cg->env, 3, msg_fFonts, cg->fontH);
273 cgbuts_init(&cg->cgbuts, cg->env, cg->rnd, color,
274 clp_getBool(cg->clp, "client.noTypo"),
275 clp_getBool(cg->clp, "hiContrast"),
276 diff -ru cgoban-1.9.12-orig/src/client/board.c cgoban-1.9.12-et1/src/client/board.c
277 --- cgoban-1.9.12-orig/src/client/board.c Tue Jan 25 05:40:25 2000
278 +++ cgoban-1.9.12-et1/src/client/board.c Fri Apr 12 10:03:39 2002
280 static const ButKey ctrlKeys[] = {{XK_Control_L, 0,0},
281 {XK_Control_R,0,0}, {0,0,0}};
284 + Str gameName, whiteName, blackName;
286 cli = wms_malloc(sizeof(CliBoard));
289 cli->game->forcePlay = TRUE;
290 cli->sgf->mode = sgfInsert_variant;
292 + str_init(&whiteName);
293 + str_init(&blackName);
294 + str_print(&whiteName, "%s %s", str_chars(wName), str_chars(wRank));
295 + str_print(&blackName, "%s %s", str_chars(bName), str_chars(bRank));
296 str_print(&gameName, msg_cliGameName, gameNum,
297 - str_chars(wName), str_chars(wRank),
298 - str_chars(bName), str_chars(bRank));
299 + str_chars(&whiteName), str_chars(&blackName));
300 cli->goban = goban_create(cli->cg, &actions, cli, cli->game,
301 - "client", str_chars(&gameName));
302 + "client", str_chars(&gameName),
303 + str_chars(&whiteName), str_chars(&blackName));
304 goban_startTimer(cli->goban, goGame_whoseMove(cli->game));
305 goban_setHold(cli->goban, TRUE);
306 but_setFlags(cli->goban->save, BUT_NOPRESS);
307 + str_deinit(&blackName);
308 + str_deinit(&whiteName);
309 str_deinit(&gameName);
310 cli->goban->iDec1 = grid_create(&cli->cg->cgbuts, NULL, NULL,
311 cli->goban->iWin, 2, BUT_DRAWABLE, 0);
312 diff -ru cgoban-1.9.12-orig/src/client/conn.c cgoban-1.9.12-et1/src/client/conn.c
313 --- cgoban-1.9.12-orig/src/client/conn.c Tue Jan 25 05:40:25 2000
314 +++ cgoban-1.9.12-et1/src/client/conn.c Thu May 9 19:45:22 2002
315 @@ -142,64 +142,70 @@
317 static ButOut newNetData(void *packet, int fd) {
318 CliConn *cc = packet;
319 - int amtRead, totalAmtRead, readLen, lineStart, lineEnd;
325 - if (cc->inLen + totalAmtRead + 1 >= cc->inSize)
326 - expandBuf(&cc->inBuf, &cc->inSize, cc->inLen);
327 - readLen = cc->inSize - (cc->inLen + totalAmtRead + 1);
328 - amtRead = read(cc->fd, cc->inBuf + cc->inLen, readLen);
330 - if (errno == EAGAIN)
333 - cc->newData(cc->packet, NULL, errno);
336 - } else if (amtRead == 0) {
337 + if (cc->inLen + 1 >= cc->inSize) /* +1 for \0 */
338 + expandBuf(&cc->inBuf, &cc->inSize, len);
339 + /*FIXME: if server sends a sequence of non-LF chars we run OOM...*/
341 + len = read(cc->fd, cc->inBuf + cc->inLen, cc->inSize - cc->inLen - 1);
344 + if (len == 0) /* EOF */
345 + cc->newData(cc->packet, NULL, 0);
346 + else if (errno != EAGAIN)
347 cc->newData(cc->packet, NULL, errno);
350 - totalAmtRead += amtRead;
351 - } while (amtRead == readLen);
352 - totalAmtRead = telnetMunge(cc, totalAmtRead);
353 - if (totalAmtRead < 0) {
357 + len = telnetMunge(cc, len);
358 + if (len < 0) /* a telnet ^C packet */
360 cc->newData(cc->packet, NULL, EPIPE);
364 - if (totalAmtRead > 0) {
365 - cc->inLen += totalAmtRead;
366 - assert(cc->inLen < cc->inSize);
369 - lineEnd = lineStart;
370 - while ((lineEnd < cc->inLen) && (cc->inBuf[lineEnd] != '\n'))
372 - if ((lineEnd < cc->inLen) ||
374 - (((lineEnd - lineStart == 7) &&
375 - !strncmp(cc->inBuf + lineStart, "Login: ", 7)) ||
376 - ((lineEnd - lineStart == 10) &&
377 - !strncmp(cc->inBuf + lineStart, "Password: ", 10)) ||
378 - ((lineEnd - lineStart == 3) &&
379 - !strncmp(cc->inBuf + lineStart, "#> ", 3))))) {
380 - cc->inBuf[lineEnd] = '\0';
382 - printf("%s\n", cc->inBuf + lineStart);
386 + char *s = cc->inBuf;
387 + char *e = s + cc->inLen + len;
391 + /* pass complete lines */
392 + while (s < e && (p = memchr(s, '\n', e - s)))
396 + printf("`%s'\n", s);
398 - cc->newData(cc->packet, cc->inBuf + lineStart, lineEnd - lineStart);
399 - lineStart = lineEnd + 1;
402 + cc->newData(cc->packet, s, p - s);
405 - if (lineStart >= cc->inLen) {
407 - } else if (lineStart > 0) {
408 - memmove(cc->inBuf, cc->inBuf + lineStart, cc->inLen - lineStart);
409 - cc->inLen -= lineStart;
410 + /* in login mode we may pass (some) incomplete lines */
411 + if (s < e && cc->loginMode)
413 + /* strip trailing whitespace */
414 + for (p = e; p > s && isspace(p[-1]); *--p = '\0')
416 + if (!strcmp(s, "Login:") || !strcmp(s, "Password:") || !strcmp(s, "#>"))
419 + printf("`%s'\n", s);
421 + cc->newData(cc->packet, s, p - s);
429 + memmove(cc->inBuf, s, cc->inLen);
436 diff -ru cgoban-1.9.12-orig/src/client/game.c cgoban-1.9.12-et1/src/client/game.c
437 --- cgoban-1.9.12-orig/src/client/game.c Thu Feb 28 04:29:03 2002
438 +++ cgoban-1.9.12-et1/src/client/game.c Wed Apr 24 16:35:22 2002
441 physH = butEnv_fontH(gl->data->cg->env, 0);
442 bw = butEnv_stdBw(gl->data->cg->env);
443 - minWinW = physH * 18 + bw * 8;
444 + minWinW = physH * 19 + bw * 8;
445 winW = minWinW + physH * 2 * clp_getInt(cg->clp, "client.games.w");
446 wHRatio = clp_getDouble(cg->clp, "client.games.h2");
447 winH = ((double)(minWinW + physH * 12) * wHRatio + 0.5);
452 +void cliGameList_gotTitle(CliGameList *gl, const char *buf) {
453 + if (gl->defaultGame >= 0) {
454 + CliBoard *b = gl->games[gl->defaultGame].board;
456 + butText_set(b->goban->labelText, buf);
461 void cliGameList_gotMove(CliGameList *gl, const char *buf) {
463 int moveNum, handicap;
465 cliPlayerList_playerInGame(gl->playerList, bName, gameNum);
467 if (g->board && g->fromMatch && (move < 2)) {
468 + str_clip(&gl->data->cmdBuild, 0);
470 str_print(&gl->data->cmdBuild, "komi %g\n", g->komi);
471 if (g->board->moveBlack) {
474 int physFontH = butEnv_fontH(butWin_env(win), 0);
475 int slideW = (physFontH * 3)/2;
479 fontH = gl->data->cg->fontH;
480 @@ -535,28 +544,27 @@
482 butCan_resizeWin(gl->swin->win, 0, butList_len(gl->list) *
483 physFontH + bw * 2, TRUE);
484 - centerAdd = (physFontH * 3 + 1) / 4;
485 - tabs[0] = (physFontH * 2) / 2;
486 - tabs[1] = (physFontH * 3) / 2;
487 - tabs[2] = (physFontH * 17) / 2;
488 - tabs[3] = (physFontH * 20) / 2;
489 - tabs[4] = (physFontH * 37) / 2;
490 - tabs[5] = (physFontH * 41) / 2;
491 - tabs[6] = (physFontH * 45) / 2;
492 - tabs[7] = (physFontH * 49) / 2;
493 - tabs[8] = (physFontH * 53) / 2;
494 - tabs[9] = (physFontH * 57) / 2;
495 - if (w < physFontH * 20 + bw * 8)
496 + tabs[0] = (physFontH * 3) / 2;
497 + tabs[1] = (physFontH * 4) / 2;
498 + tabs[2] = (physFontH * 18) / 2;
499 + tabs[3] = (physFontH * 21) / 2;
500 + tabs[4] = (physFontH * 38) / 2;
501 + tabs[5] = (physFontH * 42) / 2;
502 + tabs[6] = (physFontH * 46) / 2;
503 + tabs[7] = (physFontH * 50) / 2;
504 + tabs[8] = (physFontH * 54) / 2;
505 + tabs[9] = (physFontH * 58) / 2;
506 + if (w < physFontH * 21 + bw * 8)
507 tabs[4] += physFontH * 20;
508 - if (w < physFontH * 22 + bw * 8)
509 + if (w < physFontH * 23 + bw * 8)
510 tabs[5] += physFontH * 20;
511 - if (w < physFontH * 24 + bw * 8)
512 + if (w < physFontH * 25 + bw * 8)
513 tabs[6] += physFontH * 20;
514 - if (w < physFontH * 26 + bw * 8)
515 + if (w < physFontH * 27 + bw * 8)
516 tabs[7] += physFontH * 20;
517 - if (w < physFontH * 28 + bw * 8)
518 + if (w < physFontH * 29 + bw * 8)
519 tabs[8] += physFontH * 20;
520 - if (w < physFontH * 30 + bw * 8)
521 + if (w < physFontH * 31 + bw * 8)
522 tabs[9] += physFontH * 20;
523 butList_setTabs(gl->title, tabs, tabAligns, 10);
524 butList_setTabs(gl->list, tabs, tabAligns, 10);
530 +opt_num(int num, int ignore)
532 + static char buf[64];
533 + static char *p = buf;
537 + if ((p += 8) >= buf + sizeof(buf))
539 + sprintf(p, "%d", num);
543 static void getListEl(CliGameList *gl, int gNum, Str *out) {
544 switch(gl->games[gNum].state) {
545 @@ -606,28 +627,30 @@
546 str_copyCharsLen(out, "", 0);
549 - str_print(out, "\t-\t%s [%s]\tvs.\t%s [%s]\t%d\t%d\t%d\t%g\t\t%s",
550 + str_print(out, "\t\t%s [%s]\tvs.\t%s [%s]\t%s\t%s\t%s\t%g\t\t%s",
551 str_chars(&gl->games[gNum].wName),
552 str_chars(&gl->games[gNum].wRank),
553 str_chars(&gl->games[gNum].bName),
554 str_chars(&gl->games[gNum].bRank),
555 - gl->games[gNum].moveNum,
556 - gl->games[gNum].size,
557 - gl->games[gNum].handicap, gl->games[gNum].komi,
558 + opt_num(gl->games[gNum].moveNum, 0),
559 + opt_num(gl->games[gNum].size, 19),
560 + opt_num(gl->games[gNum].handicap, 0),
561 + gl->games[gNum].komi,
562 str_chars(&gl->games[gNum].flags));
565 - str_print(out, "\t%d\t%s [%s]\tvs.\t%s [%s]\t%d\t%d\t%d\t%g\t%s\t(%d)",
566 + str_print(out, "\t%d\t%s [%s]\tvs.\t%s [%s]\t%s\t%s\t%s\t%g\t%s\t%s",
568 str_chars(&gl->games[gNum].wName),
569 str_chars(&gl->games[gNum].wRank),
570 str_chars(&gl->games[gNum].bName),
571 str_chars(&gl->games[gNum].bRank),
572 - gl->games[gNum].moveNum,
573 - gl->games[gNum].size,
574 - gl->games[gNum].handicap, gl->games[gNum].komi,
575 + opt_num(gl->games[gNum].moveNum, 0),
576 + opt_num(gl->games[gNum].size, 19),
577 + opt_num(gl->games[gNum].handicap, 0),
578 + gl->games[gNum].komi,
579 str_chars(&gl->games[gNum].flags),
580 - gl->games[gNum].observers);
581 + opt_num(gl->games[gNum].observers, 0));
585 diff -ru cgoban-1.9.12-orig/src/client/game.h cgoban-1.9.12-et1/src/client/game.h
586 --- cgoban-1.9.12-orig/src/client/game.h Tue Jan 25 05:40:25 2000
587 +++ cgoban-1.9.12-et1/src/client/game.h Wed Apr 3 23:13:29 2002
589 extern void cliGameList_deadStone(CliGameList *gl, const char *buf);
590 extern void cliGameList_gotUndo(CliGameList *gl, const char *buf);
591 extern bool cliGame_tellIsSay(CliGameList *list, Str *tell);
592 +extern void cliGameList_gotTitle(CliGameList *gl, const char *buf);
594 #endif /* _CLIENT_MAIN_H_ */
595 diff -ru cgoban-1.9.12-orig/src/client/login.c cgoban-1.9.12-et1/src/client/login.c
596 --- cgoban-1.9.12-orig/src/client/login.c Tue Jan 25 05:40:25 2000
597 +++ cgoban-1.9.12-et1/src/client/login.c Thu May 9 19:36:52 2002
599 cl = wms_malloc(sizeof(CliLogin));
602 - fs = butEnv_fontStr(cd->cg->env, 0);
603 + fs = butEnv_fontStr(cd->cg->env, TBIN_FONTNUM);
604 conn = cliConn_init(&cd->conn, cd->cg, cd->serverNum, cd->server,
605 fs->min_char_or_byte2, fs->max_char_or_byte2,
606 cliLogin_dataIn, cl);
608 cliMain_log(cl->main, "\n");
610 case cliLogin_waitForUser:
611 - if (!strcmp(buf, "Login: ")) {
612 + if (!strcmp(buf, "Login:")) {
613 cl->state = cliLogin_waitForPassword;
614 cliConn_send(&cl->cd->conn, str_chars(&cl->user));
615 cliMain_log(cl->main, str_chars(&cl->user));
618 case cliLogin_waitForPassword:
619 if (!strcmp(buf, "1 1") ||
620 - !strcmp(buf, "Password: ")) {
621 + !strcmp(buf, "Password:")) {
622 cl->state = cliLogin_waitForPrompt;
623 if ((str_len(&cl->pass) == 0) && (cl->cd->server == cliServer_nngs)) {
626 cliConn_send(&cl->cd->conn, str_chars(&cl->pass));
627 cliMain_log(cl->main, "******\n");
629 - } else if (!strcmp(buf, "#> ")) {
630 + } else if (!strcmp(buf, "#>")) {
631 cliConn_send(&cl->cd->conn, "toggle client 1\n");
632 cliMain_message(cl->main, msg_guest);
633 cl->state = cliLogin_waitForPrompt;
634 @@ -149,11 +149,11 @@
637 case cliLogin_waitForPrompt:
638 - if (!strcmp(buf, "Login: ")) {
639 + if (!strcmp(buf, "Login:")) {
640 cliMain_message(cl->main, msg_loginFailed);
641 cliLogin_destroy(cl, TRUE);
643 - } else if (!strcmp(buf, "#> ")) {
644 + } else if (!strcmp(buf, "#>")) {
645 cliConn_send(&cl->cd->conn, "toggle client 1\n");
646 cliMain_log(cl->main, "toggle client 1\n");
647 } else if (!strcmp(buf, "1 5")) {
648 diff -ru cgoban-1.9.12-orig/src/client/look.c cgoban-1.9.12-et1/src/client/look.c
649 --- cgoban-1.9.12-orig/src/client/look.c Tue Jan 25 05:40:25 2000
650 +++ cgoban-1.9.12-et1/src/client/look.c Fri Apr 12 09:50:42 2002
652 moveOk, moveOk, moveOk, moveOk};
656 + Str title, white, black;
657 static const GoTime noTime = {goTime_none, 0, 0, 0};
660 @@ -124,11 +124,13 @@
661 child = wms_malloc(sizeof(CliLookChild));
664 - str_print(&title, msg_cliLookName,
665 - str_chars(&look->name[goStone_white]),
666 - str_chars(&look->rank[goStone_white]),
667 - str_chars(&look->name[goStone_black]),
668 - str_chars(&look->rank[goStone_black]));
671 + str_print(&white, "%s %s", str_chars(&look->name[goStone_white]),
672 + str_chars(&look->rank[goStone_white]));
673 + str_print(&black, "%s %s", str_chars(&look->name[goStone_black]),
674 + str_chars(&look->rank[goStone_black]));
675 + str_print(&title, msg_cliLookName, str_chars(&white), str_chars(&black));
677 * I pass in a handicap of 0 even though I know the real handicap. Why?
678 * because otherwise when I parse over the board, if I find a white
681 makeMoves(game, str_chars(&look->boardData), size);
682 goban = goban_create(look->cg, &actions, child, game, "client.look",
683 - str_chars(&title));
684 + str_chars(&title), str_chars(&white), str_chars(&black));
685 goban->pic->allowedMoves = goPicMove_noWhite | goPicMove_noBlack;
686 goban->iDec1 = grid_create(&look->cg->cgbuts, NULL, NULL,
687 goban->iWin, 2, BUT_DRAWABLE, 0);
689 butText_set(goban->infoText, "Static Game Board");
691 child->goban = goban;
692 + str_deinit(&black);
693 + str_deinit(&white);
697 diff -ru cgoban-1.9.12-orig/src/client/main.c cgoban-1.9.12-et1/src/client/main.c
698 --- cgoban-1.9.12-orig/src/client/main.c Sat Feb 26 23:53:49 2000
699 +++ cgoban-1.9.12-et1/src/client/main.c Mon Apr 29 18:14:51 2002
706 + if (isspace(*buf)) {
710 str_copyCharsLen(&cMain->outStr, buf, bufLen);
711 str_catChar(&cMain->outStr, '\n');
714 cliGameList_deadStone(&cMain->gameList, buf);
715 else if (!strncmp(buf, "You can check ", 14))
716 cliGameList_selectDead(&cMain->gameList, buf);
717 + else if (!strncmp(buf, "Game is titled: ", 16))
718 + cliGameList_gotTitle(&cMain->gameList, buf + 16);
719 else if (!strncmp(buf, "Use <match", 10)) {
723 !strcmp(buf + bufLen - 26,
724 "withdraws the match offer.")))
725 cliMatch_declineCommand(cMain->playerList.match, buf);
726 - else if (strncmp(buf, "Adding game to", 14) &&
727 + else if (!strncmp(buf, "Player:", 7)) {
728 + /* it's hard to read... */
729 + cliMain_log(cMain, "--- Player stats ---\n");
730 + cliMain_log(cMain, str_chars(&cMain->outStr));
731 + } else if (strncmp(buf, "Adding game to", 14) &&
732 strncmp(buf, "{Game ", 6) &&
733 strncmp(buf, "Requesting ", 11) &&
734 strncmp(buf, "You decline", 11) &&
735 diff -ru cgoban-1.9.12-orig/src/client/match.c cgoban-1.9.12-et1/src/client/match.c
736 --- cgoban-1.9.12-orig/src/client/match.c Tue Jan 25 05:40:25 2000
737 +++ cgoban-1.9.12-et1/src/client/match.c Mon May 13 23:00:48 2002
739 match = cliMatch_create(data, oppName, next, rankDiff);
740 if ((colorChar == 'B') != match->meFirst)
741 swapPressed(match->swap);
742 +#if 0 /* ET: issue an automatic "stats <opponent>" on game request */
743 + str_print(&data->cmdBuild, "stats %s\n", oppName);
744 + cliConn_send(&data->conn, str_chars(&data->cmdBuild));
747 /* Modify an old one. */
748 XRaiseWindow(butEnv_dpy(butWin_env(match->win)), butWin_xwin(match->win));
749 diff -ru cgoban-1.9.12-orig/src/client/player.c cgoban-1.9.12-et1/src/client/player.c
750 --- cgoban-1.9.12-orig/src/client/player.c Tue Jan 25 05:40:25 2000
751 +++ cgoban-1.9.12-et1/src/client/player.c Mon Apr 29 17:42:29 2002
752 @@ -305,13 +305,14 @@
755 void cliPlayerList_whoOutput(CliPlayerList *pl, const char *buf) {
756 + int len = strlen(buf);
759 - if (buf[1] != 'I') {
760 + if (len > 20 && buf[1] != 'I') {
761 strncpy(onePlayer, buf, 35);
762 onePlayer[35] = '\0';
763 updatePlayer(pl, onePlayer);
764 - if (strlen(buf) > 50) {
766 strncpy(onePlayer, buf+37, 35);
767 onePlayer[35] = '\0';
768 updatePlayer(pl, onePlayer);
769 diff -ru cgoban-1.9.12-orig/src/control.c cgoban-1.9.12-et1/src/control.c
770 --- cgoban-1.9.12-orig/src/control.c Tue Jan 25 05:40:24 2000
771 +++ cgoban-1.9.12-et1/src/control.c Thu May 9 17:27:15 2002
773 ctrl->sPics[1] = grid_create(&cg->cgbuts, NULL, NULL, ctrl->win, 2,
774 BUT_DRAWABLE|BUT_PRESSTHRU, 0);
775 grid_setStone(ctrl->sPics[1], goStone_white, FALSE);
776 - grid_setVersion(ctrl->sPics[1], CGBUTS_WORLDEAST(1));
777 + if (clp_getStrNum(cg->clp, "client.protocol", serverNum)[0] == 'n')
778 + grid_setVersion(ctrl->sPics[1], CGBUTS_WORLDWEST(1));
780 + grid_setVersion(ctrl->sPics[1], CGBUTS_WORLDEAST(1));
781 grid_setLineGroup(ctrl->sPics[1], gridLines_none);
783 ctrl->lGame = butCt_create(localGoban, ctrl, ctrl->win, 1,
784 diff -ru cgoban-1.9.12-orig/src/editBoard.c cgoban-1.9.12-et1/src/editBoard.c
785 --- cgoban-1.9.12-orig/src/editBoard.c Tue Jan 25 05:40:24 2000
786 +++ cgoban-1.9.12-et1/src/editBoard.c Sun Apr 21 20:05:37 2002
790 eb->goban = goban_create(cg, &editBoard_actions, eb, eb->game, "edit",
792 + title, white, black);
794 str_destroy(tmpTitle);
795 eb->goban->iDec1 = stoneGroup_create(&cg->cgbuts, eb->goban->iWin, 2,
798 result = gobanOut_err;
800 + case editTool_cross:
801 + if (butEnv_keyModifiers(env) & ShiftMask) {
802 + if (!markGroup(eb, sgfType_cross, loc))
803 + result = gobanOut_err;
805 + eb->tools.modified = TRUE;
808 + eb->tools.modified = TRUE;
809 + setMark(eb, sgfType_cross, loc, setMark_toggle);
812 case editTool_triangle:
813 if (butEnv_keyModifiers(env) & ShiftMask) {
814 if (!markGroup(eb, sgfType_triangle, loc))
816 for (search = eb->sgf->active; search && (search->type != sgfType_node);
817 search = search->parent) {
818 if (((search->type == sgfType_triangle) ||
819 + (search->type == sgfType_cross) ||
820 (search->type == sgfType_circle) ||
821 (search->type == sgfType_square)) &&
822 (goBoard_sgf2Loc(eb->game->board, search->lVal) == loc)) {
823 @@ -853,11 +866,13 @@
824 eb->sgf->mode = sgfInsert_variant;
825 if (sType == sgfType_triangle) {
826 markAdded = goMark_triangle;
827 + } else if (sType == sgfType_circle) {
828 + markAdded = goMark_circle;
829 } else if (sType == sgfType_square) {
830 markAdded = goMark_square;
832 - assert(sType == sgfType_circle);
833 - markAdded = goMark_circle;
834 + assert(sType == sgfType_cross);
835 + markAdded = goMark_cross;
837 grid_setMark(eb->goban->pic->boardButs[loc], markAdded, 0);
841 oldMark = grid_markType(eb->goban->pic->boardButs[loc]);
842 if ((oldMark == goMark_triangle) || (oldMark == goMark_square) ||
843 - (oldMark == goMark_circle))
844 + (oldMark == goMark_cross) || (oldMark == goMark_circle))
845 action = setMark_forceOff;
847 action = setMark_forceOn;
848 @@ -1020,6 +1035,7 @@
849 pressAllowed = goPicMove_stone | goPicMove_noPass;
850 gameState = goGameState_selectDead;
852 + case editTool_cross:
853 case editTool_triangle:
854 case editTool_square:
855 case editTool_circle:
856 diff -ru cgoban-1.9.12-orig/src/editTool.c cgoban-1.9.12-et1/src/editTool.c
857 --- cgoban-1.9.12-orig/src/editTool.c Wed Feb 9 07:50:02 2000
858 +++ cgoban-1.9.12-et1/src/editTool.c Sun Apr 21 20:05:47 2002
860 grid_setLineGroup(b, gridLines_none);
861 grid_setVersion(b, CGBUTS_YINYANG(1));
863 + etw->selDesc[editTool_cross] = b =
864 + grid_create(&cg->cgbuts, NULL, NULL, etw->toolWin,
865 + 2, BUT_DRAWABLE|BUT_PRESSTHRU, 0);
866 + grid_setStone(b, goStone_black, FALSE);
867 + grid_setLineGroup(b, gridLines_none);
868 + grid_setMark(b, goMark_cross, 0);
870 etw->selDesc[editTool_triangle] = b =
871 grid_create(&cg->cgbuts, NULL, NULL, etw->toolWin,
872 2, BUT_DRAWABLE|BUT_PRESSTHRU, 0);
873 diff -ru cgoban-1.9.12-orig/src/editTool.h cgoban-1.9.12-et1/src/editTool.h
874 --- cgoban-1.9.12-orig/src/editTool.h Wed Feb 9 07:50:02 2000
875 +++ cgoban-1.9.12-et1/src/editTool.h Sun Apr 21 20:05:57 2002
877 **********************************************************************/
879 editTool_play, editTool_changeBoard, editTool_score,
880 - editTool_triangle, editTool_square, editTool_circle,
881 + editTool_cross, editTool_triangle, editTool_square, editTool_circle,
882 editTool_letter, editTool_number
884 #define editTool_min editTool_play
885 diff -ru cgoban-1.9.12-orig/src/gmp/play.c cgoban-1.9.12-et1/src/gmp/play.c
886 --- cgoban-1.9.12-orig/src/gmp/play.c Wed Feb 9 07:50:05 2000
887 +++ cgoban-1.9.12-et1/src/gmp/play.c Fri Apr 12 09:47:22 2002
893 + const char *title, *white = NULL, *black = NULL;
902 + me = sgf_findFirstType(mc, sgfType_playerName);
904 + if (me->gVal == goStone_white)
905 + white = str_chars(me->sVal);
907 + black = str_chars(me->sVal);
908 + me = sgfElem_findFirstType(me, sgfType_playerName);
911 l->goban = goban_create(cg, &gmpPlay_actions, l, l->game, "local",
913 + title, white, black);
914 l->goban->pic->allowedMoves |= goPicMove_noWhite | goPicMove_noBlack;
915 goPic_update(l->goban->pic);
916 goban_message(l->goban, msg_waitingForGame);
917 diff -ru cgoban-1.9.12-orig/src/goTime.c cgoban-1.9.12-et1/src/goTime.c
918 --- cgoban-1.9.12-orig/src/goTime.c Tue Jan 25 05:40:24 2000
919 +++ cgoban-1.9.12-et1/src/goTime.c Fri Apr 12 10:07:29 2002
922 case(goTime_canadian):
923 goTime_str(tLeft, out);
924 - str_catChar(out, '/');
925 + str_catChars(out, " / ");
926 if (timer->aux == 0) {
927 str_catChar(out, '-');
930 case(goTime_japanese):
931 goTime_str(tLeft, out);
932 if (tLeft <= time->aux * time->by) {
933 - str_catChar(out, '(');
934 + str_catChars(out, " (");
936 str_catChar(out, '0');
938 diff -ru cgoban-1.9.12-orig/src/goban.c cgoban-1.9.12-et1/src/goban.c
939 --- cgoban-1.9.12-orig/src/goban.c Thu Feb 28 04:34:35 2002
940 +++ cgoban-1.9.12-et1/src/goban.c Tue May 7 22:19:50 2002
944 Goban *goban_create(Cgoban *cg, const GobanActions *actions,void *packet,
945 - GoGame *game, const char *clpName, const char *title) {
946 + GoGame *game, const char *clpName, const char *title,
947 + const char *white, const char *black) {
948 static ButKey rewKeys[] = {{XK_Home, 0,0}, {0,0,0}};
949 static ButKey backKeys[] = {{XK_Left, 0,0}, {0,0,0}};
950 static ButKey fwdKeys[] = {{XK_Right, 0,0}, {0,0,0}};
952 winSize = WIN_W(cg->fontH, butEnv_stdBw(cg->env));
954 g->win = butWin_iCreate(g, cg->env, title,
955 - (int)(winSize * clpEntry_getDouble(g->bPropW) + 0.5),
956 + (int)(winSize * clpEntry_getDouble(g->bPropW)/2 + 0.5),
957 (int)(winSize * clpEntry_getDouble(g->bProp) + 0.5),
958 &g->iWin, FALSE, 64,64, NULL, NULL, resize,
960 @@ -181,20 +182,25 @@
961 but_setKeys(g->ff, ffKeys);
963 for (s = goStone_white; s <= goStone_black; ++s) {
964 + const char *name = s == goStone_white ? white : black;
966 pi = &g->playerInfos[s];
967 pi->box = butBoxFilled_create(g->win, 1, BUT_DRAWABLE);
968 - for (i = 0; i < 5; ++i) {
969 - assert(i < CGBUTS_NUMWHITE);
970 - pi->stones[i] = grid_create(&g->cg->cgbuts, NULL, NULL, g->win, 2,
972 - grid_setStone(pi->stones[i], s, FALSE);
973 - grid_setLineGroup(pi->stones[i], gridLines_none);
974 - grid_setVersion(pi->stones[i], i);
977 + pi->stone = grid_create(&g->cg->cgbuts, NULL, NULL, g->win, 2,
979 + grid_setStone(pi->stone, s, FALSE);
980 + grid_setLineGroup(pi->stone, gridLines_none);
981 + /*grid_setVersion(pi->stones[i], i);*/
983 + pi->nameLabel = butText_create(g->win, 2, BUT_DRAWABLE, name, butText_left);
984 + butText_setFont(pi->nameLabel, 2);
986 pi->capsLabel = butText_create(g->win, 2, BUT_DRAWABLE,
987 msg_score, butText_left);
988 pi->capsOut = butText_create(g->win, 3, BUT_DRAWABLE, "0", butText_right);
989 butText_setColor(pi->capsOut, CGBUTS_COLORREDLED, FALSE);
990 + butText_setFont(pi->capsOut, 2);
991 pi->capsBox = butBoxFilled_create(g->win, 2, BUT_DRAWABLE);
992 butBoxFilled_setColors(pi->capsBox, BUT_SHAD,BUT_LIT,BUT_FG);
993 pi->timeLabel = butText_create(g->win, 2, BUT_DRAWABLE,
995 pi->timeOut = butText_create(g->win, 3, BUT_DRAWABLE, "",
997 butText_setColor(pi->timeOut, CGBUTS_COLORREDLED, FALSE);
998 + butText_setFont(pi->timeOut, 2);
999 pi->timeBox = butBoxFilled_create(g->win, 2, BUT_DRAWABLE);
1000 butBoxFilled_setColors(pi->timeBox, BUT_SHAD,BUT_LIT,BUT_FG);
1003 butW = fontH * 10 + bw*4;
1004 boardW = winW - butW - fontH*3 - bw*2;
1005 clpEntry_setDouble(g->bProp, (double)winH / (double)butWin_getMinH(win));
1006 - clpEntry_setDouble(g->bPropW, (double)winW / (double)butWin_getMinW(win)/2.0);
1007 + clpEntry_setDouble(g->bPropW, (double)winW / (double)butWin_getMinW(win));
1010 butSpc = fontH * 2 + bw;
1012 for (s = goStone_white; s <= goStone_black; ++s) {
1013 pi = &g->playerInfos[s];
1014 but_resize(pi->box, butX,butY, butW,boxH);
1015 - for (i = 0; i < 5; ++i)
1016 - but_resize(pi->stones[i], butX+bw*2+bigStoneW*2*i + fontH/2,
1017 - butY+bw*2 + fontH/2, fontH, fontH);
1018 + but_resize(pi->stone, butX+bw*2 + fontH/2, butY+bw*2 + fontH/2,fontH,fontH);
1019 + butText_resize(pi->nameLabel, butX+bw*2+bigStoneW*2 + 0*fontH/2,
1020 + butY+bw*2 + fontH/2, fontH);
1021 butText_resize(pi->capsLabel, butX+bw*2,butY+butSpc+bw*2, butH);
1022 but_resize(pi->capsOut, x+bw*2,butY+bw*3+butSpc, w-bw*4,butH-bw*2);
1023 but_resize(pi->capsBox, x,butY+bw*2+butSpc, w,butH);
1025 butTbin_setReadOnly(g->comments->tbin, TRUE);
1026 butPlain_setColor(g->comments->bg, BUT_BG);
1027 g->kibIn = butTextin_create(gotKibitz, g, g->win, 1,
1028 - BUT_PRESSABLE|BUT_DRAWABLE, "", 200);
1029 + BUT_PRESSABLE|BUT_DRAWABLE|BUT_KEYED, "", 200);
1031 g->kibType = butRadio_create(newKibVal, g, g->win, 1,
1032 kibFlags, kibVal, 3);
1033 diff -ru cgoban-1.9.12-orig/src/goban.h cgoban-1.9.12-et1/src/goban.h
1034 --- cgoban-1.9.12-orig/src/goban.h Thu Feb 28 04:34:35 2002
1035 +++ cgoban-1.9.12-et1/src/goban.h Fri Apr 12 09:21:52 2002
1039 typedef struct GobanPlayerInfo_struct {
1040 - But *box, *stones[5], *capsLabel, *capsOut, *timeLabel, *timeOut;
1041 + But *box, *stone, *nameLabel, *capsLabel, *capsOut, *timeLabel, *timeOut;
1042 But *capsBox, *timeBox;
1046 **********************************************************************/
1047 extern Goban *goban_create(Cgoban *cg, const GobanActions *actions,
1048 void *packet, GoGame *game, const char *bPropName,
1049 - const char *title);
1050 + const char *title,
1051 + const char *white, const char *black);
1052 #define goban_setTitle(g, n) butText_set((g)->labelText, (n))
1053 #define goban_getComments(g) abutTerm_get((g)->comments)
1054 #define goban_setComments(g, c) abutTerm_set((g)->comments, (c))
1055 diff -ru cgoban-1.9.12-orig/src/local.c cgoban-1.9.12-et1/src/local.c
1056 --- cgoban-1.9.12-orig/src/local.c Wed Feb 9 07:50:02 2000
1057 +++ cgoban-1.9.12-et1/src/local.c Fri Apr 12 10:47:42 2002
1062 - const char *title;
1063 + const char *title, *white = NULL, *black = NULL;
1066 l = wms_malloc(sizeof(Local));
1067 @@ -176,6 +176,10 @@
1069 me = sgf_findFirstType(mc, sgfType_playerName);
1071 + if (me->gVal == goStone_white)
1072 + white = str_chars(me->sVal);
1074 + black = str_chars(me->sVal);
1075 me = sgfElem_findFirstType(me, sgfType_playerName);
1077 me = sgf_findFirstType(mc, sgfType_time);
1081 l->goban = goban_create(cg, &local_actions, l, l->game, "local",
1083 + title, white, black);
1084 l->goban->iDec1 = grid_create(&cg->cgbuts, NULL, NULL, l->goban->iWin, 2,
1086 grid_setStone(l->goban->iDec1, goStone_white, FALSE);
1087 diff -ru cgoban-1.9.12-orig/src/main.c cgoban-1.9.12-et1/src/main.c
1088 --- cgoban-1.9.12-orig/src/main.c Sun Feb 27 00:03:46 2000
1089 +++ cgoban-1.9.12-et1/src/main.c Mon May 13 14:46:40 2002
1091 #include "editBoard.h"
1093 #include "client/setup.h"
1094 +#include "client/login.h"
1099 * Forward Declarations
1100 **********************************************************************/
1101 static void stealth(int exitVal);
1102 +static int connect_to(Cgoban *cg, const char *server);
1104 static RETSIGTYPE sigHandler();
1112 cg = cgoban_create(argc, argv, envp);
1115 crwin_create(cg, e->goban->win, 4);
1116 control_create(cg, TRUE);
1118 + } else if (clp_getStr(cg->clp, "connect")[0]) {
1119 + retVal = connect_to(cg, clp_getStr(cg->clp, "connect"));
1120 } else if (clp_getBool(cg->clp, "nngs")) {
1121 - if ((client = cliSetup_create(cg, cliServer_nngs)) == NULL) {
1122 - cg->env->minWindows = 0;
1125 - crwin_create(cg, client->login->win, 3);
1126 - control_create(cg, TRUE);
1128 + retVal = connect_to(cg, "NNGS");
1129 } else if (clp_getBool(cg->clp, "igs")) {
1130 - if ((client = cliSetup_create(cg, cliServer_igs)) == NULL) {
1131 - cg->env->minWindows = 0;
1134 - crwin_create(cg, client->login->win, 3);
1135 - control_create(cg, TRUE);
1137 + retVal = connect_to(cg, "IGS");
1139 ctrl = control_create(cg, clp_getBool(cg->clp, "iconic"));
1140 crwin_create(cg, ctrl->win, 3);
1148 +static int connect_to(Cgoban *cg, const char *server) {
1152 + sNames = clp_lookup(cg->clp, "client.server");
1153 + for (serverNum = 0; serverNum < SETUP_MAXSERVERS; serverNum++)
1154 + if (!strcmp(server, clpEntry_getStrNum(sNames, serverNum))) {
1155 +#if 1 /* auto-login */
1158 + const char *user = clp_getStrNum(cg->clp, "client.username", serverNum);
1159 + const char *pass = clp_getStrNum(cg->clp, "client.password", serverNum);
1161 + cd = cliData_create(cg, serverNum, NULL, NULL);
1162 + str_copyChars(&cd->userName, user);
1163 + if ((cl = cliLogin_create(cd, user, pass)) != NULL) {
1164 + cliData_decRef(cd); /*ET: not sure!?! */
1165 + crwin_create(cg, cl->main->win, 3);
1166 + control_create(cg, TRUE);
1169 +#else /* request username/password (old behaviour) */
1172 + if ((client = cliSetup_create(cg, serverNum)) != NULL) {
1173 + crwin_create(cg, client->login->win, 3);
1174 + control_create(cg, TRUE);
1180 + if (serverNum >= SETUP_MAXSERVERS)
1181 + fprintf(stderr, "cgoban: Cannot find server '%s' in setup.\n", server);
1182 + cg->env->minWindows = 0;
1187 diff -ru cgoban-1.9.12-orig/src/msg.c cgoban-1.9.12-et1/src/msg.c
1188 --- cgoban-1.9.12-orig/src/msg.c Tue Jan 25 05:40:25 2000
1189 +++ cgoban-1.9.12-et1/src/msg.c Mon May 13 23:22:18 2002
1192 **********************************************************************/
1193 const char msg_mFonts[] =
1194 + "-adobe-helvetica-medium-r-normal--%d-*-*-*-*-*-*-*/"
1195 "-adobe-utopia-medium-r-normal--%d-*-*-*-*-*-*-*/"
1196 "-adobe-times-medium-r-normal--%d-*-*-*-*-*-*-*/"
1197 "-bitstream-charter-medium-r-normal--%d-*-*-*-*-*-*-*";
1198 const char msg_labelFonts[] =
1199 "-adobe-helvetica-bold-r-normal--%d-*-*-*-*-*-*-*";
1200 const char msg_bFonts[] =
1201 + "-adobe-helvetica-bold-r-normal--%d-*-*-*-*-*-*-*/"
1202 "-adobe-utopia-bold-r-normal--%d-*-*-*-*-*-*-*/"
1203 "-adobe-times-bold-r-normal--%d-*-*-*-*-*-*-*/"
1204 "-bitstream-charter-black-r-normal--%d-*-*-*-*-*-*-*";
1205 +const char msg_fFonts[] =
1206 + "-jmk-neep-medium-r-*--*-%d0-*-*-*-*-*-*/"
1207 + "-b&h-lucidatypewriter-medium-r-normal-*-%d-*-*-*-*-*-*-*/"
1208 + "-adobe-courier-medium-r-normal--%d-*-*-*-*-*-*-*/"
1209 + "-bitstream-courier-black-r-normal--%d-*-*-*-*-*-*-*/"
1214 @@ -213,12 +221,13 @@
1216 /* From editTools.c */
1217 const char *msg_toolNames[] = {
1218 - "Play Game", "Edit Board", "Compute Score", "Add Triangle", "Add Square",
1219 - "Add Circle", "Add Letter", "Number Stones"};
1220 + "Play Game", "Edit Board", "Compute Score", "Add Mark", "Add Triangle",
1221 + "Add Square", "Add Circle", "Add Letter", "Number Stones"};
1222 const char *msg_toolDesc1[] = {
1223 "Click to play a stone",
1224 "Click to add/remove white stones",
1225 "Click to mark stones as dead",
1226 + "Click to add/remove cross marks",
1227 "Click to add/remove triangle marks",
1228 "Click to add/remove square marks",
1229 "Click to add/remove circle marks",
1231 "Shift-click to mark groups of stones",
1232 "Shift-click to mark groups of stones",
1233 "Shift-click to mark groups of stones",
1234 + "Shift-click to mark groups of stones",
1236 "Shift-click to add/remove move numbers"};
1237 const char msg_killNode[] = "Delete Moves";
1239 "Login is in progress.";
1241 /* From client/board.c */
1242 -const char msg_cliGameName[] = "Game %d: %s %s (W) vs. %s %s (B)";
1243 +const char msg_cliGameName[] = "Game %d: %s (W) vs. %s (B)";
1244 const char msg_close[] = "Close";
1245 const char msg_adjourn[] = "Adjourn";
1246 const char msg_resign[] = "Resign";
1250 /* From client/look.c */
1251 -const char msg_cliLookName[] = "%s %s (W) vs. %s %s (B)";
1252 +const char msg_cliLookName[] = "%s (W) vs. %s (B)";
1253 const char msg_cliLookInfo[] = "Static Game Board";
1255 /* From client/main.c */
1256 diff -ru cgoban-1.9.12-orig/src/msg.h cgoban-1.9.12-et1/src/msg.h
1257 --- cgoban-1.9.12-orig/src/msg.h Tue Jan 25 05:40:25 2000
1258 +++ cgoban-1.9.12-et1/src/msg.h Wed Apr 3 02:46:45 2002
1260 /**********************************************************************
1262 **********************************************************************/
1263 -extern const char msg_mFonts[], msg_labelFonts[], msg_bFonts[];
1264 +extern const char msg_mFonts[], msg_labelFonts[], msg_bFonts[], msg_fFonts[];
1266 /* From "crwin.c" */
1267 extern const char msg_byBillShubert[];
1268 diff -ru cgoban-1.9.12-orig/src/sgf.h cgoban-1.9.12-et1/src/sgf.h
1269 --- cgoban-1.9.12-orig/src/sgf.h Tue Jan 25 05:40:25 2000
1270 +++ cgoban-1.9.12-et1/src/sgf.h Sun Apr 21 20:07:00 2002
1272 sgfType_timeLeft, sgfType_stonesLeft,
1273 sgfType_setBoard, sgfType_territory,
1275 - sgfType_triangle, sgfType_square, sgfType_circle, sgfType_label,
1276 + sgfType_cross,sgfType_triangle,sgfType_square,sgfType_circle,sgfType_label,
1278 sgfType_comment, sgfType_result
1281 #define sgf_addTerritory(mc, color, loc) \
1282 sgf_addCLElem(mc, sgfType_territory, color, loc)
1283 #define sgf_addTriangle(mc, loc) sgf_addLElem(mc, sgfType_triangle, loc)
1284 +#define sgf_addCross(mc, loc) sgf_addLElem(mc, sgfType_cross, loc)
1285 #define sgf_addCircle(mc, loc) sgf_addLElem(mc, sgfType_circle, loc)
1286 #define sgf_addSquare(mc, loc) sgf_addLElem(mc, sgfType_square, loc)
1287 #define sgf_label(mc, loc, label) \
1288 diff -ru cgoban-1.9.12-orig/src/sgfIn.c cgoban-1.9.12-et1/src/sgfIn.c
1289 --- cgoban-1.9.12-orig/src/sgfIn.c Thu Nov 30 00:45:42 2000
1290 +++ cgoban-1.9.12-et1/src/sgfIn.c Tue Apr 23 21:18:10 2002
1291 @@ -331,12 +331,17 @@
1293 return(msg_sgfBadLoc);
1295 - case(TOKEN2('M','A')): /* I draw "MA" (mark) as a square. */
1296 - case(TOKEN1('M')): /* Some games have marks as "M[..]". */
1297 + case(TOKEN2('S','Q')):
1298 arg_multi(arg, mc, sgfType_square, goStone_empty, &err);
1300 return(msg_sgfBadLoc);
1302 + case(TOKEN2('M','A')):
1303 + case(TOKEN1('M')): /* Some games have marks as "M[..]". */
1304 + arg_multi(arg, mc, sgfType_cross, goStone_empty, &err);
1306 + return(msg_sgfBadLoc);
1308 case(TOKEN2('L','B')):
1309 arg_multiLabel(arg, mc, &err);
1314 state = state_token;
1315 - str_copyChars(&buf, "");
1316 + str_clip(&buf, 0);
1320 diff -ru cgoban-1.9.12-orig/src/sgfMap.c cgoban-1.9.12-et1/src/sgfMap.c
1321 --- cgoban-1.9.12-orig/src/sgfMap.c Tue Jan 25 05:40:25 2000
1322 +++ cgoban-1.9.12-et1/src/sgfMap.c Sun Apr 21 20:31:04 2002
1324 cgbuts_drawp(map->cgbuts, win, stone, grey,
1325 stoneX, stoneY, gridSize,
1326 x % CGBUTS_NUMWHITE, dx, dy, dw, dh);
1327 - } if (el->flags & SGFMAPFLAGS_MARKED)
1329 + if (el->flags & SGFMAPFLAGS_MARKED)
1330 cgbuts_markPiece(map->cgbuts, win, stone, goMark_triangle, 0,
1331 stoneX, stoneY, gridSize, 1, dx, dy, dw, dh);
1332 else if (stone != goStone_empty)
1335 me->moveNum = ++moveNum;
1337 + case sgfType_cross:
1338 case sgfType_triangle:
1339 case sgfType_comment:
1340 case sgfType_square:
1345 + case sgfType_cross:
1346 case sgfType_triangle:
1347 case sgfType_comment:
1348 case sgfType_square:
1349 diff -ru cgoban-1.9.12-orig/src/sgfOut.c cgoban-1.9.12-et1/src/sgfOut.c
1350 --- cgoban-1.9.12-orig/src/sgfOut.c Sat Apr 7 01:10:19 2001
1351 +++ cgoban-1.9.12-et1/src/sgfOut.c Sun Apr 21 20:08:57 2002
1352 @@ -184,6 +184,10 @@
1353 me = printPoints(nodeOut, mc, me);
1356 + case sgfType_cross:
1357 + str_copyChars(nodeOut, "MA");
1358 + me = printPoints(nodeOut, mc, me);
1360 case sgfType_triangle:
1361 str_copyChars(nodeOut, "TR");
1362 me = printPoints(nodeOut, mc, me);
1364 me = printPoints(nodeOut, mc, me);
1366 case sgfType_square:
1367 - str_copyChars(nodeOut, "MA");
1368 + str_copyChars(nodeOut, "SQ");
1369 me = printPoints(nodeOut, mc, me);
1372 diff -ru cgoban-1.9.12-orig/src/sgfPlay.c cgoban-1.9.12-et1/src/sgfPlay.c
1373 --- cgoban-1.9.12-orig/src/sgfPlay.c Tue Jan 25 05:40:25 2000
1374 +++ cgoban-1.9.12-et1/src/sgfPlay.c Sun Apr 21 20:09:48 2002
1376 grid_setMark(pic->boardButs[loc], mark, 0);
1379 + case sgfType_cross:
1380 case sgfType_triangle:
1381 case sgfType_circle:
1382 case sgfType_square:
1383 @@ -234,8 +235,10 @@
1384 mark = goMark_triangle;
1385 else if (me->type == sgfType_circle)
1386 mark = goMark_circle;
1387 - else /* me->type == sgfType_square */
1388 + else if (me->type == sgfType_square)
1389 mark = goMark_square;
1390 + else /* me->type == sgfType_cross */
1391 + mark = goMark_cross;
1392 loc = goBoard_sgf2Loc(game->board, me->lVal);
1393 changed[loc] = TRUE;
1394 if (grid_grey(pic->boardButs[loc])) {
1395 diff -ru cgoban-1.9.12-orig/wmslib/src/abut/term.c cgoban-1.9.12-et1/wmslib/src/abut/term.c
1396 --- cgoban-1.9.12-orig/wmslib/src/abut/term.c Tue Jan 25 05:40:25 2000
1397 +++ cgoban-1.9.12-et1/wmslib/src/abut/term.c Sun May 12 23:15:58 2002
1399 env = term->abut->env;
1400 butTbin_set(term->tbin, text);
1401 butCan_resizeWin(term->swin->win, 0, butTbin_numLines(term->tbin) *
1402 - butEnv_fontH(env, 0) + butEnv_stdBw(env) * 2, TRUE);
1403 + butEnv_fontH(env, TBIN_FONTNUM) + butEnv_stdBw(env) * 2, TRUE);
1407 void abutTerm_resize(AbutTerm *term, int x, int y, int w, int h) {
1408 - int fontH = butEnv_fontH(term->abut->env, 0);
1409 - int bw = butEnv_stdBw(term->abut->env);
1413 assert(MAGIC(term));
1414 - abutSwin_resize(term->swin, x, y, w, h, (fontH * 3) / 2, fontH);
1415 + env = term->abut->env;
1416 + fontH = butEnv_fontH(term->abut->env, TBIN_FONTNUM);
1417 + abutSwin_resize(term->swin, x, y, w, h, (butEnv_fontH(env, 0) * 3) / 2, fontH);
1418 butCan_resizeWin(term->swin->win, 0, butTbin_numLines(term->tbin) * fontH +
1420 + butEnv_stdBw(env) * 2, TRUE);
1425 term = swin->packet;
1426 assert(MAGIC(term));
1427 newState = abutTermState_steady;
1428 - h = butEnv_fontH(env, 0);
1429 + h = butEnv_fontH(env, TBIN_FONTNUM);
1430 y = activeLine * h + bw;
1431 if (passiveLine != activeLine) {
1432 if (y <= butCan_yOff(win) + bw) {
1433 diff -ru cgoban-1.9.12-orig/wmslib/src/but/i_win.c cgoban-1.9.12-et1/wmslib/src/but/i_win.c
1434 --- cgoban-1.9.12-orig/wmslib/src/but/i_win.c Sun Feb 27 00:03:49 2000
1435 +++ cgoban-1.9.12-et1/wmslib/src/but/i_win.c Sat May 11 02:58:28 2002
1437 static Atom protocols[1];
1438 /* Stupid X doesn't call their strings const always. */
1440 - char annoy2[] = "Basicwin";
1441 + static char annoy2[] = "CGoban";
1443 sizeHints = XAllocSizeHints();
1444 if (win->x != int_max) {
1446 wm_hints.initial_state = NormalState;
1447 wm_hints.input = True;
1449 - class_hints.res_name = annoyance;
1450 - class_hints.res_class = annoy2;
1451 + class_hints.res_class = annoyance;
1452 + class_hints.res_name = annoy2;
1453 XSetWMProperties(dpy, win->win, &windowName, &iconName, dumb_argv, 0,
1454 sizeHints, &wm_hints, &class_hints);
1455 protocols[0] = but_wmDeleteWindow;
1456 diff -ru cgoban-1.9.12-orig/wmslib/src/but/rcur.c cgoban-1.9.12-et1/wmslib/src/but/rcur.c
1457 --- cgoban-1.9.12-orig/wmslib/src/but/rcur.c Tue Jan 25 05:40:26 2000
1458 +++ cgoban-1.9.12-et1/wmslib/src/but/rcur.c Wed Apr 24 00:27:19 2002
1460 for (i = butCur_idle; i < butCur_bogus; ++i)
1461 cursors[i].pic = NULL;
1463 - cursors[butCur_idle].fontcurnum = XC_left_ptr;
1464 + cursors[butCur_idle].fontcurnum = XC_top_left_arrow;
1465 cursors[butCur_idle].hotX = 1;
1466 cursors[butCur_idle].hotY = 1;
1467 cursors[butCur_idle].w = 16;
1469 cursors[butCur_idle].pic = ntp_bits;
1470 cursors[butCur_idle].mask = ntm_bits;
1472 - cursors[butCur_twitch].fontcurnum = XC_arrow;
1473 + cursors[butCur_twitch].fontcurnum = XC_top_left_arrow;
1474 cursors[butCur_twitch].hotX = 14;
1475 cursors[butCur_twitch].hotY = 1;
1476 cursors[butCur_twitch].w = 16;
1478 cursors[butCur_text].pic = txtp_bits;
1479 cursors[butCur_text].mask = txtm_bits;
1481 - cursors[butCur_up].fontcurnum = XC_sb_up_arrow;
1482 + cursors[butCur_up].fontcurnum = XC_top_left_arrow;
1483 cursors[butCur_up].hotX = 14;
1484 cursors[butCur_up].hotY = 14;
1485 cursors[butCur_up].w = 16;
1487 cursors[butCur_up].pic = ntp_bits;
1488 cursors[butCur_up].mask = ntm_bits;
1490 - cursors[butCur_down].fontcurnum = XC_sb_down_arrow;
1491 + cursors[butCur_down].fontcurnum = XC_top_left_arrow;
1492 cursors[butCur_down].hotX = 14;
1493 cursors[butCur_down].hotY = 14;
1494 cursors[butCur_down].w = 16;
1496 cursors[butCur_down].pic = ntp_bits;
1497 cursors[butCur_down].mask = ntm_bits;
1499 - cursors[butCur_left].fontcurnum = XC_sb_left_arrow;
1500 + cursors[butCur_left].fontcurnum = XC_top_left_arrow;
1501 cursors[butCur_left].hotX = 14;
1502 cursors[butCur_left].hotY = 14;
1503 cursors[butCur_left].w = 16;
1505 cursors[butCur_left].pic = ntp_bits;
1506 cursors[butCur_left].mask = ntm_bits;
1508 - cursors[butCur_right].fontcurnum = XC_sb_right_arrow;
1509 + cursors[butCur_right].fontcurnum = XC_top_left_arrow;
1510 cursors[butCur_right].hotX = 14;
1511 cursors[butCur_right].hotY = 14;
1512 cursors[butCur_right].w = 16;
1514 cursors[butCur_right].pic = ntp_bits;
1515 cursors[butCur_right].mask = ntm_bits;
1517 - cursors[butCur_lr].fontcurnum = XC_sb_h_double_arrow;
1518 + cursors[butCur_lr].fontcurnum = XC_top_left_arrow;
1519 cursors[butCur_lr].hotX = 14;
1520 cursors[butCur_lr].hotY = 14;
1521 cursors[butCur_lr].w = 16;
1523 cursors[butCur_lr].pic = ntp_bits;
1524 cursors[butCur_lr].mask = ntm_bits;
1526 - cursors[butCur_ud].fontcurnum = XC_sb_v_double_arrow;
1527 + cursors[butCur_ud].fontcurnum = XC_top_left_arrow;
1528 cursors[butCur_ud].hotX = 14;
1529 cursors[butCur_ud].hotY = 14;
1530 cursors[butCur_ud].w = 16;
1532 cursors[butCur_ud].pic = ntp_bits;
1533 cursors[butCur_ud].mask = ntm_bits;
1535 - cursors[butCur_grab].fontcurnum = XC_fleur;
1536 + cursors[butCur_grab].fontcurnum = XC_top_left_arrow;
1537 cursors[butCur_grab].hotX = 14;
1538 cursors[butCur_grab].hotY = 14;
1539 cursors[butCur_grab].w = 16;
1540 @@ -199,6 +199,11 @@
1541 cursors[i].w, cursors[i].h);
1542 env->cmask[i] = XCreateBitmapFromData(env->dpy, d, cursors[i].mask,
1543 cursors[i].w, cursors[i].h);
1545 + { /* make the idle cursor dull */
1546 + static XColor gray1 = { 0, 0x8888,0x8888,0x8888, DoRed|DoGreen|DoBlue };
1547 + static XColor gray2 = { 0, 0xcccc,0xcccc,0xcccc, DoRed|DoGreen|DoBlue };
1548 + XRecolorCursor(env->dpy, env->cursors[butCur_idle], &gray1, &gray2);
1550 env->curnum = butCur_idle;
1552 diff -ru cgoban-1.9.12-orig/wmslib/src/but/slide.c cgoban-1.9.12-et1/wmslib/src/but/slide.c
1553 --- cgoban-1.9.12-orig/wmslib/src/but/slide.c Tue Jan 25 05:40:26 2000
1554 +++ cgoban-1.9.12-et1/wmslib/src/but/slide.c Mon May 13 00:32:46 2002
1556 atj = slide->timer_jump;
1558 atj = -slide->timer_jump;
1559 - slide->timer = butTimer_fCreate(NULL, but, delay, atj*2, FALSE, slide_now);
1560 + slide->timer = butTimer_fCreate(NULL, but, delay, atj*8, FALSE, slide_now);
1564 diff -ru cgoban-1.9.12-orig/wmslib/src/but/tbin.c cgoban-1.9.12-et1/wmslib/src/but/tbin.c
1565 --- cgoban-1.9.12-orig/wmslib/src/but/tbin.c Tue Jan 25 05:40:26 2000
1566 +++ cgoban-1.9.12-et1/wmslib/src/but/tbin.c Tue May 14 00:13:24 2002
1569 assert(but->action == &action);
1571 - fontH = butEnv_fontH(env, 0);
1572 - XSetFont(env->dpy, env->gc, env->fonts[0]->fid);
1573 + fontH = butEnv_fontH(env, TBIN_FONTNUM);
1574 + XSetFont(env->dpy, env->gc, env->fonts[TBIN_FONTNUM]->fid);
1575 startLine = (y - fontH + 1 - but->y) / fontH;
1579 ButWin *win = but->win;
1580 ButEnv *env = win->env;
1581 Tin *ti = &tb->tins[tinNum];
1582 - XFontStruct *fs = env->fonts[0];
1583 + XFontStruct *fs = env->fonts[TBIN_FONTNUM];
1591 - newMousePress = locateMouse(env->fonts[0], tb->buf + ti->start,
1592 + newMousePress = locateMouse(env->fonts[TBIN_FONTNUM], tb->buf + ti->start,
1594 x - (but->x+tb->lMargin), &rightSide);
1595 if (rightSide && (newMousePress == ti->len) &&
1597 tb->locs[tbin_mouse].index = 0;
1600 - tb->locs[tbin_mouse].index = locateMouse(env->fonts[0],
1601 + tb->locs[tbin_mouse].index = locateMouse(env->fonts[TBIN_FONTNUM],
1602 tb->buf + ti->start,
1604 x - (but->x+tb->lMargin),
1606 tb->locs[tbin_loCur].index);
1607 tb->locs[tbin_loCur].tin = tinNum_prev(tb->locs[tbin_loCur].tin, tb);
1608 tb->locs[tbin_loCur].index =
1609 - locateMouse(env->fonts[0],
1610 + locateMouse(env->fonts[TBIN_FONTNUM],
1611 tb->buf + tb->tins[tb->locs[tbin_loCur].tin].start,
1612 tb->tins[tb->locs[tbin_loCur].tin].len,
1615 tb->locs[tbin_hiCur].index);
1616 tb->locs[tbin_hiCur].tin = tinNum_next(tb->locs[tbin_hiCur].tin, tb);
1617 tb->locs[tbin_hiCur].index =
1618 - locateMouse(env->fonts[0],
1619 + locateMouse(env->fonts[TBIN_FONTNUM],
1620 tb->buf + tb->tins[tb->locs[tbin_hiCur].tin].start,
1621 tb->tins[tb->locs[tbin_hiCur].tin].len,
1623 @@ -706,14 +706,14 @@
1625 } else if (tinNum_next(tb->locs[tbin_loCur].tin, tb) < tb->maxTins) {
1626 if (tb->locs[tbin_loCur].index <
1627 - tb->tins[tb->locs[tbin_loCur].tin].len)
1628 + tb->tins[tb->locs[tbin_loCur].tin].len) {
1629 ++tb->locs[tbin_hiCur].index;
1630 - else if (tb->buf[tb->loBreak - 1] == '\n') {
1631 + } else if (tb->buf[tb->loBreak - 1] == '\n') {
1632 tb->locs[tbin_hiCur].tin = tinNum_next(tb->locs[tbin_hiCur].tin, tb);
1633 tb->locs[tbin_hiCur].index = 0;
1635 tb->locs[tbin_hiCur].tin = tinNum_next(tb->locs[tbin_hiCur].tin, tb);
1636 - tb->locs[tbin_hiCur].index = 1;
1637 + tb->locs[tbin_hiCur].index = 0; /*ET: was 1*/
1639 insertResult = insert(env, "", tb, but->w, &changePrev);
1641 @@ -781,6 +781,27 @@
1642 } else if ((keysym >= XK_Shift_L) && (keysym <= XK_Hyper_R)) {
1643 } else if ((keysym >= XK_F1) && (keysym <= XK_F35)) {
1644 insertResult = insert(env, newtext, tb, but->w, &changePrev);
1645 +#if 1 /* People don't like my delete. :-( */
1646 + } else if (keysym == XK_Delete) {
1647 + if ((tb->locs[tbin_loCur].index != tb->locs[tbin_hiCur].index) ||
1648 + (tb->locs[tbin_loCur].tin != tb->locs[tbin_hiCur].tin)) {
1649 + insertResult = insert(env, "", tb, but->w, &changePrev);
1651 + } else if (tinNum_next(tb->locs[tbin_loCur].tin, tb) < tb->maxTins) {
1652 + if (tb->locs[tbin_loCur].index < tb->tins[tb->locs[tbin_loCur].tin].len)
1653 + ++tb->locs[tbin_hiCur].index;
1654 + else if (tb->buf[tb->loBreak - 1] == '\n') {
1655 + tb->locs[tbin_hiCur].tin = tinNum_next(tb->locs[tbin_hiCur].tin, tb);
1656 + tb->locs[tbin_hiCur].index = 0;
1658 + tb->locs[tbin_hiCur].tin = tinNum_next(tb->locs[tbin_hiCur].tin, tb);
1659 + tb->locs[tbin_hiCur].index = 0; /*ET: was 1*/
1661 + insertResult = insert(env, "", tb, but->w, &changePrev);
1664 + result |= BUTOUT_ERR;
1666 } else if ((keysym == XK_BackSpace) || (keysym == XK_Delete)) {
1667 if ((tb->locs[tbin_loCur].index != tb->locs[tbin_hiCur].index) ||
1668 (tb->locs[tbin_loCur].tin != tb->locs[tbin_hiCur].tin)) {
1669 @@ -807,27 +828,6 @@
1671 result |= BUTOUT_ERR;
1673 -#if 0 /* People don't like my delete. :-( */
1674 - } else if (keysym == XK_Delete) {
1675 - if ((tb->locs[tbin_loCur].index != tb->locs[tbin_hiCur].index) ||
1676 - (tb->locs[tbin_loCur].tin != tb->locs[tbin_hiCur].tin)) {
1677 - insertResult = insert(env, "", tb, but->w, &changePrev);
1679 - } else if (tinNum_next(tb->locs[tbin_loCur].tin, tb) < tb->maxTins) {
1680 - if (tb->locs[tbin_loCur].index < tb->tins[tb->locs[tbin_loCur].tin].len)
1681 - ++tb->locs[tbin_hiCur].index;
1682 - else if (tb->buf[tb->loBreak - 1] == '\n') {
1683 - tb->locs[tbin_hiCur].tin = tinNum_next(tb->locs[tbin_hiCur].tin, tb);
1684 - tb->locs[tbin_hiCur].index = 0;
1686 - tb->locs[tbin_hiCur].tin = tinNum_next(tb->locs[tbin_hiCur].tin, tb);
1687 - tb->locs[tbin_hiCur].index = 1;
1689 - insertResult = insert(env, "", tb, but->w, &changePrev);
1692 - result |= BUTOUT_ERR;
1694 } else if (keysym == XK_Left) {
1696 if (!loc_eq(tb->locs[tbin_loCur], tb->locs[tbin_hiCur])) {
1698 setMouseX(but, tb, tb->locs[tbin_loCur].tin,
1699 tb->locs[tbin_loCur].index);
1700 tb->locs[tbin_loCur].tin = tinNum_prev(tb->locs[tbin_loCur].tin, tb);
1701 - tb->locs[tbin_loCur].index = locateMouse(env->fonts[0],
1702 + tb->locs[tbin_loCur].index = locateMouse(env->fonts[TBIN_FONTNUM],
1704 tb->tins[tb->locs[tbin_loCur].
1706 @@ -892,13 +892,16 @@
1707 tb->locs[tbin_hiCur].index);
1708 tb->locs[tbin_hiCur].tin = tinNum_next(tb->locs[tbin_hiCur].tin, tb);
1709 tb->locs[tbin_hiCur].index =
1710 - locateMouse(env->fonts[0],
1711 + locateMouse(env->fonts[TBIN_FONTNUM],
1712 tb->buf + tb->tins[tb->locs[tbin_hiCur].tin].start,
1713 tb->tins[tb->locs[tbin_hiCur].tin].len,
1715 tb->locs[tbin_loCur] = tb->locs[tbin_hiCur];
1718 + } else if (keysym == XK_Insert) {
1719 + tb->locs[tbin_mouse] = tb->locs[tbin_loCur] = tb->locs[tbin_hiCur];
1721 } else if ((keysym == XK_Return) || (keysym == XK_Linefeed) ||
1722 (keysym == XK_KP_Enter)) {
1723 insertResult = insert(env, "\n", tb, but->w, &changePrev);
1724 @@ -923,12 +926,12 @@
1725 drawLo = tinNum_prev(drawLo, tb);
1727 assert(drawHi >= drawLo);
1728 - drawLo = tinNum_line(drawLo, tb) * butEnv_fontH(env, 0);
1729 + drawLo = tinNum_line(drawLo, tb) * butEnv_fontH(env, TBIN_FONTNUM);
1730 if (insertResult == insert_cr) {
1733 assert((drawHi < tb->loTinBreak) || (drawHi >= tb->hiTinBreak));
1734 - drawHi = (tinNum_line(drawHi, tb) + 1) * butEnv_fontH(env, 0);
1735 + drawHi = (tinNum_line(drawHi, tb) + 1) * butEnv_fontH(env, TBIN_FONTNUM);
1737 if (drawLo < but->h) {
1738 assert(drawHi >= drawLo);
1739 @@ -1110,7 +1113,7 @@
1740 static bool tryJoinLines(Tbin *tb, int tinNum, ButEnv *env, int butW) {
1741 int prevTinNum, w, curChar;
1743 - XFontStruct *fs = env->fonts[0];
1744 + XFontStruct *fs = env->fonts[TBIN_FONTNUM];
1747 if ((tinNum == 0) || (tinNum == tb->maxTins))
1748 @@ -1198,7 +1201,7 @@
1751 static void breakLine(Tbin *tb, int tinNum, ButEnv *env, int butW) {
1752 - XFontStruct *fs = env->fonts[0];
1753 + XFontStruct *fs = env->fonts[TBIN_FONTNUM];
1757 @@ -1251,7 +1254,7 @@
1758 tb->tins[tb->hiTinBreak].len += tb->tins[tinNum].len - breakPoint;
1759 tb->tins[tb->hiTinBreak].start = tb->tins[tinNum].start + breakPoint;
1760 tb->tins[tb->hiTinBreak].width +=
1761 - XTextWidth(env->fonts[0], tb->buf + tb->tins[tb->hiTinBreak].start,
1762 + XTextWidth(env->fonts[TBIN_FONTNUM], tb->buf + tb->tins[tb->hiTinBreak].start,
1763 tb->tins[tinNum].len - breakPoint);
1764 tb->tins[tb->loTinBreak] = tb->tins[tb->hiTinBreak];
1766 @@ -1284,7 +1287,7 @@
1767 Tin *ti = &tb->tins[tb->locs[tbin_loCur].tin];
1768 ButWin *win = but->win;
1769 ButEnv *env = win->env;
1770 - XFontStruct *fs = env->fonts[0];
1771 + XFontStruct *fs = env->fonts[TBIN_FONTNUM];
1775 @@ -1318,7 +1321,7 @@
1776 Tin *ti = &tb->tins[tb->locs[tbin_loCur].tin];
1777 ButWin *win = but->win;
1778 ButEnv *env = win->env;
1779 - XFontStruct *fs = env->fonts[0];
1780 + XFontStruct *fs = env->fonts[TBIN_FONTNUM];
1781 int fontH = fs->ascent + fs->descent;
1784 @@ -1620,7 +1623,7 @@
1788 - n = (y - but->y) / butEnv_fontH(but->win->env, 0);
1789 + n = (y - but->y) / butEnv_fontH(but->win->env, TBIN_FONTNUM);
1790 if (n >= tbin->loTinBreak)
1791 n += tbin->hiTinBreak - tbin->loTinBreak;
1792 if (n >= tbin->maxTins)
1793 @@ -1632,7 +1635,7 @@
1794 static void setMouseX(But *but, Tbin *tbin, int tin, int loc) {
1795 assert((tin >= 0) && (tin < tbin->maxTins));
1796 assert((loc >= 0) && (loc <= tbin->tins[tin].len));
1797 - tbin->mouseX = XTextWidth(but->win->env->fonts[0],
1798 + tbin->mouseX = XTextWidth(but->win->env->fonts[TBIN_FONTNUM],
1799 tbin->buf + tbin->tins[tin].start, loc);
1802 @@ -1662,7 +1665,7 @@
1803 if (tbin->offWinCallback) {
1806 - ch = butEnv_fontH(win->env, 0);
1807 + ch = butEnv_fontH(win->env, TBIN_FONTNUM);
1809 assert(loc_valid(tbin->locs[tbin_mouse], tbin));
1810 cy = loLineNum = tinNum_line(tbin->locs[tbin_mouse].tin, tbin);
1811 @@ -1849,7 +1852,7 @@
1813 while ((textLen > 0) && (buf[tin->start + textLen - 1] == ' '))
1815 - tin->width = XTextWidth(env->fonts[0], buf + tin->start, textLen);
1816 + tin->width = XTextWidth(env->fonts[TBIN_FONTNUM], buf + tin->start, textLen);
1820 @@ -1914,8 +1917,7 @@
1821 tb->locs[tbin_loCur].index = tb->tins[tb->locs[tbin_loCur].tin].len;
1822 tb->locs[tbin_hiCur] = tb->locs[tbin_loCur];
1824 - insert(but->win->env, appText, tb,
1825 - but->w - (tb->lMargin + tb->rMargin), NULL);
1826 + insert(but->win->env, appText, tb, but->w, NULL);
1827 checkOffWin(but, 0, TRUE);
1828 if (saveOldCurs && !loc_eq(tb->locs[tbin_mouse], tb->locs[tbin_press])) {
1829 tb->locs[tbin_loCur] = tb->locs[tbin_mouse];
1830 diff -ru cgoban-1.9.12-orig/wmslib/src/but/tbin.h cgoban-1.9.12-et1/wmslib/src/but/tbin.h
1831 --- cgoban-1.9.12-orig/wmslib/src/but/tbin.h Tue Jan 25 05:40:26 2000
1832 +++ cgoban-1.9.12-et1/wmslib/src/but/tbin.h Mon May 13 22:59:32 2002
1834 #ifndef _BUT_TBIN_H_
1835 #define _BUT_TBIN_H_ 1
1837 +#define TBIN_FONTNUM 0 /* 0 = prop, 3 = fixed width font */
1839 /**********************************************************************
1841 **********************************************************************/
1842 diff -ru cgoban-1.9.12-orig/wmslib/src/but/text.c cgoban-1.9.12-et1/wmslib/src/but/text.c
1843 --- cgoban-1.9.12-orig/wmslib/src/but/text.c Tue Jan 25 05:40:26 2000
1844 +++ cgoban-1.9.12-et1/wmslib/src/but/text.c Wed Apr 3 23:48:18 2002
1846 assert(but->action == &action);
1849 - str_copyChars(&t->text, text);
1851 + if (strcmp(str_chars(&t->text), text)) {
1852 + str_copyChars(&t->text, text);
1858 diff -ru cgoban-1.9.12-orig/wmslib/src/but/textin.c cgoban-1.9.12-et1/wmslib/src/but/textin.c
1859 --- cgoban-1.9.12-orig/wmslib/src/but/textin.c Tue Jan 25 05:40:26 2000
1860 +++ cgoban-1.9.12-et1/wmslib/src/but/textin.c Tue May 7 22:05:41 2002
1861 @@ -549,29 +549,29 @@
1862 } else if ((keysym >= XK_F1) && (keysym <= XK_F35)) {
1863 if (!(need_draw = insert(env, newtext, ti)))
1864 result |= BUTOUT_ERR | BUTOUT_CAUGHT;
1865 - } else if ((keysym == XK_BackSpace) || (keysym == XK_Delete)) {
1866 +#if 1 /* People don't like it when delete works the way I like it. :-( */
1867 + } else if (keysym == XK_Delete) {
1868 if (ti->loc != ti->cutend)
1869 need_draw = insert(env, "", ti);
1870 - else if (ti->loc > 0) {
1871 - for (i = ti->cutend = --ti->loc; ti->str[i]; ++i)
1872 + else if (ti->loc < ti->len) {
1873 + for (i = ti->loc; ti->str[i]; ++i)
1874 ti->str[i] = ti->str[i+1];
1878 result |= BUTOUT_ERR | BUTOUT_CAUGHT;
1879 -#if 0 /* People don't like it when delete works the way I like it. :-( */
1880 - } else if (keysym == XK_Delete) {
1882 + } else if ((keysym == XK_BackSpace) || (keysym == XK_Delete)) {
1883 if (ti->loc != ti->cutend)
1884 need_draw = insert(env, "", ti);
1885 - else if (ti->loc < ti->len) {
1886 - for (i = ti->loc; ti->str[i]; ++i)
1887 + else if (ti->loc > 0) {
1888 + for (i = ti->cutend = --ti->loc; ti->str[i]; ++i)
1889 ti->str[i] = ti->str[i+1];
1893 result |= BUTOUT_ERR | BUTOUT_CAUGHT;
1895 - } else if (keysym == XK_Left) {
1896 + } else if (keysym == XK_Left) {
1897 if (ti->loc != ti->cutend) {
1898 if (ti->loc < ti->cutend)
1899 ti->cutend = ti->loc;
1901 } else if (keysym == XK_Down) {
1902 ti->loc = ti->cutend = ti->len;
1904 + } else if (keysym == XK_Insert) {
1906 } else if ((keysym == XK_Return) || (keysym == XK_Linefeed) ||
1907 (keysym == XK_KP_Enter)) {
1908 result |= BUTOUT_CAUGHT;
1915 env->sNotify = NULL;
1918 diff -ru cgoban-1.9.12-orig/wmslib/src/but/timer.c cgoban-1.9.12-et1/wmslib/src/but/timer.c
1919 --- cgoban-1.9.12-orig/wmslib/src/but/timer.c Tue Jan 25 05:40:26 2000
1920 +++ cgoban-1.9.12-et1/wmslib/src/but/timer.c Mon May 13 00:33:18 2002
1922 for (bt = but_timerList; bt != NULL; bt = bt->next) {
1923 if (bt->state == butTimer_on) {
1924 if (timercmp(&bt->nextFiring, ¤t_time, <)) {
1925 - take_timer = TRUE;
1926 ticks = but_timerDiv(but_timerSub(current_time, bt->nextFiring),
1927 bt->period, &timerem) + 1 + bt->ticksLeft;
1929 diff -ru cgoban-1.9.12-orig/wmslib/src/wms/str.c cgoban-1.9.12-et1/wmslib/src/wms/str.c
1930 --- cgoban-1.9.12-orig/wmslib/src/wms/str.c Tue Jan 25 05:40:26 2000
1931 +++ cgoban-1.9.12-et1/wmslib/src/wms/str.c Tue Apr 23 21:18:27 2002
1935 assert(MAGIC(dest));
1936 - str_copyChars(dest, "");
1937 + str_clip(dest, 0);