GNU bug report logs - #1032
foreground-color in default-frame-alist affects tooltips, while background-color does not

Previous Next

Packages: w32, emacs;

Reported by: "Juanma Barranquero" <lekktu <at> gmail.com>

Date: Fri, 26 Sep 2008 08:50:03 UTC

Severity: normal

Found in version 23.0.60

Done: "Juanma Barranquero" <lekktu <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1032 in the body.
You can then email your comments to 1032 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1032; Package emacs,w32. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: Bug-Gnu-Emacs <bug-gnu-emacs <at> gnu.org>
Subject: foreground-color in default-frame-alist affects tooltips, while background-color does not
Date: Fri, 26 Sep 2008 10:40:10 +0200
Package: emacs,w32
Version: 23.0.60

default-frame-alist affects tooltips on Windows, but the background of
the tooltip window is not affected.

With

(setq default-frame-alist
      '((background-mode  . dark)
	(background-color . "black")
	(foreground-color . "white")))

the tooltip text foreground is white, but the background is still the
default lightyellow, so the text is not visible.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1032; Package emacs,w32. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #10 received at 1032 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 1032 <at> debbugs.gnu.org
Subject: Re: bug#1032: foreground-color in default-frame-alist affects tooltips,
 while background-color does not
Date: Fri, 26 Sep 2008 17:14:28 +0200
[Message part 1 (text/plain, inline)]
> With
> 
> (setq default-frame-alist
>       '((background-mode  . dark)
> 	(background-color . "black")
> 	(foreground-color . "white")))
> 
> the tooltip text foreground is white, but the background is still the
> default lightyellow, so the text is not visible.

Does the attached patch fix it?

martin

[1032.diff (text/plain, inline)]
*** w32fns.c.~1.347.~	2008-09-19 23:24:49.062500000 +0200
--- w32fns.c	2008-09-26 17:10:10.953125000 +0200
***************
*** 5532,5546 ****
       attribute of the frame get's set, which let's the internal border
       of the tooltip frame appear in pink.  Prevent this.  */
    {
      Lisp_Object bg = Fframe_parameter (frame, Qbackground_color);
  
      /* Set tip_frame here, so that */
      tip_frame = frame;
      call2 (Qface_set_after_frame_default, frame, Qnil);
  
!     if (!EQ (bg, Fframe_parameter (frame, Qbackground_color)))
!       Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg),
! 					      Qnil));
    }
  
    f->no_split = 1;
--- 5532,5549 ----
       attribute of the frame get's set, which let's the internal border
       of the tooltip frame appear in pink.  Prevent this.  */
    {
+     Lisp_Object fg = Fframe_parameter (frame, Qforeground_color);
      Lisp_Object bg = Fframe_parameter (frame, Qbackground_color);
  
      /* Set tip_frame here, so that */
      tip_frame = frame;
      call2 (Qface_set_after_frame_default, frame, Qnil);
  
!     if (!EQ (bg, Fframe_parameter (frame, Qbackground_color))
! 	|| !EQ (fg, Fframe_parameter (frame, Qforeground_color)))
! 	Fmodify_frame_parameters (frame, (Fcons (Qforeground_color, fg),
! 					  (Fcons (Qbackground_color, bg),
! 					   Qnil)));
    }
  
    f->no_split = 1;

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1032; Package emacs,w32. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #15 received at 1032 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "martin rudalics" <rudalics <at> gmx.at>
Cc: 1032 <at> debbugs.gnu.org
Subject: Re: bug#1032: foreground-color in default-frame-alist affects tooltips, while background-color does not
Date: Fri, 26 Sep 2008 17:34:29 +0200
[Message part 1 (text/plain, inline)]
On Fri, Sep 26, 2008 at 17:14, martin rudalics <rudalics <at> gmx.at> wrote:

> Does the attached patch fix it?

Yes, in the sense that now the text is readable: the whole tooltip is
white on black, as it is the Emacs frame, so the text is legible but
the tooltip is hard to tell apart from the background (see attached
image).

I think default frame settings should not affect tooltips (perhaps
some mechanism like scroll-bar-{foreground|background} ?).

             Juanma
[sample.png (image/png, attachment)]

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1032; Package emacs,w32. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #20 received at 1032 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 1032 <at> debbugs.gnu.org
Subject: Re: bug#1032: foreground-color in default-frame-alist affects tooltips,
 while background-color does not
Date: Fri, 26 Sep 2008 18:13:10 +0200
> Yes, in the sense that now the text is readable: the whole tooltip is
> white on black, as it is the Emacs frame, so the text is legible but
> the tooltip is hard to tell apart from the background (see attached
> image).

I noticed that too.  It's because border-color is not set as well.

> I think default frame settings should not affect tooltips (perhaps
> some mechanism like scroll-bar-{foreground|background} ?).

