diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/frame.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/frame.c b/src/frame.c index 8580ef79ad6..5990b9e0717 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -3057,18 +3057,30 @@ x_set_screen_gamma (f, new_value, old_value) | |||
| 3057 | struct frame *f; | 3057 | struct frame *f; |
| 3058 | Lisp_Object new_value, old_value; | 3058 | Lisp_Object new_value, old_value; |
| 3059 | { | 3059 | { |
| 3060 | Lisp_Object bgcolor; | ||
| 3061 | |||
| 3060 | if (NILP (new_value)) | 3062 | if (NILP (new_value)) |
| 3061 | f->gamma = 0; | 3063 | f->gamma = 0; |
| 3062 | else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0) | 3064 | else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0) |
| 3063 | { | 3065 | /* The value 0.4545 is the normal viewing gamma. */ |
| 3064 | Fclear_face_cache (Qnil); | 3066 | f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value)); |
| 3065 | /* The value 0.4545 is the normal viewing gamma. */ | ||
| 3066 | f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value)); | ||
| 3067 | } | ||
| 3068 | else | 3067 | else |
| 3069 | signal_error ("Invalid screen-gamma", new_value); | 3068 | signal_error ("Invalid screen-gamma", new_value); |
| 3070 | 3069 | ||
| 3071 | clear_face_cache (0); | 3070 | /* Apply the new gamma value to the frame background. */ |
| 3071 | bgcolor = Fassq (Qbackground_color, f->param_alist); | ||
| 3072 | if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor))) | ||
| 3073 | { | ||
| 3074 | Lisp_Object index = Fget (Qbackground_color, Qx_frame_parameter); | ||
| 3075 | if (NATNUMP (index) | ||
| 3076 | && (XFASTINT (index) | ||
| 3077 | < sizeof (frame_parms)/sizeof (frame_parms[0])) | ||
| 3078 | && rif->frame_parm_handlers[XFASTINT (index)]) | ||
| 3079 | (*(rif->frame_parm_handlers[XFASTINT (index)])) | ||
| 3080 | (f, bgcolor, Qnil); | ||
| 3081 | } | ||
| 3082 | |||
| 3083 | Fclear_face_cache (Qnil); | ||
| 3072 | } | 3084 | } |
| 3073 | 3085 | ||
| 3074 | 3086 | ||