XkbSetControls(3)

πŸ¦‹ NAME πŸ¦‹

okay so welcome to XkbSetControls from the XKB FUNCTIONS section (section 3, bestie πŸ’…) β€” it copies changes to the X server based on a modified ctrls structure in a local copy of the keyboard description. that's the whole vibe. no cap.


✨ SYNOPSIS ✨

Bool XkbSetControls (Display *display, unsigned long which, XkbDescPtr
       xkb);

πŸŽ€ ARGUMENTS πŸŽ€

  • display β€” connection to X server. the whole reason we're here 🫢
  • which β€” mask of controls requested. it's giving "pick your fighters" energy ⭐
  • xkb β€” keyboard description for controls information. this is where the ctrls tea lives πŸ’œ

πŸ’– DESCRIPTION πŸ’–

so for each bit that's set in the which parameter, XkbSetControls sends the corresponding values from the xkb->ctrls field to the server. literally bit by bit, she's delivering πŸ“¦βœ¨

valid values for which are any combination of the masks listed in Table 1 that have "ok" in the which column. iykyk πŸ‘‘

Table 1 shows the actual values for the individual mask bits used to select controls for modification and to enable and disable the control. note (and this is the important part, don't skip it πŸ™ˆ) that the same mask bit is used to specify general modifications to the parameters used to configure the control (which), and to enable and disable the control (enabled_ctrls).

the anomalies in the table (the rows with no "ok" in the column) are for controls that have no configurable attributes; and for controls that are not boolean controls and therefore cannot be enabled or disabled. lowkey rude of them but ok πŸ’€

🌈 Table 1 β€” Controls Mask Bits 🌈

each bullet is one mask bit, showing whether it's "ok" in which or changed_ctrls, whether it's "ok" in enabled_ctrls, and its value ✨

  • XkbRepeatKeysMask β€” which or changed_ctrls: ok Β· enabled_ctrls: ok Β· value (1L<<0)
  • XkbSlowKeysMask β€” which or changed_ctrls: ok Β· enabled_ctrls: ok Β· value (1L<<1)
  • XkbBounceKeysMask β€” which or changed_ctrls: ok Β· enabled_ctrls: ok Β· value (1L<<2)
  • XkbStickyKeysMask β€” which or changed_ctrls: ok Β· enabled_ctrls: ok Β· value (1L<<3)
  • XkbMouseKeysMask β€” which or changed_ctrls: ok Β· enabled_ctrls: ok Β· value (1L<<4)
  • XkbMouseKeysAccelMask β€” which or changed_ctrls: ok Β· enabled_ctrls: ok Β· value (1L<<5)
  • XkbAccessXKeysMask β€” which or changed_ctrls: ok Β· enabled_ctrls: ok Β· value (1L<<6)
  • XkbAccessXTimeoutMask β€” which or changed_ctrls: ok Β· enabled_ctrls: ok Β· value (1L<<7)
  • XkbAccessXFeedbackMask β€” which or changed_ctrls: ok Β· enabled_ctrls: ok Β· value (1L<<8)
  • XkbAudibleBellMask β€” which or changed_ctrls: (blank β€” not ok) Β· enabled_ctrls: ok Β· value (1L<<9)
  • XkbOverlay1Mask β€” which or changed_ctrls: (blank β€” not ok) Β· enabled_ctrls: ok Β· value (1L<<10)
  • XkbOverlay2Mask β€” which or changed_ctrls: (blank β€” not ok) Β· enabled_ctrls: ok Β· value (1L<<11)
  • XkbIgnoreGroupLockMask β€” which or changed_ctrls: (blank β€” not ok) Β· enabled_ctrls: ok Β· value (1L<<12)
  • XkbGroupsWrapMask β€” which or changed_ctrls: ok Β· enabled_ctrls: (blank β€” not ok) Β· value (1L<<27)
  • XkbInternalModsMask β€” which or changed_ctrls: ok Β· enabled_ctrls: (blank β€” not ok) Β· value (1L<<28)
  • XkbIgnoreLockModsMask β€” which or changed_ctrls: ok Β· enabled_ctrls: (blank β€” not ok) Β· value (1L<<29)
  • XkbPerKeyRepeatMask β€” which or changed_ctrls: ok Β· enabled_ctrls: (blank β€” not ok) Β· value (1L<<30)
  • XkbControlsEnabledMask β€” which or changed_ctrls: ok Β· enabled_ctrls: (blank β€” not ok) Β· value (1L<<31)
  • XkbAccessXOptionsMask β€” which or changed_ctrls: ok Β· enabled_ctrls: ok Β· value (XkbStickyKeysMask | XkbAccessXFeedbackMask)
  • XkbAllBooleanCtrlsMask β€” which or changed_ctrls: (blank β€” not ok) Β· enabled_ctrls: ok Β· value (0x00001FFF)
  • XkbAllControlsMask β€” which or changed_ctrls: ok Β· enabled_ctrls: (blank β€” not ok) Β· value (0xF8001FFF)

🧚 the fail conditions, gather round 🧚

if xkb->ctrls is NULL, or the server does not support a compatible version of Xkb, or the Xkb extension has not been properly initialized, XkbSetControls returns False. otherwise, it sends the request to the X server and returns True. and that's it, that's the whole storyline πŸ˜­πŸ’–

πŸ‘‘ control attributes β€” the lore πŸ‘‘

note that changes to attributes of controls in the XkbControlsRec structure are apparent only when the associated control is enabled, although the corresponding values are still updated in the X server. for example, the repeat_delay and repeat_interval fields are ignored unless the RepeatKeys control is enabled (that is, the X server's equivalent of xkb->ctrls has XkbRepeatKeyMask set in enabled_ctrls). ngl that's the fine print, read it twice πŸ™ˆ

it is permissible to modify the attributes of a control in one call to XkbSetControls and enable the control in a subsequent call. see XkbChangeEnabledControls for more information on enabling and disabling controls. spread it out, she doesn't mind ✨

⭐ enabled_ctrls is itself a control β€” plot twist ⭐

note that the enabled_ctrls field is itself a control β€” the EnabledControls control. as such, to set a specific configuration of enabled and disabled boolean controls, you must set enabled_ctrls to the appropriate bits to enable only the controls you want and disable all others, then specify the XkbControlsEnabledMask in a call to XkbSetControls. main character energy, honestly πŸ”₯

because this is somewhat awkward if all you want to do is enable and disable controls, and not modify any of their attributes, a convenience function is also provided for this purpose, XkbChangeEnabledControls. she's the shortcut bestie 🫢


πŸ’œ RETURN VALUES πŸ’œ

  • True β€” the XkbSetControls function returns True when it sends the request to the X server. slay βœ…
  • False β€” the XkbSetControls function returns False when xkb->ctrls is NULL, the server does not support a compatible version of Xkb, or the Xkb extension has not been properly initialized. sad girl hours 😭

🌸 DIAGNOSTICS 🌸

  • BadAlloc β€” unable to allocate storage. out of room, no vibe πŸ’€
  • BadMatch β€” a compatible version of Xkb was not available in the server or an argument has correct type and range, but is otherwise invalid. right shape, wrong energy πŸ™ˆ

πŸ“ SEE ALSO πŸ“

go read them, they're the supporting cast πŸ’…


ok that's the whole page, you ate that πŸ’– no notes.

mwah πŸ’‹ this has been X Version 11, libX11 1.8.14, XkbSetControls(3) β€” catch you in the next manpage bestie πŸŒˆβœ¨πŸŽ€

πŸ“¦ where this page comes from