XkbAllocDeviceLedInfo(3)

πŸ“¦
version 1.8.4 Β· 2 versions
, in debian bookworm

✨ XkbAllocDeviceLedInfo ✨

okay bestie, welcome to the XKB FUNCTIONS corner of the manual, this is XkbAllocDeviceLedInfo(3) and it's genuinely so useful, come sit with me πŸ’–


🌸 NAME 🌸

XkbAllocDeviceLedInfo β€” grab yourself an XkbDeviceLedInfoRec structure, no cap


πŸŽ€ SYNOPSIS πŸŽ€

Status XkbAllocDeviceLedInfo (XkbDeviceInfoPtr device_info, int
       num_needed);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • device_info β€” the structure where the LED space is gonna get allocated. it's giving "put it here please" ✨
  • num_needed β€” how many indicators you want space for. the vibes-based count, basically πŸ’…

πŸ’œ DESCRIPTION πŸ’œ

So XkbAllocDeviceLedInfo allocates space for an XkbDeviceLedInfoRec and places it in device_info. iconic behaviour, truly.

If num_needed is nonzero, then num_needed XkbIndicatorMapRec structures get allocated too and linked right into the XkbDeviceLedInfoRec structure. 🫢

⚠️ but listen, bestie β€” if you request XkbIndicatorMapRec structures be allocated using this request, you must initialize them explicitly. no skipping that, fr fr. all the other fields get initialized to zero though, so that part's chill 😌

To initialize an XkbDeviceLedInfoRec structure, use XkbAddDeviceLedInfo. that's your girl for that job πŸ’…


🧚 STRUCTURES 🧚

Information about X Input Extension devices gets transferred between a client program and the Xkb extension inside an XkbDeviceInfoRec structure, and here's exactly what she looks like πŸ‘‘

    typedef struct {
        char *               name;          /* name for device */
        Atom                 type;          /* name for class of devices */
        unsigned short       device_spec;   /* device of interest */
        Bool                 has_own_state; /* True=>this device has its own state */
        unsigned short       supported;     /* bits indicating supported capabilities */
        unsigned short       unsupported;   /* bits indicating unsupported capabilities */
        unsigned short       num_btns;      /* number of entries in btn_acts */
        XkbAction *          btn_acts;      /* button actions */
        unsigned short       sz_leds;       /* total number of entries in LEDs vector */
        unsigned short       num_leds;      /* number of valid entries in LEDs vector */
        unsigned short       dflt_kbd_fb;   /* input extension ID of default (core kbd) indicator */
        unsigned short       dflt_led_fb;   /* input extension ID of default indicator feedback */
        XkbDeviceLedInfoPtr  leds;          /* LED descriptions */
    } XkbDeviceInfoRec, *XkbDeviceInfoPtr;
    typedef struct {
        unsigned short      led_class;        /* class for this LED device*/
        unsigned short      led_id;           /* ID for this LED device */
        unsigned int        phys_indicators;  /* bits for which LEDs physically present */
        unsigned int        maps_present;     /* bits for which LEDs have maps in maps */
        unsigned int        names_present;    /* bits for which LEDs are in names */
        unsigned int        state;            /* 1 bit => corresponding LED is on */
        Atom                names[XkbNumIndicators];   /* names for LEDs */
        XkbIndicatorMapRec  maps;             /* indicator maps for each LED */
    } XkbDeviceLedInfoRec, *XkbDeviceLedInfoPtr;

Every indicator has its own lil set of attributes that say whether clients can explicitly set its state and whether it tracks the keyboard state. the way that these attributes live in the maps array β€” which is an array of XkbIndicatorRec structures β€” is honestly so neat ✨

    typedef struct {
        unsigned char   flags;            /* how the indicator can be changed */
        unsigned char   which_groups;     /* match criteria for groups */
        unsigned char   groups;           /* which keyboard groups the indicator watches */
        unsigned char   which_mods;       /* match criteria for modifiers */
        XkbModsRec      mods;             /* which modifiers the indicator watches */
        unsigned int    ctrls;            /* which controls the indicator watches */
    } XkbIndicatorMapRec, *XkbIndicatorMapPtr;

This indicator map specifies, for each indicator:

  • The conditions under which the keyboard modifier state affects the indicator
  • The conditions under which the keyboard group state affects the indicator
  • The conditions under which the state of the boolean controls affects the indicator
  • The effect (if any) of attempts to explicitly change the state of the indicator using the functions XkbSetControls or XChangeKeyboardControl

🌈 SEE ALSO 🌈

XkbAddDeviceLedInfo(3), XkbSetControls(3)


aaaand that's the whole page, you ate it πŸ“

X Version 11 Β· libX11 1.8.4 β€” that's the source and version bestie, go forth and allocate responsibly, ily, periodt πŸ’…πŸ‘‘

πŸ“¦ where this page comes from