XKeymapEvent(3)

πŸŽ€ NAME πŸŽ€

okay so this is the page for XKeymapEvent(3), straight out of the XLIB FUNCTIONS manual, bestie β€” it's literally the KeymapNotify event structure. That's the name section, periodt. ✨

πŸ¦‹ STRUCTURES πŸ¦‹

The structure for KeymapNotify events contains:

       /* generated on EnterWindow and FocusIn when KeymapState selected */
       typedef struct {
               int type;       /* KeymapNotify */
               unsigned long serial;   /* # of last request processed by server */
               Bool send_event;        /* true if this came from a SendEvent request */
               Display *display;       /* Display the event was read from */
               Window window;
               char key_vector[32];
       } XKeymapEvent;

When you receive this event, the structure members are set as follows. No cap, this is the vibe check for every member. πŸ’…

  • type β€” set to the event type constant name that uniquely identifies it. For example, when the X server reports a GraphicsExpose event to a client application, it sends an XGraphicsExposeEvent structure with the type member set to GraphicsExpose. Iconic example behavior, honestly.
  • display β€” set to a pointer to the display the event was read on. 🫢
  • send_event β€” set to True if the event came from a SendEvent protocol request. πŸ’…
  • serial β€” set from the serial number reported in the protocol, but expanded from the 16-bit least-significant bits to a full 32-bit value. Math girlie moment.
  • window β€” set to the window that is most useful to toolkit dispatchers. πŸŽ€

Then there's the window member again, because she's a little extra: window is not used but is present to aid some toolkits. Not me explaining the same member twice, but the manpage said it, so we're saying it. 😭

The key_vector member is set to the bit vector of the keyboard. Each bit set to 1 indicates that the corresponding key is currently pressed. The vector is represented as 32 bytes. Byte N (from 0) contains the bits for keys 8N to 8N + 7 with the least significant bit in the byte representing key 8N. That's the whole mapping, bestie β€” byte N, keys 8N through 8N + 7, LSB = key 8N. Slay. πŸ”₯

πŸ’– SEE ALSO πŸ’–


byeee 🫢 this page's footer energy is literally X Version 11, libX11 1.8.14, and XKeymapEvent(3) β€” mwah, bestie. πŸ’‹βœ¨

πŸ“¦ where this page comes from