all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
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: Sat, 09 Apr 2022 12:30:33 +0300	[thread overview]
Message-ID: <83v8vi8uyu.fsf@gnu.org> (raw)
In-Reply-To: <8735impqw4.fsf@yahoo.com> (message from Po Lu on Sat, 09 Apr 2022 17:06:35 +0800)

> From: Po Lu <luangruo@yahoo.com>
> Cc: monnier@iro.umontreal.ca,  emacs-devel@gnu.org
> Date: Sat, 09 Apr 2022 17:06:35 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > And you never explained in enough detail why we would need to know
> > about "devices" when we use other event types.  You said something
> > about keyboards, but I still don't understand why we would care about
> > the type of a keyboard.
> >
> > What other kinds of input could need this information, and why?
> 
> Well as another example, artist-mode might want to behave differently
> with an "eraser" pointer, removing pixels from the picture instead of
> adding them.

Why cannot this be handled by producing special events that erase
pixels?

> Different keyboard might have different layouts (and input
> methods want to behave differently)

I don't think I understand why, see below.

> or lilypond-mode might want to insert notes directly from a MIDI
> keyboard while allowing typing from a normal keyboard.

Again, why not implement this as special events?

> > That was not yet demonstrated.  Though every system has some notion of
> > "input device", the information they expose could be utterly different
> > and not necessarily appropriate for us.  Your additions express
> > devices as strings, and strings don't necessarily carry any useful
> > information to explain the significance.  And I don't think you have
> > explained anywhere what aspects of the "devices" we'd want to know
> > about, and why.
> 
> We want to know whether a device is a mouse, trackpoint, eraser, pen,
> puck, device control, keyboard, touchscreen, touchpad or MIDI keyboard,
> and whether or not it's a different device from some other device, and
> also tell apart a single device from anotherq whenever possible.

I still don't understand why special-purpose events cannot solve the
same problems.  Maybe even specialized mode with the same events.

> What would you think about allowing the device structure to be something
> other than a string (i.e. window-system dependent, like the argument to
> drag-n-drop events), that should be treated as opaque except when passed
> to functions like `device-class', and probably `device-equal'?

If we must.  But I'm not yet convinced we must have this information.

> > And I suggested an alternative for dealing with these differences: new
> > kinds of input events.  AFAIU, going that way will completely avoid
> > introducing the notion of a "device" into input events.
> 
> That won't be very flexible, and it'll be very difficult for the user to
> write customizations for some new kind of device (or just a different
> device) without adding an entirely new kind of input event for it.  

Please explain these two counter-arguments in more detail.  Why "not
very flexible" and why it will make customizations more difficult?

> > We do? why?  I think we definitely DON'T.  Emacs is not a GUI toolkit,
> > it is a client of such toolkits.  We use toolkits because we do NOT
> > want to deal with device-dependent behavior, we want to use
> > device-independent abstractions.  If some device is unable to do
> > something, it will not produce events that express that functionality,
> > and the corresponding Emacs commands will not be invoked.  That is all
> > I think Emacs needs to support each input device as appropriate.
> 
> To most programs, the graphics tablet buttons are just mouse buttons.
> In Emacs, they will just send mouse-1 through 8 when clicked.

And why is that a problem?  We already interpret mouse-4 and mouse-5
as the wheel, so why not have mouse-8 be interpreted in some special
way?

> And what if the user has two ordinary mice connected, and wants one to
> behave differently from the other, in effect giving him an extra set of
> mouse buttons?

What about it?  Why does this require to know about the device, and
cannot be expressed as special events?

> > I don't think I understand.  What would you like Emacs to support in
> > conjunction with Xkb, and what will Emacs have to learn about that for
> > it to "understand" those "configurations" (and what are those
> > "configurations", btw, i.e. what discerns one "configuration" from
> > another?).
> 
> The simple use case of having two different keyboards behave
> differently.  In my own specific case, they are printed with different
> layouts (one is US International, the other is Russian), but X only
> allows one keyboard layout for both the keyboards to be active.

Please tell more: how do they behave differently?  If you press a key
that is labeled with some character, doesn't Emacs receive a keyboard
input event with that character?

> So to me, it would be nice to have different input methods for each
> individual keyboard, in order to not have to manually switch input
> methods each time.

We could have a keyboard-layout switch event, which would change input
methods automatically.  (On MS-Windows, we already have such an
event.)  Once again, low-level code does know about these details, and
that is not a problem IMO; it is exposing that to Lisp as "device"
that I don't like.



  parent reply	other threads:[~2022-04-09  9:30 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
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 [this message]
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=83v8vi8uyu.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 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.