From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: master 3b41141708: Expose the name of an event's input device to Lisp
Date: Fri, 08 Apr 2022 15:12:35 +0300 [thread overview]
Message-ID: <83v8vjai4s.fsf@gnu.org> (raw)
In-Reply-To: <87o81bu7zj.fsf@yahoo.com> (message from Po Lu on Fri, 08 Apr 2022 19:31:28 +0800)
> From: Po Lu <luangruo@yahoo.com>
> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
> Date: Fri, 08 Apr 2022 19:31:28 +0800
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > That suggests a different strategy: produce different input event
> > types from each such device. That'd leave the device dependency to
> > low-level code, and let the application level deal with event kinds
> > and not with device types. I think this is a better abstraction, if
> > it's possible/feasible.
>
> I don't think it's feasible, especially since there are too many
> different kinds of events, and with some of them those dfferent kinds of
> events simply cannot work. (Think single character keyboard events.)
We were talking about pixel-scroll events, not about character
events. If keyboard events also depend on the device, that's a
separate discussion.
Let's not make the issue harder than it must be by lumping together
all the possible complications.
> > We have been burned by modeling the application-level features on the
> > particular X implementation and low-level details. It took us
> > literally decades to get rid of X-specific code and features, let
> > alone API names, and move to exposing more general and more adaptable
> > APIs to applications. I was there when this hard lesson was learned,
> > and I'd rather we didn't repeat those mistakes.
>
> This API is not X specific at all; in contrast, an X-specific API would
> be to expose the list of device valuators and "classes", containing
> various flags.
It is X-specific in that it's modeled on what X exposes.
> When designing this feature, and why I purposely didn't design it based
> on the X concepts of device axises and classes, I worked from two
> directions: it should be possible to extract the type of a device
> (i.e. tell between a touchpad, a keyboard, a pointer, and a piano), and
> when possible (i.e. supported by the window system), it should be able
> to tell individual devices apart. The current API achieves the first
> goal by giving each device a "name", which contains enough information
> to determine the device type, and it also achieves the second goal by
> guaranteeing that the device names are unique to each device on window
> systems which support that, such as X and Wayland.
>
> Each window system can then define a function for `device-class', which
> returns the type of a device based on the name given to it.
I'm not sure I agree with this design, sorry. E.g., having a name for
a device doesn't necessarily mean we can know its type. More
importantly, as I already said, I'm not sure Emacs should care about
the type of the device that produced an event. We need to discuss
what kinds of decisions a Lisp program would want to make that depend
on the device information, and design the information based on those
decisions.
> This feature was already implemented not just on X, but also on PGTK,
> which means it also works well with the very different input subsystems
> of Wayland and Broadway. I also wrote the code to make it work with NS,
> but it hasn't been tested yet.
I appreciate the hard work, but I still think the design principles
should be discussed. They should have been discussed before you
started working, for such a non-trivial new feature, but that's water
under the bridge.
> > That doesn't mean you want to know about the device, it rather means
> > you want to know the keyboard layout: an entirely different aspect,
> > and not specific to any OS.
>
> You would still need to be able to identify the keyboard in order to
> know its keyboard layout, at least on X.
I'm talking about what kind of information is exposed to the
application level, where we interpret the events. That on X and maybe
other platforms we'll need to have low-level code that looks at the
device is secondary. The current code exposes the device type/name to
the application level, and that is what worries me.
> > IMNSHO, it's too bad we rush into implementing such features without
> > any discussion. See above about the alternatives that, at least at
> > this time, seem much better to me than dragging the low-level device
> > type information to the application level, and in global stateful
> > variables on top of that.
>
> > Which once again favors the alternative that would work by defining
> > new kinds of events. That alternative has no compatibility issues.
>
> IMHO we cannot simply define new kinds of wheel events that purposely
> separate touchpads from mice, or mouse-movement events which separate
> trackpoints from mice. That would mean, from the perspective of the
> user, mice would continue to "work as before", but trackpads would not.
That's easy to fix: we can add entries in relevant maps to remap
trackpad events to mouse event by default, or when some minor mode is
in effect.
> Or a keyboard with a Greek layout would not work as it used to, while a
> keyboard with an English one would.
??? As long as Emacs reads characters, I don't see how this could
happen. Please elaborate.
> It's also not possible to consistently give an individual keyboard a
> different keyboard layout under X, since the part of the keyboard
> extension for that only works with the obsolete version of the input
> extension, not the new one that some programs such as Emacs and most of
> the modern toolkits now support.
Sorry, I cannot understand what this means in practice. Please tell
more. In particular, what are those "keyboard extensions" that you
mention, and how are they relevant to the issue at hand?
> I'm sorry if I rushed things, and I'd be happy to listen to any
> suggestions you might have.
Well, I did suggest several things.
next prev parent reply other threads:[~2022-04-08 12:12 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <164933858147.29834.15050766441005536059@vcs2.savannah.gnu.org>
[not found] ` <20220407133623.9C209C009A8@vcs2.savannah.gnu.org>
2022-04-07 14:05 ` master 3b41141708: Expose the name of an event's input device to Lisp Stefan Monnier
2022-04-07 23:31 ` Po Lu
2022-04-07 23:41 ` Stefan Monnier
2022-04-08 0:07 ` Po Lu
2022-04-08 6:02 ` Eli Zaretskii
2022-04-08 6:08 ` Po Lu
2022-04-08 6:26 ` Eli Zaretskii
2022-04-08 7:36 ` Po Lu
2022-04-08 11:12 ` Eli Zaretskii
2022-04-08 11:31 ` Po Lu
2022-04-08 12:12 ` Eli Zaretskii [this message]
2022-04-08 12:35 ` Po Lu
2022-04-09 6:48 ` Eli Zaretskii
2022-04-09 9:06 ` Po Lu
2022-04-09 9:09 ` Lars Ingebrigtsen
2022-04-09 9:30 ` Eli Zaretskii
2022-04-09 10:03 ` Po Lu
2022-04-09 11:03 ` Eli Zaretskii
2022-04-09 11:44 ` Po Lu
2022-04-09 14:04 ` Eli Zaretskii
2022-04-09 16:33 ` Stefan Monnier
2022-04-09 16:41 ` Lars Ingebrigtsen
2022-04-09 17:06 ` Eli Zaretskii
2022-04-09 17:16 ` Eli Zaretskii
2022-04-09 17:52 ` Brian Cully
2022-04-09 19:18 ` Eli Zaretskii
2022-04-10 0:54 ` Po Lu
2022-04-10 1:46 ` Brian Cully
2022-04-10 2:11 ` Po Lu
2022-04-10 2:45 ` Brian Cully
2022-04-10 3:30 ` Po Lu
2022-04-10 0:37 ` Po Lu
2022-04-10 5:49 ` Eli Zaretskii
2022-04-10 6:09 ` Po Lu
2022-04-10 6:44 ` Eli Zaretskii
2022-04-10 7:31 ` Po Lu
2022-04-10 8:28 ` Eli Zaretskii
2022-04-10 8:50 ` Po Lu
2022-04-10 9:17 ` Eli Zaretskii
2022-04-10 9:25 ` Po Lu
2022-04-10 11:15 ` Po Lu
2022-04-10 15:16 ` Stefan Monnier
2022-04-11 1:02 ` Po Lu
2022-04-10 11:46 ` Lars Ingebrigtsen
2022-04-10 11:41 ` Lars Ingebrigtsen
2022-04-10 0:48 ` Po Lu
2022-04-10 6:04 ` Eli Zaretskii
2022-04-10 6:17 ` Po Lu
2022-04-10 6:49 ` Eli Zaretskii
2022-04-10 7:01 ` Po Lu
2022-04-10 8:24 ` Eli Zaretskii
2022-04-10 8:42 ` Po Lu
2022-04-10 9:13 ` Eli Zaretskii
2022-04-10 12:51 ` Brian Cully
2022-04-10 13:21 ` Po Lu
2022-04-10 18:08 ` Brian Cully
2022-04-11 0:58 ` Po Lu
2022-04-11 1:08 ` Brian Cully
2022-04-11 2:00 ` Po Lu
2022-04-11 2:03 ` Po Lu
2022-04-11 2:21 ` Brian Cully
2022-04-11 3:12 ` Po Lu
2022-04-11 4:11 ` Brian Cully
2022-04-11 5:20 ` Po Lu
2022-04-11 11:33 ` Brian Cully
2022-04-11 14:09 ` Po Lu
2022-04-11 16:26 ` Brian Cully
2022-04-11 10:10 ` Lars Ingebrigtsen
2022-04-10 12:44 ` Brian Cully
2022-04-10 13:14 ` Po Lu
2022-04-08 14:27 ` Stefan Monnier
2022-04-09 0:24 ` Po Lu
2022-04-09 2:52 ` Stefan Monnier
2022-04-09 3:17 ` Po Lu
2022-04-09 13:31 ` Stefan Monnier
2022-04-09 13:37 ` Po Lu
2022-04-09 14:20 ` Stefan Monnier
2022-04-10 0:58 ` Po Lu
2022-04-09 14:31 ` Eli Zaretskii
2022-04-10 0:56 ` Po Lu
2022-04-10 6:11 ` Eli Zaretskii
2022-04-10 6:23 ` Po Lu
2022-04-10 6:52 ` Eli Zaretskii
2022-04-10 7:37 ` Po Lu
2022-04-10 8:12 ` Eli Zaretskii
2022-04-09 6:22 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83v8vjai4s.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=luangruo@yahoo.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).