if(!appData.pieceMenu && blackPlaysFirst) EditPositionMenuEvent(ClearBoard, 0, 0);
SetBlackToPlayEvent();
} else if ((gameMode == AnalyzeMode || gameMode == EditGame ||
- gameMode == MachinePlaysBlack && PosFlags(0) & F_NULL_MOVE && !blackFlag) && WhiteOnMove(currentMove)) {
+ gameMode == MachinePlaysBlack && PosFlags(0) & F_NULL_MOVE && !blackFlag && !shiftKey) && WhiteOnMove(currentMove)) {
UserMoveEvent((int)EmptySquare, DROP_RANK, 0, 0, 0); // [HGM] multi-move: if not out of time, enters null move
} else if (shiftKey) {
AdjustClock(which, -1);
if(!appData.pieceMenu && !blackPlaysFirst) EditPositionMenuEvent(ClearBoard, 0, 0);
SetWhiteToPlayEvent();
} else if ((gameMode == AnalyzeMode || gameMode == EditGame ||
- gameMode == MachinePlaysWhite && PosFlags(0) & F_NULL_MOVE && !whiteFlag) && !WhiteOnMove(currentMove)) {
+ gameMode == MachinePlaysWhite && PosFlags(0) & F_NULL_MOVE && !whiteFlag && !shiftKey) && !WhiteOnMove(currentMove)) {
UserMoveEvent((int)EmptySquare, DROP_RANK, 0, 0, 0); // [HGM] multi-move
} else if (shiftKey) {
AdjustClock(which, -1);
}
static void
+LabelCallback (Widget ww, XtPointer client_data, XEvent *event, Boolean *b)
+{ // called on ButtonPress in label widgets with attached user handler (clocks!)
+ int s, data = (intptr_t) client_data;
+ Option *opt = dialogOptions[data >> 8] + (s = data & 255);
+
+ if(((XButtonEvent*)event)->button != Button1) s = -s;
+ ((ButtonCallback*) opt->target) (s);
+}
+
+static void
CheckCallback (Widget ww, XtPointer client_data, XEvent *event, Boolean *b)
{
int s, data = (intptr_t) client_data;
Option *opt = dialogOptions[data >> 8] + (data & 255);
- if(opt->type == Label) { ((ButtonCallback*) opt->target)(data&255); return; }
-
GetWidgetState(opt, &s);
SetWidgetState(opt, !s);
}
XtSetArg(args[j], XtNlabel, _(msg)); j++;
option[i].handle = (void*) (last = XtCreateManagedWidget("label", labelWidgetClass, form, args, j));
if(option[i].target) // allow user to specify event handler for button presses
- XtAddEventHandler(last, ButtonPressMask, False, CheckCallback, (XtPointer)(intptr_t) i + 256*dlgNr);
+ XtAddEventHandler(last, ButtonPressMask, False, LabelCallback, (XtPointer)(intptr_t) i + 256*dlgNr);
break;
case SaveButton:
case Button: