emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 3b41141708: Expose the name of an event's input device to Lis


From: Eli Zaretskii
Subject: Re: master 3b41141708: Expose the name of an event's input device to Lisp
Date: Fri, 08 Apr 2022 09:26:42 +0300

> From: Po Lu <luangruo@yahoo.com>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,  emacs-devel@gnu.org
> Date: Fri, 08 Apr 2022 14:08:40 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Can we make a step back and discuss why do we need this information in
> > Emacs, and how it is supposed to be used?
> 
> I thought it was described in the commit message

I wouldn't have asked if the commit message explained this enough for
me to understand.  I see no rationale in the commit message.

> different devices can generate the same events, but commands (such
> as pixel-scroll-precision) might want to act differently depending
> on the device that generated it.

What for?  Why do we care in Emacs which device generated a scroll
event?  Emacs was always transparent regarding that, and did the same
regardless of the particular device which caused the event.  Why do we
suddenly need to distinguish between them?  This could add complexity
to Emacs's application level that we don't particularly want.  So if
we do add this, it had better be a very good reason.

> (I'm still getting the device detection right, though it already works
> for most hardware: on X, the only way to find out the "device class" of
> a device is to look at its name.)

But what is a "device" for this purpose?

Most input events nowadays come from the window-system, which
typically hides the device level from the application.  For example,
there are programs that allow you to inject mouse events by typing on
the keyboard, and vice versa.  There are also programs that inject
keyboard events programmatically.  Etc. etc.  Why would we want to
know or care exactly what device generated an event?

> There are use cases other than precision pixel scrolling as well.  For
> example, different keyboards could be configured to behave differently,
> which is useful for people who have multiple keyboards lying around.

The question is why it is useful for Emacs to know which keyboard
device generated a key sequence.

> Tetris might also want to treat mouse movement from a joystick
> differently from that of an ordinary pointing device.

Why?

In any case, if we do agree to have this information in Emacs, the
definition of a "device" should be abstract enough to allow its
implementation on systems other than X.  And then I will ask a
question similar to that Stefan asked: why not make the device part of
event object we have on the event queue?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]