aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfaces.c
diff options
context:
space:
mode:
authorDaniel Colascione2012-09-17 04:07:36 -0800
committerDaniel Colascione2012-09-17 04:07:36 -0800
commit2ab329f3b5d52a39f0a45c3d9c129f1c19560142 (patch)
tree6dd6784d63e54cb18071df8e28fbdbc27d418728 /src/xfaces.c
parentf701ab72dd55460d23c8b029550aa4d7ecef3cfa (diff)
parentbb7dce392f6d9d5fc4b9d7de09ff920a52f07669 (diff)
downloademacs-2ab329f3b5d52a39f0a45c3d9c129f1c19560142.tar.gz
emacs-2ab329f3b5d52a39f0a45c3d9c129f1c19560142.zip
Merge from trunk
Diffstat (limited to 'src/xfaces.c')
-rw-r--r--src/xfaces.c72
1 files changed, 17 insertions, 55 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 67e9c2c37c6..51e568547ee 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -204,7 +204,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
204#include <sys/types.h> 204#include <sys/types.h>
205#include <sys/stat.h> 205#include <sys/stat.h>
206#include <stdio.h> /* This needs to be before termchar.h */ 206#include <stdio.h> /* This needs to be before termchar.h */
207#include <setjmp.h>
208 207
209#include "lisp.h" 208#include "lisp.h"
210#include "character.h" 209#include "character.h"
@@ -315,9 +314,10 @@ static Lisp_Object QCfontset;
315Lisp_Object Qnormal; 314Lisp_Object Qnormal;
316Lisp_Object Qbold; 315Lisp_Object Qbold;
317static Lisp_Object Qline, Qwave; 316static Lisp_Object Qline, Qwave;
318Lisp_Object Qultra_light, Qextra_light, Qlight; 317static Lisp_Object Qultra_light, Qreverse_oblique, Qreverse_italic;
318Lisp_Object Qextra_light, Qlight;
319Lisp_Object Qsemi_light, Qsemi_bold, Qextra_bold, Qultra_bold; 319Lisp_Object Qsemi_light, Qsemi_bold, Qextra_bold, Qultra_bold;
320Lisp_Object Qoblique, Qreverse_oblique, Qreverse_italic; 320Lisp_Object Qoblique;
321Lisp_Object Qitalic; 321Lisp_Object Qitalic;
322static Lisp_Object Qultra_condensed, Qextra_condensed; 322static Lisp_Object Qultra_condensed, Qextra_condensed;
323Lisp_Object Qcondensed; 323Lisp_Object Qcondensed;
@@ -452,18 +452,7 @@ static int menu_face_changed_default;
452struct table_entry; 452struct table_entry;
453struct named_merge_point; 453struct named_merge_point;
454 454
455static void map_tty_color (struct frame *, struct face *,
456 enum lface_attribute_index, int *);
457static Lisp_Object resolve_face_name (Lisp_Object, int);
458static void set_font_frame_param (Lisp_Object, Lisp_Object); 455static void set_font_frame_param (Lisp_Object, Lisp_Object);
459static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *,
460 int, struct named_merge_point *);
461static ptrdiff_t load_pixmap (struct frame *, Lisp_Object,
462 unsigned *, unsigned *);
463static struct frame *frame_or_selected_frame (Lisp_Object, int);
464static void load_face_colors (struct frame *, struct face *, Lisp_Object *);
465static void free_face_colors (struct frame *, struct face *);
466static int face_color_gray_p (struct frame *, const char *);
467static struct face *realize_face (struct face_cache *, Lisp_Object *, 456static struct face *realize_face (struct face_cache *, Lisp_Object *,
468 int); 457 int);
469static struct face *realize_non_ascii_face (struct frame *, Lisp_Object, 458static struct face *realize_non_ascii_face (struct frame *, Lisp_Object,
@@ -473,38 +462,11 @@ static struct face *realize_tty_face (struct face_cache *, Lisp_Object *);
473static int realize_basic_faces (struct frame *); 462static int realize_basic_faces (struct frame *);
474static int realize_default_face (struct frame *); 463static int realize_default_face (struct frame *);
475static void realize_named_face (struct frame *, Lisp_Object, int); 464static void realize_named_face (struct frame *, Lisp_Object, int);
476static int lface_fully_specified_p (Lisp_Object *);
477static int lface_equal_p (Lisp_Object *, Lisp_Object *);
478static unsigned hash_string_case_insensitive (Lisp_Object);
479static unsigned lface_hash (Lisp_Object *);
480static int lface_same_font_attributes_p (Lisp_Object *, Lisp_Object *);
481static struct face_cache *make_face_cache (struct frame *); 465static struct face_cache *make_face_cache (struct frame *);
482static void clear_face_gcs (struct face_cache *); 466static void clear_face_gcs (struct face_cache *);
483static void free_face_cache (struct face_cache *); 467static void free_face_cache (struct face_cache *);
484static int face_fontset (Lisp_Object *);
485static void merge_face_vectors (struct frame *, Lisp_Object *, Lisp_Object*,
486 struct named_merge_point *);
487static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *, 468static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *,
488 int, struct named_merge_point *); 469 int, struct named_merge_point *);
489static int set_lface_from_font (struct frame *, Lisp_Object, Lisp_Object,
490 int);
491static Lisp_Object lface_from_face_name (struct frame *, Lisp_Object, int);
492static struct face *make_realized_face (Lisp_Object *);
493static void cache_face (struct face_cache *, struct face *, unsigned);
494static void uncache_face (struct face_cache *, struct face *);
495
496#ifdef HAVE_WINDOW_SYSTEM
497
498static GC x_create_gc (struct frame *, unsigned long, XGCValues *);
499static void x_free_gc (struct frame *, GC);
500
501#ifdef USE_X_TOOLKIT
502static void x_update_menu_appearance (struct frame *);
503
504extern void free_frame_menubar (struct frame *);
505#endif /* USE_X_TOOLKIT */
506
507#endif /* HAVE_WINDOW_SYSTEM */
508 470
509 471
510/*********************************************************************** 472/***********************************************************************
@@ -547,7 +509,7 @@ unregister_color (unsigned long pixel)
547 if (color_count[pixel] > 0) 509 if (color_count[pixel] > 0)
548 --color_count[pixel]; 510 --color_count[pixel];
549 else 511 else
550 abort (); 512 emacs_abort ();
551} 513}
552 514
553 515
@@ -698,7 +660,7 @@ x_create_gc (struct frame *f,
698 XGCValues *xgcv) 660 XGCValues *xgcv)
699{ 661{
700 GC gc = xmalloc (sizeof *gc); 662 GC gc = xmalloc (sizeof *gc);
701 memcpy (gc, xgcv, sizeof (XGCValues)); 663 *gc = *xgcv;
702 return gc; 664 return gc;
703} 665}
704 666
@@ -764,7 +726,7 @@ init_frame_faces (struct frame *f)
764 if (!FRAME_NS_P (f) || FRAME_NS_WINDOW (f)) 726 if (!FRAME_NS_P (f) || FRAME_NS_WINDOW (f))
765#endif 727#endif
766 if (!realize_basic_faces (f)) 728 if (!realize_basic_faces (f))
767 abort (); 729 emacs_abort ();
768} 730}
769 731
770 732
@@ -808,7 +770,7 @@ recompute_basic_faces (struct frame *f)
808 { 770 {
809 clear_face_cache (0); 771 clear_face_cache (0);
810 if (!realize_basic_faces (f)) 772 if (!realize_basic_faces (f))
811 abort (); 773 emacs_abort ();
812 } 774 }
813} 775}
814 776
@@ -1145,7 +1107,7 @@ defined_color (struct frame *f, const char *color_name, XColor *color_def,
1145 return ns_defined_color (f, color_name, color_def, alloc, 1); 1107 return ns_defined_color (f, color_name, color_def, alloc, 1);
1146#endif 1108#endif
1147 else 1109 else
1148 abort (); 1110 emacs_abort ();
1149} 1111}
1150 1112
1151 1113
@@ -1341,7 +1303,7 @@ load_color (struct frame *f, struct face *face, Lisp_Object name,
1341 break; 1303 break;
1342 1304
1343 default: 1305 default:
1344 abort (); 1306 emacs_abort ();
1345 } 1307 }
1346 } 1308 }
1347#ifdef GLYPH_DEBUG 1309#ifdef GLYPH_DEBUG
@@ -4585,7 +4547,7 @@ lookup_named_face (struct frame *f, Lisp_Object symbol, int signal_p)
4585 return -1; 4547 return -1;
4586 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); 4548 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
4587 if (default_face == NULL) 4549 if (default_face == NULL)
4588 abort (); /* realize_basic_faces must have set it up */ 4550 emacs_abort (); /* realize_basic_faces must have set it up */
4589 } 4551 }
4590 4552
4591 if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0)) 4553 if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
@@ -4628,7 +4590,7 @@ lookup_basic_face (struct frame *f, int face_id)
4628 case MENU_FACE_ID: name = Qmenu; break; 4590 case MENU_FACE_ID: name = Qmenu; break;
4629 4591
4630 default: 4592 default:
4631 abort (); /* the caller is supposed to pass us a basic face id */ 4593 emacs_abort (); /* the caller is supposed to pass us a basic face id */
4632 } 4594 }
4633 4595
4634 /* Do a quick scan through Vface_remapping_alist, and return immediately 4596 /* Do a quick scan through Vface_remapping_alist, and return immediately
@@ -4749,7 +4711,7 @@ lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id,
4749 struct face *default_face = FACE_FROM_ID (f, face_id); 4711 struct face *default_face = FACE_FROM_ID (f, face_id);
4750 4712
4751 if (!default_face) 4713 if (!default_face)
4752 abort (); 4714 emacs_abort ();
4753 4715
4754 if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0)) 4716 if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
4755 return -1; 4717 return -1;
@@ -5139,7 +5101,7 @@ face for italic. */)
5139 error ("Cannot realize default face"); 5101 error ("Cannot realize default face");
5140 def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); 5102 def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
5141 if (def_face == NULL) 5103 if (def_face == NULL)
5142 abort (); /* realize_basic_faces must have set it up */ 5104 emacs_abort (); /* realize_basic_faces must have set it up */
5143 } 5105 }
5144 5106
5145 /* Dispatch to the appropriate handler. */ 5107 /* Dispatch to the appropriate handler. */
@@ -5424,7 +5386,7 @@ realize_default_face (struct frame *f)
5424 else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) 5386 else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
5425 ASET (lface, LFACE_FOREGROUND_INDEX, build_string (unspecified_fg)); 5387 ASET (lface, LFACE_FOREGROUND_INDEX, build_string (unspecified_fg));
5426 else 5388 else
5427 abort (); 5389 emacs_abort ();
5428 } 5390 }
5429 5391
5430 if (UNSPECIFIEDP (LFACE_BACKGROUND (lface))) 5392 if (UNSPECIFIEDP (LFACE_BACKGROUND (lface)))
@@ -5439,7 +5401,7 @@ realize_default_face (struct frame *f)
5439 else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) 5401 else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
5440 ASET (lface, LFACE_BACKGROUND_INDEX, build_string (unspecified_bg)); 5402 ASET (lface, LFACE_BACKGROUND_INDEX, build_string (unspecified_bg));
5441 else 5403 else
5442 abort (); 5404 emacs_abort ();
5443 } 5405 }
5444 5406
5445 if (UNSPECIFIEDP (LFACE_STIPPLE (lface))) 5407 if (UNSPECIFIEDP (LFACE_STIPPLE (lface)))
@@ -5539,7 +5501,7 @@ realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id)
5539 face = make_realized_face (attrs); 5501 face = make_realized_face (attrs);
5540 } 5502 }
5541 else 5503 else
5542 abort (); 5504 emacs_abort ();
5543 5505
5544 /* Insert the new face. */ 5506 /* Insert the new face. */
5545 cache_face (cache, face, lface_hash (attrs)); 5507 cache_face (cache, face, lface_hash (attrs));
@@ -5634,7 +5596,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
5634 if (default_face) 5596 if (default_face)
5635 fontset = default_face->fontset; 5597 fontset = default_face->fontset;
5636 if (fontset == -1) 5598 if (fontset == -1)
5637 abort (); 5599 emacs_abort ();
5638 } 5600 }
5639 if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX])) 5601 if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
5640 attrs[LFACE_FONT_INDEX] 5602 attrs[LFACE_FONT_INDEX]