From: joakim@verona.se
To: Eli Zaretskii <eliz@gnu.org>
Cc: Po Lu <luangruo@yahoo.com>, 74016@debbugs.gnu.org
Subject: bug#74016: 29.4; emacs-pgtk doesnt receive numpad events on wayland(sway)
Date: Sun, 03 Nov 2024 10:02:42 +0100 [thread overview]
Message-ID: <87plnc8zbh.fsf@tanaka.verona.se> (raw)
In-Reply-To: <86a5ehzxf5.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 02 Nov 2024 13:29:18 +0200")
Eli Zaretskii <eliz@gnu.org> writes:
>> From: joakim@verona.se
>> Date: Fri, 25 Oct 2024 21:35:48 +0200
>>
>>
>> Emacs-pgtk doesnt seem to receive numpad events, instead number events
>> are received.
>>
>> There was a thread about this on emacs-help:
>>
>> https://lists.gnu.org/archive/html/help-gnu-emacs/2024-10/msg00094.html
>>
>> I have attempted to summarize the thread here, wherein Stefan Monier
>> recomended I report this as a bug, and I also received knowledgeable
>> advice from several others.
>>
>> Heres the bug:
>>
>> 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.
>>
>> 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")
>>
>>
>> Instead of xev, I tried wev, and got this, which seems expected:
>>
>> 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?
>>
>> so now I tried emacs-29.4-gtk+x11 -Q
>>
>> and then I get "4 (translated from <kp-4>)"
>> on c-h k, numpad 4, so xwayland is doing something correctly in this
>> case, which pgtk isnt doing in the same way(imho incorrectly but what do
>> I know)
>>
>> (and as a reminder, I run emacs-pgtk because it looks super nice on
>> wayland, with the scaling hints I use on my framework hidpi screen, but
>> emacs-29.4-gtk+x11 doesnt look good.)
>
> Po Lu, is this another manifestation of problems with keyboard input
> under PGTK? If so, should we add something to etc/PROBLEMS?
FYI I found a "workaround" to this problem. I now run Sway with scaling of
1 rather than 1.25.
Then I have to scale each application independently, so I set the
corresponding scale factor in sway window decorations, waybar, firefox
etc.
(the problem with this aproach is that a number of x11 apps cant be scaled)
Lastly in emacs I just scale the fonts and run emacs-gtk-x11. Now things
work adequately.
emacs-pgtk has other interesting features, but I guess they will have to
wait a while more.
Thanks everyone!
>
>
>
--
Joakim Verona
joakim@verona.se
prev parent reply other threads:[~2024-11-03 9:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 19:35 bug#74016: 29.4; emacs-pgtk doesnt receive numpad events on wayland(sway) joakim
2024-11-02 11:29 ` Eli Zaretskii
2024-11-02 13:34 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-03 9:02 ` joakim [this message]
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=87plnc8zbh.fsf@tanaka.verona.se \
--to=joakim@verona.se \
--cc=74016@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=luangruo@yahoo.com \
/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.