summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2000-10-11 10:02:10 +0000
committerMiles Bader <miles@gnu.org>2000-10-11 10:02:10 +0000
commitf161d53913a81f0cf536d95d63b8e2cefe84124f (patch)
tree064f9d186d054c420b39f37ad86dead67fba3fbd /lisp
parent1b9a1e9d48b17d2afc573f07c55649aaae316a2e (diff)
downloademacs-f161d53913a81f0cf536d95d63b8e2cefe84124f.tar.gz
emacs-f161d53913a81f0cf536d95d63b8e2cefe84124f.tar.bz2
emacs-f161d53913a81f0cf536d95d63b8e2cefe84124f.zip
(frame-set-background-mode):
Only do anything if the bg-mode or display-type has actually changed. Use `dolist'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/faces.el76
2 files changed, 43 insertions, 38 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a8f2cad62ca..d23eac19c8b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,7 +1,8 @@
-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
- 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>
diff --git a/lisp/faces.el b/lisp/faces.el
index 6906c05447f..c847d9f71a7 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1308,42 +1308,46 @@ this won't have the expected effect."
(let* ((bg-resource
(and window-system
(x-get-resource ".backgroundMode" "BackgroundMode")))
- (bg-mode (cond (frame-background-mode)
- ((null window-system)
- ;; No way to determine this automatically (?).
- 'dark)
- (bg-resource
- (intern (downcase bg-resource)))
- ((< (apply '+ (x-color-values
- (frame-parameter frame 'background-color)
- frame))
- ;; Just looking at the screen, colors whose
- ;; values add up to .6 of the white total
- ;; still look dark to me.
- (* (apply '+ (x-color-values "white" frame)) .6))
- 'dark)
- (t 'light)))
- (display-type (cond ((null window-system)
- (if (tty-display-color-p frame) 'color 'mono))
- ((x-display-color-p frame)
- 'color)
- ((x-display-grayscale-p frame)
- 'grayscale)
- (t 'mono))))
- (modify-frame-parameters frame
- (list (cons 'background-mode bg-mode)
- (cons 'display-type display-type))))
-
- ;; For all named faces, choose face specs matching the new frame
- ;; parameters.
- (let ((face-list (face-list)))
- (while face-list
- (let* ((face (car face-list))
- (spec (or (get face 'saved-face)
- (get face 'face-defface-spec))))
- (when spec
- (face-spec-set face spec frame))
- (setq face-list (cdr face-list))))))
+ (bg-mode
+ (cond (frame-background-mode)
+ ((null window-system)
+ ;; No way to determine this automatically (?).
+ 'dark)
+ (bg-resource
+ (intern (downcase bg-resource)))
+ ((< (apply '+ (x-color-values
+ (frame-parameter frame 'background-color)
+ frame))
+ ;; Just looking at the screen, colors whose
+ ;; values add up to .6 of the white total
+ ;; still look dark to me.
+ (* (apply '+ (x-color-values "white" frame)) .6))
+ 'dark)
+ (t 'light)))
+ (display-type
+ (cond ((null window-system)
+ (if (tty-display-color-p frame) 'color 'mono))
+ ((x-display-color-p frame)
+ 'color)
+ ((x-display-grayscale-p frame)
+ 'grayscale)
+ (t 'mono)))
+ (old-bg-mode
+ (frame-parameter frame 'background-mode))
+ (old-display-type
+ (frame-parameter frame 'display-type)))
+
+ (unless (and (eq bg-mode old-bg-mode) (eq display-type old-display-type))
+ (modify-frame-parameters frame
+ (list (cons 'background-mode bg-mode)
+ (cons 'display-type display-type)))
+ ;; For all named faces, choose face specs matching the new frame
+ ;; parameters.
+ (dolist (face (face-list))
+ (let ((spec (or (get face 'saved-face)
+ (get face 'face-defface-spec))))
+ (when spec
+ (face-spec-set face spec frame)))))))