From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Support for explicitly resetting the idle timer? Date: Sat, 27 Nov 2021 10:02:42 +0200 Message-ID: <83bl2610wt.fsf@gnu.org> References: <1d3c782b-6e79-8deb-e34d-f53b94f2fd9c@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22604"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Campbell Barton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 27 09:03:10 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mqsft-0005g4-Uq for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Nov 2021 09:03:10 +0100 Original-Received: from localhost ([::1]:59972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mqsfs-0000oW-AE for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Nov 2021 03:03:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqsfN-00009K-95 for emacs-devel@gnu.org; Sat, 27 Nov 2021 03:02:37 -0500 Original-Received: from [2001:470:142:3::e] (port=46754 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqsfN-0005sC-0J; Sat, 27 Nov 2021 03:02:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VQ5eLomUNaY15Sz4sy9vApstit9DC1CxZey+sxQ2ToE=; b=NNrNzQI4GF2M 9GHmc8nlswvOaeLyFDMosVYtxTsvpD3cJo1fnv35TIt2raZ7ceN97BQfcRna75pMjvZR1p/oX/5MJ gPERvCeULZIPiNUPaoz3Zb9VK5rNpuopmcnJQAiRmzUaD3luPGeqEbQvKe0mTUAF6m1O2jkqatPx+ rMTHA10ivjaN/pElcsKEROvF7Zap8l/9sfTExDVc5i+sNYyiHiDKIhwEigZGCkeCz5YBDHjHGcBU+ ACglnAeSJ4KpuIE/LAg4p3SuUcJNsGHO6cjrzH2P9lnSxaLDcG0FFDQEBbfjc67Tg8zTxt3F9MEVC DMxwCXFSJS50ioq0pa2DZw==; Original-Received: from [87.69.77.57] (port=2352 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqsfM-0005Ni-NC; Sat, 27 Nov 2021 03:02:37 -0500 In-Reply-To: <1d3c782b-6e79-8deb-e34d-f53b94f2fd9c@gmail.com> (message from Campbell Barton on Sat, 27 Nov 2021 18:54:56 +1100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:280303 Archived-At: > Date: Sat, 27 Nov 2021 18:54:56 +1100 > From: Campbell Barton > > 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.