diff options
author | Jan Djärv <jan.h.d@swipnet.se> | 2014-11-14 08:41:53 +0100 |
---|---|---|
committer | Jan Djärv <jan.h.d@swipnet.se> | 2014-11-14 08:41:53 +0100 |
commit | 6688117e79240553b01828c351333636af049d1b (patch) | |
tree | 7b57341fcf763f6244ef15faa74001a6c583cda9 /src/nsfns.m | |
parent | f8c4f8d6a7d6eba118f01a724c4c4b0ca2dcbc90 (diff) | |
download | emacs-6688117e79240553b01828c351333636af049d1b.tar.gz |
Fixes: 19036
* nsfns.m (x_set_foreground_color, x_set_background_color)
(x_set_cursor_color, Fxw_color_values): Block/unblock input,
use SET_FRAME_GARBAGED instead of redraw_frame (Bug#19036).
Diffstat (limited to 'src/nsfns.m')
-rw-r--r-- | src/nsfns.m | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/nsfns.m b/src/nsfns.m index 8129c9e2a41..e0f8cfee14a 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -282,9 +282,14 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) NSColor *col; EmacsCGFloat r, g, b, alpha; + /* Must block_input, because ns_lisp_to_color does block/unblock_input + which means that col may be deallocated in its unblock_input if there + is user input, unless we also block_input. */ + block_input (); if (ns_lisp_to_color (arg, &col)) { store_frame_param (f, Qforeground_color, oldval); + unblock_input (); error ("Unknown color"); } @@ -301,8 +306,9 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) update_face_from_frame_parameter (f, Qforeground_color, arg); /*recompute_basic_faces (f); */ if (FRAME_VISIBLE_P (f)) - redraw_frame (f); + SET_FRAME_GARBAGED (f); } + unblock_input (); } @@ -314,9 +320,11 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) NSView *view = FRAME_NS_VIEW (f); EmacsCGFloat r, g, b, alpha; + block_input (); if (ns_lisp_to_color (arg, &col)) { store_frame_param (f, Qbackground_color, oldval); + unblock_input (); error ("Unknown color"); } @@ -353,8 +361,9 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } if (FRAME_VISIBLE_P (f)) - redraw_frame (f); + SET_FRAME_GARBAGED (f); } + unblock_input (); } @@ -363,9 +372,11 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { NSColor *col; + block_input (); if (ns_lisp_to_color (arg, &col)) { store_frame_param (f, Qcursor_color, oldval); + unblock_input (); error ("Unknown color"); } @@ -378,6 +389,7 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) x_update_cursor (f, 1); } update_face_from_frame_parameter (f, Qcursor_color, arg); + unblock_input (); } @@ -2298,11 +2310,16 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, check_window_system (NULL); CHECK_STRING (color); + block_input (); if (ns_lisp_to_color (color, &col)) - return Qnil; + { + unblock_input (); + return Qnil; + } [[col colorUsingDefaultColorSpace] getRed: &red green: &green blue: &blue alpha: &alpha]; + unblock_input (); return list3i (lrint (red * 65280), lrint (green * 65280), lrint (blue * 65280)); } |