]> granicus.if.org Git - nethack/commitdiff
X11 pop-up dialog width
authorcohrs <cohrs>
Sun, 31 Mar 2002 17:11:23 +0000 (17:11 +0000)
committercohrs <cohrs>
Sun, 31 Mar 2002 17:11:23 +0000 (17:11 +0000)
- 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.

doc/fixes34.1
win/X11/dialogs.c

index 305d35eb2b31feee8e6d210961603e1451bd78f2..bc06dcfc564a9eb6683f21505afd0905721aa81c 100644 (file)
@@ -52,6 +52,7 @@ win32tty: honour the use_inverse option and default to ATR_BOLD if disabled
 X11: restore support for non-square tiles when USE_XPM is defined
 Gnome: add support for non-square tiles
 tty: remove #define DEBUG that forced debug behavior in production builds
+X11: getlin dialog got steadily narrower each time it was used
 
 
 General New Features
index ba2f913c28ca145724c6a76f6da912a342226690..a887ef0c7b09faf296130d68de170e548928cde9 100644 (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);