From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: James Cherti Newsgroups: gmane.emacs.devel Subject: Re: Disabling mouse input Date: Sun, 3 Nov 2024 09:01:08 -0500 Message-ID: <83d65ee4-3109-40d6-8fc4-29b2b5e7cef8@jamescherti.com> References: <86sesaytjn.fsf@gnu.org> <4p6cs2adzzqihjdustvlklr3ykrrz7eq7rtz2ciywcyevgmoej@klyfgnsjtnti> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8287"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 03 15:02:06 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 1t7bB6-000218-Ji for ged-emacs-devel@m.gmane-mx.org; Sun, 03 Nov 2024 15:02:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7bAX-0002u1-PY; Sun, 03 Nov 2024 09:01:29 -0500 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 1t7bAM-0002tI-G0 for emacs-devel@gnu.org; Sun, 03 Nov 2024 09:01:24 -0500 Original-Received: from fly.ash.relay.mailchannels.net ([23.83.222.61]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t7bAK-0005sQ-Kf for emacs-devel@gnu.org; Sun, 03 Nov 2024 09:01:18 -0500 X-Sender-Id: dreamhost|x-authsender|contact@jamescherti.com Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 39F35A3482 for ; Sun, 3 Nov 2024 14:01:11 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a316.dreamhost.com (trex-7.trex.outbound.svc.cluster.local [100.103.228.94]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id E0D0BA347F for ; Sun, 3 Nov 2024 14:01:10 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1730642470; a=rsa-sha256; cv=none; b=T8QTlTBdpnRk3P6SmTosDWd6DY4RUbr0H08lrKTVgJq1jjc1hYPHXNAQ9OcT85D6E8uZP/ KJeKOUGHBIJnn7TdOWip07OO8vXkq79EOriGbU491fGQVkkrQ8B0tyml0ybtONvqiowD2Q cZO82324Z1X7pE04X9NaZ/mJMd2iTBtlNyPSlEmmhXVlxrZ6X0LW4VVYqNVuGEaQq6iQjc GDRo6LuTcGCpvnBLstLdHWLf/MvpiNlYmSnG339MW0+qlgMilJVnd3+FSyd3QY8z/5tcH1 WQ0faEO/1CEKT50yADb20NxGhGb8p7/cna/ow+gSFen5G9FD/JirXTFEVlpp2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1730642470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=47lDhf6bKy9Du34lRZXYZO7rNVDyoUvK9q4p54iDlMU=; b=aJwHEXgnKIvj6KTDfznP7d+xH1yZHG69sIaeKjsXYCRUpf+0YrK3F5mCzmXPl3o3eYdAtU OaU3xuVobegpLxljp5b6oLB0np8Vs+jiZzHqYqpwRfJb8d+BhcgJJM6HNxuoL2S6F0iNl+ kiRUygkA9uk3Fyc59XJgwiIlbErg1gassOV1bC2HY9yIgESQLVjtlwU0c+MsbeuTN5QD/x 4XkPsl2GrZRCvdzxaubggaz/mAu9IWVzOKroKJiFLQCrms53RIQwFfaVmqiiULMYNbhtno YH5bQzWjmGDceg+TCYMjLrIMcVTtaja3QO6UfLLTW7sKGep5ANkm8WBiDfNZaw== ARC-Authentication-Results: i=1; rspamd-5cc7c5c758-mz4bc; auth=pass smtp.auth=dreamhost smtp.mailfrom=contact@jamescherti.com X-Sender-Id: dreamhost|x-authsender|contact@jamescherti.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|contact@jamescherti.com X-MailChannels-Auth-Id: dreamhost X-Illegal-Illegal: 3928b0b245e7b3d0_1730642471121_3231019178 X-MC-Loop-Signature: 1730642471121:2621627479 X-MC-Ingress-Time: 1730642471121 Original-Received: from pdx1-sub0-mail-a316.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.103.228.94 (trex/7.0.2); Sun, 03 Nov 2024 14:01:11 +0000 Original-Received: from [192.168.5.23] (bras-base-toroon0648w-grc-11-142-198-74-25.dsl.bell.ca [142.198.74.25]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: contact@jamescherti.com) by pdx1-sub0-mail-a316.dreamhost.com (Postfix) with ESMTPSA id 4XhGTy4FsCzN4 for ; Sun, 3 Nov 2024 06:01:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jamescherti.com; s=dreamhost; t=1730642470; bh=47lDhf6bKy9Du34lRZXYZO7rNVDyoUvK9q4p54iDlMU=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=XbnI+7kbIZRJX+Yzeq1FaH2rPGpKgu96AYkCXMy+mnUB59nYCcFqg8atIIS1Pu6BI pT3mkbOCFE1dBs61mxsCvFgqdAxTJRkqjM0RsznT+/sdS1WgH82XfAsIINtKNob3+e rB7doe+yttEHq9PsqOiRzTl/puoCGBn7uUR/496HEiMvEDhFd8QhPRFwD7Wp8E4++w K4gIL6bLlLHtkqb78wIurGOZGiYcD5SXLDRAg5L5wozQ7WvABtdpnYqs3F3/Pp406r QNAiM2vD00VhkrlK7NB2ILOTVen8Y9pdBg4DW5LG6pUAFmmG4nuqCmz1f1NkGVuS7D PKsHy6qStpzpQ== Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=23.83.222.61; envelope-from=contact@jamescherti.com; helo=fly.ash.relay.mailchannels.net 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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:325056 Archived-At: Hello Stefan, Just in case anyone is interested: I have created a small Emacs package inspired by your idea of using input-decode-map to disable the mouse: https://github.com/jamescherti/inhibit-mouse.el -- James Cherti https://www.jamescherti.com/ On 2024-11-02 09:38, Stefan Monnier 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. > My first intuition would be to do something like: > > (define-key input-decode-map [wheel-down] (lambda (_prompt) [])) > (define-key input-decode-map [wheel-up] (lambda (_prompt) [])) > (define-key input-decode-map [mouse-1] (lambda (_prompt) [])) > (define-key input-decode-map [mouse-2] (lambda (_prompt) [])) > (define-key input-decode-map [mouse-3] (lambda (_prompt) [])) > > If that works, then you'll probably want to add more bindings for those > cases where you hit the "mouse" while holding a modifier, i.e. something like: > > (dolist (modifier '(control meta nil)) > (dolist (base '(wheel-down wheel-up mouse-1 mouse-2 mouse-3)) > (define-key input-decode-map > (vector (event-convert-list (list modifier base))) > (lambda (_prompt) [])))) > > > - Stefan > >