aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2000-10-11 10:02:10 +0000
committerMiles Bader2000-10-11 10:02:10 +0000
commitf161d53913a81f0cf536d95d63b8e2cefe84124f (patch)
tree064f9d186d054c420b39f37ad86dead67fba3fbd
parent1b9a1e9d48b17d2afc573f07c55649aaae316a2e (diff)
downloademacs-f161d53913a81f0cf536d95d63b8e2cefe84124f.tar.gz
emacs-f161d53913a81f0cf536d95d63b8e2cefe84124f.zip
(frame-set-background-mode):
Only do anything if the bg-mode or display-type has actually changed. Use `dolist'.
-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 @@
12000-10-11 Miles Bader <miles@lsi.nec.co.jp> 12000-10-11 Miles Bader <miles@gnu.org>
2 2
3 * faces.el (frame-set-background-mode): Pay attention to saved 3 * faces.el (frame-set-background-mode): Pay attention to saved
4 face specs as well as default ones. 4 face specs as well as default ones. Only do anything if the
5 bg-mode or display-type has actually changed. Use `dolist'.
5 6
62000-10-10 Sam Steingold <sds@gnu.org> 72000-10-10 Sam Steingold <sds@gnu.org>
7 8
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."
1308 (let* ((bg-resource 1308 (let* ((bg-resource
1309 (and window-system 1309 (and window-system
1310 (x-get-resource ".backgroundMode" "BackgroundMode"))) 1310 (x-get-resource ".backgroundMode" "BackgroundMode")))
1311 (bg-mode (cond (frame-background-mode) 1311 (bg-mode
1312 ((null window-system) 1312 (cond (frame-background-mode)
1313 ;; No way to determine this automatically (?). 1313 ((null window-system)
1314 'dark) 1314 ;; No way to determine this automatically (?).
1315 (bg-resource 1315 'dark)
1316 (intern (downcase bg-resource))) 1316 (bg-resource
1317 ((< (apply '+ (x-color-values 1317 (intern (downcase bg-resource)))
1318 (frame-parameter frame 'background-color) 1318 ((< (apply '+ (x-color-values
1319 frame)) 1319 (frame-parameter frame 'background-color)
1320 ;; Just looking at the screen, colors whose 1320 frame))
1321 ;; values add up to .6 of the white total 1321 ;; Just looking at the screen, colors whose
1322 ;; still look dark to me. 1322 ;; values add up to .6 of the white total
1323 (* (apply '+ (x-color-values "white" frame)) .6)) 1323 ;; still look dark to me.
1324 'dark) 1324 (* (apply '+ (x-color-values "white" frame)) .6))
1325 (t 'light))) 1325 'dark)
1326 (display-type (cond ((null window-system) 1326 (t 'light)))
1327 (if (tty-display-color-p frame) 'color 'mono)) 1327 (display-type
1328 ((x-display-color-p frame) 1328 (cond ((null window-system)
1329 'color) 1329 (if (tty-display-color-p frame) 'color 'mono))
1330 ((x-display-grayscale-p frame) 1330 ((x-display-color-p frame)
1331 'grayscale) 1331 'color)
1332 (t 'mono)))) 1332 ((x-display-grayscale-p frame)
1333 (modify-frame-parameters frame 1333 'grayscale)
1334 (list (cons 'background-mode bg-mode) 1334 (t 'mono)))
1335 (cons 'display-type display-type)))) 1335 (old-bg-mode
1336 1336 (frame-parameter frame 'background-mode))
1337 ;; For all named faces, choose face specs matching the new frame 1337 (old-display-type
1338 ;; parameters. 1338 (frame-parameter frame 'display-type)))
1339 (let ((face-list (face-list))) 1339
1340 (while face-list 1340 (unless (and (eq bg-mode old-bg-mode) (eq display-type old-display-type))
1341 (let* ((face (car face-list)) 1341 (modify-frame-parameters frame
1342 (spec (or (get face 'saved-face) 1342 (list (cons 'background-mode bg-mode)
1343 (get face 'face-defface-spec)))) 1343 (cons 'display-type display-type)))
1344 (when spec 1344 ;; For all named faces, choose face specs matching the new frame
1345 (face-spec-set face spec frame)) 1345 ;; parameters.
1346 (setq face-list (cdr face-list)))))) 1346 (dolist (face (face-list))
1347 (let ((spec (or (get face 'saved-face)
1348 (get face 'face-defface-spec))))
1349 (when spec
1350 (face-spec-set face spec frame)))))))
1347 1351
1348 1352
1349 1353