(This is easy to miss without some [xkbcommon] in the subject!) On Tue, Apr 09, 2013 at 09:57:29PM -0400, matthias.cla...@gmail.com wrote: > From: Matthias Clasen <mcla...@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? 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? While we're on the subject: currently we hold the keys in a simple array, indexed directly by the keycode. We really should use some other sparse data structure for that (should be able to iterate it in order though). TODO :) (Small comment below) > --- > src/keymap.c | 12 ++++++++++++ > xkbcommon/xkbcommon.h | 20 ++++++++++++++++++++ > 2 files changed, 32 insertions(+) > > diff --git a/src/keymap.c b/src/keymap.c > index 55000f4..14ec25f 100644 > --- a/src/keymap.c > +++ b/src/keymap.c > @@ -484,6 +484,18 @@ err: > return 0; > } > > +XKB_EXPORT xkb_keycode_t > +xkb_keymap_get_min_keycode (struct xkb_keymap *keymap) We don't put a space here ^. > +{ > + return keymap->min_key_code; > +} > + > +XKB_EXPORT xkb_keycode_t > +xkb_keymap_get_max_keycode (struct xkb_keymap *keymap) > +{ > + return keymap->max_key_code; > +} > + > /** > * Simple boolean specifying whether or not the key should repeat. > */ > diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h > index a2aecfb..412f429 100644 > --- a/xkbcommon/xkbcommon.h > +++ b/xkbcommon/xkbcommon.h > @@ -974,6 +974,26 @@ xkb_led_index_t > xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name); > > /** > + * Get the minimum keycode of the keymap > + * > + * @returns The minimum keycode of the keymap. You can skip the @returns if it doesn't say anything interesting... Ran > + * > + * @memberof xkb_keymap > + */ > +xkb_keycode_t > +xkb_keymap_get_min_keycode (struct xkb_keymap *keymap); > + > +/** > + * Get the maximum keycode of the keymap > + * > + * @returns The maximum keycode of the keymap. > + * > + * @memberof xkb_keymap > + */ > +xkb_keycode_t > +xkb_keymap_get_max_keycode (struct xkb_keymap *keymap); > + > +/** > * Determine whether a key should repeat or not. > * > * A keymap may specify different repeat behaviors for different keys. > -- > 1.8.2 > > _______________________________________________ > wayland-devel mailing list > wayland-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/wayland-devel _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel