aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsfns.m
diff options
context:
space:
mode:
authorStefan Monnier2014-11-16 00:22:20 -0500
committerStefan Monnier2014-11-16 00:22:20 -0500
commit9075fcc1937a211bc91e8bc49c332bc55ac99e24 (patch)
tree1cff4991107011e0b5d13fac46b0881c30d31a63 /src/nsfns.m
parent86009dd5d886f1101358990e4f8f69a5d1467eb8 (diff)
parent4f4cf9c855f5818d4c3c0fb772db8bbcf4f33780 (diff)
downloademacs-9075fcc1937a211bc91e8bc49c332bc55ac99e24.tar.gz
emacs-9075fcc1937a211bc91e8bc49c332bc55ac99e24.zip
Merge from emacs-24
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index c4b273c3bf5..4f158f4c51e 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -280,9 +280,14 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
280 NSColor *col; 280 NSColor *col;
281 EmacsCGFloat r, g, b, alpha; 281 EmacsCGFloat r, g, b, alpha;
282 282
283 /* Must block_input, because ns_lisp_to_color does block/unblock_input
284 which means that col may be deallocated in its unblock_input if there
285 is user input, unless we also block_input. */
286 block_input ();
283 if (ns_lisp_to_color (arg, &col)) 287 if (ns_lisp_to_color (arg, &col))
284 { 288 {
285 store_frame_param (f, Qforeground_color, oldval); 289 store_frame_param (f, Qforeground_color, oldval);
290 unblock_input ();
286 error ("Unknown color"); 291 error ("Unknown color");
287 } 292 }
288 293
@@ -299,8 +304,9 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
299 update_face_from_frame_parameter (f, Qforeground_color, arg); 304 update_face_from_frame_parameter (f, Qforeground_color, arg);
300 /*recompute_basic_faces (f); */ 305 /*recompute_basic_faces (f); */
301 if (FRAME_VISIBLE_P (f)) 306 if (FRAME_VISIBLE_P (f))
302 redraw_frame (f); 307 SET_FRAME_GARBAGED (f);
303 } 308 }
309 unblock_input ();
304} 310}
305 311
306 312
@@ -312,9 +318,11 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
312 NSView *view = FRAME_NS_VIEW (f); 318 NSView *view = FRAME_NS_VIEW (f);
313 EmacsCGFloat r, g, b, alpha; 319 EmacsCGFloat r, g, b, alpha;
314 320
321 block_input ();
315 if (ns_lisp_to_color (arg, &col)) 322 if (ns_lisp_to_color (arg, &col))
316 { 323 {
317 store_frame_param (f, Qbackground_color, oldval); 324 store_frame_param (f, Qbackground_color, oldval);
325 unblock_input ();
318 error ("Unknown color"); 326 error ("Unknown color");
319 } 327 }
320 328
@@ -351,8 +359,9 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
351 } 359 }
352 360
353 if (FRAME_VISIBLE_P (f)) 361 if (FRAME_VISIBLE_P (f))
354 redraw_frame (f); 362 SET_FRAME_GARBAGED (f);
355 } 363 }
364 unblock_input ();
356} 365}
357 366
358 367
@@ -361,9 +370,11 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
361{ 370{
362 NSColor *col; 371 NSColor *col;
363 372
373 block_input ();
364 if (ns_lisp_to_color (arg, &col)) 374 if (ns_lisp_to_color (arg, &col))
365 { 375 {
366 store_frame_param (f, Qcursor_color, oldval); 376 store_frame_param (f, Qcursor_color, oldval);
377 unblock_input ();
367 error ("Unknown color"); 378 error ("Unknown color");
368 } 379 }
369 380
@@ -376,6 +387,7 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
376 x_update_cursor (f, 1); 387 x_update_cursor (f, 1);
377 } 388 }
378 update_face_from_frame_parameter (f, Qcursor_color, arg); 389 update_face_from_frame_parameter (f, Qcursor_color, arg);
390 unblock_input ();
379} 391}
380 392
381 393
@@ -2331,11 +2343,16 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
2331 check_window_system (NULL); 2343 check_window_system (NULL);
2332 CHECK_STRING (color); 2344 CHECK_STRING (color);
2333 2345
2346 block_input ();
2334 if (ns_lisp_to_color (color, &col)) 2347 if (ns_lisp_to_color (color, &col))
2335 return Qnil; 2348 {
2349 unblock_input ();
2350 return Qnil;
2351 }
2336 2352
2337 [[col colorUsingDefaultColorSpace] 2353 [[col colorUsingDefaultColorSpace]
2338 getRed: &red green: &green blue: &blue alpha: &alpha]; 2354 getRed: &red green: &green blue: &blue alpha: &alpha];
2355 unblock_input ();
2339 return list3i (lrint (red * 65280), lrint (green * 65280), 2356 return list3i (lrint (red * 65280), lrint (green * 65280),
2340 lrint (blue * 65280)); 2357 lrint (blue * 65280));
2341} 2358}