emacs-devel
[Top][All Lists]
Advanced

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

Re: Regarding on-key-up event


From: Po Lu
Subject: Re: Regarding on-key-up event
Date: Sat, 04 Feb 2023 08:18:54 +0800

This nice behavior may be guaranteed by a keyboard itself, but not by input 
methods, where it is actually impossible to match up an input method's 
committed key events with a corresponding key release event.

Of course, since the input method is not operating synchronously wrt the X 
connection, there is not even the guarantee that the key release arrives after 
the key press, since the latter are not filtered through it.  And for good 
reason; imagine that the input method commits a string, abcdef, and Emacs 
generates one key event for each character.

Which key release events should Emacs then deliver?

On February 4, 2023 5:47:14 AM GMT+08:00, Konstantin Kharlamov 
<hi-angel@yandex.ru> wrote:
>On Fri, 2023-02-03 at 21:39 +0200, Eli Zaretskii wrote:
>> 
>> While you hold a key, a typical keyboard auto-repeats, so I see no
>> problem here.
>
>I am not aware of any keyboard that repeats its events upon holding a key.
>Repetition is usually implemented in a toolkit handling key events. A keyboard
>typically sends a single "pressed" event, and then after you done holding a key
>it sends a "released" event.
>
>Here's a proof: I run `libinput debug-events --verbose`, then hold `j`:
>
>    $ libinput debug-events --verbose
>    […]
>    -event6   KEYBOARD_KEY            +0.000s       *** (-1) pressed
>    jjjjjjjjjjjjjjjjjj event6   KEYBOARD_KEY            +1.280s     *** (-1)
>released
>    […]
>
>See, there are repeating `j` on the screen, but it's created by the Qt toolkit
>of my Konsole terminal. Keyboard sent only 2 events: `pressed` and `released`.
>


reply via email to

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