X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xoptions.c;h=e2646c1815dc9a2be6008b2ecad3f4d8356cb48f;hb=6d2eb06e7ad56484b364a517cea83c85919f2bd8;hp=820ca81424776312d10a9eef9c3680889f4b91ab;hpb=6ce428cd6c31f2203aeabacb774c26c635af58c0;p=xboard.git diff --git a/xoptions.c b/xoptions.c index 820ca81..e2646c1 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'); } @@ -1017,7 +1018,7 @@ GenericPopUp (Option *option, char *title, int dlgNr) Arg args[16]; Widget popup, layout, dialog=NULL, edit=NULL, form, last, b_ok, b_cancel, leftMargin = NULL, textField = NULL; Window root, child; - int x, y, i, j, height=999, width=1, h, c, w; + int x, y, i, j, height=999, width=1, h, c, w, shrink=FALSE; int win_x, win_y, maxWidth, maxTextWidth; unsigned int mask; char def[MSG_SIZ], *msg; @@ -1107,7 +1108,7 @@ GenericPopUp (Option *option, char *title, int dlgNr) if(option[i].value & 2) { XtSetArg(args[j], XtNscrollHorizontal, XawtextScrollAlways); j++; } if(option[i].value & 4) { XtSetArg(args[j], XtNautoFill, True); j++; } if(option[i].value & 8) { XtSetArg(args[j], XtNwrap, XawtextWrapWord); j++; } - } + } else shrink = TRUE; XtSetArg(args[j], XtNleft, XtChainLeft); j++; XtSetArg(args[j], XtNeditType, XawtextEdit); j++; XtSetArg(args[j], XtNuseStringInPlace, False); j++; @@ -1178,7 +1179,7 @@ GenericPopUp (Option *option, char *title, int dlgNr) j=0; XtSetArg(args[j], XtNfromVert, last); j++; XtSetArg(args[j], XtNfromHoriz, option[i].type != Label ? dialog : NULL); j++; - if(option[i].type != Label) XtSetArg(args[j], XtNheight, textHeight), j++; + if(option[i].type != Label) XtSetArg(args[j], XtNheight, textHeight), j++, shrink = TRUE; XtSetArg(args[j], XtNleft, XtChainLeft); j++; XtSetArg(args[j], XtNborderWidth, 0); j++; XtSetArg(args[j], XtNjustify, XtJustifyLeft); j++; @@ -1195,12 +1196,13 @@ GenericPopUp (Option *option, char *title, int dlgNr) XtSetArg(args[j], XtNfromHoriz, last); j++; XtSetArg(args[j], XtNleft, XtChainRight); j++; XtSetArg(args[j], XtNright, XtChainRight); j++; + if(shrink) XtSetArg(args[j], XtNheight, textHeight), j++; } else { XtSetArg(args[j], XtNfromVert, last); j++; XtSetArg(args[j], XtNfromHoriz, NULL); j++; lastrow = forelast; + shrink = FALSE; } XtSetArg(args[j], XtNlabel, _(option[i].name)); j++; - XtSetArg(args[j], XtNheight, textHeight), j++; if(option[i].max) { XtSetArg(args[j], XtNwidth, option[i].max); j++; } if(option[i].textValue) { // special for buttons of New Variant dialog XtSetArg(args[j], XtNsensitive, appData.noChessProgram || option[i].value < 0 @@ -1243,6 +1245,7 @@ GenericPopUp (Option *option, char *title, int dlgNr) XtSetArg(args[j], XtNmenuName, XtNewString(option[i].name)); j++; XtSetArg(args[j], XtNlabel, _(((char**)option[i].textValue)[option[i].value])); j++; XtSetArg(args[j], XtNheight, textHeight), j++; + shrink = TRUE; option[i].handle = (void*) (last = XtCreateManagedWidget(" ", menuButtonWidgetClass, form, args, j)); CreateComboPopup(last, option + i, i); @@ -1323,14 +1326,14 @@ GenericPopUp (Option *option, char *title, int dlgNr) } j = 0; XtSetArg(args[j], XtNfromHoriz, last); last = forelast; - } else + } else shrink = FALSE, XtSetArg(args[j], XtNfromHoriz, widest ? widest : dialog); j++; XtSetArg(args[j], XtNfromVert, anchor ? anchor : last); j++; XtSetArg(args[j], XtNbottom, XtChainBottom); j++; XtSetArg(args[j], XtNtop, XtChainBottom); j++; XtSetArg(args[j], XtNleft, XtChainRight); j++; XtSetArg(args[j], XtNright, XtChainRight); j++; - XtSetArg(args[j], XtNheight, textHeight), j++; + if(shrink) XtSetArg(args[j], XtNheight, textHeight), j++; b_ok = XtCreateManagedWidget(_("OK"), commandWidgetClass, form, args, j); XtAddCallback(b_ok, XtNcallback, GenericCallback, (XtPointer)(intptr_t) dlgNr + (dlgNr<<16));