Include "font.h".
[bpt/emacs.git] / src / frame.c
index b84eee0..1606f19 100644 (file)
@@ -1,5 +1,5 @@
 /* Generic frame functions.
-   Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003,
+   Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2006,
                  2004, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -53,6 +53,10 @@ Boston, MA 02110-1301, USA.  */
 
 #ifdef HAVE_WINDOW_SYSTEM
 
+#ifdef USE_FONT_BACKEND
+#include "font.h"
+#endif /* USE_FONT_BACKEND */
+
 /* The name we're using in resource queries.  Most often "emacs".  */
 
 Lisp_Object Vx_resource_name;
@@ -299,6 +303,9 @@ make_frame (mini_p)
 #endif
   f->size_hint_flags = 0;
   f->win_gravity = 0;
+#ifdef USE_FONT_BACKEND
+  f->font_driver_list = NULL;
+#endif /* USE_FONT_BACKEND */
 
   root_window = make_window ();
   if (mini_p)
@@ -3068,6 +3075,12 @@ x_set_font (f, arg, oldval)
   Lisp_Object frame;
   int old_fontset = FRAME_FONTSET(f);
 
+#ifdef USE_FONT_BACKEND
+  if (enable_font_backend)
+    fontset_name = result = x_new_fontset2 (f, arg);
+  else
+    {
+#endif /* USE_FONT_BACKEND */
   CHECK_STRING (arg);
 
   fontset_name = Fquery_fontset (arg, Qnil);
@@ -3077,6 +3090,9 @@ x_set_font (f, arg, oldval)
             ? x_new_fontset (f, fontset_name)
             : x_new_fontset (f, arg));
   UNBLOCK_INPUT;
+#ifdef USE_FONT_BACKEND
+    }
+#endif
 
   if (EQ (result, Qnil))
     error ("Font `%s' is not defined", SDATA (arg));
@@ -3093,9 +3109,15 @@ x_set_font (f, arg, oldval)
            return;
        }
       store_frame_param (f, Qfont, result);
+
       if (!NILP (Fequal (result, oldval)))
         return;
 
+      /* Recalculate toolbar height.  */
+      f->n_tool_bar_rows = 0;
+      /* Ensure we redraw it.  */
+      clear_current_matrices (f);
+
       recompute_basic_faces (f);
     }
   else
@@ -3136,7 +3158,7 @@ x_set_border_width (f, arg, oldval)
 
 #ifndef MAC_OS
   if (FRAME_X_WINDOW (f) != 0)
-    error ("Cannot change the border width of a window");
+    error ("Cannot change the border width of a frame");
 #endif /* MAC_TODO */
 
   f->border_width = XINT (arg);
@@ -3524,9 +3546,15 @@ x_get_arg (dpyinfo, alist, param, attribute, class, type)
     {
       /* If we find this parm in ALIST, clear it out
         so that it won't be "left over" at the end.  */
-#ifdef HAVE_X_WINDOWS /* macfns.c and w32fns.c have not yet
-                        been changed to cope with this.  */
+#ifndef WINDOWSNT /* w32fns.c has not yet been changed to cope with this.  */
+      Lisp_Object tail;
       XSETCAR (tem, Qnil);
+      /* In case the parameter appears more than once in the alist,
+        clear it out.  */
+      for (tail = alist; CONSP (tail); tail = XCDR (tail))
+       if (CONSP (XCAR (tail))
+           && EQ (XCAR (XCAR (tail)), param))
+         XSETCAR (XCAR (tail), Qnil);
 #endif
     }
   else