XkbFreeCompatMap(3)

πŸ’– XkbFreeCompatMap πŸ’–

okay so bestie, welcome to XkbFreeCompatMap from the XKB FUNCTIONS manual 🫢 this one is literally about freeing an entire compatibility map or just the selected little pieces of one. main character energy, but make it memory management πŸ’…


🌸 NAME 🌸

XkbFreeCompatMap β€” free a whole compatibility map or selected portions of one ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

       void XkbFreeCompatMap (XkbDescPtr xkb, unsigned int which, Bool
              free_map);

πŸŽ€ ARGUMENTS πŸŽ€

  • xkb β€” the Xkb description where you want to free the compatibility map πŸ’–
  • which β€” a mask of compatibility map components to free 🧚
  • free_map β€” True means free the XkbCompatMap structure itself 😭

πŸ’œ DESCRIPTION πŸ’œ

so which tells the function which compatibility map components to free, iykyk β€” see XkbGetCompatMap for the full lore πŸ”₯ which is an inclusive OR of the bits shown in Table 1, no cap.

Table 1 β€” Compatibility Map Component Masks

  • XkbSymInterpMask β€” value (1<<0) β€” affecting Symbol interpretations 🌸
  • XkbGroupCompatMask β€” value (1<<1) β€” affecting Group maps 🌈
  • XkbAllCompatMask β€” value (0x3) β€” affecting All compatibility map components πŸ‘‘

free_map indicates whether the XkbCompatMap structure itself should be freed. If free_map is True, which is ignored, all non-NULL compatibility map components are freed, and the compat field in the XkbDescRec referenced by xkb is set to NULL πŸ’€ periodt.

bestie, this is the part where which gets absolutely ignored if free_map is True β€” the whole compatibility map situation gets cleaned up, and compat goes to NULL πŸ™ˆ

🧚 STRUCTURES 🧚

okay, struct soup time β€” here’s the exact XkbCompatMapRec situation:

typedef struct _XkbCompatMapRec {
    XkbSymInterpretPtr    sym_interpret;            /* symbol based key semantics*/
    XkbModsRec            groups[XkbNumKbdGroups];  /* group => modifier map */
    unsigned short        num_si;                   /* # structures used in sym_interpret */
    unsigned short        size_si;                  /* # structures allocated in sym_interpret */
} XkbCompatMapRec, *XkbCompatMapPtr;

the complete description of an Xkb keyboard is given by an XkbDescRec πŸ¦‹ the component structures in the XkbDescRec represent the major Xkb components outlined in Figure 1.1 ✨

typedef struct {
   struct _XDisplay * display;      /* connection to X server */
   unsigned short     flags;        /* private to Xkb, do not modify */
   unsigned short     device_spec;  /* device of interest */
   KeyCode            min_key_code; /* minimum keycode for device */
   KeyCode            max_key_code; /* maximum keycode for device */
   XkbControlsPtr     ctrls;        /* controls */
   XkbServerMapPtr    server;       /* server keymap */
   XkbClientMapPtr    map;          /* client keymap */
   XkbIndicatorPtr    indicators;   /* indicator map */
   XkbNamesPtr        names;        /* names for all components */
   XkbCompatMapPtr    compat;       /* compatibility map */
   XkbGeometryPtr     geom;         /* physical geometry of keyboard */
} XkbDescRec, *XkbDescPtr;

the display field points to an X display structure πŸ’» the flags field is private to the library: modifying flags may yield unpredictable results οΏ½οΏ½ so don’t touch, bestie.

warning: flags is private to the library β€” modifying flags may yield unpredictable results 🚨

the device_spec field specifies the device identifier of the keyboard input device, or XkbUseCoreKeyboard, which specifies the core keyboard device 🎹 the min_key_code and max_key_code fields specify the least and greatest keycode that can be returned by the keyboard πŸ”’ the other fields specify structure components of the keyboard description and are described in detail in other sections of this document πŸ“š Table 2 identifies the subsequent sections of this document that discuss the individual components of the XkbDescRec πŸ‘‘

Table 2 β€” XkbDescRec Component References

  • ctrls β€” for more info: Chapter 10 🌸
  • server β€” for more info: Chapter 16 🌈
  • map β€” for more info: Chapter 15 πŸ¦‹
  • indicators β€” for more info: Chapter 8 ⭐
  • names β€” for more info: Chapter 18 πŸŽ€
  • compat β€” for more info: Chapter 17 πŸ’œ
  • geom β€” for more info: Chapter 13 πŸ’…

each structure component has a corresponding mask bit that is used in function calls to indicate that the structure should be manipulated in some manner, such as allocating it or freeing it πŸ‘€ these masks and their relationships to the fields in the XkbDescRec are shown in Table 3 🫢

Table 3 β€” Mask Bits for XkbDescRec

  • XkbControlsMask β€” XkbDescRec field ctrls β€” value (1L<<0) ✨
  • XkbServerMapMask β€” XkbDescRec field server β€” value (1L<<1) 🌸
  • XkbIClientMapMask β€” XkbDescRec field map β€” value (1L<<2) πŸ¦‹
  • XkbIndicatorMapMask β€” XkbDescRec field indicators β€” value (1L<<3) ⭐
  • XkbNamesMask β€” XkbDescRec field names β€” value (1L<<4) πŸŽ€
  • XkbCompatMapMask β€” XkbDescRec field compat β€” value (1L<<5) πŸ’œ
  • XkbGeometryMask β€” XkbDescRec field geom β€” value (1L<<6) 🌈
  • XkbAllComponentsMask β€” XkbDescRec field All Fields β€” value (0x7f) πŸ‘‘

🌟 SEE ALSO 🌟

  • XkbGetCompatMap(3) β€” the bestie that gets the compatibility map in the first place πŸ’–

okay bestie, that’s the whole page β€” signing off from X Version 11, libX11 1.8.14, with no separate date line in this footer, so that’s the vibe πŸŽ€βœ¨πŸ’… periodt

πŸ“¦ where this page comes from