]> code.delx.au - gnu-emacs/blobdiff - lwlib/lwlib-Xaw.c
Switch from NO_RETURN to C11's _Noreturn.
[gnu-emacs] / lwlib / lwlib-Xaw.c
index e89282853beddc41347ca3ed5c49a121954e31f8..0a759e1a0a0711b5bd98e17ed5c48a30d8219150 100644 (file)
@@ -1,7 +1,7 @@
 /* The lwlib interface to Athena widgets.
+
 Copyright (C) 1993 Chuck Thompson <cthomp@cs.uiuc.edu>
-Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006,
-  2007, 2008, 2009, 2010, 2011 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 <setjmp.h>
 #include <ctype.h>
 
-#include "../src/lisp.h"
+#include <lisp.h>
 
 #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) */