minput_event_to_key(3m17n)

๐Ÿ“ฆ
version 1.8.4 ยท 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

โœจ NAME โœจ

minput_event_to_key โ€” that's it bestie, that's the whole name. no little one-liner summary. she's mysterious. she's giving less-is-more. iconic behavior honestly ๐Ÿ’…


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

MSymbol minput_event_to_key (MFrame * frame, void * event)

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so this one is a glow-up machine: it takes an event and turns it into an input key. literally. minput_event_to_key() hands back the input key that matches event on frame, and how it does that is a whole window system dependent situation โ€” the window system decides the vibe, not her ๐Ÿ’–

so in the m17n-X library, event has to be a pointer to the structure XKeyEvent, and she handles it like this:

first things first โ€” the keysym name of event gets scooped up by the function XKeysymToString. then the name gets modified, and here's the tea:

  • if the name is one of 'a' .. 'z' and event has a Shift modifier, the name gets converted to 'A' .. 'Z' respectively, and that Shift modifier gets cleared. uppercase era โœจ
  • if the name is one byte length and event has a Control modifier, that byte gets bitwise anded by 0x1F and the Control modifier gets cleared. math moment ๐Ÿงฎ
  • if event still has modifiers after all that, the name gets preceded by these, in exactly this order:
    1. 'S-' (Shift)
    2. 'C-' (Control)
    3. 'M-' (Meta)
    4. 'A-' (Alt)
    5. 'G-' (AltGr)
    6. 's-' (Super)
    7. 'H-' (Hyper)

fr fr, that order matters, don't shuffle it ๐Ÿ™ˆ

for instance, if the keysym name is 'a' and the event has Shift, Meta, and Hyper modifiers, the resulting name is 'M-H-A'. yes really, Shift dipped and the other two stayed, that's just how she rolls ๐Ÿ˜ญ

and at last? a symbol who has the name gets returned. periodt. ๐Ÿ‘‘


Copyright (C) 2001 Information-technology Promotion Agency (IPA)

Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>.


okay that's the whole page, you're so welcome ๐Ÿซถ this was Version 1.8.4, dated Mon Sep 25 2023, from the m17n library and she ate, no cap ๐ŸŒˆโญ bye bestie, go convert some events ๐Ÿ’–

๐Ÿ“ฆ where this page comes from