Return-Path: pachydq Delivery-Date: Thu Aug 16 21:01:58 PDT Delivery-Date: Tue, 27 Mar 2001 15:24:27 -0800 Return-Path: bem5r@virginia.edu Received: by src-mail.pa.dec.com; id PAA30994; Tue, 27 Mar 2001 15:24:27 -0800 (PST) Received: from exchou-gh01.cca.cpqcorp.net by pobox1.pa.dec.com (5.65v3.2/1.1.10.5/07Nov97-1157AM) id AA13731; Tue, 27 Mar 2001 15:24:26 -0800 Received: by exchou-gh01.cca.cpqcorp.net with Internet Mail Service (5.5.2652.78) id ; Tue, 27 Mar 2001 17:21:30 -0600 Received: from zmamail01.zma.compaq.com (zmamail01.nz-tay.cpqcorp.net [161.114.72.101]) by exchou-gh01.cca.cpqcorp.net with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2652.78) id HZ1QJP9X; Tue, 27 Mar 2001 17:07:11 -0600 Received: by zmamail01.zma.compaq.com (Postfix, from userid 12345) id CA2B71225D; Tue, 27 Mar 2001 18:06:24 -0500 (EST) Received: from mail.virginia.edu (mail.Virginia.EDU [128.143.2.9]) by zmamail01.zma.compaq.com (Postfix) with SMTP id 8B29B12019 for ; Tue, 27 Mar 2001 18:06:24 -0500 (EST) Received: from bootp-230-227.bootp.virginia.edu by mail.virginia.edu id aa04562; 27 Mar 2001 13:38 EST Received: from ariel (localhost [127.0.0.1]) by ariel.local.net (Postfix) with ESMTP id C0425DFC0 for ; Tue, 27 Mar 2001 13:37:37 -0500 (EST) From: Brian Mays To: tim.mann@compaq.com Subject: Visual low time warning for xboard (patch) Date: Tue, 27 Mar 2001 13:37:37 -0500 Sender: bem5r@virginia.edu Message-Id: <20010327183737.C0425DFC0@ariel.local.net> Status: Here is a patch that I have applied to Debian's prepackaged version of xboard. I am forwarding it to be included in the upstream version at the author's discretion. - Brian ------- Forwarded Message Subject: Bug#88856: Visual low time warning (patch) Reply-To: Matt Zimmerman , 88856@bugs.debian.org Resent-From: Matt Zimmerman Orignal-Sender: Matt Zimmerman Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: Brian Mays Resent-Date: Wed, 07 Mar 2001 19:03:50 GMT Resent-Message-ID: Resent-Sender: owner@bugs.debian.org Date: Wed, 7 Mar 2001 13:24:19 -0500 Message-ID: <20010307132418.M11904@alcor.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="DocE+STaALJfprDB" Content-Disposition: inline User-Agent: Mutt/1.3.15i Sender: Matt Zimmerman Delivered-To: submit@bugs.debian.org - --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Package: xboard Version: 4.2.3-1 Severity: wishlist Attached is a patch which will change the background color of the time display (red, by default, but configurable by an X resource) when the time remaining passes below a user-defined number of seconds (again, configurable by an X resource). This functionality is off by default (lowTimeWarningSeconds is set to 0), and can be enabled/disabled at compile time in config.h. Recent versions of xboard include a similar feature that rings the terminal bell when time is low (icsAlarmTime). I find a visual indicator to be much more useful, because: a) The bell is easily missed, especially when using the "move sound" option, which rings the bell after each move b) A visual warning is persistent, while an audible warning only sounds once c) The visual indicator provided in this patch gives notification when either party is almost out of time (you or your opponent), while the icsAlarm feature only warns when you are out of time. I have been maintaining this patch since before xboard 4.0.0, and it hasn't broken anything for me or those I know who have tried it. - -- - mdz - --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="xboard-4.2.3+lowtimewarning.patch" diff -ru xboard-4.2.3/common.h xboard-4.2.3.1/common.h - --- xboard-4.2.3/common.h Mon Feb 19 23:02:35 2001 +++ xboard-4.2.3.1/common.h Wed Mar 7 13:06:17 2001 @@ -423,6 +423,10 @@ int zippyMaxGames; int zippyReplayTimeout; /*seconds*/ #endif +#if LOWTIMEWARNING + char *lowTimeWarningColor; + int lowTimeWarningSeconds; +#endif } AppData, *AppDataPtr; extern AppData appData; diff -ru xboard-4.2.3/config.h.in xboard-4.2.3.1/config.h.in - --- xboard-4.2.3/config.h.in Mon Feb 19 23:02:37 2001 +++ xboard-4.2.3.1/config.h.in Wed Mar 7 13:06:17 2001 @@ -133,3 +133,5 @@ /* Define if you have the seq library (-lseq). */ #undef HAVE_LIBSEQ + +#define LOWTIMEWARNING 1 diff -ru xboard-4.2.3/xboard.c xboard-4.2.3.1/xboard.c - --- xboard-4.2.3/xboard.c Wed Mar 7 13:06:35 2001 +++ xboard-4.2.3.1/xboard.c Wed Mar 7 13:06:17 2001 @@ -419,6 +419,9 @@ Window xBoardWindow; Pixel lightSquareColor, darkSquareColor, whitePieceColor, blackPieceColor, jailSquareColor, highlightSquareColor, premoveHighlightColor; +#if LOWTIMEWARNING +Pixel lowTimeWarningColor; +#endif GC lightSquareGC, darkSquareGC, jailSquareGC, lineGC, wdPieceGC, wlPieceGC, bdPieceGC, blPieceGC, wbPieceGC, bwPieceGC, coordGC, highlineGC, wjPieceGC, bjPieceGC, prelineGC; @@ -1134,6 +1137,14 @@ { "secondProtocolVersion", "secondProtocolVersion", XtRInt, sizeof(int), XtOffset(AppDataPtr, secondProtocolVersion), XtRImmediate, (XtPointer)PROTOVER }, +#if LOWTIMEWARNING + { "lowTimeWarningColor", "lowTimeWarningColor", XtRString, + sizeof(String), XtOffset(AppDataPtr, lowTimeWarningColor), + XtRString, COLOR_LOWTIMEWARNING }, + { "lowTimeWarningSeconds", "lowTimeWarningSeconds", XtRInt, + sizeof(int), XtOffset(AppDataPtr, lowTimeWarningSeconds), + XtRImmediate, 0 }, +#endif }; XrmOptionDescRec shellOptions[] = { @@ -1421,6 +1432,10 @@ { "-variant", "variant", XrmoptionSepArg, NULL }, { "-firstProtocolVersion", "firstProtocolVersion", XrmoptionSepArg, NULL }, { "-secondProtocolVersion","secondProtocolVersion",XrmoptionSepArg, NULL }, +#if LOWTIMEWARNING + { "-lowTimeWarningColor", "lowTimeWarningColor", XrmoptionSepArg, NULL }, + { "-lowTimeWarningSeconds", "lowTimeWarningSeconds", XrmoptionSepArg, NULL }, +#endif }; @@ -2092,6 +2107,21 @@ programName); } +#if LOWTIMEWARNING + + if (appData.lowTimeWarningSeconds > 0 && !appData.monoMode) { + vFrom.addr = (caddr_t) appData.lowTimeWarningColor; + vFrom.size = strlen(appData.lowTimeWarningColor); + XtConvert(shellWidget, XtRString, &vFrom, XtRPixel, &vTo); + if (vTo.addr == NULL) + appData.monoMode = True; + else + lowTimeWarningColor = *(Pixel *) vTo.addr; + } + +#endif + + if (appData.monoMode && appData.debugMode) { fprintf(stderr, "white pixel = 0x%lx, black pixel = 0x%lx\n", (unsigned long) XWhitePixel(xDisplay, xScreen), @@ -7295,7 +7325,18 @@ { char buf[MSG_SIZ]; Arg args[16]; - - + +#if LOWTIMEWARNING + Pixel foregroundOrWarningColor = timerForegroundPixel; + + if (timer > 0 + && appData.lowTimeWarningSeconds > 0 + && (timer / 1000) < appData.lowTimeWarningSeconds) + + foregroundOrWarningColor = lowTimeWarningColor; + +#endif + if (appData.clockMode) { sprintf(buf, "%s: %s", color, TimeString(timer)); XtSetArg(args[0], XtNlabel, buf); @@ -7305,11 +7346,24 @@ } if (highlight) { + +#if LOWTIMEWARNING + XtSetArg(args[1], XtNbackground, foregroundOrWarningColor); +#else XtSetArg(args[1], XtNbackground, timerForegroundPixel); +#endif + XtSetArg(args[2], XtNforeground, timerBackgroundPixel); } else { + XtSetArg(args[1], XtNbackground, timerBackgroundPixel); + +#if LOWTIMEWARNING + XtSetArg(args[2], XtNforeground, foregroundOrWarningColor); +#else XtSetArg(args[2], XtNforeground, timerForegroundPixel); +#endif + } XtSetValues(w, args, 3); diff -ru xboard-4.2.3/xboard.h xboard-4.2.3.1/xboard.h - --- xboard-4.2.3/xboard.h Mon Feb 19 23:02:36 2001 +++ xboard-4.2.3.1/xboard.h Wed Mar 7 13:06:17 2001 @@ -64,6 +64,7 @@ #define COLOR_REQUEST "red" #define COLOR_SEEK "blue" #define COLOR_NORMAL "default" +#define COLOR_LOWTIMEWARNING "red" typedef struct { char *name; - --DocE+STaALJfprDB-- ------- End of Forwarded Message