From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Radetsky Newsgroups: gmane.emacs.devel Subject: Re: Disabling mouse input Date: Sat, 2 Nov 2024 03:17:39 -0700 Message-ID: <4p6cs2adzzqihjdustvlklr3ykrrz7eq7rtz2ciywcyevgmoej@klyfgnsjtnti> References: <86sesaytjn.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7963"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , Po Lu , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 02 11:18:35 2024 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 1t7BDH-0001zf-9T for ged-emacs-devel@m.gmane-mx.org; Sat, 02 Nov 2024 11:18:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7BCT-0005D5-0f; Sat, 02 Nov 2024 06:17:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t7BCR-0005Cr-GV for emacs-devel@gnu.org; Sat, 02 Nov 2024 06:17:43 -0400 Original-Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t7BCP-0005CS-TZ; Sat, 02 Nov 2024 06:17:43 -0400 Original-Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2e2e23f2931so2092233a91.0; Sat, 02 Nov 2024 03:17:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730542660; x=1731147460; darn=gnu.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=cK2A10yI5subvUSBkAwWbJ6/jKiWfp+Nn5TJZBFRw4c=; b=iXp/e7wlzg6723m66Y+hN5CXPS6URlfCDy1zi81SaBW5haY4zlH4qgWxic5o8Lk+fM g+CUZKjMCysntm/ZHDM6PXjlF+r7+Jx6+Zmy7+6c5NnINBjU4c9BY4jPD13yjnegP3xw aPioyQa5rNAF08UnU2AyqnMMZdjzliw38gGB3WJCosCyE00ekK1piFo+XTZxSlHMmFrn gKM9SO2IJXOeKFXaylO58+p0q4mpbLdw+VEMHw4MlRqpU93f10MefvRZ0XKHCpApsy9o dBMk0sqd7Tnalus1Mw0sOTs0IRx6qKqLBM/P9m9XQh17wF2WzaWJLsDOvzNvexqs2OsG ytyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730542660; x=1731147460; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cK2A10yI5subvUSBkAwWbJ6/jKiWfp+Nn5TJZBFRw4c=; b=fODaDu5pTiP/naFMVmBesdqLmYsFdK5mg5y2eI4mTlQE2j/DkLpUwC9itMF3fdSYNX ge5a+/aGf+TrPByQx0PAXiC7bVdc/uW2Er2Q4LIkEpXD08zGoMcnfeBUD55OM285Ve9F si5IE+WH5B6o58OwjdVtJecO3E0QcX5j7+/OaSdX1NYn3d9hz65OTkgEY2eB71EqWMwy UF3tpl7HI7Eqovf3p/9c6+kqt0R5GZ2VgL9/nRM7XM2V+pKckBjbazsqdPa1UgAZHRKC SnUrvrWJDc0mMj3Vlm63Ke0FiiI2YKryLbKqaoHXvMv2xUQ46+uuSqmXPPkcds1F84uP gQ+A== X-Forwarded-Encrypted: i=1; AJvYcCVrmurMuCaUeZDrskR+RrL7TrfqPL08ubRX3ttIeyNUhwhZpeG44iSUKgZCCsozI5NOD2c4AeIlpsClhA==@gnu.org X-Gm-Message-State: AOJu0YzVxmgqwCz+SAj73YSX9ddyST0jCIP+4kl4b84SPdj5PerWKZbL gWcrcp2AZGVGkbZiNVoaSU5rbIsaEJF7WtDssdv45dehBIh6v8nU2keh9w== X-Google-Smtp-Source: AGHT+IFqGr/T19ccLX19Zg0XRhHY+2fNR+6Pmz8mV43rgsDhu1eHlv9GX61mfkuQv8prlJmLSQb0Zw== X-Received: by 2002:a17:90b:270a:b0:2e2:d33b:cc with SMTP id 98e67ed59e1d1-2e94c2e730cmr8637470a91.21.1730542659706; Sat, 02 Nov 2024 03:17:39 -0700 (PDT) Original-Received: from flap ([2601:645:8a81:69c0:e657:69fd:648d:782]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e92fa44a34sm6286315a91.26.2024.11.02.03.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Nov 2024 03:17:39 -0700 (PDT) Content-Disposition: inline In-Reply-To: <86sesaytjn.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=dradetsky@gmail.com; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:325006 Archived-At: On Sat, Nov 02, 2024 at 09:38:20AM GMT, Eli Zaretskii wrote: > (This should not surprise anyone, because input events are handled in > C, not in Lisp, and so disabling this in Lisp is expected to be > impossible.) Well, everyone I talked to was sure it must be possible in Lisp, so I figured somebody would ask eventually. > Thanks, but this is not enough, and I also think it doesn't > necessarily ignore the mouse events on the right level. We should > instead ignore these events where they are read, here: It was clearly enough for you to tell me I was doing it the Stupid Way, which was my objective, so I don't see the problem. I mean, obviously you're not going to merge what I sent. That wasn't the point. > This loop should ignore and remove from the queue any events whose > 'kind' (as declared in termhooks.h) is a mouse or touchpad event. And > perhaps we also should allow ignoring the latter, but not the former. Sounds reasonable. I'll take another look soon. > Otherwise, the "ignored" input events will act like ghosts: they do > exist in the queue, and do trigger input-even related mechanisms we > have, such as while-no-input, but cannot be accessed. I can't tell if this issue is supposed to be a consequence of not implementing ignore-touchpad-but-not-mouse, or of ignoring the events the way I was doing it (via the goto in read_key_sequence). > In addition, we'd need to change display-mouse-p, so that it reflects > the fact that mouse clicks are not available. Otherwise, some > features will present mouse-driven UI that cannot be used. Good point. I'm thoroughly ignorant of emacs' mouse-driven UI. > > + DEFVAR_LISP ("ignore-mouse-input", ignore_mouse_input, > > + doc: /* If non-nil, discard mouse input in the command loop */); > > + ignore_mouse_input = Qnil; > > This should be DEFVAR_BOOL instead. Okay, wasn't certain about that. It was also suggested to me that other devs would want the feature exposed via a global minor mode, not just a variable. Do you? I looked into it and it was about 10 lines of Lisp (most of which was to allow it to be set via customize), so that's not a big deal if so. Or I mean probably not; maybe I'll discover it's much worse in practice once I know what's actually involved. Thanks for the info.