aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong <[email protected]>2007-02-20 01:56:11 +0000
committerChong Yidong <[email protected]>2007-02-20 01:56:11 +0000
commit05fc2ef7b290c9c85d6a15e378f1ab52a0322cd9 (patch)
tree183f8884a4344509ac22641e562a14d9efc1cb2b
parent864a4ae770d365604a8b716cf40840908b7e32d4 (diff)
* frame.c (x_set_screen_gamma): Apply gamma value to the frame's bgcolor.
-rw-r--r--src/frame.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/frame.c b/src/frame.c
index 8580ef79ad..5990b9e071 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3057,18 +3057,30 @@ x_set_screen_gamma (f, new_value, old_value)
struct frame *f;
Lisp_Object new_value, old_value;
{
+ Lisp_Object bgcolor;
+
if (NILP (new_value))
f->gamma = 0;
else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0)
- {
- Fclear_face_cache (Qnil);
- /* The value 0.4545 is the normal viewing gamma. */
- f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
- }
+ /* The value 0.4545 is the normal viewing gamma. */
+ f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
else
signal_error ("Invalid screen-gamma", new_value);
- clear_face_cache (0);
+ /* Apply the new gamma value to the frame background. */
+ bgcolor = Fassq (Qbackground_color, f->param_alist);
+ if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor)))
+ {
+ Lisp_Object index = Fget (Qbackground_color, Qx_frame_parameter);
+ if (NATNUMP (index)
+ && (XFASTINT (index)
+ < sizeof (frame_parms)/sizeof (frame_parms[0]))
+ && rif->frame_parm_handlers[XFASTINT (index)])
+ (*(rif->frame_parm_handlers[XFASTINT (index)]))
+ (f, bgcolor, Qnil);
+ }
+
+ Fclear_face_cache (Qnil);
}