diff --git a/win/X11/winX.c b/win/X11/winX.c index 28d3e4da5..1b3089e9e 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -749,27 +749,28 @@ nhFreePixel( Dimension nhFontHeight(Widget w) { + Arg args[1]; + XFontStruct *fs; + #ifdef _XawTextSink_h - Widget sink; + Widget sink = NULL; XawTextPosition pos = 0; int resWidth, resHeight; - Arg args[1]; XtSetArg(args[0], XtNtextSink, &sink); XtGetValues(w, args, 1); - XawTextSinkFindPosition(sink, pos, 0, 0, 0, &pos, &resWidth, &resHeight); - return resHeight; -#else - XFontStruct *fs; - Arg args[1]; + if (sink != NULL) { + XawTextSinkFindPosition(sink, pos, 0, 0, 0, &pos, &resWidth, &resHeight); + return resHeight; + } +#endif XtSetArg(args[0], XtNfont, &fs); XtGetValues(w, args, 1); /* Assume font height is ascent + descent. */ - return = fs->ascent + fs->descent; -#endif + return fs->ascent + fs->descent; } static String *default_resource_data = 0, /* NULL-terminated arrays */ diff --git a/win/X11/winstat.c b/win/X11/winstat.c index b5bdc1072..8d7f3230c 100644 --- a/win/X11/winstat.c +++ b/win/X11/winstat.c @@ -1113,6 +1113,12 @@ create_tty_status(Widget parent, Widget top) X11_status_widget = XtCreateManagedWidget("status_form", windowWidgetClass, form, args, num_args); + int height = nhFontHeight(X11_status_widget) * 3; + num_args = 0; + XtSetArg(args[num_args], XtNheight, height); num_args++; + XtSetValues(form, args, num_args); + XtSetValues(X11_status_widget, args, num_args); + XtAddCallback(X11_status_widget, XtNexposeCallback, tty_status_exposed, (XtPointer) 0); @@ -1194,15 +1200,13 @@ tty_status_redraw(Widget w) }; Arg args[5]; int num_args; - XFontStruct *font; Dimension width; /* Get the height of the font and the width of the widget */ num_args = 0; - XtSetArg(args[num_args], XtNfont, &font); num_args++; XtSetArg(args[num_args], XtNwidth, &width); num_args++; XtGetValues(w, args, num_args); - int height = font->max_bounds.ascent + font->max_bounds.descent; + int height = nhFontHeight(w); int x = 0; int y = 0;