GNU bug report logs - #56779
29.0.50; [wishlist] Function to check if a mouse-button is pressed

Previous Next

Package: emacs;

Reported by: Visuwesh <visuweshm <at> gmail.com>

Date: Tue, 26 Jul 2022 08:59:02 UTC

Severity: wishlist

Found in version 29.0.50

To reply to this bug, email your comments to 56779 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#56779; Package emacs. (Tue, 26 Jul 2022 08:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Visuwesh <visuweshm <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 26 Jul 2022 08:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; [wishlist] Function to check if a mouse-button is pressed
Date: Tue, 26 Jul 2022 14:28:46 +0530
Currently, to know if a mouse button is being pressed, one has to keep
track of state by cleverly utilising [down-mouse-N] and [mouse-N] events
(see [1]).  It is certainly no easy task, it would be really nice if
Emacs had the equivalent of `xinput --query-state <mouse-id>' [2]
(the implementation of which can be found in state.c in xinput's
source).

The reason I ask this is because I would really like to have mouse
chording in Emacs but currently it is too hard to implement it (BTW,
mouse-copy.el talks about mouse-chording).

    1. https://github.com/akrito/acme-mouse
    2. All you need to do is,
           % xinput --query-state <mouse-id> |sed -n 's/[ \t]\+button\[1\]=//p'
       to get the state of mouse-1.

In GNU Emacs 29.0.50 (build 26, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2022-07-22 built on astatine
Repository revision: 12a3137cd381cb743768033e789b900b015041d7
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --with-sound=alsa --with-x-toolkit=lucid --with-json
 --without-xaw3d --without-gconf --without-libsystemd --without-cairo'
Configured features:
ACL DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XFT
XIM XINPUT2 XPM LUCID ZLIB
Important settings:
  value of $LC_MONETARY: ta_IN.UTF-8
  value of $LC_NUMERIC: ta_IN.UTF-8
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  recentf-mode: t
  shell-dirtrack-mode: t
  paredit-mode: t
  eros-mode: t
  flymake-mode: t
  pdf-occur-global-minor-mode: t
  minibuffer-depth-indicate-mode: t
  repeat-mode: t
  display-time-mode: t
  display-battery-mode: t
  winner-mode: t
  delete-selection-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  use-hard-newlines: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  undelete-frame-mode: t
  transient-mark-mode: (only . t)
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
/home/viz/lib/emacs/straight/build/faceup/faceup hides /home/viz/lib/ports/emacs/lisp/emacs-lisp/faceup

Features:
(shadow flyspell ispell ecomplete emacsbug etags fileloop generator
misearch multi-isearch reveal imenu-xref pcmpl-unix ediff ediff-merg
ediff-mult ediff-wind ediff-diff ediff-help ediff-init ediff-util
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs recentf tree-widget pulse cl-print semantic/symref/grep
grep semantic/symref vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs
xref avy noutline outline bug-reference shortdoc help-fns radix-tree
ement-taxy svg-lib mule-util display-line-numbers ement-room-list ement
ement-notify notifications ement-room ement-lib ement-api ement-structs
plz color ement-macros taxy-magit-section magit-section taxy ewoc dns
gnus-fun flow-fill qp sort gnus-cite mm-archive mail-extr textsec
uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check
gnus-async gnus-bcklg gnus-ml network-stream nsm face-remap sh-script
smie files-x shell-command+ shell pcomplete nndraft nnmh nnfolder
nnmaildir nnagent nnml executable vc-backup log-view pcvs-util vc diff
vc-git diff-mode vc-dispatcher nnnil gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime
smime gnutls dig nntp gnus-cache gnus-sum shr pixel-fill kinsoku
url-file url-dired svg gnus-group gnus-undo gnus-start gnus-dbus
gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time iso8601
gnus-spec gnus-int gnus-range message sendmail yank-media puny rfc822
mml mml-sec epa epg rfc6068 epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils
mailheader gnus-win gnus nnheader gnus-util mail-utils range mm-util
mail-prsvr cursor-sensor server paredit edmacro kmacro eros time-date
checkdoc lisp-mnt flymake-proc flymake project warnings thingatpt
wordel-autoloads sokoban-autoloads ement-autoloads svg-lib-autoloads
taxy-magit-section-autoloads magit-section-autoloads dash-autoloads
taxy-autoloads plz-autoloads nov-autoloads esxml-autoloads kv-autoloads
transmission-autoloads lua-mode-autoloads nix-mode-autoloads
racket-mode-autoloads pos-tip-autoloads faceup-autoloads eros-autoloads
flymake-shellcheck-autoloads writegood-mode-autoloads
siege-mode-autoloads paredit-autoloads puni-autoloads
expand-region-autoloads filladapt-autoloads compose quail
scroll-other-window org-pdftools-autoloads org-noter-autoloads
change-env-autoloads math-delimiters-autoloads doct-autoloads
ob-async-autoloads async-autoloads emacs-ob-racket-autoloads
valign-autoloads cdlatex-autoloads auctex-autoloads tex-site pdf-occur
ibuf-ext ibuffer ibuffer-loaddefs tablist advice tablist-filter
semantic/wisent/comp semantic/wisent semantic/wisent/wisent
semantic/util-modes semantic/util semantic semantic/tag semantic/lex
semantic/fw mode-local cedet pdf-isearch let-alist pdf-misc imenu
pdf-tools package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie generate-lisp-file url-domsuf
url-util mailcap url-handlers url-parse auth-source eieio eieio-core
json map byte-opt url-vars compile comint ansi-color cus-edit edebug
debug backtrace find-func wid-edit pdf-view password-cache jka-compr
pdf-cache pdf-info tq pdf-util pdf-macs image-mode dired-x dired
dired-loaddefs exif pdf-tools-autoloads tablist-autoloads mb-depth
repeat visual-fill-autoloads olivetti-autoloads time format-spec battery
dbus filenotify xml dom disp-table lacarte-autoloads
shell-command-plus-autoloads winner ring delsel cus-load easy-mmode
avy-autoloads finder-inf vc-backup-autoloads compat-autoloads icalendar
diary-lib diary-loaddefs cal-menu calendar cal-loaddefs rx filecache
imenu-xref-autoloads derived chemtable-autoloads molar-mass-autoloads
saveplace-pdf-view saveplace bookmark text-property-search pp
saveplace-pdf-view-autoloads pcase inspector-autoloads xr-autoloads
straight-autoloads cl-seq info cl-extra help-mode straight subr-x
cl-macs gv cl-loaddefs cl-lib bytecomp byte-compile cconv vz-nh-theme
vz-options-theme rmc iso-transl tooltip eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting
x-toolkit xinput2 x multi-tty make-network-process emacs)

Memory information:
((conses 16 659546 81471) (symbols ?0 37066 3) (strings 32 163534 5044)
 (string-bytes 1
               6737836) (vectors 16 86388) (vector-slots 8 1108290 50611) (floats 8 711
               357)
 (
  intervals ?8 10835 1580) (buffers 992 40))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56779; Package emacs. (Tue, 26 Jul 2022 10:19:02 GMT) Full text and rfc822 format available.

Message #8 received at 56779 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 56779 <at> debbugs.gnu.org
Subject: Re: bug#56779: 29.0.50; [wishlist] Function to check if a
 mouse-button is pressed
Date: Tue, 26 Jul 2022 18:18:40 +0800
Visuwesh <visuweshm <at> gmail.com> writes:

> Currently, to know if a mouse button is being pressed, one has to keep
> track of state by cleverly utilising [down-mouse-N] and [mouse-N] events
> (see [1]).  It is certainly no easy task, it would be really nice if
> Emacs had the equivalent of `xinput --query-state <mouse-id>' [2]
> (the implementation of which can be found in state.c in xinput's
> source).

