]> code.delx.au - gnu-emacs/blobdiff - src/xfaces.c
(XMenuActivate): Fix call to lookup_derived_face.
[gnu-emacs] / src / xfaces.c
index c6dff0bae7f3802bad7dd2157260ebb9215f8422..753b20765d8d9eeca5c616d4cb216988ade7ef2a 100644 (file)
@@ -1,5 +1,5 @@
 /* xfaces.c -- "Face" primitives.
-   Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation.
 
 This file is part of GNU Emacs.
@@ -738,7 +738,7 @@ x_free_gc (f, gc)
      GC gc;
 {
   BLOCK_INPUT;
-  xassert (--ngcs >= 0);
+  IF_DEBUG (xassert (--ngcs >= 0));
   XFreeGC (FRAME_X_DISPLAY (f), gc);
   UNBLOCK_INPUT;
 }
@@ -771,7 +771,7 @@ x_free_gc (f, gc)
      GC gc;
 {
   BLOCK_INPUT;
-  xassert (--ngcs >= 0);
+  IF_DEBUG (xassert (--ngcs >= 0));
   xfree (gc);
   UNBLOCK_INPUT;
 }
@@ -1513,7 +1513,7 @@ face_color_supported_p (f, color_name, background_p)
 
   XSETFRAME (frame, f);
   return
-#ifdef HAVE_X_WINDOWS
+#ifdef HAVE_WINDOW_SYSTEM
     FRAME_WINDOW_P (f)
     ? (!NILP (Fxw_display_color_p (frame))
        || xstricmp (color_name, "black") == 0
@@ -4148,7 +4148,7 @@ FRAME 0 means change the face on all frames, and change the default
                }
              else if (EQ (k, QCcolor))
                {
-                 if (!STRINGP (v) || SCHARS (v) == 0)
+                 if (!NILP (v) && (!STRINGP (v) || SCHARS (v) == 0))
                    break;
                }
              else if (EQ (k, QCstyle))
@@ -4692,16 +4692,27 @@ x_update_menu_appearance (f)
        {
 #ifdef USE_MOTIF
          const char *suffix = "List";
+         Bool motif = True;
 #else
          const char *suffix = "";
+         Bool motif = False;
+#endif
+#if defined HAVE_X_I18N
+         extern char *xic_create_fontsetname
+           P_ ((char *base_fontname, Bool motif));
+         char *fontsetname = xic_create_fontsetname (face->font_name, motif);
+#else
+         char *fontsetname = face->font_name;
 #endif
          sprintf (line, "%s.pane.menubar*font%s: %s",
-                  myname, suffix, face->font_name);
+                  myname, suffix, fontsetname);
          XrmPutLineResource (&rdb, line);
          sprintf (line, "%s.%s*font%s: %s",
-                  myname, popup_path, suffix, face->font_name);
+                  myname, popup_path, suffix, fontsetname);
          XrmPutLineResource (&rdb, line);
          changed_p = 1;
+         if (fontsetname != face->font_name)
+           xfree (fontsetname);
        }
 
       if (changed_p && f->output_data.x->menubar_widget)
@@ -7691,16 +7702,19 @@ face_at_string_position (w, string, pos, bufpos, region_beg,
 
    F is frame where faces are (to be) realized.
 
-   FACE_NAME is named face to merge, or if nil,
-   FACE_ID is face_id of realized face to merge.
+   FACE_NAME is named face to merge.
+
+   If FACE_NAME is nil, FACE_ID is face_id of realized face to merge.
+
+   If FACE_NAME is t, FACE_ID is lface_id of face to merge.
 
    BASE_FACE_ID is realized face to merge into.
 
-   Return new face.
+   Return new face id.
 */
 
 int
-merge_into_realized_face (f, face_name, face_id, base_face_id)
+merge_faces (f, face_name, face_id, base_face_id)
      struct frame *f;
      Lisp_Object face_name;
      int face_id, base_face_id;
@@ -7712,6 +7726,17 @@ merge_into_realized_face (f, face_name, face_id, base_face_id)
   if (!base_face)
     return base_face_id;
 
+  if (EQ (face_name, Qt))
+    {
+      if (face_id < 0 || face_id >= lface_id_to_name_size)
+       return base_face_id;
+      face_name = lface_id_to_name[face_id];
+      face_id = lookup_derived_face (f, face_name, 0, base_face_id);
+      if (face_id >= 0)
+       return face_id;
+      return base_face_id;
+    }
+
   /* Begin with attributes from the base face.  */
   bcopy (base_face->lface, attrs, sizeof attrs);
 
@@ -7723,6 +7748,8 @@ merge_into_realized_face (f, face_name, face_id, base_face_id)
   else
     {
       struct face *face;
+      if (face_id < 0)
+       return base_face_id;
       face = FACE_FROM_ID (f, face_id);
       if (!face)
        return base_face_id;
@@ -7749,7 +7776,7 @@ dump_realized_face (face)
 {
   fprintf (stderr, "ID: %d\n", face->id);
 #ifdef HAVE_X_WINDOWS
-  fprintf (stderr, "gc: %d\n", (int) face->gc);
+  fprintf (stderr, "gc: %ld\n", (long) face->gc);
 #endif
   fprintf (stderr, "foreground: 0x%lx (%s)\n",
           face->foreground,