diff options
| author | Chong Yidong | 2007-02-20 01:56:11 +0000 |
|---|---|---|
| committer | Chong Yidong | 2007-02-20 01:56:11 +0000 |
| commit | 05fc2ef7b290c9c85d6a15e378f1ab52a0322cd9 (patch) | |
| tree | 183f8884a4344509ac22641e562a14d9efc1cb2b /src | |
| parent | 864a4ae770d365604a8b716cf40840908b7e32d4 (diff) | |
| download | emacs-05fc2ef7b290c9c85d6a15e378f1ab52a0322cd9.tar.gz emacs-05fc2ef7b290c9c85d6a15e378f1ab52a0322cd9.zip | |
* frame.c (x_set_screen_gamma): Apply gamma value to the frame's bgcolor.
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 | ||