Skip to content

Instantly share code, notes, and snippets.

@alebastr
Created January 6, 2024 04:25
Show Gist options
  • Save alebastr/1f92a532d738a72f51cbd2f144412b68 to your computer and use it in GitHub Desktop.
Save alebastr/1f92a532d738a72f51cbd2f144412b68 to your computer and use it in GitHub Desktop.
`XKB_KEYSYM_NO_FLAGS` vs `XKB_KEYSYM_CASE_INSENSITIVE`
// const char *key_names [] = {
// `sed -En 's/^#.*XKB_KEY_(\w*).*/"\1",/p' /usr/include/xkbcommon/xkbcommon-keysyms.h |sort -u`
// };
//
// g++ $(pkg-config --libs --cflags xkbcommon) generator.cpp
#include <cstdio>
#include <cstdlib>
#include <xkbcommon/xkbcommon.h>
int main(int, char**) {
printf("| %20s | %29s | %29s\n", "key", "to_lower", "case-insensitive");
printf("| %20s | %29s | %29s\n", "---", "---", "---");
for (auto name : key_names) {
auto kscs = xkb_keysym_from_name(name, XKB_KEYSYM_NO_FLAGS);
if (kscs == XKB_KEY_NoSymbol) {
continue;
}
kscs = xkb_keysym_to_lower(kscs);
auto ksci = xkb_keysym_from_name(name, XKB_KEYSYM_CASE_INSENSITIVE);
if (kscs == ksci) {
continue;
}
char ncs[64], nci[64];
xkb_keysym_get_name(kscs, ncs, sizeof(ncs) - 1);
xkb_keysym_get_name(ksci, nci, sizeof(nci) - 1);
printf("| %20s | %18s (%08x) | %18s (%08x)\n", name, ncs, kscs, nci, ksci);
}
return EXIT_SUCCESS;
}
key to_lower case-insensitive
C_h C_h (0000fea4) c_h (0000fea3)
Ch Ch (0000fea1) ch (0000fea0)
C_H C_H (0000fea5) c_h (0000fea3)
CH CH (0000fea2) ch (0000fea0)
dead_A dead_A (0000fe81) dead_a (0000fe80)
dead_E dead_E (0000fe83) dead_e (0000fe82)
dead_i dead_i (0000fe84) dead_I (0000fe85)
dead_o dead_o (0000fe86) dead_O (0000fe87)
dead_schwa dead_schwa (0000fe8a) dead_SCHWA (0000fe8b)
dead_U dead_U (0000fe89) dead_u (0000fe88)
Greek_IOTAdiaeresis Greek_iotadieresis (000007b5) Greek_IOTAdieresis (000007a5)
kana_A kana_A (000004b1) kana_a (000004a7)
kana_E kana_E (000004b4) kana_e (000004aa)
kana_I kana_I (000004b2) kana_i (000004a8)
kana_O kana_O (000004b5) kana_o (000004ab)
kana_tsu kana_tsu (000004af) kana_TSU (000004c2)
kana_TU kana_TSU (000004c2) kana_tsu (000004af)
kana_U kana_U (000004b3) kana_u (000004a9)
kana_ya kana_ya (000004ac) kana_YA (000004d4)
kana_yo kana_yo (000004ae) kana_YO (000004d6)
kana_YU kana_YU (000004d5) kana_yu (000004ad)
XF86ScreenSaver XF86ScreenSaver (1008ff2d) XF86Screensaver (10081245)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment