I think you are asking for trouble here.

The biggest problem I see is that you are calling tolower() which changes depending on the locale. Though most software fixes this by forcing the locale to C, I'm not sure if that is acceptable for xkb. Please do not rely on anything more complicated that ASCII-only to-lower. Unicode tolower is extremely complex and changes over time. ISO-8859-1 tolower will require you to assume the text is either UTF-8 or not UTF-8, both are bad assumptions.

Also if the calling code adds "Foo" and makes it point to A, then decides to replace it with a pointer to B, the "foo" entry will still point to A. Probably not what is wanted.

Case independence is a bad idea all around for lookup in tables.

Also not clear why users would type in any of these strings, rather than click on pre-defined strings, which can have the right case.

David Herrmann wrote:
xkb_keysym_from_name() uses a big lookup table generated by "makekeys"
to find keysyms. It does this case-sensitive because we have keys like
XKB_KEY_A and XKB_KEY_a. So if a user searches for "a" we must always
return the case-sensitive match, which is XKB_KEY_a.
However, lets look at XKB_KEY_XF86HomePage. The user currently _must_
enter "XF86HomePage" correctly to get this keysym.
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to