diff options
author | Alexander Gramiak <agrambot@gmail.com> | 2019-05-09 13:07:35 -0600 |
---|---|---|
committer | Alexander Gramiak <agrambot@gmail.com> | 2019-05-19 19:50:32 -0600 |
commit | c0e146e4ec266edf348473c3db7ca8d16745f4f7 (patch) | |
tree | 3f2070ccbf941ba14f43836f7cfa1b4c78979043 /src/xfaces.c | |
parent | 05b79539f4d22bfe5160777aa5a963aeb74b000c (diff) | |
download | emacs-c0e146e4ec266edf348473c3db7ca8d16745f4f7.tar.gz emacs-c0e146e4ec266edf348473c3db7ca8d16745f4f7.tar.bz2 emacs-c0e146e4ec266edf348473c3db7ca8d16745f4f7.zip |
Introduce Emacs_Color struct and typedef
This avoids clashing with the XColor struct from X.
* src/dispextern [HAVE_X_WINDOWS]: Define Emacs_Color alias.
[!HAVE_X_WINDOWS]: Rename XColor compatibility struct to
Emacs_Color. Remove unused fields.
* src/gtkutil.c:
* src/gtkutil.h:
* src/image.c:
* src/nsterm.h:
* src/nsterm.m:
* src/termhooks.h:
* src/w32fns.c:
* src/w32term.c:
* src/w32term.h:
* src/xfaces.c:
* src/xfns.c:
* src/xterm.h: Use Emacs_Color over XColor outside of X-specific
sections.
Diffstat (limited to 'src/xfaces.c')
-rw-r--r-- | src/xfaces.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index 5c2414b7b0e..a8fdca70c9e 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -348,7 +348,7 @@ static void free_face_cache (struct face_cache *); static bool merge_face_ref (struct window *w, struct frame *, Lisp_Object, Lisp_Object *, bool, struct named_merge_point *); -static int color_distance (XColor *x, XColor *y); +static int color_distance (Emacs_Color *x, Emacs_Color *y); #ifdef HAVE_WINDOW_SYSTEM static void set_font_frame_param (Lisp_Object, Lisp_Object); @@ -802,7 +802,7 @@ load_pixmap (struct frame *f, Lisp_Object name) /*********************************************************************** - X Colors + Color Handling ***********************************************************************/ /* Parse RGB_LIST, and fill in the RGB fields of COLOR. @@ -810,7 +810,7 @@ load_pixmap (struct frame *f, Lisp_Object name) Return true iff RGB_LIST is OK. */ static bool -parse_rgb_list (Lisp_Object rgb_list, XColor *color) +parse_rgb_list (Lisp_Object rgb_list, Emacs_Color *color) { #define PARSE_RGB_LIST_FIELD(field) \ if (CONSP (rgb_list) && FIXNUMP (XCAR (rgb_list))) \ @@ -835,8 +835,8 @@ parse_rgb_list (Lisp_Object rgb_list, XColor *color) returned in it. */ static bool -tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, - XColor *std_color) +tty_lookup_color (struct frame *f, Lisp_Object color, Emacs_Color *tty_color, + Emacs_Color *std_color) { Lisp_Object frame, color_desc; @@ -897,7 +897,7 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, bool tty_defined_color (struct frame *f, const char *color_name, - XColor *color_def, bool alloc, bool _makeIndex) + Emacs_Color *color_def, bool alloc, bool _makeIndex) { bool status = true; @@ -965,7 +965,7 @@ tty_color_name (struct frame *f, int idx) static bool face_color_gray_p (struct frame *f, const char *color_name) { - XColor color; + Emacs_Color color; bool gray_p; if (FRAME_TERMINAL (f)->defined_color_hook @@ -994,7 +994,7 @@ face_color_supported_p (struct frame *f, const char *color_name, bool background_p) { Lisp_Object frame; - XColor not_used; + Emacs_Color not_used; XSETFRAME (frame, f); return @@ -1043,7 +1043,7 @@ COLOR must be a valid color name. */) static unsigned long load_color2 (struct frame *f, struct face *face, Lisp_Object name, - enum lface_attribute_index target_index, XColor *color) + enum lface_attribute_index target_index, Emacs_Color *color) { eassert (STRINGP (name)); eassert (target_index == LFACE_FOREGROUND_INDEX @@ -1117,7 +1117,7 @@ unsigned long load_color (struct frame *f, struct face *face, Lisp_Object name, enum lface_attribute_index target_index) { - XColor color; + Emacs_Color color; return load_color2 (f, face, name, target_index, &color); } @@ -1134,7 +1134,7 @@ load_face_colors (struct frame *f, struct face *face, Lisp_Object attrs[LFACE_VECTOR_SIZE]) { Lisp_Object fg, bg, dfg; - XColor xfg, xbg; + Emacs_Color xfg, xbg; bg = attrs[LFACE_BACKGROUND_INDEX]; fg = attrs[LFACE_FOREGROUND_INDEX]; @@ -4170,7 +4170,7 @@ prepare_face_for_display (struct frame *f, struct face *face) /* Returns the `distance' between the colors X and Y. */ static int -color_distance (XColor *x, XColor *y) +color_distance (Emacs_Color *x, Emacs_Color *y) { /* This formula is from a paper titled `Colour metric' by Thiadmer Riemersma. Quoting from that paper: @@ -4205,7 +4205,7 @@ two lists of the form (RED GREEN BLUE) aforementioned. */) Lisp_Object metric) { struct frame *f = decode_live_frame (frame); - XColor cdef1, cdef2; + Emacs_Color cdef1, cdef2; if (!(CONSP (color1) && parse_rgb_list (color1, &cdef1)) && !(STRINGP (color1) @@ -4885,8 +4885,8 @@ tty_supports_face_attributes_p (struct frame *f, { int weight, slant; Lisp_Object val, fg, bg; - XColor fg_tty_color, fg_std_color; - XColor bg_tty_color, bg_std_color; + Emacs_Color fg_tty_color, fg_std_color; + Emacs_Color bg_tty_color, bg_std_color; unsigned test_caps = 0; Lisp_Object *def_attrs = def_face->lface; @@ -4988,7 +4988,7 @@ tty_supports_face_attributes_p (struct frame *f, else /* Make sure the color is really different than the default. */ { - XColor def_fg_color; + Emacs_Color def_fg_color; if (tty_lookup_color (f, def_fg, &def_fg_color, 0) && (color_distance (&fg_tty_color, &def_fg_color) <= TTY_SAME_COLOR_THRESHOLD)) @@ -5012,7 +5012,7 @@ tty_supports_face_attributes_p (struct frame *f, else /* Make sure the color is really different than the default. */ { - XColor def_bg_color; + Emacs_Color def_bg_color; if (tty_lookup_color (f, def_bg, &def_bg_color, 0) && (color_distance (&bg_tty_color, &def_bg_color) <= TTY_SAME_COLOR_THRESHOLD)) |