Relying on the X input extension is not portable, not only outside of
X, but also inside Emacs, which supports being run on X servers where
the input extension is not available.

How about a function that returns a list of mouse buttons currently held
down on a given terminal? That would be very straightforward to
implement.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56779; Package emacs. (Tue, 26 Jul 2022 10:23:02 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, 56779 <at> debbugs.gnu.org
Subject: Re: bug#56779: 29.0.50; [wishlist] Function to check if a
 mouse-button is pressed
Date: Tue, 26 Jul 2022 15:51:54 +0530
[செவ்வாய் ஜூலை 26, 2022] Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> Visuwesh <visuweshm <at> gmail.com> writes:
>
>> Currently, to know if a mouse button is being pressed, one has to keep
>> track of state by cleverly utilising [down-mouse-N] and [mouse-N] events
>> (see [1]).  It is certainly no easy task, it would be really nice if
>> Emacs had the equivalent of `xinput --query-state <mouse-id>' [2]
>> (the implementation of which can be found in state.c in xinput's
>> source).
>
> Relying on the X input extension is not portable, not only outside of
> X, but also inside Emacs, which supports being run on X servers where
> the input extension is not available.
>
> How about a function that returns a list of mouse buttons currently held
> down on a given terminal? That would be very straightforward to
> implement.

That would work just fine with me, thanks.  I pointed out xinput since
that was the first straightforward thing that came up when I searched
the internet.  BTW, it would be nice if the order of the buttons was in
the order they were pressed i.e., if I pressed mouse-1 then mouse-2 the
list would be (mouse-2 mouse-1).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56779; Package emacs. (Tue, 26 Jul 2022 10:23:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56779; Package emacs. (Tue, 26 Jul 2022 10:45:01 GMT) Full text and rfc822 format available.

Message #17 received at 56779 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 56779 <at> debbugs.gnu.org
Subject: Re: bug#56779: 29.0.50; [wishlist] Function to check if a
 mouse-button is pressed
Date: Tue, 26 Jul 2022 18:43:38 +0800
Visuwesh <visuweshm <at> gmail.com> writes:

> BTW, it would be nice if the order of the buttons was in the order
> they were pressed i.e., if I pressed mouse-1 then mouse-2 the list
> would be (mouse-2 mouse-1).

That information is unfortunately not readily available, but can't you
look at `recent-keys'?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56779; Package emacs. (Tue, 26 Jul 2022 10:53:01 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, 56779 <at> debbugs.gnu.org
Subject: Re: bug#56779: 29.0.50; [wishlist] Function to check if a
 mouse-button is pressed
Date: Tue, 26 Jul 2022 16:22:00 +0530
[செவ்வாய் ஜூலை 26, 2022] Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> Visuwesh <visuweshm <at> gmail.com> writes:
>
>> BTW, it would be nice if the order of the buttons was in the order
>> they were pressed i.e., if I pressed mouse-1 then mouse-2 the list
>> would be (mouse-2 mouse-1).
>
> That information is unfortunately not readily available, but can't you
> look at `recent-keys'?

It's not a huge deal breaker, I think.  Thanks for the pointer to
`recent-keys' though.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56779; Package emacs. (Tue, 26 Jul 2022 10:53:02 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.