aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dispextern.h15
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/gtkutil.h2
-rw-r--r--src/image.c66
-rw-r--r--src/nsgui.h5
-rw-r--r--src/nsterm.h4
-rw-r--r--src/nsterm.m6
-rw-r--r--src/termhooks.h6
-rw-r--r--src/w32fns.c8
-rw-r--r--src/w32gui.h1
-rw-r--r--src/w32term.c6
-rw-r--r--src/w32term.h4
-rw-r--r--src/xfaces.c34
-rw-r--r--src/xfns.c2
-rw-r--r--src/xterm.h3
15 files changed, 80 insertions, 84 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index e86ea6a02ae..e3f4297e313 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -34,16 +34,17 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
34#ifdef HAVE_XRENDER 34#ifdef HAVE_XRENDER
35# include <X11/extensions/Xrender.h> 35# include <X11/extensions/Xrender.h>
36#endif 36#endif
37
38typedef XColor Emacs_Color;
37#else /* !HAVE_X_WINDOWS */ 39#else /* !HAVE_X_WINDOWS */
38 40
39/* X-related stuff used by non-X gui code. */ 41/* XColor-like struct used by non-X code. */
40 42
41typedef struct { 43typedef struct
44{
42 unsigned long pixel; 45 unsigned long pixel;
43 unsigned short red, green, blue; 46 unsigned short red, green, blue;
44 char flags; 47} Emacs_Color;
45 char pad;
46} XColor;
47 48
48#endif /* HAVE_X_WINDOWS */ 49#endif /* HAVE_X_WINDOWS */
49 50
@@ -3410,8 +3411,8 @@ void x_free_colors (struct frame *, unsigned long *, int);
3410 3411
3411void update_face_from_frame_parameter (struct frame *, Lisp_Object, 3412void update_face_from_frame_parameter (struct frame *, Lisp_Object,
3412 Lisp_Object); 3413 Lisp_Object);
3413extern bool tty_defined_color (struct frame *f, const char *, XColor *, bool, 3414extern bool tty_defined_color (struct frame *, const char *, Emacs_Color *,
3414 bool); 3415 bool, bool);
3415 3416
3416Lisp_Object tty_color_name (struct frame *, int); 3417Lisp_Object tty_color_name (struct frame *, int);
3417void clear_face_cache (bool); 3418void clear_face_cache (bool);
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 48233576531..43918dd3da5 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -520,7 +520,7 @@ get_utf8_string (const char *str)
520bool 520bool
521xg_check_special_colors (struct frame *f, 521xg_check_special_colors (struct frame *f,
522 const char *color_name, 522 const char *color_name,
523 XColor *color) 523 Emacs_Color *color)
524{ 524{
525 bool success_p = 0; 525 bool success_p = 0;
526 bool get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0; 526 bool get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0;
diff --git a/src/gtkutil.h b/src/gtkutil.h
index ec899781ca8..229aa08f817 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -166,7 +166,7 @@ extern void xg_free_frame_widgets (struct frame *f);
166extern void xg_set_background_color (struct frame *f, unsigned long bg); 166extern void xg_set_background_color (struct frame *f, unsigned long bg);
167extern bool xg_check_special_colors (struct frame *f, 167extern bool xg_check_special_colors (struct frame *f,
168 const char *color_name, 168 const char *color_name,
169 XColor *color); 169 Emacs_Color *color);
170 170
171extern void xg_set_frame_icon (struct frame *f, 171extern void xg_set_frame_icon (struct frame *f,
172 Pixmap icon_pixmap, 172 Pixmap icon_pixmap,
diff --git a/src/image.c b/src/image.c
index 071b92a741e..c768ece9786 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1076,10 +1076,10 @@ image_ascent (struct image *img, struct face *face, struct glyph_slice *slice)
1076 1076
1077#ifdef USE_CAIRO 1077#ifdef USE_CAIRO
1078static uint32_t 1078static uint32_t
1079xcolor_to_argb32 (XColor xc) 1079emacs_color_to_argb32 (Emacs_Color *ec)
1080{ 1080{
1081 return ((0xffu << 24) | ((xc.red / 256) << 16) 1081 return ((0xffu << 24) | ((ec->red / 256) << 16)
1082 | ((xc.green / 256) << 8) | (xc.blue / 256)); 1082 | ((ec->green / 256) << 8) | (ec->blue / 256));
1083} 1083}
1084 1084
1085static uint32_t 1085static uint32_t
@@ -1087,11 +1087,11 @@ get_spec_bg_or_alpha_as_argb (struct image *img,
1087 struct frame *f) 1087 struct frame *f)
1088{ 1088{
1089 uint32_t bgcolor = 0; 1089 uint32_t bgcolor = 0;
1090 XColor xbgcolor; 1090 Emacs_Color xbgcolor;
1091 Lisp_Object bg = image_spec_value (img->spec, QCbackground, NULL); 1091 Lisp_Object bg = image_spec_value (img->spec, QCbackground, NULL);
1092 1092
1093 if (STRINGP (bg) && x_parse_color (f, SSDATA (bg), &xbgcolor)) 1093 if (STRINGP (bg) && x_parse_color (f, SSDATA (bg), &xbgcolor))
1094 bgcolor = xcolor_to_argb32 (xbgcolor); 1094 bgcolor = emacs_color_to_argb32 (&xbgcolor);
1095 1095
1096 return bgcolor; 1096 return bgcolor;
1097} 1097}
@@ -1321,7 +1321,7 @@ static unsigned long
1321image_alloc_image_color (struct frame *f, struct image *img, 1321image_alloc_image_color (struct frame *f, struct image *img,
1322 Lisp_Object color_name, unsigned long dflt) 1322 Lisp_Object color_name, unsigned long dflt)
1323{ 1323{
1324 XColor color; 1324 Emacs_Color color;
1325 unsigned long result; 1325 unsigned long result;
1326 1326
1327 eassert (STRINGP (color_name)); 1327 eassert (STRINGP (color_name));
@@ -4286,7 +4286,7 @@ xpm_load_image (struct frame *f,
4286 char *color, *max_color; 4286 char *color, *max_color;
4287 int key, next_key, max_key = 0; 4287 int key, next_key, max_key = 0;
4288 Lisp_Object symbol_color = Qnil, color_val; 4288 Lisp_Object symbol_color = Qnil, color_val;
4289 XColor cdef; 4289 Emacs_Color cdef;
4290 4290
4291 expect (XPM_TK_STRING); 4291 expect (XPM_TK_STRING);
4292 if (len <= chars_per_pixel || len >= BUFSIZ + chars_per_pixel) 4292 if (len <= chars_per_pixel || len >= BUFSIZ + chars_per_pixel)
@@ -4772,17 +4772,17 @@ static int laplace_matrix[9] = {
4772#define COLOR_INTENSITY(R, G, B) ((2 * (R) + 3 * (G) + (B)) / 6) 4772#define COLOR_INTENSITY(R, G, B) ((2 * (R) + 3 * (G) + (B)) / 6)
4773 4773
4774 4774
4775/* On frame F, return an array of XColor structures describing image 4775/* On frame F, return an array of Emacs_Color structures describing image
4776 IMG->pixmap. Each XColor structure has its pixel color set. RGB_P 4776 IMG->pixmap. Each Emacs_Color structure has its pixel color set. RGB_P
4777 means also fill the red/green/blue members of the XColor 4777 means also fill the red/green/blue members of the Emacs_Color
4778 structures. Value is a pointer to the array of XColors structures, 4778 structures. Value is a pointer to the array of Emacs_Color structures,
4779 allocated with xmalloc; it must be freed by the caller. */ 4779 allocated with xmalloc; it must be freed by the caller. */
4780 4780
4781static XColor * 4781static Emacs_Color *
4782image_to_xcolors (struct frame *f, struct image *img, bool rgb_p) 4782image_to_emacs_colors (struct frame *f, struct image *img, bool rgb_p)
4783{ 4783{
4784 int x, y; 4784 int x, y;
4785 XColor *colors, *p; 4785 Emacs_Color *colors, *p;
4786 XImagePtr_or_DC ximg; 4786 XImagePtr_or_DC ximg;
4787 ptrdiff_t nbytes; 4787 ptrdiff_t nbytes;
4788#ifdef HAVE_NTGUI 4788#ifdef HAVE_NTGUI
@@ -4798,13 +4798,13 @@ image_to_xcolors (struct frame *f, struct image *img, bool rgb_p)
4798 /* Get the X image or create a memory device context for IMG. */ 4798 /* Get the X image or create a memory device context for IMG. */
4799 ximg = image_get_x_image_or_dc (f, img, 0, &prev); 4799 ximg = image_get_x_image_or_dc (f, img, 0, &prev);
4800 4800
4801 /* Fill the `pixel' members of the XColor array. I wished there 4801 /* Fill the `pixel' members of the Emacs_Color array. I wished there
4802 were an easy and portable way to circumvent XGetPixel. */ 4802 were an easy and portable way to circumvent XGetPixel. */
4803 p = colors; 4803 p = colors;
4804 for (y = 0; y < img->height; ++y) 4804 for (y = 0; y < img->height; ++y)
4805 { 4805 {
4806#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) 4806#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
4807 XColor *row = p; 4807 Emacs_Color *row = p;
4808 for (x = 0; x < img->width; ++x, ++p) 4808 for (x = 0; x < img->width; ++x, ++p)
4809 p->pixel = GET_PIXEL (ximg, x, y); 4809 p->pixel = GET_PIXEL (ximg, x, y);
4810 if (rgb_p) 4810 if (rgb_p)
@@ -4878,16 +4878,16 @@ XPutPixel (XImagePtr ximg, int x, int y, COLORREF color)
4878 4878
4879#endif /* HAVE_NTGUI */ 4879#endif /* HAVE_NTGUI */
4880 4880
4881/* Create IMG->pixmap from an array COLORS of XColor structures, whose 4881/* Create IMG->pixmap from an array COLORS of Emacs_Color structures, whose
4882 RGB members are set. F is the frame on which this all happens. 4882 RGB members are set. F is the frame on which this all happens.
4883 COLORS will be freed; an existing IMG->pixmap will be freed, too. */ 4883 COLORS will be freed; an existing IMG->pixmap will be freed, too. */
4884 4884
4885static void 4885static void
4886image_from_xcolors (struct frame *f, struct image *img, XColor *colors) 4886image_from_emacs_colors (struct frame *f, struct image *img, Emacs_Color *colors)
4887{ 4887{
4888 int x, y; 4888 int x, y;
4889 XImagePtr oimg = NULL; 4889 XImagePtr oimg = NULL;
4890 XColor *p; 4890 Emacs_Color *p;
4891 4891
4892 init_color_table (); 4892 init_color_table ();
4893 4893
@@ -4925,8 +4925,8 @@ static void
4925image_detect_edges (struct frame *f, struct image *img, 4925image_detect_edges (struct frame *f, struct image *img,
4926 int *matrix, int color_adjust) 4926 int *matrix, int color_adjust)
4927{ 4927{
4928 XColor *colors = image_to_xcolors (f, img, 1); 4928 Emacs_Color *colors = image_to_emacs_colors (f, img, 1);
4929 XColor *new, *p; 4929 Emacs_Color *new, *p;
4930 int x, y, i, sum; 4930 int x, y, i, sum;
4931 ptrdiff_t nbytes; 4931 ptrdiff_t nbytes;
4932 4932
@@ -4969,7 +4969,7 @@ image_detect_edges (struct frame *f, struct image *img,
4969 for (xx = x - 1; xx < x + 2; ++xx, ++i) 4969 for (xx = x - 1; xx < x + 2; ++xx, ++i)
4970 if (matrix[i]) 4970 if (matrix[i])
4971 { 4971 {
4972 XColor *t = COLOR (colors, xx, yy); 4972 Emacs_Color *t = COLOR (colors, xx, yy);
4973 r += matrix[i] * t->red; 4973 r += matrix[i] * t->red;
4974 g += matrix[i] * t->green; 4974 g += matrix[i] * t->green;
4975 b += matrix[i] * t->blue; 4975 b += matrix[i] * t->blue;
@@ -4983,7 +4983,7 @@ image_detect_edges (struct frame *f, struct image *img,
4983 } 4983 }
4984 4984
4985 xfree (colors); 4985 xfree (colors);
4986 image_from_xcolors (f, img, new); 4986 image_from_emacs_colors (f, img, new);
4987 4987
4988#undef COLOR 4988#undef COLOR
4989} 4989}
@@ -5066,8 +5066,8 @@ image_disable_image (struct frame *f, struct image *img)
5066 /* Color (or grayscale). Convert to gray, and equalize. Just 5066 /* Color (or grayscale). Convert to gray, and equalize. Just
5067 drawing such images with a stipple can look very odd, so 5067 drawing such images with a stipple can look very odd, so
5068 we're using this method instead. */ 5068 we're using this method instead. */
5069 XColor *colors = image_to_xcolors (f, img, 1); 5069 Emacs_Color *colors = image_to_emacs_colors (f, img, 1);
5070 XColor *p, *end; 5070 Emacs_Color *p, *end;
5071 const int h = 15000; 5071 const int h = 15000;
5072 const int l = 30000; 5072 const int l = 30000;
5073 5073
@@ -5080,7 +5080,7 @@ image_disable_image (struct frame *f, struct image *img)
5080 p->red = p->green = p->blue = i2; 5080 p->red = p->green = p->blue = i2;
5081 } 5081 }
5082 5082
5083 image_from_xcolors (f, img, colors); 5083 image_from_emacs_colors (f, img, colors);
5084 } 5084 }
5085 5085
5086 /* Draw a cross over the disabled image, if we must or if we 5086 /* Draw a cross over the disabled image, if we must or if we
@@ -5522,7 +5522,7 @@ pbm_load (struct frame *f, struct image *img)
5522 unsigned long fg = FRAME_FOREGROUND_PIXEL (f); 5522 unsigned long fg = FRAME_FOREGROUND_PIXEL (f);
5523 unsigned long bg = FRAME_BACKGROUND_PIXEL (f); 5523 unsigned long bg = FRAME_BACKGROUND_PIXEL (f);
5524#ifdef USE_CAIRO 5524#ifdef USE_CAIRO
5525 XColor xfg, xbg; 5525 Emacs_Color xfg, xbg;
5526 int fga32, bga32; 5526 int fga32, bga32;
5527#endif 5527#endif
5528 /* Parse the image specification. */ 5528 /* Parse the image specification. */
@@ -5542,7 +5542,7 @@ pbm_load (struct frame *f, struct image *img)
5542 xfg.pixel = fg; 5542 xfg.pixel = fg;
5543 x_query_colors (f, &xfg, 1); 5543 x_query_colors (f, &xfg, 1);
5544 } 5544 }
5545 fga32 = xcolor_to_argb32 (xfg); 5545 fga32 = emacs_color_to_argb32 (&xfg);
5546 5546
5547 if (! fmt[PBM_BACKGROUND].count 5547 if (! fmt[PBM_BACKGROUND].count
5548 || ! STRINGP (fmt[PBM_BACKGROUND].value) 5548 || ! STRINGP (fmt[PBM_BACKGROUND].value)
@@ -5555,7 +5555,7 @@ pbm_load (struct frame *f, struct image *img)
5555 xbg.pixel = bg; 5555 xbg.pixel = bg;
5556 x_query_colors (f, &xbg, 1); 5556 x_query_colors (f, &xbg, 1);
5557 } 5557 }
5558 bga32 = xcolor_to_argb32 (xbg); 5558 bga32 = emacs_color_to_argb32 (&xbg);
5559#else 5559#else
5560 if (fmt[PBM_FOREGROUND].count 5560 if (fmt[PBM_FOREGROUND].count
5561 && STRINGP (fmt[PBM_FOREGROUND].value)) 5561 && STRINGP (fmt[PBM_FOREGROUND].value))
@@ -6180,7 +6180,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
6180 /* png_color_16 *image_bg; */ 6180 /* png_color_16 *image_bg; */
6181 Lisp_Object specified_bg 6181 Lisp_Object specified_bg
6182 = image_spec_value (img->spec, QCbackground, NULL); 6182 = image_spec_value (img->spec, QCbackground, NULL);
6183 XColor color; 6183 Emacs_Color color;
6184 6184
6185 /* If the user specified a color, try to use it; if not, use the 6185 /* If the user specified a color, try to use it; if not, use the
6186 current frame background, ignoring any default background 6186 current frame background, ignoring any default background
@@ -7813,7 +7813,7 @@ gif_load (struct frame *f, struct image *img)
7813 uint32_t *data32 = (uint32_t *) cairo_image_surface_get_data (surface); 7813 uint32_t *data32 = (uint32_t *) cairo_image_surface_get_data (surface);
7814 if (STRINGP (specified_bg)) 7814 if (STRINGP (specified_bg))
7815 { 7815 {
7816 XColor color; 7816 Emacs_Color color;
7817 if (FRAME_TERMINAL (f)->defined_color_hook 7817 if (FRAME_TERMINAL (f)->defined_color_hook
7818 (f, SSDATA (specified_bg), &color, false, false)) 7818 (f, SSDATA (specified_bg), &color, false, false))
7819 { 7819 {
@@ -8548,7 +8548,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
8548 8548
8549 /* Retrieve the frame's background color, for use later. */ 8549 /* Retrieve the frame's background color, for use later. */
8550 { 8550 {
8551 XColor bgcolor; 8551 Emacs_Color bgcolor;
8552 Lisp_Object specified_bg; 8552 Lisp_Object specified_bg;
8553 8553
8554 specified_bg = image_spec_value (img->spec, QCbackground, NULL); 8554 specified_bg = image_spec_value (img->spec, QCbackground, NULL);
@@ -9285,7 +9285,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
9285 9285
9286 /* Handle alpha channel by combining the image with a background 9286 /* Handle alpha channel by combining the image with a background
9287 color. */ 9287 color. */
9288 XColor background; 9288 Emacs_Color background;
9289 Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL); 9289 Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL);
9290 if (!STRINGP (specified_bg) 9290 if (!STRINGP (specified_bg)
9291 || !FRAME_TERMINAL (f)->defined_color_hook (f, 9291 || !FRAME_TERMINAL (f)->defined_color_hook (f,
diff --git a/src/nsgui.h b/src/nsgui.h
index ab6cdff1e5c..81be68b574d 100644
--- a/src/nsgui.h
+++ b/src/nsgui.h
@@ -109,11 +109,6 @@ typedef void *Cursor;
109 109
110#define No_Cursor (0) 110#define No_Cursor (0)
111 111
112#ifdef __OBJC__
113typedef NSColor * Color;
114#else
115typedef void * Color;
116#endif
117typedef int Window; 112typedef int Window;
118 113
119 114
diff --git a/src/nsterm.h b/src/nsterm.h
index ffaf809785e..ad1af3098d6 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1134,10 +1134,10 @@ extern void ns_set_doc_edited (void);
1134extern bool 1134extern bool
1135ns_defined_color (struct frame *f, 1135ns_defined_color (struct frame *f,
1136 const char *name, 1136 const char *name,
1137 XColor *color_def, bool alloc, 1137 Emacs_Color *color_def, bool alloc,
1138 bool makeIndex); 1138 bool makeIndex);
1139extern void 1139extern void
1140ns_query_color (void *col, XColor *color_def, bool setPixel); 1140ns_query_color (void *col, Emacs_Color *color_def, bool setPixel);
1141 1141
1142#ifdef __OBJC__ 1142#ifdef __OBJC__
1143extern int ns_lisp_to_color (Lisp_Object color, NSColor **col); 1143extern int ns_lisp_to_color (Lisp_Object color, NSColor **col);
diff --git a/src/nsterm.m b/src/nsterm.m
index d688aceca53..deac229c98b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2327,7 +2327,7 @@ ns_color_index_to_rgba(int idx, struct frame *f)
2327} 2327}
2328 2328
2329void 2329void
2330ns_query_color(void *col, XColor *color_def, bool setPixel) 2330ns_query_color(void *col, Emacs_Color *color_def, bool setPixel)
2331/* -------------------------------------------------------------------------- 2331/* --------------------------------------------------------------------------
2332 Get ARGB values out of NSColor col and put them into color_def. 2332 Get ARGB values out of NSColor col and put them into color_def.
2333 If setPixel, set the pixel to a concatenated version. 2333 If setPixel, set the pixel to a concatenated version.
@@ -2350,7 +2350,7 @@ ns_query_color(void *col, XColor *color_def, bool setPixel)
2350bool 2350bool
2351ns_defined_color (struct frame *f, 2351ns_defined_color (struct frame *f,
2352 const char *name, 2352 const char *name,
2353 XColor *color_def, 2353 Emacs_Color *color_def,
2354 bool alloc, 2354 bool alloc,
2355 bool makeIndex) 2355 bool makeIndex)
2356/* -------------------------------------------------------------------------- 2356/* --------------------------------------------------------------------------
@@ -2378,7 +2378,7 @@ ns_defined_color (struct frame *f,
2378} 2378}
2379 2379
2380static void 2380static void
2381ns_query_frame_background_color (struct frame *f, XColor *bgcolor) 2381ns_query_frame_background_color (struct frame *f, Emacs_Color *bgcolor)
2382/* -------------------------------------------------------------------------- 2382/* --------------------------------------------------------------------------
2383 External (hook): Store F's background color into *BGCOLOR 2383 External (hook): Store F's background color into *BGCOLOR
2384 -------------------------------------------------------------------------- */ 2384 -------------------------------------------------------------------------- */
diff --git a/src/termhooks.h b/src/termhooks.h
index 0962add0817..410273875a6 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -496,7 +496,7 @@ struct terminal
496 496
497 If MAKEINDEX (on NS), set COLOR_DEF pixel to ARGB. */ 497 If MAKEINDEX (on NS), set COLOR_DEF pixel to ARGB. */
498 bool (*defined_color_hook) (struct frame *f, const char *color_name, 498 bool (*defined_color_hook) (struct frame *f, const char *color_name,
499 XColor *color_def, 499 Emacs_Color *color_def,
500 bool alloc, 500 bool alloc,
501 bool makeIndex); 501 bool makeIndex);
502 502
@@ -515,13 +515,13 @@ struct terminal
515 515
516 /* This hook is called to store the frame's background color into 516 /* This hook is called to store the frame's background color into
517 BGCOLOR. */ 517 BGCOLOR. */
518 void (*query_frame_background_color) (struct frame *f, XColor *bgcolor); 518 void (*query_frame_background_color) (struct frame *f, Emacs_Color *bgcolor);
519 519
520#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) 520#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
521 /* On frame F, translate pixel colors to RGB values for the NCOLORS 521 /* On frame F, translate pixel colors to RGB values for the NCOLORS
522 colors in COLORS. Use cached information, if available. */ 522 colors in COLORS. Use cached information, if available. */
523 523
524 void (*query_colors) (struct frame *f, XColor *colors, int ncolors); 524 void (*query_colors) (struct frame *f, Emacs_Color *colors, int ncolors);
525#endif 525#endif
526 /* Return the current position of the mouse. 526 /* Return the current position of the mouse.
527 527
diff --git a/src/w32fns.c b/src/w32fns.c
index 525642bfaab..2f54bdc1da1 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1174,7 +1174,7 @@ gamma_correct (struct frame *f, COLORREF *color)
1174 If ALLOC is nonzero, allocate a new colormap cell. */ 1174 If ALLOC is nonzero, allocate a new colormap cell. */
1175 1175
1176bool 1176bool
1177w32_defined_color (struct frame *f, const char *color, XColor *color_def, 1177w32_defined_color (struct frame *f, const char *color, Emacs_Color *color_def,
1178 bool alloc_p, bool _makeIndex) 1178 bool alloc_p, bool _makeIndex)
1179{ 1179{
1180 register Lisp_Object tem; 1180 register Lisp_Object tem;
@@ -1248,7 +1248,7 @@ w32_defined_color (struct frame *f, const char *color, XColor *color_def,
1248static int 1248static int
1249w32_decode_color (struct frame *f, Lisp_Object arg, int def) 1249w32_decode_color (struct frame *f, Lisp_Object arg, int def)
1250{ 1250{
1251 XColor cdef; 1251 Emacs_Color cdef;
1252 1252
1253 CHECK_STRING (arg); 1253 CHECK_STRING (arg);
1254 1254
@@ -6100,7 +6100,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
6100 doc: /* SKIP: real doc in xfns.c. */) 6100 doc: /* SKIP: real doc in xfns.c. */)
6101 (Lisp_Object color, Lisp_Object frame) 6101 (Lisp_Object color, Lisp_Object frame)
6102{ 6102{
6103 XColor foo; 6103 Emacs_Color foo;
6104 struct frame *f = decode_window_system_frame (frame); 6104 struct frame *f = decode_window_system_frame (frame);
6105 6105
6106 CHECK_STRING (color); 6106 CHECK_STRING (color);
@@ -6115,7 +6115,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
6115 doc: /* SKIP: real doc in xfns.c. */) 6115 doc: /* SKIP: real doc in xfns.c. */)
6116 (Lisp_Object color, Lisp_Object frame) 6116 (Lisp_Object color, Lisp_Object frame)
6117{ 6117{
6118 XColor foo; 6118 Emacs_Color foo;
6119 struct frame *f = decode_window_system_frame (frame); 6119 struct frame *f = decode_window_system_frame (frame);
6120 6120
6121 CHECK_STRING (color); 6121 CHECK_STRING (color);
diff --git a/src/w32gui.h b/src/w32gui.h
index 5dcbbd95166..b2ad28366c3 100644
--- a/src/w32gui.h
+++ b/src/w32gui.h
@@ -43,7 +43,6 @@ typedef HBITMAP Pixmap;
43typedef HBITMAP Bitmap; 43typedef HBITMAP Bitmap;
44 44
45typedef XGCValues * GC; 45typedef XGCValues * GC;
46typedef COLORREF Color;
47typedef HWND Window; 46typedef HWND Window;
48typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ 47typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */
49typedef HCURSOR Cursor; 48typedef HCURSOR Cursor;
diff --git a/src/w32term.c b/src/w32term.c
index 435455e1a6d..6c53bc147a0 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1517,7 +1517,7 @@ w32_alloc_lighter_color (struct frame *f, COLORREF *color,
1517 colors in COLORS. On W32, we no longer try to map colors to 1517 colors in COLORS. On W32, we no longer try to map colors to
1518 a palette. */ 1518 a palette. */
1519static void 1519static void
1520w32_query_colors (struct frame *f, XColor *colors, int ncolors) 1520w32_query_colors (struct frame *f, Emacs_Color *colors, int ncolors)
1521{ 1521{
1522 int i; 1522 int i;
1523 1523
@@ -1534,7 +1534,7 @@ w32_query_colors (struct frame *f, XColor *colors, int ncolors)
1534/* Store F's background color into *BGCOLOR. */ 1534/* Store F's background color into *BGCOLOR. */
1535 1535
1536static void 1536static void
1537w32_query_frame_background_color (struct frame *f, XColor *bgcolor) 1537w32_query_frame_background_color (struct frame *f, Emacs_Color *bgcolor)
1538{ 1538{
1539 bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f); 1539 bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f);
1540 w32_query_colors (f, bgcolor, 1); 1540 w32_query_colors (f, bgcolor, 1);
@@ -7208,7 +7208,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
7208 7208
7209 /* initialize palette with white and black */ 7209 /* initialize palette with white and black */
7210 { 7210 {
7211 XColor color; 7211 Emacs_Color color;
7212 w32_defined_color (0, "white", &color, true, false); 7212 w32_defined_color (0, "white", &color, true, false);
7213 w32_defined_color (0, "black", &color, true, false); 7213 w32_defined_color (0, "black", &color, true, false);
7214 } 7214 }
diff --git a/src/w32term.h b/src/w32term.h
index a03b9fd3311..0dffd3db070 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -241,7 +241,7 @@ extern void w32_set_scroll_bar_default_height (struct frame *);
241 241
242extern struct w32_display_info *w32_term_init (Lisp_Object, 242extern struct w32_display_info *w32_term_init (Lisp_Object,
243 char *, char *); 243 char *, char *);
244extern bool w32_defined_color (struct frame *, const char *, XColor *, 244extern bool w32_defined_color (struct frame *, const char *, Emacs_Color *,
245 bool, bool); 245 bool, bool);
246extern int w32_display_pixel_height (struct w32_display_info *); 246extern int w32_display_pixel_height (struct w32_display_info *);
247extern int w32_display_pixel_width (struct w32_display_info *); 247extern int w32_display_pixel_width (struct w32_display_info *);
@@ -721,7 +721,7 @@ extern void complete_deferred_msg (HWND hwnd, UINT msg, LRESULT result);
721extern BOOL parse_button (int, int, int *, int *); 721extern BOOL parse_button (int, int, int *, int *);
722 722
723extern void w32_sys_ring_bell (struct frame *f); 723extern void w32_sys_ring_bell (struct frame *f);
724extern void w32_query_color (struct frame *, XColor *); 724extern void w32_query_color (struct frame *, Emacs_Color *);
725extern void w32_delete_display (struct w32_display_info *dpyinfo); 725extern void w32_delete_display (struct w32_display_info *dpyinfo);
726 726
727#define FILE_NOTIFICATIONS_SIZE 16384 727#define FILE_NOTIFICATIONS_SIZE 16384
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 *);
348static bool merge_face_ref (struct window *w, 348static bool merge_face_ref (struct window *w,
349 struct frame *, Lisp_Object, Lisp_Object *, 349 struct frame *, Lisp_Object, Lisp_Object *,
350 bool, struct named_merge_point *); 350 bool, struct named_merge_point *);
351static int color_distance (XColor *x, XColor *y); 351static int color_distance (Emacs_Color *x, Emacs_Color *y);
352 352
353#ifdef HAVE_WINDOW_SYSTEM 353#ifdef HAVE_WINDOW_SYSTEM
354static void set_font_frame_param (Lisp_Object, Lisp_Object); 354static void set_font_frame_param (Lisp_Object, Lisp_Object);
@@ -802,7 +802,7 @@ load_pixmap (struct frame *f, Lisp_Object name)
802 802
803 803
804/*********************************************************************** 804/***********************************************************************
805 X Colors 805 Color Handling
806 ***********************************************************************/ 806 ***********************************************************************/
807 807
808/* Parse RGB_LIST, and fill in the RGB fields of COLOR. 808/* Parse RGB_LIST, and fill in the RGB fields of COLOR.
@@ -810,7 +810,7 @@ load_pixmap (struct frame *f, Lisp_Object name)
810 Return true iff RGB_LIST is OK. */ 810 Return true iff RGB_LIST is OK. */
811 811
812static bool 812static bool
813parse_rgb_list (Lisp_Object rgb_list, XColor *color) 813parse_rgb_list (Lisp_Object rgb_list, Emacs_Color *color)
814{ 814{
815#define PARSE_RGB_LIST_FIELD(field) \ 815#define PARSE_RGB_LIST_FIELD(field) \
816 if (CONSP (rgb_list) && FIXNUMP (XCAR (rgb_list))) \ 816 if (CONSP (rgb_list) && FIXNUMP (XCAR (rgb_list))) \
@@ -835,8 +835,8 @@ parse_rgb_list (Lisp_Object rgb_list, XColor *color)
835 returned in it. */ 835 returned in it. */
836 836
837static bool 837static bool
838tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, 838tty_lookup_color (struct frame *f, Lisp_Object color, Emacs_Color *tty_color,
839 XColor *std_color) 839 Emacs_Color *std_color)
840{ 840{
841 Lisp_Object frame, color_desc; 841 Lisp_Object frame, color_desc;
842 842
@@ -897,7 +897,7 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color,
897 897
898bool 898bool
899tty_defined_color (struct frame *f, const char *color_name, 899tty_defined_color (struct frame *f, const char *color_name,
900 XColor *color_def, bool alloc, bool _makeIndex) 900 Emacs_Color *color_def, bool alloc, bool _makeIndex)
901{ 901{
902 bool status = true; 902 bool status = true;
903 903
@@ -965,7 +965,7 @@ tty_color_name (struct frame *f, int idx)
965static bool 965static bool
966face_color_gray_p (struct frame *f, const char *color_name) 966face_color_gray_p (struct frame *f, const char *color_name)
967{ 967{
968 XColor color; 968 Emacs_Color color;
969 bool gray_p; 969 bool gray_p;
970 970
971 if (FRAME_TERMINAL (f)->defined_color_hook 971 if (FRAME_TERMINAL (f)->defined_color_hook
@@ -994,7 +994,7 @@ face_color_supported_p (struct frame *f, const char *color_name,
994 bool background_p) 994 bool background_p)
995{ 995{
996 Lisp_Object frame; 996 Lisp_Object frame;
997 XColor not_used; 997 Emacs_Color not_used;
998 998
999 XSETFRAME (frame, f); 999 XSETFRAME (frame, f);
1000 return 1000 return
@@ -1043,7 +1043,7 @@ COLOR must be a valid color name. */)
1043 1043
1044static unsigned long 1044static unsigned long
1045load_color2 (struct frame *f, struct face *face, Lisp_Object name, 1045load_color2 (struct frame *f, struct face *face, Lisp_Object name,
1046 enum lface_attribute_index target_index, XColor *color) 1046 enum lface_attribute_index target_index, Emacs_Color *color)
1047{ 1047{
1048 eassert (STRINGP (name)); 1048 eassert (STRINGP (name));
1049 eassert (target_index == LFACE_FOREGROUND_INDEX 1049 eassert (target_index == LFACE_FOREGROUND_INDEX
@@ -1117,7 +1117,7 @@ unsigned long
1117load_color (struct frame *f, struct face *face, Lisp_Object name, 1117load_color (struct frame *f, struct face *face, Lisp_Object name,
1118 enum lface_attribute_index target_index) 1118 enum lface_attribute_index target_index)
1119{ 1119{
1120 XColor color; 1120 Emacs_Color color;
1121 return load_color2 (f, face, name, target_index, &color); 1121 return load_color2 (f, face, name, target_index, &color);
1122} 1122}
1123 1123
@@ -1134,7 +1134,7 @@ load_face_colors (struct frame *f, struct face *face,
1134 Lisp_Object attrs[LFACE_VECTOR_SIZE]) 1134 Lisp_Object attrs[LFACE_VECTOR_SIZE])
1135{ 1135{
1136 Lisp_Object fg, bg, dfg; 1136 Lisp_Object fg, bg, dfg;
1137 XColor xfg, xbg; 1137 Emacs_Color xfg, xbg;
1138 1138
1139 bg = attrs[LFACE_BACKGROUND_INDEX]; 1139 bg = attrs[LFACE_BACKGROUND_INDEX];
1140 fg = attrs[LFACE_FOREGROUND_INDEX]; 1140 fg = attrs[LFACE_FOREGROUND_INDEX];
@@ -4170,7 +4170,7 @@ prepare_face_for_display (struct frame *f, struct face *face)
4170/* Returns the `distance' between the colors X and Y. */ 4170/* Returns the `distance' between the colors X and Y. */
4171 4171
4172static int 4172static int
4173color_distance (XColor *x, XColor *y) 4173color_distance (Emacs_Color *x, Emacs_Color *y)
4174{ 4174{
4175 /* This formula is from a paper titled `Colour metric' by Thiadmer Riemersma. 4175 /* This formula is from a paper titled `Colour metric' by Thiadmer Riemersma.
4176 Quoting from that paper: 4176 Quoting from that paper:
@@ -4205,7 +4205,7 @@ two lists of the form (RED GREEN BLUE) aforementioned. */)
4205 Lisp_Object metric) 4205 Lisp_Object metric)
4206{ 4206{
4207 struct frame *f = decode_live_frame (frame); 4207 struct frame *f = decode_live_frame (frame);
4208 XColor cdef1, cdef2; 4208 Emacs_Color cdef1, cdef2;
4209 4209
4210 if (!(CONSP (color1) && parse_rgb_list (color1, &cdef1)) 4210 if (!(CONSP (color1) && parse_rgb_list (color1, &cdef1))
4211 && !(STRINGP (color1) 4211 && !(STRINGP (color1)
@@ -4885,8 +4885,8 @@ tty_supports_face_attributes_p (struct frame *f,
4885{ 4885{
4886 int weight, slant; 4886 int weight, slant;
4887 Lisp_Object val, fg, bg; 4887 Lisp_Object val, fg, bg;
4888 XColor fg_tty_color, fg_std_color; 4888 Emacs_Color fg_tty_color, fg_std_color;
4889 XColor bg_tty_color, bg_std_color; 4889 Emacs_Color bg_tty_color, bg_std_color;
4890 unsigned test_caps = 0; 4890 unsigned test_caps = 0;
4891 Lisp_Object *def_attrs = def_face->lface; 4891 Lisp_Object *def_attrs = def_face->lface;
4892 4892
@@ -4988,7 +4988,7 @@ tty_supports_face_attributes_p (struct frame *f,
4988 else 4988 else
4989 /* Make sure the color is really different than the default. */ 4989 /* Make sure the color is really different than the default. */
4990 { 4990 {
4991 XColor def_fg_color; 4991 Emacs_Color def_fg_color;
4992 if (tty_lookup_color (f, def_fg, &def_fg_color, 0) 4992 if (tty_lookup_color (f, def_fg, &def_fg_color, 0)
4993 && (color_distance (&fg_tty_color, &def_fg_color) 4993 && (color_distance (&fg_tty_color, &def_fg_color)
4994 <= TTY_SAME_COLOR_THRESHOLD)) 4994 <= TTY_SAME_COLOR_THRESHOLD))
@@ -5012,7 +5012,7 @@ tty_supports_face_attributes_p (struct frame *f,
5012 else 5012 else
5013 /* Make sure the color is really different than the default. */ 5013 /* Make sure the color is really different than the default. */
5014 { 5014 {
5015 XColor def_bg_color; 5015 Emacs_Color def_bg_color;
5016 if (tty_lookup_color (f, def_bg, &def_bg_color, 0) 5016 if (tty_lookup_color (f, def_bg, &def_bg_color, 0)
5017 && (color_distance (&bg_tty_color, &def_bg_color) 5017 && (color_distance (&bg_tty_color, &def_bg_color)
5018 <= TTY_SAME_COLOR_THRESHOLD)) 5018 <= TTY_SAME_COLOR_THRESHOLD))
diff --git a/src/xfns.c b/src/xfns.c
index c8cc1704a47..4195980d33e 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -653,7 +653,7 @@ gamma_correct (struct frame *f, XColor *color)
653 653
654bool 654bool
655x_defined_color (struct frame *f, const char *color_name, 655x_defined_color (struct frame *f, const char *color_name,
656 XColor *color, bool alloc_p, bool _makeIndex) 656 Emacs_Color *color, bool alloc_p, bool _makeIndex)
657{ 657{
658 bool success_p = false; 658 bool success_p = false;
659 Colormap cmap = FRAME_X_COLORMAP (f); 659 Colormap cmap = FRAME_X_COLORMAP (f);
diff --git a/src/xterm.h b/src/xterm.h
index 84030d5c25e..758a1939d6e 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1224,7 +1224,8 @@ extern void destroy_frame_xic (struct frame *);
1224extern void xic_set_preeditarea (struct window *, int, int); 1224extern void xic_set_preeditarea (struct window *, int, int);
1225extern void xic_set_statusarea (struct frame *); 1225extern void xic_set_statusarea (struct frame *);
1226extern void xic_set_xfontset (struct frame *, const char *); 1226extern void xic_set_xfontset (struct frame *, const char *);
1227extern bool x_defined_color (struct frame *, const char *, XColor *, bool, bool); 1227extern bool x_defined_color (struct frame *, const char *, Emacs_Color *,
1228 bool, bool);
1228#ifdef HAVE_X_I18N 1229#ifdef HAVE_X_I18N
1229extern void free_frame_xic (struct frame *); 1230extern void free_frame_xic (struct frame *);
1230# if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT 1231# if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT