Subject: Re: bug#13476: 24.3.50; Reverting scroll-bar face customization has no effect

From: Po Lu <[email-masked]>
Date: Mon, 28 Feb 2022 20:51:05 +0800

Mauro Aranda <[email-masked]> writes:

> It would have been nice to see the patch posted here.

branch: master
commit 66899628f8a8c79ca8dfe32094f11a8320630fae
Author: Po Lu <[email-masked]>
Commit: Po Lu <[email-masked]>

    Better fix for bug#13476
    
    * lisp/faces.el (face-spec-recalc): Apply scroll bar foreground
    and background to the frame if changing the scroll-bar face.
    (scroll-bar): Restore previous declaration.  That way, the
    default colors are used for toolkit scroll bars, instead of
    black and white.
---
 lisp/faces.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/lisp/faces.el b/lisp/faces.el
index 76da210280..4b582ac439 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1743,7 +1743,14 @@ The following sources are applied in this order:
         (and tail (face-spec-set-2 face frame
                                    (list :extend (cadr tail))))))
     (setq face-attrs (face-spec-choose (get face 'face-override-spec) frame))
-    (face-spec-set-2 face frame face-attrs)))
+    (face-spec-set-2 face frame face-attrs)
+    (when (and (fboundp 'set-frame-parameter) ; This isn't available
+                                              ; during loadup.
+               (eq face 'scroll-bar))
+      ;; Set the `scroll-bar-foreground' and `scroll-bar-background'
+      ;; frame parameters.  (bug#13476)
+      (set-frame-parameter frame 'scroll-bar-foreground (face-foreground face))
+      (set-frame-parameter frame 'scroll-bar-background (face-background face)))))
 
 (defun face-spec-set-2 (face frame face-attrs)
   "Set the face attributes of FACE on FRAME according to FACE-ATTRS.
@@ -2826,11 +2833,9 @@ used to display the prompt text."
   :group 'frames
   :group 'basic-faces)
 
-(defface scroll-bar
-  '((((background light)) :foreground "black")
-    (((background dark))  :foreground "white"))
+(defface scroll-bar '((t nil))
   "Basic face for the scroll bar colors under X."
-  :version "28.1"
+  :version "21.1"
   :group 'frames
   :group 'basic-faces)