Can you produce a good tooltip by setting `tooltip-frame-parameters'
appropriately?  Here I can't.  For example, the following gets always
reset as

(background-color . "systeminfowindow")

martin




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1032; Package emacs,w32. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #25 received at 1032 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "martin rudalics" <rudalics <at> gmx.at>
Cc: 1032 <at> debbugs.gnu.org
Subject: Re: bug#1032: foreground-color in default-frame-alist affects tooltips, while background-color does not
Date: Fri, 26 Sep 2008 21:03:41 +0200
On Fri, Sep 26, 2008 at 18:13, martin rudalics <rudalics <at> gmx.at> wrote:

> Can you produce a good tooltip by setting `tooltip-frame-parameters'
> appropriately?  Here I can't.  For example, the following gets always
> reset as
>
> (background-color . "systeminfowindow")

Same here:

*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> tooltip-frame-parameters
((name . "tooltip")
 (internal-border-width . 2)
 (border-width . 1))

ELISP> (setq tooltip-frame-parameters (append '((background-color .
"lightyellow") (foreground-color . "black"))
tooltip-frame-parameters))
((background-color . "lightyellow")
 (foreground-color . "black")
 (name . "tooltip")
 (internal-border-width . 2)
 (border-width . 1))

;;; Show tooltip, then:

ELISP> tooltip-frame-parameters
((background-color . "systeminfowindow")
 (foreground-color . "systeminfotext")
 (name . "tooltip")
 (internal-border-width . 2)
 (border-width . 1))

             Juanma




Reply sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
bug acknowledged by developer. Full text and rfc822 format available.

Message #30 received at 1032-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "martin rudalics" <rudalics <at> gmx.at>
Cc: 1032-done <at> debbugs.gnu.org
Subject: Re: bug#1032: foreground-color in default-frame-alist affects tooltips, while background-color does not
Date: Thu, 30 Oct 2008 02:43:27 +0100
Martin, I've fixed #1032 with a variant of the patch you sent.

The other issue, about tooltip-show modifying
tooltip-frame-parameters, seems deliberate. tooltip.el defines a
function tooltip-set-param with the explicit intent of modifying its
argument alist, and `tooltip-show' copies `tooltip-frame-parameters'
with copy-sequence, instead of copy-alist, and then uses
`tooltip-set-param' on it.

I can only imagine the idea was that `tooltip-frame-parameters' should
not contain misleading (fore|back)ground-color entries that weren't
really applied while creating the tooltip. Still, it seems weird to
modify under-the-hood a customizable variable.

             Juanma




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1032; Package emacs,w32. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #35 received at 1032 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 1032 <at> debbugs.gnu.org
Subject: Re: bug#1032: foreground-color in default-frame-alist affects tooltips,
 while background-color does not
Date: Thu, 30 Oct 2008 08:24:17 +0100
> The other issue, about tooltip-show modifying
> tooltip-frame-parameters, seems deliberate. tooltip.el defines a
> function tooltip-set-param with the explicit intent of modifying its
> argument alist, and `tooltip-show' copies `tooltip-frame-parameters'
> with copy-sequence, instead of copy-alist, and then uses
> `tooltip-set-param' on it.

This doesn't make sense to me.  When `tooltip-show' calls `x-show-tip'
it does so with _params_ and not with `tooltip-frame-parameters'.
What's the reason to do the `copy-sequence' in the first place?  Maybe
it's all about the 'left or 'top paramters.

> I can only imagine the idea was that `tooltip-frame-parameters' should
> not contain misleading (fore|back)ground-color entries that weren't
> really applied while creating the tooltip. Still, it seems weird to
> modify under-the-hood a customizable variable.

At least, such a reset should occur at the time the variable is
customized and not when the tooltip is displayed.


BTW, a related issue: When I, for example, use the mouse for popping up

	"Tools->Version Control->Show History"
	
from the menubar I get the tooltip

    "List the change log of the current fileset in a window"

When I now move the mouse to the next menu entry

     "Tools->Version Control->Update ChangeLog"

the old tooltip remains displayed.  Do you see that?  Is that a w32-only
problem?

martin




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1032; Package emacs,w32. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #40 received at 1032 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "martin rudalics" <rudalics <at> gmx.at>
Cc: 1032 <at> debbugs.gnu.org
Subject: Re: bug#1032: foreground-color in default-frame-alist affects tooltips, while background-color does not
Date: Thu, 30 Oct 2008 11:24:20 +0100
On Thu, Oct 30, 2008 at 08:24, martin rudalics <rudalics <at> gmx.at> wrote:

> This doesn't make sense to me.  When `tooltip-show' calls `x-show-tip'
> it does so with _params_ and not with `tooltip-frame-parameters'.
> What's the reason to do the `copy-sequence' in the first place?  Maybe
> it's all about the 'left or 'top paramters.

Judging from the code, I think the idea is not to modify
`tooltip-frame-parameters', *except* for
(foreground|background|border)-color, if they appear (if they don't,
they are not added). The reasoning being that allowing such parameters
with values that are not being obeyed would be misleading.

> At least, such a reset should occur at the time the variable is
> customized and not when the tooltip is displayed.

The right thing to do, IMHO, is to change tooltip-show not to modify
`tooltip-frame-parameters', and fix the variable's docstring to
explain that the color attributes of the tooltip frame come from the
tooltip face. WDYT about the attached patch?

