XkbGetBounceKeysDelay(3)

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

πŸ’– XkbGetBounceKeysDelay β€” the girlies' guide πŸ’–

okay so this one lives in the XKB FUNCTIONS section of the libX11 manual, and it's genuinely such a useful little guy. sit down, hydrate, let's get into it ✨


🌸 NAME 🌸

XkbGetBounceKeysDelay β€” it asks your keyboard device "hey bestie, what's your current BounceKeys delay?" and reports back. that's the whole job. iconique.


πŸŽ€ SYNOPSIS πŸŽ€

Bool XkbGetBounceKeysDelay (Display *display, unsigned int device_spec,
       unsigned int *delay_rtrn);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • display β€” the connection to your X server. your link to the mothership fr.
  • device_spec β€” the device ID, or XkbUseCoreKbd if you want the core keyboard (iykyk).
  • delay_rtrn β€” gets backfilled with the bounce keys delay, in ms. she's an output param, she's giving ✨pointer✨.

πŸ‘‘ DESCRIPTION πŸ‘‘

so the server can generate XkbAccessXNotify events for some of the global keyboard controls. the detail field tells you exactly what AccessX event just happened, and it can be any of the values in Table 1 πŸ’…

Table 1 β€” AccessXNotify Events

  • XkbAXN_SKPress β€” A key was pressed when SlowKeys was enabled.
  • XkbAXN_SKAccept β€” A key was accepted (held longer than the SlowKeys delay).
  • XkbAXN_SKRelease β€” An accepted SlowKeys key was released.
  • XkbAXN_SKReject β€” A key was rejected (released before the SlowKeys delay expired).
  • XkbAXN_BKAccept β€” A key was accepted by BounceKeys.
  • XkbAXN_BKReject β€” A key was rejected (pressed before the BounceKeys delay expired).
  • XkbAXN_AXKWarning β€” AccessXKeys is about to turn on/off StickyKeys or BounceKeys.

ngl that warning one is giving "heads up bestie, something's about to change" energy.

the keycode field reports the keycode of the key the event happened for. if the action is related to SlowKeys, the slowKeysDelay field contains the current SlowKeys acceptance delay. if the action is related to BounceKeys, the debounceDelay field contains the current BounceKeys debounce delay. no cap.

Selecting for AccessX Events

to receive XkbAccessXNotify events under all possible conditions, use XkbSelectEvents and pass XkbAccesXNotifyMask in both bits_to_change and values_for_bits. (yes, that spelling β€” XkbAccesXNotifyMask β€” is exactly how the original says it, don't come for me 🫢)

to receive XkbStateNotify events only under certain conditions, use XkbSelectEventDetails with XkbAccessXNotify as the event_type and specify the state changes you want in bits_to_change and values_for_bits, using mask bits from Table 2 πŸ‘‡

Table 2 β€” AccessXNotify Event Details

  • XkbAXN_SKPressMask β€” (1<<0) β€” Slow key press notification wanted
  • XkbAXN_SKAcceptMask β€” (1<<1) β€” Slow key accept notification wanted
  • XkbAXN_SKRejectMask β€” (1<<2) β€” Slow key reject notification wanted
  • XkbAXN_SKReleaseMask β€” (1<<3) β€” Slow key release notification wanted
  • XkbAXN_BKAcceptMask β€” (1<<4) β€” Bounce key accept notification wanted
  • XkbAXN_BKRejectMask β€” (1<<5) β€” Bounce key reject notification wanted
  • XkbAXN_AXKWarningMask β€” (1<<6) β€” AccessX warning notification wanted
  • XkbAllAccessXEventsMask β€” (0x7f) β€” All AccessX features notifications wanted

the actual bounce keys lore πŸ€

some users may accidentally "bounce" on a key when they release it. they press it once, then accidentally press it again after they release it. the BounceKeys control temporarily disables a key after it has been pressed, effectively "debouncing" the keyboard. the period of time the key is disabled after it is released is known as the BounceKeys delay. BounceKeys is a boolean control.

when the BounceKeys control is active, the server reports acceptance or rejection of any key to interested clients by sending an appropriate AccessXNotify event (see STRUCTURES). she's keeping everyone in the loop, so considerate πŸ’œ

XkbGetBounceKeysDelay requests the attributes of the BounceKeys control from the server, waits for a reply, and backfills delay_rtrn with the BounceKeys delay attribute. XkbGetBounceKeysDelay returns True if successful; if a compatible version of the Xkb extension is not available in the server XkbGetSlowKeysDelay returns False.

⚠️ okay yes, that last sentence says XkbGetSlowKeysDelay and not XkbGetBounceKeysDelay. that is exactly what the original page says, so I'm leaving it alone. do not @ me, I do not make the rules πŸ’€

πŸ’… RETURN VALUES πŸ’…

  • True β€” The XkbGetBounceKeysDelay function returns True when it successfully requests the attributes of the BounceKeys control from the server, waits for a reply, and backfills delay_rtrn with the BounceKeys delay attribute. slay.
  • False β€” The XkbGetBounceKeysDelay function returns False if a compatible version of the Xkb extension is not available in the server. tragic, honestly 😭

🌈 STRUCTURES 🌈

the structure for the XkbAccessXNotify event type is as follows:

typedef struct {
    int            type;           /* Xkb extension base event code */
    unsigned long  serial;         /* X server serial number for event */
    Bool           send_event;     /* True => synthetically generated */
    Display *      display;        /* server connection where event generated */
    Time           time;           /* server time when event generated */
    int            xkb_type;       /* XkbAccessXNotify */
    int            device;         /* Xkb device ID, will not be XkbUseCoreKbd */
    int            detail;         /* XkbAXN_* */
    KeyCode        keycode;        /* key of event */
    int            slowKeysDelay;  /* current SlowKeys delay */
    int            debounceDelay;  /* current debounce delay */
} XkbAccessXNotifyEvent;

look at her. immaculate. πŸŽ€


πŸ“ SEE ALSO πŸ“


and that's the tea, bestie 🫢 this page is from X Version 11, libX11 1.8.4 β€” shoutout to the libX11 girlies for keeping the keyboard vibes immaculate. go forth and debounce responsibly βœ¨πŸ’–πŸŒΈ

πŸ“¦ where this page comes from