XStringToKeysym(3)

πŸ’… XStringToKeysym(3) πŸ’…

okay so welcome to the XLIB FUNCTIONS manual, bestie β€” this page is all about the keysym-conversion squad, and yes, it's giving main character energy. πŸŽ€


🌸 NAME 🌸

The squad: XStringToKeysym, XKeysymToString, XKeycodeToKeysym, XKeysymToKeycode, XConvertCase β€” and their whole thing is convert keysyms. Periodt. ✨


✨ SYNTAX ✨

KeySym XStringToKeysym(_Xconst char *string);

char *XKeysymToString(KeySym keysym);

KeySym XKeycodeToKeysym(Display *display, KeyCode keycode, int index);

KeyCode XKeysymToKeycode(Display *display, KeySym keysym);

void XConvertCase(KeySym keysym, KeySym *lower_return, KeySym
              *upper_return);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • display β€” Specifies the connection to the X server. Your X server link, basically. πŸ’–
  • index β€” Specifies the element of KeyCode vector. It's the little index slot, bestie. 🌸
  • keycode β€” Specifies the KeyCode. The actual keycode in question. πŸŽ€
  • keysym β€” Specifies the KeySym that is to be searched for or converted. The keysym main character. πŸ‘‘
  • lower_return β€” Returns the lowercase form of keysym, or keysym. So if there's no lowercase glow-up, you get keysym back. πŸ’…
  • string β€” Specifies the name of the KeySym that is to be converted. The name string, literally. πŸ¦‹
  • upper_return β€” Returns the uppercase form of keysym, or keysym. Same deal, but uppercase. ✨

🌈 DESCRIPTION 🌈

okay so the standard KeySym names? They come from X11/keysymdef.h, and you get each one by removing the XK_ prefix from the name. That's the whole trick, no cap. 🫢

KeySyms that are not part of the Xlib standard also may be obtained with this function β€” iconic β€” but the set of KeySyms that are available in this manner and the mechanisms by which Xlib obtains them is implementation-dependent. So it's a vibe, but not a universal promise, iykyk. πŸ’€

If the KeySym name is not in the Host Portable Character Encoding, the result is implementation-dependent. If the specified string does not match a valid KeySym, XStringToKeysym returns NoSymbol. That's the vibe check failing, bestie. 😭

The returned string is in a static area and must not be modified β€” do not touch it, just admire it from afar. The returned string is in the Host Portable Character Encoding. If the specified KeySym is not defined, XKeysymToString returns a NULL. 🧚

XKeycodeToKeysym uses internal Xlib tables and returns the KeySym defined for the specified KeyCode and the element of the KeyCode vector. If no symbol is defined, XKeycodeToKeysym returns NoSymbol. Also, important lore: XKeycodeToKeysym predates the XKB extension. If you want to lookup a KeySym while using XKB you have to use XkbKeycodeToKeysym β€” that's the rule, fr fr. πŸ”₯

If the specified KeySym is not defined for any KeyCode, XKeysymToKeycode returns zero. Zero, bestie. Not a keysym, not a slay. πŸ’…

XConvertCase returns the uppercase and lowercase forms of the specified Keysym, if the KeySym is subject to case conversion; otherwise, the specified KeySym is returned to both lower_return and upper_return. Support for conversion of other than Latin and Cyrillic KeySyms is implementation-dependent β€” so Latin and Cyrillic are the main characters here, and anything else is a maybe. 🌸


πŸ’œ SEE ALSO πŸ’œ

go read these too, bestie β€” they're part of the extended universe. πŸ¦‹


mwah πŸ’‹ β€” source/version tea: X Version 11, libX11 1.8.14; the footer didn't give me a date, so I'm not inventing one, bestie 🫢

πŸ“¦ where this page comes from