[Top][All Lists]

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

bug#5703: 23.1.92; `x-show-tip' and `tooltip-frame-parameters' do not re

From: Drew Adams
Subject: bug#5703: 23.1.92; `x-show-tip' and `tooltip-frame-parameters' do not respect `left' and `top'
Date: Wed, 10 Mar 2010 23:49:35 -0800

emacs -Q

M-: (x-show-tip "aaaaaaaa" (selected-frame)
                '((left . 30) (top . 40)) 10 0 0)

Or something similar. Instead of displaying the tooltip frame at the absolute
location specified by `left' and `top', it always displays it at the mouse
position plus the DX and DY (0 and 0 here).

Also, the tooltip does not remain displayed for the 10 seconds specified, but
perhaps that is due to the way this is evaluated (M-:).

As another example (easier to see), evaluate this:

(let ((tooltip-frame-parameters '((nil . "tooltip")
                                  (left . 100)
                                  (top . 200))))
  (tooltip-show "aaaaaaaaa" nil))

In this case, the tooltip is always shown with an offset of 5 (the default DX
and DY) from the mouse pointer. 

The `left' and `right' parameters are ignored. Even the doc string of
`tooltip-frame-parameters' says that `left' and `top' should be respected.
Instead, the mouse pointer position is always used.

Another illustration:

M-: (my-show "aaaaaa" nil 100 200)

where `my-show' is the same as `tooltip-show' except that it accepts optional
LEFT and TOP params, to override `tooltip-frame-parameters':

(defun my-show (text &optional use-echo-area left top)
  (if use-echo-area
      (tooltip-show-help-non-mode text)
    (condition-case error
        (let ((params (copy-sequence 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)))
          (when (stringp bg)
            (setq params (tooltip-set-param params 'background-color bg)))
          (when left (setq params  (tooltip-set-param params 'left left)))
          (when top  (setq params  (tooltip-set-param params 'top top)))
          (x-show-tip (propertize text 'face 'tooltip)
       (message "Error while displaying tooltip: %s" error)
       (sit-for 1)
       (message "%s" text)))))

`tooltip-show' should in fact be modified in this way (adding optional LEFT and
TOP), IMO, so that you can easily show the tooltip anywhere without first adding
the location to `tooltip-frame-parameters' (e.g. as in the `let' example). But
the bug needs to be fixed first.

In GNU Emacs (i386-mingw-nt5.1.2600)
 of 2010-02-20 on LENNART-69DE564
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/g/include

reply via email to

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