unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Tooltip pops up when moving mouse
@ 2005-03-15 17:29 Lennart Borgman
  2005-03-16 13:06 ` Lennart Borgman
  0 siblings, 1 reply; 7+ messages in thread
From: Lennart Borgman @ 2005-03-15 17:29 UTC (permalink / raw)


If I put the mouse cursor on a link with a tooltip and then move the mouse
before the tooltip pops up the tooltips pops up where I have moved the mouse
and then immediately disappears. Do you see this too? This is on w32.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Tooltip pops up when moving mouse
  2005-03-15 17:29 Tooltip pops up when moving mouse Lennart Borgman
@ 2005-03-16 13:06 ` Lennart Borgman
  2005-03-16 21:35   ` Jan D.
  0 siblings, 1 reply; 7+ messages in thread
From: Lennart Borgman @ 2005-03-16 13:06 UTC (permalink / raw)


> If I put the mouse cursor on a link with a tooltip and then move the mouse
> before the tooltip pops up the tooltips pops up where I have moved the
mouse
> and then immediately disappears. Do you see this too? This is on w32.

Some enhancement to my own message ;-)

You can (perhaps) see another version of this problem if you slowly move the
mouse over a link. The tooltip pops up and immediately disappears again.

That I am seeing this problem may depend on both that I have a slow pc and
that I am using w32. I believe it is a thread issue. Mouse movements are
detected by the UI thread, but I believe that the lisp timer for the tooltip
popup runs in the lisp thread. I do not know if the problem is there on X
Windows as well but I would believe it.

Maybe this can be seen as a minor bug, but still many users seems to have
found the tooltip implementation to be less optimal. So I suggested that it
should be corrected.

I do not know if this is difficult or not. What is needed (as far as I can
see) is that the mouse position when starting the tooltip popup timer is
recorded and then compared to the last mouse position when the tooltip
actually should popup. If the mouse has moved the tooltip should never popup
(instead of flashing by as now).

At the moment I do not want to try to implement it since I do not understand
how mouse positions are handled generally.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Tooltip pops up when moving mouse
  2005-03-16 13:06 ` Lennart Borgman
@ 2005-03-16 21:35   ` Jan D.
  2005-03-17 17:12     ` Lennart Borgman
  0 siblings, 1 reply; 7+ messages in thread
From: Jan D. @ 2005-03-16 21:35 UTC (permalink / raw)
  Cc: Emacs Devel

Lennart Borgman wrote:

>You can (perhaps) see another version of this problem if you slowly move the
>mouse over a link. The tooltip pops up and immediately disappears again.
>
>That I am seeing this problem may depend on both that I have a slow pc and
>that I am using w32. I believe it is a thread issue. Mouse movements are
>detected by the UI thread, but I believe that the lisp timer for the tooltip
>popup runs in the lisp thread. I do not know if the problem is there on X
>Windows as well but I would believe it.
>

It is not.  And by the way:

       The  X Consortium requests that the following names be used when 
refer-
       ring to this software:

                                          X
                                   X Window System
                                    X Version 11
                             X Window System, Version 11
                                         X11


    Jan D.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Tooltip pops up when moving mouse
  2005-03-16 21:35   ` Jan D.
@ 2005-03-17 17:12     ` Lennart Borgman
  2005-03-17 20:12       ` Jan D.
  0 siblings, 1 reply; 7+ messages in thread
From: Lennart Borgman @ 2005-03-17 17:12 UTC (permalink / raw)
  Cc: Emacs Devel

----- Original Message ----- 
From: "Jan D." <jan.h.d@swipnet.se>

> >You can (perhaps) see another version of this problem if you slowly move
the
> >mouse over a link. The tooltip pops up and immediately disappears again.
> >
> >That I am seeing this problem may depend on both that I have a slow pc
and
> >that I am using w32. I believe it is a thread issue. Mouse movements are
> >detected by the UI thread, but I believe that the lisp timer for the
tooltip
> >popup runs in the lisp thread. I do not know if the problem is there on X
> >Windows as well but I would believe it.
> >
>
> It is not.

Thanks. Then I must say I do not understand how this works. As far as I see
for this to work reliably tooltip.el:tooltip-start-delayed-tip must record
the mouse position (because if the mouse has moved when the timer fires the
tooltip should not be shown). However it does not.

Could someone please try to explain this to me? Am I missing something here?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Tooltip pops up when moving mouse
  2005-03-17 17:12     ` Lennart Borgman
