[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tooltip pops up when moving mouse
From: |
Lennart Borgman |
Subject: |
Re: Tooltip pops up when moving mouse |
Date: |
Fri, 18 Mar 2005 00:01:21 +0100 |
----- Original Message -----
From: "Lennart Borgman" <address@hidden>
> Yes, that is how it works on w32 too. I meant something a little bit
> different. I think the timer for the tooltip popup should be canceled (and
> maybe started again) every time the mouse is moved. Indeed I believe that
is
> what the code does.
>
> However this does not work as intended. Sometimes the operation for
> canceling the timer get queued but it is actually canceled and instead the
> tooltip flashes by. To prevent this ugly behaviour that occurs on w32 the
> mouse position where the timer where started must be recorded (I am
> repeating myself here...). As far as I can see this is not done.
>
> It is actually quite simple I believe now:
>
> mouse-position should be called in tooltip.el: tooltip-start-delayed-tip
and
> then again in tooltip-timeout again. It the mouse position has changed
then
> tooltip-timeout should not run tooltip-hook. This should fix the problem
> with the flashing tooltip. I will test and come back...
Coming back ... - the code below seems to do what I want. Comments,
suggestions? Can someone please test on X? Mac?
Changes to tooltip.el:
(defvar tooltip-mouse-pixel-position nil)
(defun tooltip-timeout (object)
"Function called when timer with id tooltip-timeout-id fires."
(if (and
(equal (nth 0 tooltip-mouse-pixel-position) (nth 0
(mouse-pixel-position)))
(> 10 (abs (- (nth 1 tooltip-mouse-pixel-position) (nth 1
(mouse-pixel-position)))))
(> 10 (abs (- (nthcdr 2 tooltip-mouse-pixel-position)
(nthcdr 2 (mouse-pixel-position))))))
(progn
(run-hook-with-args-until-success 'tooltip-hook
tooltip-last-mouse-motion-event))
;;(message "%s ### %s" tooltip-mouse-pixel-position
(mouse-pixel-position))
))
(defun tooltip-start-delayed-tip ()
"Add a one-shot timeout to call function tooltip-timeout."
(setq tooltip-mouse-pixel-position (mouse-pixel-position))
(setq tooltip-timeout-id
(add-timeout (tooltip-delay) 'tooltip-timeout nil)))