[Top][All Lists]

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

Re: Support for explicitly resetting the idle timer?

From: Campbell Barton
Subject: Re: Support for explicitly resetting the idle timer?
Date: Sat, 27 Nov 2021 19:42:15 +1100

On Sat, Nov 27, 2021 at 7:02 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Sat, 27 Nov 2021 18:54:56 +1100
> > From: Campbell Barton <ideasman42@gmail.com>
> >
> > There is a package I use/maintain which implements something like
> > Firefox's auto-scroll (click-drag to scroll up/down) [0].
> >
> > An issue with this is (unlike mouse wheel scrolling) using track-mouse
> > doesn't handle keyboard events in a way that resets the idle timer.
> >
> > So while scrolling, idle timers may run (which can cause visible
> > stuttering).
> >
> > I've worked around this by locally let binding `timer-idle-list` to nil,
> > however this back-fires if any timers are added while scrolling (rare
> > but possible), workarounds for this are possible - but they involve
> > clearing the list while scrolling then moving the contents into the real
> > `timer-idle-list` list... which as far as I can see is quite error
> > prone, especially if packages are inspecting the contents of this list.
> >
> > All this complexity could be avoided if the function `timer_stop_idle`
> > in ./src/keyboard.c was exposed to elisp, this way scripts that use
> > mouse input could explicitly reset the idle timer on mouse based
> > user-interaction (when it makes sense).
> The cleanest solution in this case would be to call timer_stop_idle if
> Emacs is executing a command, no matter how it was invoked.  In fact,
> I'm surprised that we don't stop idle timers when track-mouse invokes
> commands: it sounds like a bug we should fix.

Not sure if this would solve my case (is there some formal definition
of what is meant by a command?).
I'm changing the scroll position using `set-window-vscroll` - so I'm
not sure if that counts as a command.
As a workaround it may be possible to define a dummy command that does
nothing but reset the idle timer.

- Campbell

reply via email to

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