all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 43830@debbugs.gnu.org, Juri Linkov <juri@linkov.net>
Subject: bug#43830: keyboard layout handling incompatible with rest of the OS
Date: Wed, 28 Oct 2020 17:16:59 +0100	[thread overview]
Message-ID: <CAG7Bpap18sVTGGuqXDgKRw-jK6W-f7+XL58KHVvmxcvM7gpqDA@mail.gmail.com> (raw)
In-Reply-To: <83y2jqcrvn.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2383 bytes --]

> Is XKB universally available?  AFAICT, we don't require it, but use it
> if available (not for XkbTranslateKeyCode, though).

No. E.g. Java has functions to process keystrokes with and without XKB.
I have no idea how it works without: I use KDE that internally uses XKB.
But AFAIK GNOME (optionally) replaces XKB with something else.

> > However, in Elisp this is further complicated by there being no
> > real KeyEvent structure, instead it's a single integer as far as I
> > can see.
>
> Why would you need that?  If we decide to use XkbTranslateKeyCode, we
> could translate the keycode in C, according to some logic that took
> into account the modifiers and perhaps also some user options, and
> returned the resulting translated character.

The point is that the character is not enough, you need to know both
the character and the physical key (you cannot reconstruct the key
from the character alone). E.g. suppose I type 'й' in Russian layout.
If it is a self-inserting command, character 'й' should be added to the
active buffer. But if I'm typing a multikey binding, it should be
interpreted as 'q' (it's the same physical key), so that e.g. 'C-ч й' is
translated to 'C-x q'. Without looking, I'm pretty sure this goes well
into Elisp part of Emacs, and changing key events from integers to
something else would be a compatibility nightmare.

Paul


On Wed, 28 Oct 2020 at 16:06, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Paul Pogonyshev <pogonyshev@gmail.com>
> > Date: Wed, 28 Oct 2020 01:43:04 +0100
> > Cc: Juri Linkov <juri@linkov.net>, 43830@debbugs.gnu.org
> >
> > Apparently what Java does internally is calling function
> > XkbTranslateKeyCode() to translate 'keycode' that corresponds
> > to a physical key into a character using the current XKB layout.
>
> Is XKB universally available?  AFAICT, we don't require it, but use it
> if available (not for XkbTranslateKeyCode, though).
>
> > However, in Elisp this is further complicated by there being no
> > real KeyEvent structure, instead it's a single integer as far as I
> > can see.
>
> Why would you need that?  If we decide to use XkbTranslateKeyCode, we
> could translate the keycode in C, according to some logic that took
> into account the modifiers and perhaps also some user options, and
> returned the resulting translated character.
>

[-- Attachment #2: Type: text/html, Size: 3295 bytes --]

  reply	other threads:[~2020-10-28 16:16 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 15:34 bug#43830: keyboard layout handling incompatible with rest of the OS Paul Pogonyshev
2020-10-06 17:26 ` Eli Zaretskii
2020-10-06 17:48   ` Paul Pogonyshev
2020-10-06 18:00     ` Eli Zaretskii
2020-10-06 18:46 ` Juri Linkov
2020-10-06 18:59   ` Paul Pogonyshev
2020-10-06 20:34     ` Juri Linkov
2020-10-06 21:05       ` Paul Pogonyshev
2020-10-07  8:16         ` Juri Linkov
2020-10-07  8:51           ` Eli Zaretskii
2020-10-07 19:01             ` Juri Linkov
2020-10-08  8:50               ` Eli Zaretskii
2020-10-08 13:58                 ` Paul Pogonyshev
2020-10-28  0:43                   ` Paul Pogonyshev
2020-10-28 15:06                     ` Eli Zaretskii
2020-10-28 16:16                       ` Paul Pogonyshev [this message]
2020-10-28 16:31                         ` Eli Zaretskii
2020-11-01  0:19                           ` Paul Pogonyshev
2020-11-01 15:09                             ` Eli Zaretskii
2020-11-01  7:53                         ` Juri Linkov
2020-11-01 15:11                           ` Eli Zaretskii
2020-11-01 18:27                             ` Juri Linkov
2020-11-01 18:49                               ` Eli Zaretskii
2020-11-01 16:51                           ` Paul Pogonyshev
2020-11-01 17:24                             ` Eli Zaretskii
2020-11-01 18:56                               ` Paul Pogonyshev
2020-11-01 19:32                                 ` Eli Zaretskii
2020-11-01 20:06                                   ` Paul Pogonyshev
2020-11-02  4:41                                   ` Arthur Miller
2020-11-02 15:38                                     ` Eli Zaretskii
2020-11-01  7:48                   ` Juri Linkov
2020-10-07 10:37           ` Paul Pogonyshev
2020-10-07 19:04             ` Juri Linkov
2020-10-07 20:08               ` Paul Pogonyshev
2020-10-07 20:25                 ` Juri Linkov

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=CAG7Bpap18sVTGGuqXDgKRw-jK6W-f7+XL58KHVvmxcvM7gpqDA@mail.gmail.com \
    --to=pogonyshev@gmail.com \
    --cc=43830@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    /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.