From: H.G. Muller Date: Sat, 11 Feb 2012 23:01:24 +0000 (+0100) Subject: Fix OK button of error popup X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=dce079bee6bd128a9ecf9e00ba480371b30878e9;p=xboard.git Fix OK button of error popup The error dialog popped up as a child of the board window, even when DisplayError was called from a dialog. Now it checks if a transient dialog is up, and if so, it pops up as a child of that, grabs focus, and suppresses the system popdown of the transient dialog through a flag dialogError until it is popped down itself. --- diff --git a/xboard.c b/xboard.c index e8fdeb7..260bddc 100644 --- a/xboard.c +++ b/xboard.c @@ -5222,7 +5222,7 @@ PromotionCallback (Widget w, XtPointer client_data, XtPointer call_data) void ErrorCallback (Widget w, XtPointer client_data, XtPointer call_data) { - errorUp = False; + dialogError = errorUp = False; XtPopdown(w = XtParent(XtParent(XtParent(w)))); XtDestroyWidget(w); if (errorExitStatus != -1) ExitEvent(errorExitStatus); @@ -5233,7 +5233,7 @@ void ErrorPopDown () { if (!errorUp) return; - errorUp = False; + dialogError = errorUp = False; XtPopdown(errorShell); XtDestroyWidget(errorShell); if (errorExitStatus != -1) ExitEvent(errorExitStatus); @@ -5256,7 +5256,7 @@ ErrorPopUp (char *title, char *label, int modal) XtSetArg(args[i], XtNtitle, title); i++; errorShell = XtCreatePopupShell("errorpopup", transientShellWidgetClass, - shellWidget, args, i); + shellUp[0] ? (dialogError = modal = TRUE, shells[0]) : shellWidget, args, i); layout = XtCreateManagedWidget(layoutName, formWidgetClass, errorShell, layoutArgs, XtNumber(layoutArgs)); diff --git a/xboard.h b/xboard.h index 48ce476..2807e65 100644 --- a/xboard.h +++ b/xboard.h @@ -153,6 +153,7 @@ FILE * XsraSelFile P((Widget w, char *prompt, char *ok, char *cancel, char *fail extern Widget shells[]; extern Boolean shellUp[]; +extern int dialogError; extern Widget formWidget, shellWidget, boardWidget, menuBarWidget, gameListShell, historyShell; extern Display *xDisplay; extern Window xBoardWindow; diff --git a/xoptions.c b/xoptions.c index 820ca81..46ca0e0 100644 --- a/xoptions.c +++ b/xoptions.c @@ -113,6 +113,7 @@ typedef int OKCallback(int n); int values[MAX_OPTIONS]; ChessProgramState *currentCps; +int dialogError; static Option *currentOption; static Boolean browserUp; ButtonCallback *comboCallback; @@ -303,7 +304,7 @@ PopDown (int n) void GenericPopDown (Widget w, XEvent *event, String *prms, Cardinal *nprms) { - if(browserUp) return; // prevent closing dialog when it has an open file-browse daughter + if(browserUp || dialogError) return; // prevent closing dialog when it has an open file-browse daughter PopDown(prms[0][0] - '0'); }