From 2185e1a810176b9d35911045d876513fa86b5dc2 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Tue, 1 Mar 2016 21:09:49 +0100 Subject: [PATCH] Preserve flip on pasting game when auto-flipView is off Normally starting a new game would restore the orientation as given by the -flipView option on the command line, which might flip the view even when -autoFlipView is off. A new game started through Paste Game now always preserves the current orientation when -autoFlipView is off. --- gtk/xboard.c | 4 +++- winboard/wclipbrd.c | 4 ++++ xaw/xboard.c | 3 +++ 3 files changed, 10 insertions(+), 1 deletions(-) diff --git a/gtk/xboard.c b/gtk/xboard.c index de5da12..dbb2670 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -1887,7 +1887,7 @@ PasteGameProc () { gchar *text=NULL; GtkClipboard *cb; - guint len=0; + guint len=0; int flip = appData.flipView; FILE* f; // get game from clipboard @@ -1911,7 +1911,9 @@ PasteGameProc () fclose(f); // load from file + if(!appData.autoFlipView) appData.flipView = flipView; LoadGameFromFile(gamePasteFilename, 0, gamePasteFilename, TRUE); + appData.flipView = flip; return; } diff --git a/winboard/wclipbrd.c b/winboard/wclipbrd.c index 4b532de..bcefd4c 100644 --- a/winboard/wclipbrd.c +++ b/winboard/wclipbrd.c @@ -260,6 +260,7 @@ VOID PasteGameFromString( char * buf ) { FILE *f; size_t len; + int flip = appData.flipView; if (!pasteTemp) { pasteTemp = tempnam(NULL, "wbpt"); } @@ -276,7 +277,10 @@ VOID PasteGameFromString( char * buf ) free(buf); /* [AS] */ return; } + if(!appData.auto + if(!appData.autoFlipView) appData.flipView = flipView; LoadGameFromFile(pasteTemp, 0, "Clipboard", TRUE); + appData.flipView = flip; free( buf ); /* [AS] */ } diff --git a/xaw/xboard.c b/xaw/xboard.c index f1e991d..91d35b7 100644 --- a/xaw/xboard.c +++ b/xaw/xboard.c @@ -1998,6 +1998,7 @@ PasteGameCB (Widget w, XtPointer client_data, Atom *selection, Atom *type, XtPointer value, unsigned long *len, int *format) { FILE* f; + int flip = appData.flipView; if (value == NULL || *len == 0) { return; /* nothing had been selected to copy */ } @@ -2009,7 +2010,9 @@ PasteGameCB (Widget w, XtPointer client_data, Atom *selection, fwrite(value, 1, *len, f); fclose(f); XtFree(value); + if(!appData.autoFlipView) appData.flipView = flipView; LoadGameFromFile(gamePasteFilename, 0, gamePasteFilename, TRUE); + appData.flipView = flip; } /* called when Paste Game button is pressed, -- 1.7.0.4