aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobert Pluim2019-12-11 11:21:22 +0100
committerRobert Pluim2019-12-11 16:28:24 +0100
commitea84a95bd8d43612b4a424fb93de25a68ac31d05 (patch)
tree6178230001c8ac87cc7d2f05e792a4521fa658a6 /src
parent8aaa92a4b648aef137eb9a7054fdffaed04328ff (diff)
downloademacs-ea84a95bd8d43612b4a424fb93de25a68ac31d05.tar.gz
emacs-ea84a95bd8d43612b4a424fb93de25a68ac31d05.zip
Check for GUI frame in ns_color_index_to_rgba
* nsterm.m (ns_color_index_to_rgba): Check that we're using a GUI frame before converting color (Bug#38564).
Diffstat (limited to 'src')
-rw-r--r--src/nsterm.m19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index c4151598906..6995577920e 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2290,19 +2290,24 @@ ns_lisp_to_color (Lisp_Object color, NSColor **col)
2290 2290
2291/* Convert an index into the color table into an RGBA value. Used in 2291/* Convert an index into the color table into an RGBA value. Used in
2292 xdisp.c:extend_face_to_end_of_line when comparing faces and frame 2292 xdisp.c:extend_face_to_end_of_line when comparing faces and frame
2293 color values. */ 2293 color values. No-op on non-gui frames. */
2294 2294
2295unsigned long 2295unsigned long
2296ns_color_index_to_rgba(int idx, struct frame *f) 2296ns_color_index_to_rgba(int idx, struct frame *f)
2297{ 2297{
2298 NSColor *col; 2298 if (FRAME_DISPLAY_INFO (f))
2299 col = ns_lookup_indexed_color (idx, f); 2299 {
2300 NSColor *col;
2301 col = ns_lookup_indexed_color (idx, f);
2300 2302
2301 EmacsCGFloat r, g, b, a; 2303 EmacsCGFloat r, g, b, a;
2302 [col getRed: &r green: &g blue: &b alpha: &a]; 2304 [col getRed: &r green: &g blue: &b alpha: &a];
2303 2305
2304 return ARGB_TO_ULONG((int)(a*255), 2306 return ARGB_TO_ULONG((int)(a*255),
2305 (int)(r*255), (int)(g*255), (int)(b*255)); 2307 (int)(r*255), (int)(g*255), (int)(b*255));
2308 }
2309 else
2310 return idx;
2306} 2311}
2307 2312
2308void 2313void