From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dov Grobgeld Newsgroups: gmane.emacs.devel Subject: Re: Disabling mouse input Date: Sat, 2 Nov 2024 18:30:26 +0200 Message-ID: References: <86sesaytjn.fsf@gnu.org> <4p6cs2adzzqihjdustvlklr3ykrrz7eq7rtz2ciywcyevgmoej@klyfgnsjtnti> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35716"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: James Cherti Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 02 17:31:17 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 1t7H1w-00097j-O3 for ged-emacs-devel@m.gmane-mx.org; Sat, 02 Nov 2024 17:31:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7H1c-00086t-5r; Sat, 02 Nov 2024 12:30:56 -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 1t7H1P-00086I-J7 for emacs-devel@gnu.org; Sat, 02 Nov 2024 12:30:45 -0400 Original-Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t7H1N-0003Fv-TA for emacs-devel@gnu.org; Sat, 02 Nov 2024 12:30:43 -0400 Original-Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2fc968b3545so27928431fa.2 for ; Sat, 02 Nov 2024 09:30:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730565039; x=1731169839; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ktr2nKi3lJf51DUU540CsKmG8zlLd5Q+ZWmruE6z0hg=; b=NjEfj6Gd4Evv+Z/D0sSekt+hJwNDsZLqvqoDmO5zLva327DoMroU3CjRFcIXSamDwt UdbXoCdAK6Z5FrGT9hvzuDPZQD6GjDulJadBRisTmIjfPrDQHvRkCrayAkb2Cm5qrdyj D9Vp+nKuLhRRJgVVNaqAWxpaE1HXgCeTAQRPlgQDIgOHzLZRbYZxiKm+AcqJpz7phLXR oAv64n1PEe4WlbbAmXC6zHcbCnKpuLvAQO5ipGIOVA+cebLcg3FloJrbDATvutw2I6UI Gv9SwPHOLYGFDyMWmaVF/46TnoO3OQjpcRn5pEBHQK8MsCUHifv3Zze9lPGm2RwEJg8j QgPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730565039; x=1731169839; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ktr2nKi3lJf51DUU540CsKmG8zlLd5Q+ZWmruE6z0hg=; b=j0abVVzqiq7VNBVmgwc2U+pEAWKghWox+CZ9inDUcTKPw9aj5lYSMmth/G7prBw/7g UlBHNZW7DBTTlkSlC4phJYImZDwf9/as3VGtNy06W3i7hoL7AZdM/719bb8bcqlyM+gQ QRCj/BHbL55u8ZeIzHzi4Iz3yIAcdBtURrLFCh405oh2cIn8z15HdoXSIzyvPVWYvf2/ 8vBCW3DLRmbhlCqTWa7kQce4HDOy+uIFL3wqC7VHZen5XIzP9shJZff7q1xPEheVBtZj ATHdE7juE4L5Icz7qk+BVO/97+ewFmzg4oncCXTIAH1yaSUoeVZ+wg+J1rktGjHwL3i4 eLWQ== X-Gm-Message-State: AOJu0YyIPqcLUaAzZLdqZwhsF/7gWBfPs5MgS/nSCgtzfLxWZxiJmAH9 57W/AYChKpX6yMiBoECn3CLjaU/e1BN9qjhgiGZlkWE0k1Rn/MLRymVekaqOrUH/IgfqevdJkcQ v0Ew5z0SzNmlr9/M7/BsrqqUxa2Qrhal7yx4= X-Google-Smtp-Source: AGHT+IEK5Ey5uGx+/ZQj0YhF+5BAppCvQgdTZD7sv/JZdPQDeRUPSLzxorXSDbaFZ1rwFABOVshf7JC5RqjQHztEKVY= X-Received: by 2002:a2e:709:0:b0:2fb:351c:c3c9 with SMTP id 38308e7fff4ca-2fdecc329femr36802601fa.44.1730565038631; Sat, 02 Nov 2024 09:30:38 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::236; envelope-from=dov.grobgeld@gmail.com; helo=mail-lj1-x236.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:325016 Archived-At: Why not disable the touchpad on the OS level? E.g. under X11 you can do it = with: xinput set-prop 12 "Device Enabled" 0 where 12 is the id of the touchpad as seen by "xinput list". This also prevents accidentally losing the focus of the emacs window. An additional benefit is that this only turns off the touchpad, and if you are using an external mouse, it still works. This is what I do when working on my laptop, and I have a keybinding in my window manager that toggles the enabling of the touchpad. (Most laptops also have a low level driver option of turning off the touchpad, but in my experience this doesn't always work under Linux.) Regards, Dov On Sat, Nov 2, 2024 at 4:33=E2=80=AFPM James Cherti wrote: > > 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. somethin= g 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 > > > > >