all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Eli Zaretskii <eliz@gnu.org>
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 20:35:58 +0800	[thread overview]
Message-ID: <87bkxbsqfl.fsf@yahoo.com> (raw)
In-Reply-To: <83v8vjai4s.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 08 Apr 2022 15:12:35 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

> 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.

Okay, but please keep in mind that this feature was developed to work
with all events, not just pixel-scroll events.

> It is X-specific in that it's modeled on what X exposes.

But it's also exposed by every other window system (or at least can be
trivially synthesized from the information they expose.)

> 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.

The type should either be inherent in the name (as on X), or the name
should be computed to include the type (as on Wayland).  Otherwise, the
device should just be set to the special value which says "I don't know
what the device is".  IOW, the platform-specific code is responsible for
ensuring that `device-class' works correctly by defining the meaning of
"name".

> 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.

I listed several: the pixel-scroll events are one such example, and
Tetris is another.  ThinkPads come with these funny joysticks that
normally scroll or move the mouse pointer, but inside Tetris they might
be used to control the blocks instead.

Let's skip the keyboard-related discussion for now, since they're a
somewhat special case.

> 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.

I don't think giving too much information to the Lisp level is that big
of a problem, as long as its use cases are carefully evaluated, and
recommended procedures documented.

Basically, there are two situations in which this information should be
available: when we want some feature to behave differently based on the
type of device, and when the user wants something to behave differently
based on the device that is being used.

The user could, for example, have a graphics tablet with buttons and an
ordinary mouse connected to Emacs at the same time, and want the buttons
on those two devices to behave differently.  Writing such a
customization would be impossible without exposing the device type
and/or name to Lisp code.

For the former situation, I think it's not a good idea to have code that
might be used by other Lisp programs to depend on the type or name of
the input device used.  But it should be fine for interactive commands
like pixel-scroll-precision to depend on that information, and perhaps
even input methods.

> 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.

Hmm... I will try that.

> ??? As long as Emacs reads characters, I don't see how this could
> happen.  Please elaborate.

Sorry, I misunderstood what you said there.

>> 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?

The X Keyboard Extension (Xkb) is the component of modern X servers that
handles keymaps, and how it couples with other server extensions is
orthogonal to having different keyboard layouts for different physical
keyboards implemented on the server-side.  In other words, if Emacs is
to support such configurations, it will have to learn to understand them
by itself.

>> 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.

Thanks.



  reply	other threads:[~2022-04-08 12:35 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
2022-04-08 12:35                       ` Po Lu [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkxbsqfl.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.