[dev] Re: [st] Unable to map Ctrl+$NUMBER

From: Eric Pruitt <eric.pruitt_AT_gmail.com>
Date: Tue, 10 Oct 2017 22:10:21 -0700

On Tue, Oct 10, 2017 at 10:01:32PM -0700, Eric Pruitt wrote:
> I dug into this some more, and this code is what's causing the shortcuts
> to be ignored:
>
> if (i == LEN(mappedkeys)) {
> if ((k & 0xFFFF) < 0xFD00)
> return NULL;
> }
>
> For whatever reason, kmap is written so that anything that falls below
> 0xFD00 will never make it to the for loop that looks up mappings in the
> "key" array. I'm not providing a patch because I don't know what the
> rationale behind this decision was, and my personal copy of st is very
> out of sync with the upstream repo.

Actually, I just figured this out -- the comment for mappedkeys explains
this, but if you haven't read the comments in keysymdef.h
(https://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h), I
think it's not obvious what it means. It reads "If you want keys other
than the X11 function keys [...]." In this context, "function keys" does
NOT refer to F1, F2, F3, etc. or functions in the shortcuts array. The
solution to this was to simply add the number keys to mappedkeys:

    static KeySym mappedkeys[] = { XK_1, XK_2, XK_3, XK_4 };

Eric
Received on Wed Oct 11 2017 - 07:10:21 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 11 2017 - 07:12:36 CEST