> When I now move the mouse to the next menu entry
>
>     "Tools->Version Control->Update ChangeLog"
>
> the old tooltip remains displayed.  Do you see that?  Is that a w32-only
> problem?

I cannot reproduce it. The new tooltip appears after a small delay.

  Juanma


2008-10-30  Juanma Barranquero  <lekktu <at> gmail.com>

	* tooltip.el (tooltip-frame-parameters): Doc fix.
	(tooltip-set-param): Remove.
	(tooltip-show): Don't modify `tooltip-frame-parameters'.


Index: lisp/tooltip.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/tooltip.el,v
retrieving revision 1.89
diff -u -2 -r1.89 tooltip.el
--- lisp/tooltip.el	29 Oct 2008 12:10:33 -0000	1.89
+++ lisp/tooltip.el	30 Oct 2008 10:16:32 -0000
@@ -122,5 +122,8 @@

 If `left' or `top' parameters are included, they specify the absolute
-position to pop up the tooltip."
+position to pop up the tooltip.
+
+Note that font and color parameters are ignored, and the attributes
+of the `tooltip' face are used instead."
   :type 'sexp
   :group 'tooltip)
@@ -204,14 +207,4 @@
 ;;; Displaying tips

-(defun tooltip-set-param (alist key value)
-  "Change the value of KEY in alist ALIST to VALUE.
-If there's no association for KEY in ALIST, add one, otherwise
-change the existing association.  Value is the resulting alist."
-  (let ((param (assq key alist)))
-    (if (consp param)
-	(setcdr param value)
-      (push (cons key value) alist))
-    alist))
-
 (declare-function x-show-tip "xfns.c"
 		  (string &optional frame parms timeout dx dy))
@@ -233,12 +226,13 @@
       (tooltip-show-help-non-mode text)
     (condition-case error
-	(let ((params (copy-sequence tooltip-frame-parameters))
+	(let ((params tooltip-frame-parameters)
 	      (fg (face-attribute 'tooltip :foreground))
 	      (bg (face-attribute 'tooltip :background)))
 	  (when (stringp fg)
-	    (setq params (tooltip-set-param params 'foreground-color fg))
-	    (setq params (tooltip-set-param params 'border-color fg)))
+	    (setq params (append `((foreground-color . ,fg)
+				   (border-color . ,fg))
+				 params)))
 	  (when (stringp bg)
-	    (setq params (tooltip-set-param params 'background-color bg)))
+	    (setq params (cons (cons 'background-color bg) params)))
 	  (x-show-tip (propertize text 'face 'tooltip)
 		      (selected-frame)




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1032; Package emacs,w32. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #45 received at 1032 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 1032 <at> debbugs.gnu.org
Subject: Re: bug#1032: foreground-color in default-frame-alist affects tooltips,
 while background-color does not
Date: Thu, 30 Oct 2008 12:40:17 +0100
> Judging from the code, I think the idea is not to modify
> `tooltip-frame-parameters', *except* for
> (foreground|background|border)-color, if they appear (if they don't,
> they are not added). The reasoning being that allowing such parameters
> with values that are not being obeyed would be misleading.

Now I understand.

> The right thing to do, IMHO, is to change tooltip-show not to modify
> `tooltip-frame-parameters', and fix the variable's docstring to
> explain that the color attributes of the tooltip frame come from the
> tooltip face. WDYT about the attached patch?

Looks good.  Did you check that parameters appearing later in the
list don't override parameters appearing earlier?

> I cannot reproduce it. The new tooltip appears after a small delay.

I see - it's 10 seconds here - not really small ;-)

martin






Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1032; Package emacs,w32. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #50 received at 1032 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "martin rudalics" <rudalics <at> gmx.at>
Cc: 1032 <at> debbugs.gnu.org
Subject: Re: bug#1032: foreground-color in default-frame-alist affects tooltips, while background-color does not
Date: Thu, 30 Oct 2008 12:55:02 +0100
On Thu, Oct 30, 2008 at 12:40, martin rudalics <rudalics <at> gmx.at> wrote:

> Looks good.

And, now that I think of it, the doc fix for
`tooltip-frame-parameters' should go in even if Stefan and/or Chong
oppose the rest of the patch.

> Did you check that parameters appearing later in the
> list don't override parameters appearing earlier?

I checked for color attributes and font, yes. But anyway, that's the
usual behavior of alists, unless the code is explicitly iterating over
them instead of using `assq' and friends...

> I see - it's 10 seconds here - not really small ;-)

Curious. It's more like half a second here.

  Juanma




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1032; Package emacs,w32. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #55 received at 1032 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 1032 <at> debbugs.gnu.org
Subject: Re: bug#1032: foreground-color in default-frame-alist affects tooltips,
 while background-color does not
Date: Thu, 30 Oct 2008 16:48:18 +0100
> Curious. It's more like half a second here.

It must be related to my .emacs.  With emacs -Q it's as you say.

martin




bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Fri, 28 Nov 2008 15:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.