X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/8f1d2ef658f95549eb33fe5265f8f11c5129bece..845ca893904e4664063cb5c121b34925386849f7:/lwlib/lwlib-Xaw.c diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c index cf98a37196..0a759e1a0a 100644 --- a/lwlib/lwlib-Xaw.c +++ b/lwlib/lwlib-Xaw.c @@ -1,6 +1,7 @@ /* The lwlib interface to Athena widgets. + Copyright (C) 1993 Chuck Thompson -Copyright (C) 1994, 2001-2011 Free Software Foundation, Inc. +Copyright (C) 1994, 2001-2012 Free Software Foundation, Inc. This file is part of the Lucid Widget Library. @@ -27,7 +28,7 @@ Boston, MA 02110-1301, USA. */ #include #include -#include "../src/lisp.h" +#include #include "lwlib-Xaw.h" @@ -135,7 +136,7 @@ openFont (Widget widget, char *name) } fn = XftFontOpenName (XtDisplay (widget), screen, fname); - if (fname != name) free (fname); + if (fname != name) xfree (fname); return fn; } @@ -383,7 +384,7 @@ xaw_destroy_instance (widget_instance *instance) if (instance->xft_data[0].xft_font) XftFontClose (XtDisplay (instance->widget), instance->xft_data[0].xft_font); - free (instance->xft_data); + xfree (instance->xft_data); } #endif if (XtIsSubclass (instance->widget, dialogWidgetClass)) @@ -576,13 +577,20 @@ make_dialog (char* name, if (w) { XtResource rec[] = - { { "faceName", "FaceName", XtRString, sizeof(String), 0, XtRString, - (XtPointer)"Sans-14" }}; - char *faceName; - XtVaGetSubresources (dialog, &faceName, "Dialog", "dialog", + { { "font", "Font", XtRString, sizeof(String), 0, XtRString, + (XtPointer)"Sans-10" }}; + char *fontName = NULL; + XtVaGetSubresources (dialog, &fontName, "Dialog", "dialog", rec, 1, (String)NULL); - if (strcmp ("none", faceName) != 0) - xft_font = openFont (dialog, faceName); + if (fontName) + { + XFontStruct *xfn = XLoadQueryFont (XtDisplay (dialog), fontName); + if (!xfn) + xft_font = openFont (dialog, fontName); + else + XFreeFont (XtDisplay (dialog), xfn); + } + if (xft_font) { instance->nr_xft_data = left_buttons + right_buttons + 1; @@ -833,4 +841,3 @@ xaw_creation_table [] = {"main", xaw_create_main}, {NULL, NULL} }; -