@ 2005-03-17 20:12       ` Jan D.
  2005-03-17 20:42         ` Lennart Borgman
  0 siblings, 1 reply; 7+ messages in thread
From: Jan D. @ 2005-03-17 20:12 UTC (permalink / raw)
  Cc: Emacs Devel

>>> You can (perhaps) see another version of this problem if you slowly 
>>> move
> the
>>> mouse over a link. The tooltip pops up and immediately disappears 
>>> again.
>>>
>>> That I am seeing this problem may depend on both that I have a slow 
>>> pc
> and
>>> that I am using w32. I believe it is a thread issue. Mouse movements 
>>> are
>>> detected by the UI thread, but I believe that the lisp timer for the
> tooltip
>>> popup runs in the lisp thread. I do not know if the problem is there 
>>> on X
>>> Windows as well but I would believe it.
>>>
>>
>> It is not.
>
> Thanks. Then I must say I do not understand how this works. As far as 
> I see
> for this to work reliably tooltip.el:tooltip-start-delayed-tip must 
> record
> the mouse position (because if the mouse has moved when the timer 
> fires the
> tooltip should not be shown). However it does not.
>
> Could someone please try to explain this to me? Am I missing something 
> here?

I don't know how it is implemented, but the tooltip for a link in X11 
is not removed if you move the mouse within the link, it is only 
removed when you leave the link (i.e. the highlight is removed).  So 
the enter/leave link code must do something.

	Jan D.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Tooltip pops up when moving mouse
  2005-03-17 20:12       ` Jan D.
@ 2005-03-17 20:42         ` Lennart Borgman
  2005-03-17 23:01           ` Lennart Borgman
  0 siblings, 1 reply; 7+ messages in thread
From: Lennart Borgman @ 2005-03-17 20:42 UTC (permalink / raw)
  Cc: Emacs Devel

----- Original Message ----- 
From: "Jan D." <jan.h.d@swipnet.se>

> > Thanks. Then I must say I do not understand how this works. As far as
> > I see
> > for this to work reliably tooltip.el:tooltip-start-delayed-tip must
> > record
> > the mouse position (because if the mouse has moved when the timer
> > fires the
> > tooltip should not be shown). However it does not.
> >
> > Could someone please try to explain this to me? Am I missing something
> > here?
>
> I don't know how it is implemented, but the tooltip for a link in X11
> is not removed if you move the mouse within the link, it is only
> removed when you leave the link (i.e. the highlight is removed).  So
> the enter/leave link code must do something.

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...

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Tooltip pops up when moving mouse
  2005-03-17 20:42         ` Lennart Borgman
@ 2005-03-17 23:01           ` Lennart Borgman
  0 siblings, 0 replies; 7+ messages in thread
From: Lennart Borgman @ 2005-03-17 23:01 UTC (permalink / raw)
  Cc: Emacs Devel

----- Original Message ----- 
From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>

> 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)))

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-03-17 23:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-15 17:29 Tooltip pops up when moving mouse Lennart Borgman
2005-03-16 13:06 ` Lennart Borgman
2005-03-16 21:35   ` Jan D.
2005-03-17 17:12     ` Lennart Borgman
2005-03-17 20:12       ` Jan D.
2005-03-17 20:42         ` Lennart Borgman
2005-03-17 23:01           ` Lennart Borgman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).