bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#1032: foreground-color in default-frame-alist affects tooltips, whil


From: Juanma Barranquero
Subject: 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@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@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)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]