Article View: gnu.chess
Article #5447XBoard patch for monochrome Suns
From: Tim Mann
Date: Wed, 21 Jul 1993 16:57
Date: Wed, 21 Jul 1993 16:57
106 lines
4421 bytes
4421 bytes
There is a bug in the X implementation on monochrome Sun ELC machines
that causes XBoard to display incorrectly. The symptom is that a
square with a piece on it is always displayed as white, and if the
square should have been black, the piece is the wrong color too.
The following patch works around the bug. It will be included in the
next XBoard release.
--Tim
*** ../xboard.distrib/xboard-2.1.pl11/xboard.c Mon Jun 14 22:24:08 1993
--- xboard.c Thu Jul 15 21:14:29 1993
***************
*** 1940,1950 ****
gc_values.background = XBlackPixel(xDisplay, xScreen);
lightSquareGC = wbPieceGC
= XtGetGC(shellWidget, value_mask, &gc_values);
!
gc_values.foreground = XBlackPixel(xDisplay, xScreen);
gc_values.background = XWhitePixel(xDisplay, xScreen);
darkSquareGC = bwPieceGC
= XtGetGC(shellWidget, value_mask, &gc_values);
} else {
gc_values.foreground = appData.lightSquareColor;
gc_values.background = appData.darkSquareColor;
--- 1940,1959 ----
gc_values.background = XBlackPixel(xDisplay, xScreen);
lightSquareGC = wbPieceGC
= XtGetGC(shellWidget, value_mask, &gc_values);
! /*!!*/
! if (DefaultDepth(xDisplay, xScreen) == 1) {
! /* Avoid XCopyPlane on 1-bit screens to work around Sun bug */
! gc_values.function = GXcopyInverted;
! wbPieceGC = XtGetGC(shellWidget, value_mask, &gc_values);
! gc_values.function = GXcopy;
! }
! /*!!*/
!
gc_values.foreground = XBlackPixel(xDisplay, xScreen);
gc_values.background = XWhitePixel(xDisplay, xScreen);
darkSquareGC = bwPieceGC
= XtGetGC(shellWidget, value_mask, &gc_values);
+
} else {
gc_values.foreground = appData.lightSquareColor;
gc_values.background = appData.darkSquareColor;
***************
*** 2462,2479 ****
square_color ? lightSquareGC : darkSquareGC,
x, y, squareSize, squareSize);
else if (appData.monoMode) {
! if (square_color)
! XCopyPlane(xDisplay, (int) piece < (int) BlackPawn
! ? *pieceToOutline[(int) piece]
! : *pieceToSolid[(int) piece],
! xBoardWindow, bwPieceGC, 0, 0,
! squareSize, squareSize, x, y, 1);
! else
! XCopyPlane(xDisplay, (int) piece < (int) BlackPawn
! ? *pieceToSolid[(int) piece]
! : *pieceToOutline[(int) piece],
! xBoardWindow, wbPieceGC, 0, 0,
! squareSize, squareSize, x, y, 1);
} else {
if (square_color)
XCopyPlane(xDisplay, *pieceToSolid[(int) piece],
--- 2471,2508 ----
square_color ? lightSquareGC : darkSquareGC,
x, y, squareSize, squareSize);
else if (appData.monoMode) {
! /*!!*/
! if (DefaultDepth(xDisplay, xScreen) == 1) {
! /* Avoid XCopyPlane on 1-bit screens to work around Sun bug */
! if (square_color)
! XCopyArea(xDisplay, (int) piece < (int) BlackPawn
! ? *pieceToOutline[(int) piece]
! : *pieceToSolid[(int) piece],
! xBoardWindow, bwPieceGC, 0, 0,
! squareSize, squareSize, x, y);
! else
! XCopyArea(xDisplay, (int) piece < (int) BlackPawn
! ? *pieceToSolid[(int) piece]
! : *pieceToOutline[(int) piece],
! xBoardWindow, wbPieceGC, 0, 0,
! squareSize, squareSize, x, y);
! } else {
! /*!!*/
! if (square_color)
! XCopyPlane(xDisplay, (int) piece < (int) BlackPawn
! ? *pieceToOutline[(int) piece]
! : *pieceToSolid[(int) piece],
! xBoardWindow, bwPieceGC, 0, 0,
! squareSize, squareSize, x, y, 1);
! else
! XCopyPlane(xDisplay, (int) piece < (int) BlackPawn
! ? *pieceToSolid[(int) piece]
! : *pieceToOutline[(int) piece],
! xBoardWindow, wbPieceGC, 0, 0,
! squareSize, squareSize, x, y, 1);
! /*!!*/
! }
! /*!!*/
} else {
if (square_color)
XCopyPlane(xDisplay, *pieceToSolid[(int) piece],
Technical Details
Message-ID:
<22jshv$5lk@src-news.pa.dec.com>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!decwrl!src.dec.com!mannShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d71d,9bcf2bbff2f8b47f,start X-Google-Attributes: gid10d71d,public X-Google-ArrivalTime: 1993-07-21 10:05:06 PST Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!decwrl!src.dec.com!mann From: mann@src.dec.com (Tim Mann) Newsgroups: gnu.chess Subject: XBoard patch for monochrome Suns Date: 21 Jul 1993 16:57:35 GMT Organization: DEC Systems Research Center Lines: 107 Message-ID: <22jshv$5lk@src-news.pa.dec.com> NNTP-Posting-Host: cypress.pa.dec.com