Cure flicker in Move History window, fix highlighting
[xboard.git] / xengineoutput.c
index 980b639..3067fc1 100644 (file)
@@ -100,14 +100,6 @@ extern char *getenv();
 
 #define _LL_ 100
 
-// imports from xboard.c
-extern Widget formWidget, shellWidget, boardWidget, menuBarWidget;
-extern Display *xDisplay;
-extern Window xBoardWindow;
-extern int squareSize;
-extern Pixmap xMarkPixmap, wIconPixmap, bIconPixmap;
-extern char *layoutName;
-
 Pixmap icons[8]; // [HGM] this front-end array translates back-end icon indicator to handle
 Widget outputField[2][7]; // [HGM] front-end array to translate output field to window handle
 
@@ -116,12 +108,6 @@ void engineOutputPopUp();
 int  EngineOutputIsUp();
 void SetEngineColorIcon( int which );
 
-/* Imports from backend.c */
-extern int opponentKibitzes;
-
-/* Imports from xboard.c */
-extern Arg layoutArgs[2], formArgs[2], messageArgs[4];
-
 //extern WindowPlacement wpEngineOutput;
 
 Position engineOutputX = -1, engineOutputY = -1;
@@ -212,17 +198,16 @@ void SetIcon( int which, int field, int nIcon )
 
 void DoClearMemo(int which)
 {
-    Widget edit;
-
-    edit = XtNameToWidget(engineOutputShell, which ? "*form2.text" : "*form.text");
-    XtCallActionProc(edit, "select-all", NULL, NULL, 0);
-    XtCallActionProc(edit, "kill-selection", NULL, NULL, 0);
+    Widget edit = XtNameToWidget(engineOutputShell, which ? "*form2.text" : "*form.text");
+    Arg arg;
+//    XtCallActionProc(edit, "select-all", NULL, NULL, 0);
+//    XtCallActionProc(edit, "kill-selection", NULL, NULL, 0);
+    XtSetArg(arg, XtNstring, ""); // clear without disturbing selection!
+    XtSetValues(edit, &arg, 1);
 }
 
 // cloned from CopyPositionProc. Abuse selected_fen_position to hold selection
 
-extern char *selected_fen_position;
-
 Boolean SendPositionSelection(Widget w, Atom *selection, Atom *target,
                 Atom *type_return, XtPointer *value_return,
                 unsigned long *length_return, int *format_return); // from xboard.c
@@ -231,7 +216,8 @@ void SetFocus(Widget w, XtPointer data, XEvent *event, Boolean *b); // from xopt
 char memoTranslations[] =
 ":Ctrl<Key>c: CopyMemoProc() \n \
 <Btn3Motion>: HandlePV() \n \
-<Btn3Down>: select-start() SelectPV() \n \
+Shift<Btn3Down>: select-start() SelectPV(1) \n \
+Any<Btn3Down>: select-start() SelectPV(0) \n \
 <Btn3Up>: extend-end() StopPV() \n";
 
 void
@@ -248,6 +234,7 @@ SelectPV (Widget w, XEvent * event, String * params, Cardinal * nParams)
        XawTextGetSelectionPos(w, &index, &dummy);
        XtSetArg(arg, XtNstring, &val);
        XtGetValues(w, &arg, 1);
+       shiftKey = strcmp(params[0], "0");
        if(LoadMultiPV(x, y, val, index, &start, &end)) {
            XawTextSetSelection( outputField[currentPV][nMemo], start, end );
            highTextStart[currentPV] = start; highTextEnd[currentPV] = end;