XkbResizeDeviceButtonActions(3)

πŸ’… XkbResizeDeviceButtonActions(3) ✨

okay so bestie, welcome to the XkbResizeDeviceButtonActions page β€” yes it's a whole mouthful, it lives in the XKB FUNCTIONS corner of the X library, and no cap it's actually pretty chill once you get it 🫢


🌸 NAME 🌸

XkbResizeDeviceButtonActions β€” literally just allocates extra space for button actions inside an XkbDeviceInfoRec structure. that's the whole gig. iconic of her honestly ✨


πŸŽ€ SYNOPSIS πŸŽ€

Status XkbResizeDeviceButtonActions (XkbDeviceInfoPtr device_info,
       unsigned int new_total);

πŸ’– ARGUMENTS πŸ’–

  • device_info β€” the structure where we're gonna allocate those button actions πŸ¦‹
  • new_total β€” the new total number of button actions you need. like, the final count, not "how many more." read the room bestie πŸ’…

⭐ DESCRIPTION ⭐

so what she does is: XkbResizeDeviceButtonActions reallocates space if necessary to make sure there's room for a total of new_total button actions in the device_info structure. and any new entries that get allocated? zeroed. clean slate, we love that for them 🌈

if it works out, XkbResizeDeviceButtonActions returns Success. slay πŸ’–

now the special cases, pay attention:

  • if new_total is zero, all button actions are deleted, device_info->num_btns gets set to zero, and device_info->btn_acts gets set to NULL. it's giving reset-era πŸŽ€
  • if device_info is invalid or new_total is greater than 255, you get BadValue back 😭
  • if a memory allocation failure happens, you get a BadAlloc πŸ”₯
also! to free an XkbDeviceInfoRec structure, use XkbFreeDeviceInfo. don't just leave her hanging πŸ’€

πŸ¦‹ STRUCTURES πŸ¦‹

info about X Input Extension devices gets passed 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;

look at all those fields. main character struct energy, honestly πŸ‘‘


πŸ‘‘ DIAGNOSTICS πŸ‘‘

  • BadAlloc β€” Unable to allocate storage 😭 the memory said no
  • BadValue β€” An argument is out of range πŸ™ˆ something you passed in is not it

πŸ’œ SEE ALSO πŸ’œ


ngl this whole page is from X Version 11, libX11 1.8.14 β€” so yeah, that's the version tea β˜• and that's the wrap, periodt πŸ’…βœ¨πŸ“
πŸ“¦ where this page comes from