🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.chess
Article #3786

xboard piece dragging

#3786
From: Daniel Sears
Date: Thu, 24 Oct 1996 00:00
79 lines
3428 bytes
mann@pa.dec.com
bug-gnu-chess@prep.ai.mit.edu
gnu.chess,rec.games.chess.computer

Tim et al,

I'm one of the original authors of XBoard.  I haven't looked at it or X
in at least 5 years until this last weekend on a vacation at my brother's
who has a PC with Linux with an X server.  XBoard has grown considerably
and admirably.  The one thing that I thought would have been taken care of
by now was piece dragging.  So I added it.  In the end it wasn't very
difficult.  The diff from xboard-3.4.pl1 is just 59 lines.

Could you please integrate this into the distrubution?

thanks,

Chris Sears

312,315d311
< int dragX, dragY, dragOffsetX, dragOffsetY;
< Pixmap dragPiecePixmap, dragSavePixmap;
< GC dragGC, dragClipGC;
< 
905d900
<    <BtnMotion>: HandleUserMove() \n \
1335,1339d1329
<     dragPiecePixmap = XCreatePixmap(xDisplay, xBoardWindow,
<  squareSize, squareSize, DefaultDepth(xDisplay, xScreen));
<     dragSavePixmap = XCreatePixmap(xDisplay, xBoardWindow,
<  squareSize, squareSize, DefaultDepth(xDisplay, xScreen));
< 
1675,1678c1665
< 
<     dragClipGC = XCreateGC(xDisplay, xBoardWindow, value_mask, &gc_values);
<     dragGC = XtGetGC(shellWidget, value_mask, &gc_values);
< 
---
>     
2316,2317d2302
<     extern int currentMove;
<     extern Board boards[];
2348,2367d2332
< 
<         if (flipView) {
<      dragX = lineGap + ((BOARD_SIZE-1)-fromX) * 
<        (squareSize + lineGap);
<      dragY = lineGap + fromY * (squareSize + lineGap);
<         } else {
<      dragX = lineGap + fromX * (squareSize + lineGap);
<      dragY = lineGap + ((BOARD_SIZE-1)-fromY) * 
<        (squareSize + lineGap);
<         }
<     
<  XFillRectangle(xDisplay, dragSavePixmap,
<      ((fromX + fromY) % 2) == 1 ? lightSquareGC : darkSquareGC,
<      0, 0, squareSize, squareSize);
<         XCopyArea(xDisplay, xBoardWindow, dragPiecePixmap, dragGC,
<             dragX, dragY, squareSize, squareSize, 0, 0);
<  XSetClipMask(xDisplay, dragClipGC,
<      *pieceToSolid(boards[currentMove][fromY][fromX]));
<  dragOffsetX = event->xbutton.x - dragX;
<  dragOffsetY = event->xbutton.y - dragY;
2371,2372d2335
<         XCopyArea(xDisplay, dragSavePixmap, xBoardWindow, dragGC,
<             0, 0, squareSize, squareSize, dragX, dragY);
2387,2397d2349
<       case MotionNotify:
<         XCopyArea(xDisplay, dragSavePixmap, xBoardWindow, dragGC,
<             0, 0, squareSize, squareSize, dragX, dragY);
<  dragX = event->xbutton.x - dragOffsetX;
<  dragY = event->xbutton.y - dragOffsetY;
<         XCopyArea(xDisplay, xBoardWindow, dragSavePixmap, dragGC,
<             dragX, dragY, squareSize, squareSize, 0, 0);
<  XSetClipOrigin(xDisplay, dragClipGC, dragX, dragY);
<         XCopyArea(xDisplay, dragPiecePixmap, xBoardWindow, dragClipGC,
<             0, 0, squareSize, squareSize, dragX, dragY);
<         break;
Technical Details
Message-ID: <dbsears-2410960829550001@ala-ca11-01.ix.netcom.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 110df2,b3798a1b33d21a99,start
X-Google-Attributes: gid110df2,public
X-Google-Thread: 10d71d,b3798a1b33d21a99,start
X-Google-Attributes: gid10d71d,public
From: dbsears@ix.netcom.com (Daniel Sears)
Subject: xboard piece dragging
Date: 1996/10/24
Message-ID: <dbsears-2410960829550001@ala-ca11-01.ix.netcom.com>
X-Deja-AN: 191765418
organization: personal
x-netcom-date: Thu Oct 24 10:26:18 AM CDT 1996
newsgroups: gnu.chess,rec.games.chess.computer