X11 pop-up dialog width

- the response field of the pop-up dialog was getting smaller by a few
pixels each time it was used.  This was because the width calculation
was effectively stripping off the margins (4 pixels total) each time.
Don't do that.
This commit is contained in:
cohrs
2002-03-31 17:11:23 +00:00
parent 994f624c0a
commit 320c5e720d
2 changed files with 5 additions and 4 deletions

View File

@@ -241,7 +241,7 @@ SetDialogResponse(w, s)
Arg args[4];
Widget response;
XFontStruct *font;
Dimension width, nwidth, tmp, leftMargin, rightMargin;
Dimension width, nwidth, leftMargin, rightMargin;
response = XtNameToWidget(w, "response");
XtSetArg(args[0], XtNfont, &font);
@@ -249,10 +249,10 @@ SetDialogResponse(w, s)
XtSetArg(args[2], XtNrightMargin, &rightMargin);
XtSetArg(args[3], XtNwidth, &width);
XtGetValues(response, args, FOUR);
/* width includes margins as per Xaw documentation */
nwidth = (font->max_bounds.width * strlen(s))+leftMargin+rightMargin;
tmp = width-(leftMargin+rightMargin);
if (nwidth < tmp)
nwidth = tmp;
if (nwidth < width)
nwidth = width;
XtSetArg(args[0], XtNstring, s);
XtSetArg(args[1], XtNwidth, nwidth);