all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: [sdl.web@gmail.com: Re: scroll-bar face gets changed in a new frame]
Date: Sat, 03 Feb 2007 19:35:15 -0500	[thread overview]
Message-ID: <878xfeoj3w.fsf@stupidchicken.com> (raw)
In-Reply-To: <E1HDIw1-0004qF-43@fencepost.gnu.org> (Richard Stallman's message of "Sat\, 03 Feb 2007 06\:19\:57 -0500")

Richard Stallman <rms@gnu.org> writes:

> Would someone please investigate this and DTRT?

The problem is in face-set-after-frame-default.  The function merges
in the X resources, then initializes attributes from frame parameters.
However, if there is a scroll-bar X resource present, the call to
make-face-x-resource-internal will chang the scroll-bar-* frame
parameters in the process of changing the scroll-bar face.  Therefore,
any previously-applied frame parameters are lost.

I think one fix is for face-set-after-frame-default to first construct
a list of frame parameters to be applied (based on the new frame's
frame-parameters and/or the face's value for new frames), then wait
until after the call to make-face-x-resource-internal before applying
these changes.  See the attached patch.

By the way, the symbol inhibit-default-face-x-resources seems to be a
no-op; it is called as

 (when (not (equal face 'default))
   ...
   (when (and (memq window-system '(x w32 mac))
     (or (not (boundp 'inhibit-default-face-x-resources))
         (not (eq face 'default))))
     (make-face-x-resource-internal face frame)))

However, since face is never `default' inside the `when' form, the
enclosing `or' statement is always t, regardless of whether or not
inhibit-default-face-x-resources is bound.  I think this symbol was
introduced to solve a similar problem, and it can be removed if the
proposed fix is applied.

*** emacs/lisp/faces.el.~1.362.~	2007-02-02 11:55:30.000000000 -0500
--- emacs/lisp/faces.el	2007-02-03 19:28:18.000000000 -0500
***************
*** 1754,1788 ****
  			  (face-attribute 'default :weight t))
        (set-face-attribute 'default frame :width
  			  (face-attribute 'default :width t))))
!   (dolist (face (face-list))
!     ;; Don't let frame creation fail because of an invalid face spec.
!     (condition-case ()
! 	(when (not (equal face 'default))
! 	  (face-spec-set face (face-user-default-spec face) frame)
! 	  (internal-merge-in-global-face face frame)
! 	  (when (and (memq window-system '(x w32 mac))
! 		     (or (not (boundp 'inhibit-default-face-x-resources))
! 			 (not (eq face 'default))))
! 	    (make-face-x-resource-internal face frame)))
!       (error nil)))
!   ;; Initialize attributes from frame parameters.
    (let ((params '((foreground-color default :foreground)
  		  (background-color default :background)
  		  (border-color border :background)
  		  (cursor-color cursor :background)
  		  (scroll-bar-foreground scroll-bar :foreground)
  		  (scroll-bar-background scroll-bar :background)
! 		  (mouse-color mouse :background))))
      (dolist (param params)
!       (let ((frame-param (frame-parameter frame (nth 0 param)))
! 	    (face (nth 1 param))
! 	    (attr (nth 2 param)))
! 	(when (and frame-param
! 		   ;; Don't override face attributes explicitly
! 		   ;; specified for new frames.
! 		   (eq (face-attribute face attr t) 'unspecified))
! 	  (set-face-attribute face frame attr frame-param))))))
! 
  
  (defun tty-handle-reverse-video (frame parameters)
    "Handle the reverse-video frame parameter for terminal frames."
--- 1754,1790 ----
  			  (face-attribute 'default :weight t))
        (set-face-attribute 'default frame :width
  			  (face-attribute 'default :width t))))
!   ;; Find attributes that should be initialized from frame parameters.
    (let ((params '((foreground-color default :foreground)
  		  (background-color default :background)
  		  (border-color border :background)
  		  (cursor-color cursor :background)
  		  (scroll-bar-foreground scroll-bar :foreground)
  		  (scroll-bar-background scroll-bar :background)
! 		  (mouse-color mouse :background)))
! 	apply-params)
      (dolist (param params)
!       (let* ((value (frame-parameter frame (nth 0 param)))
! 	     (face (nth 1 param))
! 	     (attr (nth 2 param))
! 	     (default (face-attribute face attr t)))
! 	;; Don't set the attributes yet, since the call to
! 	;; make-face-x-resource-internal may change frame parameters.
! 	(if (eq default 'unspecified)
! 	    (if value
! 		(push (list face frame attr value) apply-params))
! 	  (push (list face frame attr default) apply-params))))
!     (dolist (face (delq 'default (face-list)))
!       ;; Don't let frame creation fail because of an invalid face spec.
!       (condition-case ()
! 	  (progn
! 	    (face-spec-set face (face-user-default-spec face) frame)
! 	    (internal-merge-in-global-face face frame)
! 	    (when (memq window-system '(x w32 mac))
! 	      (make-face-x-resource-internal face frame)))
! 	(error nil)))
!     (dolist (param apply-params)
!       (apply 'set-face-attribute param))))
  
  (defun tty-handle-reverse-video (frame parameters)
    "Handle the reverse-video frame parameter for terminal frames."

  reply	other threads:[~2007-02-04  0:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-03 11:19 [sdl.web@gmail.com: Re: scroll-bar face gets changed in a new frame] Richard Stallman
2007-02-04  0:35 ` Chong Yidong [this message]
2007-02-04  1:25   ` Leo
2007-02-06 22:38   ` Chong Yidong
2007-02-11  2:56     ` Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878xfeoj3w.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.