unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: joakim@verona.se
To: "Arsen Arsenović" <arsen@aarsen.me>
Cc: help-gnu-emacs@gnu.org
Subject: Re: numpad doesnt seem to send kp events in wayland
Date: Wed, 23 Oct 2024 09:11:24 +0200	[thread overview]
Message-ID: <87r087mgyr.fsf@tanaka.verona.se> (raw)
In-Reply-To: <86r087ol9n.fsf@aarsen.me> ("Arsen Arsenović"'s message of "Tue, 22 Oct 2024 23:55:32 +0200")

Arsen Arsenović <arsen@aarsen.me> writes:

> joakim@verona.se writes:
>
>> Hello,
>>
>> I used to use a numpad to bind to do things in emacs.
>>
>> This used to work really well on the i3wm window manager and a gtk emacs
>> build.
>>
>> Then I bought a nice new framework laptop which has a hidpi screen, so I
>> switched to using the sway wm, and emacs-pgtk.
>>
>> Now the numpad no longer sends keypad events in a way that emacs
>> recognizes, instead just plain numbers are received.
>>
>> for some reason i3 wont work anymore so I dont have anything to compare
>> with.
>>
>> Is this just me or is this a well known problem?
>>
>> below is an example of the code I use, but normally I just test with c-h
>> k to see which key emacs receives.
>>
>> I also tried xev, and there it seems I get kp events, at least under
>> xwayland I guess.
>>
>> (define-key cider-mode-map (kbd "<kp-enter>") 'sylt-stop)
>> (define-key cider-mode-map (kbd "<kp-separator>") 'sylt-play-metro)
>>
>> (defmacro sylt-song-event-map-key (key num)
>>   `(define-key cider-mode-map (kbd ,key)
>>                (lambda  () (interactive)   (cider-nrepl-sync-request:eval  ,(concat "(sylt.core/song-event \"" num "\")")))))
>>
>>
>>
>> (sylt-song-event-map-key "<kp-0>" "init")
>> (sylt-song-event-map-key "<kp-1>" "1")
>
> FWIW, you can try checking against https://git.sr.ht/~sircmpwn/wev and
> WAYLAND_DEBUG=1 instead of xev to check whether there's matching
> keycodes.
>
> I don't have a keypad to test with right now but I suspect something can
> be arranged for your case.  Consider (read-key) also as a test.

Thanks for the reply!

Using wev, installed from Fedora repos I get, for numpad 4, and normal 4:

[14:     wl_keyboard] key: serial: 60293; time: 61646320; key: 83; state: 0 (released)
                      sym: KP_4         (65460), utf8: ''
[14:     wl_keyboard] key: serial: 60294; time: 61651642; key: 13; state: 1 (pressed)
                      sym: 4            (52), utf8: '4'

That is, the numpad and the number pad sends distinct events that are
received by wev.

using (read-key) in emacs-pgtk, both the numpad and the number row are
received as the same event:

52 (#o64, #x34, ?4) [2 times]

I get the same in a emacs gtk session.

Maybe gtk is doing something weird?

I will need to compile some other type of emacs toolkit next I guess.


-- 
Joakim Verona
joakim@verona.se



  reply	other threads:[~2024-10-23  7:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21 23:17 numpad doesnt seem to send kp events in wayland joakim
2024-10-22 21:55 ` Arsen Arsenović
2024-10-23  7:11   ` joakim [this message]
2024-10-23 13:06     ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-10-24 18:17       ` joakim
2024-10-24 20:05         ` Stefan Monnier
2024-10-25 18:21           ` joakim
2024-10-25 20:18             ` Stefan Monnier
2024-10-29 21:13               ` joakim

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=87r087mgyr.fsf@tanaka.verona.se \
    --to=joakim@verona.se \
    --cc=arsen@aarsen.me \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).