X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/266a86bd7fedf743225c2497956b73ecb2245196..845ca893904e4664063cb5c121b34925386849f7:/lwlib/lwlib-Xaw.c diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c index 2e08dd12bd..0a759e1a0a 100644 --- a/lwlib/lwlib-Xaw.c +++ b/lwlib/lwlib-Xaw.c @@ -1,7 +1,7 @@ /* The lwlib interface to Athena widgets. + Copyright (C) 1993 Chuck Thompson -Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright (C) 1994, 2001-2012 Free Software Foundation, Inc. This file is part of the Lucid Widget Library. @@ -28,7 +28,7 @@ Boston, MA 02110-1301, USA. */ #include #include -#include "../src/lisp.h" +#include #include "lwlib-Xaw.h" @@ -136,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; } @@ -384,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)) @@ -577,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; @@ -834,6 +841,3 @@ xaw_creation_table [] = {"main", xaw_create_main}, {NULL, NULL} }; - -/* arch-tag: fbbd3589-ae1c-41a0-9142-f628cfee6564 - (do not change this comment) */