Xboard and the clipboard
Posted: 06 Nov 2009, 04:11
The xboard copy/paste functions never worked for me, using KDE and netbsd. I finally bothered to figure out why, and fixed it to work in the standard way. Xboard normally works from the PRIMARY buffer, which is set when text is highlighted (rather than copied). Using the CLIPBOARD buffer works as normal, and pgns/fens can be copied and pasted from everywhere. I'm not sure if the PRIMARY worked for other environments (namely gnome), but this should work safely everywhere, AFAIK.
Here's the patch:
Here's the patch:
- Code: Select all
From e3b200b7f42f5edfce6f55fea5b84a718f8f57f8 Mon Sep 17 00:00:00 2001
From: Zach Quad <zach@zachquad.(none)>
Date: Thu, 5 Nov 2009 20:55:29 -0600
Subject: [PATCH] Set copy/paste functions to work with standard clipboard.
---
xboard.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/xboard.c b/xboard.c
index 86fda44..310e40d 100644
--- a/xboard.c
+++ b/xboard.c
@@ -6478,7 +6478,7 @@ void CopyPositionProc(w, event, prms, nprms)
if (selected_fen_position) free(selected_fen_position);
selected_fen_position = (char *)PositionToFEN(currentMove, NULL);
if (!selected_fen_position) return;
- ret = XtOwnSelection(menuBarWidget, XA_PRIMARY,
+ ret = XtOwnSelection(menuBarWidget, XInternAtom(xDisplay, "CLIPBOARD", False),
CurrentTime,
SendPositionSelection,
NULL/* lose_ownership_proc */ ,
@@ -6509,7 +6509,7 @@ void PastePositionProc(w, event, prms, nprms)
String *prms;
Cardinal *nprms;
{
- XtGetSelectionValue(menuBarWidget, XA_PRIMARY, XA_STRING,
+ XtGetSelectionValue(menuBarWidget, XInternAtom(xDisplay, "CLIPBOARD", False), XA_STRING,
/* (XtSelectionCallbackProc) */ PastePositionCB,
NULL, /* client_data passed to PastePositionCB */
@@ -6567,7 +6567,7 @@ void CopyGameProc(w, event, prms, nprms)
ret = SaveGameToFile(gameCopyFilename, FALSE);
if (!ret) return;
- ret = XtOwnSelection(menuBarWidget, XA_PRIMARY,
+ ret = XtOwnSelection(menuBarWidget, XInternAtom(xDisplay, "CLIPBOARD", False),
CurrentTime,
SendGameSelection,
NULL/* lose_ownership_proc */ ,
@@ -6602,7 +6602,7 @@ void PasteGameProc(w, event, prms, nprms)
String *prms;
Cardinal *nprms;
{
- XtGetSelectionValue(menuBarWidget, XA_PRIMARY, XA_STRING,
+ XtGetSelectionValue(menuBarWidget, XInternAtom(xDisplay, "CLIPBOARD", False), XA_STRING,
/* (XtSelectionCallbackProc) */ PasteGameCB,
NULL, /* client_data passed to PasteGameCB */
--
1.6.0.2