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: Sat, 2 Nov 2024 10:32:37 -0400 Message-ID: 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="9689"; 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 Sat Nov 02 15:33:39 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 1t7FC7-0002M1-8Z for ged-emacs-devel@m.gmane-mx.org; Sat, 02 Nov 2024 15:33:39 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7FBF-0008Kh-GR; Sat, 02 Nov 2024 10:32: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 1t7FBD-0008KS-Mg for emacs-devel@gnu.org; Sat, 02 Nov 2024 10:32:43 -0400 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 1t7FBB-00065a-VU for emacs-devel@gnu.org; Sat, 02 Nov 2024 10:32:43 -0400 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 70573C0E80 for ; Sat, 2 Nov 2024 14:32:39 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a203.dreamhost.com (100-103-175-141.trex-nlb.outbound.svc.cluster.local [100.103.175.141]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 19159C0DC3 for ; Sat, 2 Nov 2024 14:32:39 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1730557959; a=rsa-sha256; cv=none; b=vzloECj9s86jR673VzYjoiIEYSGeqfkK/fhgSoQsZHFUivJspnzXH7jvaKpzlOlNt7xM64 KMrJ70LLF3N7E6aOeBViPfhzsxxBV8rb0rXa+pES9tad1frekJo7egs7GHpYD6rgUv3o8i Eo0KENcn0qr8vjMQRw2QrOk4VMVPNY8Z8XhpW0OhP9a2aHw9upXPF6ICUvoeCdQtrp6Hdj zhctvkfcNn/dUWmSvol0EhyQbeVLKhyTJnZRnMpHQSbqULA3vtVEeSg4V/sILDY5UViI4W nQkwIA5D1lihs2aY8Ew7kIGolr9VeYdIXTzinwKmqxKkOdC0doHXFVbezcBWRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1730557959; 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=5YzFkz8fvtbBA6kOlaHGiINMM3UkLepOktlm2qhvTC4=; b=Dq2nhHjDbi2O0pSZMyP698KfghNBL2rTTpHX7TQVubqWuQBPLEOvsSvoWYkne0yrbNUYVf QYrqY8wr2et0zEosteESNrihN+bSdhQkLeYYIsIWfPB84L7Co0JBq4iyziAffuVHqsCq2z +pwW0RzY8RKjq8vVIJVFnOKte/QBrLNZcZ+mLwQ/L0bsekUWT0flkc3LR+5qtHDpJjWhkG vS0IGUf+Xkrj62Tx8XEZGY29iR1/p9GvSowZL4s1LgZd3WHPsHgnOjKRp2NM0EqbVbecfj PnVFjwEsYnNiKnKsg4ufsE0iACn0wDzct5/v7rB8aL+PCbg1nanrwwf11vyxIQ== ARC-Authentication-Results: i=1; rspamd-57ff586b7f-ht9g9; 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-Lettuce-Decisive: 1b8cab2b6da7a8b6_1730557959305_3066243180 X-MC-Loop-Signature: 1730557959305:2754915731 X-MC-Ingress-Time: 1730557959305 Original-Received: from pdx1-sub0-mail-a203.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.103.175.141 (trex/7.0.2); Sat, 02 Nov 2024 14:32:39 +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-a203.dreamhost.com (Postfix) with ESMTPSA id 4XggDk4vG5z2p for ; Sat, 2 Nov 2024 07:32:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jamescherti.com; s=dreamhost; t=1730557958; bh=5YzFkz8fvtbBA6kOlaHGiINMM3UkLepOktlm2qhvTC4=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=H1GMUOUfKErPwBR/pa01+Zzgjq98T0rjyk0qCyioYTNd9D8tz0tb7nXoMovyV+Axy PCu1YvBwsNWArTQDJwGgkClROlEgNuJi+jAWCdxqMKwV54XrSCGl/oZxqlBpxmkvdF wHO9qYgLBVsfTvrM6NjFCF0KP9tpj+o6USH6i8Z3exvlxs3oBBxKXlvTzVgGOuY3RS LQMGIYT7/g2KxR3VrJ1/y1paieggsWmsvlR4D/snUkA+ciZhvFmRXnt5ipFCynVquP dvlMgJbhTCdoJk2ddfNMQtpuTZbrKfwkh3+HgFkuolDzFAh3f+MIGO9CYTG2yuoPnQ FYS+trJVTu6bA== 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:325014 Archived-At: Your code snippet provides an interesting solution. Thank you for sharing it, Stefan. -- 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 > >