[PATCH] Add api to obtain min/max keycode

Matthias Clasen matthias.clasen at gmail.com
Sun Apr 21 18:49:25 PDT 2013


On Sat, Apr 20, 2013 at 4:53 PM, Ran Benita <ran234 at gmail.com> wrote:
> (This is easy to miss without some [xkbcommon] in the subject!)
>
> On Tue, Apr 09, 2013 at 09:57:29PM -0400, matthias.clasen at gmail.com wrote:
>> From: Matthias Clasen <mclasen at redhat.com>
>>
>> Users of libxkbcommon need these values to iterate over all
>> keycodes in the keymap.
>
> Can you describe the use case a bit more? Is it just to get the keysyms,
> or something more?

Look at
https://git.gnome.org/browse/gtk+/tree/gdk/wayland/gdkkeys-wayland.c#n388
for an example.

> For the patch: I don't think we want to expose this information directly
> like this. As far as the API goes, the keycodes may be sparsely
> distributed, and then min/max don't make much sense. It's also a bit
> too restrictive IMO. Daniel, what do you think?
>
> What I'd suggest is just adding some iterator API for the keys; that'd
> be both cleaner and more extensible (e.g. to provide some further
> information on the keys). One lazy option would be to opaquely expose
> the 'struct xkb_key' object we already have internally, and add some
> accessors and first/last/prev/next/whatever. Even if not exposed by
> itself, you can find its definition in src/keymap.h and see the various
> bits of information it contains.
>
> Would something like that be OK?
>

Seems a bit like overkill to me. Sure, xkbcommon doesn't have the 255
keys limit that xkb has, but keyboards are not suddenly going to grow
thousands of new keys...


More information about the wayland-devel mailing list