Commit f161d539 authored by Miles Bader's avatar Miles Bader
Browse files

(frame-set-background-mode):

  Only do anything if the bg-mode or display-type has actually changed.
  Use `dolist'.
parent 1b9a1e9d
2000-10-11 Miles Bader <miles@lsi.nec.co.jp> 2000-10-11 Miles Bader <miles@gnu.org>
* faces.el (frame-set-background-mode): Pay attention to saved * faces.el (frame-set-background-mode): Pay attention to saved
face specs as well as default ones. face specs as well as default ones. Only do anything if the
bg-mode or display-type has actually changed. Use `dolist'.
2000-10-10 Sam Steingold <sds@gnu.org> 2000-10-10 Sam Steingold <sds@gnu.org>
......
...@@ -1308,42 +1308,46 @@ this won't have the expected effect." ...@@ -1308,42 +1308,46 @@ this won't have the expected effect."
(let* ((bg-resource (let* ((bg-resource
(and window-system (and window-system
(x-get-resource ".backgroundMode" "BackgroundMode"))) (x-get-resource ".backgroundMode" "BackgroundMode")))
(bg-mode (cond (frame-background-mode) (bg-mode
((null window-system) (cond (frame-background-mode)
;; No way to determine this automatically (?). ((null window-system)
'dark) ;; No way to determine this automatically (?).
(bg-resource 'dark)
(intern (downcase bg-resource))) (bg-resource
((< (apply '+ (x-color-values (intern (downcase bg-resource)))
(frame-parameter frame 'background-color) ((< (apply '+ (x-color-values
frame)) (frame-parameter frame 'background-color)
;; Just looking at the screen, colors whose frame))
;; values add up to .6 of the white total ;; Just looking at the screen, colors whose
;; still look dark to me. ;; values add up to .6 of the white total
(* (apply '+ (x-color-values "white" frame)) .6)) ;; still look dark to me.
'dark) (* (apply '+ (x-color-values "white" frame)) .6))
(t 'light))) 'dark)
(display-type (cond ((null window-system) (t 'light)))
(if (tty-display-color-p frame) 'color 'mono)) (display-type
((x-display-color-p frame) (cond ((null window-system)
'color) (if (tty-display-color-p frame) 'color 'mono))
((x-display-grayscale-p frame) ((x-display-color-p frame)
'grayscale) 'color)
(t 'mono)))) ((x-display-grayscale-p frame)
(modify-frame-parameters frame 'grayscale)
(list (cons 'background-mode bg-mode) (t 'mono)))
(cons 'display-type display-type)))) (old-bg-mode
(frame-parameter frame 'background-mode))
;; For all named faces, choose face specs matching the new frame (old-display-type
;; parameters. (frame-parameter frame 'display-type)))
(let ((face-list (face-list)))
(while face-list (unless (and (eq bg-mode old-bg-mode) (eq display-type old-display-type))
(let* ((face (car face-list)) (modify-frame-parameters frame
(spec (or (get face 'saved-face) (list (cons 'background-mode bg-mode)
(get face 'face-defface-spec)))) (cons 'display-type display-type)))
(when spec ;; For all named faces, choose face specs matching the new frame
(face-spec-set face spec frame)) ;; parameters.
(setq face-list (cdr face-list)))))) (dolist (face (face-list))
(let ((spec (or (get face 'saved-face)
(get face 'face-defface-spec))))
(when spec
(face-spec-set face spec frame)))))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment