Fwd: Re: Re: [libxkbcommon] Question about how to get xkb_keycode_t from xkb_keysym_t.

Bill Spitzak spitzak at gmail.com
Mon Jun 1 20:45:41 PDT 2015

Despite the impression you may get from the API, the compositor is able 
(and required to implement many designs) to decode keyboard events into 
keysyms, using exactly the same xkb code clients would use and thus 
arriving at the same answer.

Therefore if there was a key-grab api to the compositor, it could 
identify the keys to grab using keysyms. (the existence of any api to do 
this is questionable, but *if* it existed it could use keysyms).

On 06/01/2015 04:28 AM, 박성진 wrote:

> Dear Daniel, thanks for your quick answer. :)
> In theory, one or more keysym can be mapped to each corresponding keycode
> therefore we need to look through the keymap to find them out. I agree with you on that. :)
> Actually, we'd like to provide a key grab protocol to wayland client(s)
> with which each client can make request to grab a key to wayland compositor.
> To use the protocol, we need to provide one or more keycodes associated with a given keysym to the compositor as an argument.
> At this moment we would like to call the following API to get keycode(s) from a keysym if exist.
> Could you share your opinion ?
> /**
>   @param[in] keymap : xkb_keymap pointer
>   @param[in] keysym : xkb_keysym_t keysym
>   @param[out] keycodes array : xkb_keycode_t pointer
>   @return number of keycodes found on success, otherwise -1
> */
> XKB_EXPORT int xkb_keycodes_from_keysym(struct xkb_keymap *keymap, xkb_keysym_t keysym, xkb_keycode_t *keycodes);
> or XKB_EXPORT int xkb_keymap_keycodes_from_keysym(struct xkb_keymap *keymap, xkb_keysym_t keysym, xkb_keycode_t *keycodes);

More information about the wayland-devel mailing list