XkbSetDeviceInfo(3)
π
XkbSetDeviceInfo β from the XKB FUNCTIONS girlies β¨
okay bestie, so this one is XkbSetDeviceInfo(3), and it's literally the "actually go change the device" function. buckle up π
β¨ NAME β¨
XkbSetDeviceInfo β modify some or all of the characteristics of an X Input Extension device. like, glow-up time for your device, no cap π
πΈ SYNOPSIS πΈ
Bool XkbSetDeviceInfo (Display *dpy, unsigned int which,
XkbDeviceInfoPtr device_info);
π¦ ARGUMENTS π¦
dpyβ the connection to the X server. your lil phone line to the server, basically πwhichβ a mask indicating which characteristics to modify. it's the "what are we touching today" bitmask.device_infoβ structure defining the device and the modifications. the whole vibe check of what you're changing lives in here π«Ά
π DESCRIPTION π
So, to change characteristics of an X Input Extension device in the server, you first modify a local copy of the device structure, and then you've got two paths: use either XkbSetDeviceInfo, or β and this is the "save your data plan" option β use an XkbDeviceChangesRec structure and call XkbChangeDeviceInfo to download the changes to the server. β¨
XkbSetDeviceInfo sends a request to the server to modify the characteristics of the device specified in the device_info structure. The particular characteristics modified are identified by the bits set in which, and they take their values from the relevant fields in device_info (peep Table 1 below π). XkbSetDeviceInfo returns True if the request was successfully sent to the server. If the X server implementation does not allow interaction between the X input extension and the Xkb Extension, the function does nothing and returns False. yep, it just stands there, iconic but useless π
π Table 1 β XkbDeviceInfoRec Mask Bits π
XkbXI_KeyboardsMaskβXkbDeviceInfoRecfields effected: (none listed); value:(1L <<0); capability if set: clients can use all Xkb requests and events withKeyClassdevices supported by the input device extension.XkbXI_ButtonActionsMaskβ fields effected:num_btns,btn_acts; value:(1L <<1); capability if set: clients can assign key actions to buttons non-KeyClassinput extension devices.XkbXI_IndicatorNamesMaskβ fields effected:leds->names; value:(1L <<2); capability if set: clients can assign names to indicators on non-KeyClassinput extension devices.XkbXI_IndicatorMapsMaskβ fields effected:leds->maps; value:(1L <<3); capability if set: clients can assign indicator maps to indicators on non-KeyClassinput extension devices.XkbXI_IndicatorStateMaskβ fields effected:leds->state; value:(1L <<4); capability if set: clients can request the status of indicators on non-KeyClassinput extension devices.XkbXI_IndicatorsMaskβ fields effected:sz_leds,num_leds,leds->*; value:(0x1c); capability if set:XkbXI_IndicatorNamesMask | XkbXI_IndicatorMapsMask | XkbXI_IndicatorStateMaskXkbXI_UnsupportedFeaturesMaskβ fields effected:unsupported; value:(1L <<15); capability if set: (nothing listed)XkbXI_AllDeviceFeaturesMaskβ fields effected: those selected by Value Column masks; value:(0x1e); capability if set:XkbXI_IndicatorsMask | XkbSI_ButtonActionsMaskXkbXI_AllFeaturesMaskβ fields effected: those selected by Value Column masks; value:(0x1f); capability if set:XkbSI_AllDeviceFeaturesMask | XkbSI_KeyboardsMaskXkbXI_AllDetailsMaskβ fields effected: those selected by Value column masks; value:(0x801f); capability if set:XkbXI_AllFeaturesMask | XkbXI_UnsupportedFeaturesMask
The which parameter specifies which aspects of the device should be changed, and it's a bitmask composed of an inclusive OR of one or more of the following bits: XkbXI_ButtonActionsMask, XkbXI_IndicatorNamesMask, XkbXI_IndicatorMapsMask. If the features requested to be manipulated in which are valid for the device, but the server does not support assignment of one or more of them, that particular portion of the request is ignored β the server just quietly pretends it didn't hear that part π
If the device specified in device_info->device_spec does not contain buttons and a request affecting buttons is made, or the device does not contain indicators and a request affecting indicators is made, a BadMatch protocol error results. read the room, bestie π
If the XkbXI_ButtonActionsMask bit is set in the supported mask returned by XkbGetDeviceInfo, the Xkb extension allows applications to assign key actions to buttons on input extension devices other than the core keyboard device. If the XkbXI_ButtonActionsMask is set in which, the actions for all buttons specified in device_info are set to the XkbActions specified in device_info->btn_acts. If the number of buttons requested to be updated is not valid for the device, XkbSetDeviceInfo returns False and a BadValue protocol error results. π₯
If the XkbXI_IndicatorMaps and / or XkbXI_IndicatorNamesMask bit is set in the supported mask returned by XkbGetDeviceInfo, the Xkb extension allows applications to assign maps and / or names to the indicators of nonkeyboard extension devices. If supported, maps and / or names can be assigned to all extension device indicators, whether they are part of a keyboard feedback or part of an indicator feedback. π«
If the XkbXI_IndicatorMapsMask and / or XkbXI_IndicatorNamesMask flag is set in which, the indicator maps and / or names for all device_info->num_leds indicator devices specified in device_info->leds are set to the maps and / or names specified in device_info->leds. device_info->leds->led_class and led_id specify the input extension class and device ID for each indicator device to modify; if they have invalid values, a BadValue protocol error results and XkbSetDeviceInfo returns False. If they have legal values but do not specify a keyboard or indicator class feedback for the device in question, a BadMatch error results. If any of the values in device_info->leds->names are not a valid Atom or None, a BadAtom protocol error results. π«
β RETURN VALUES β
Trueβ theXkbSetDeviceInfofunction returnsTrueif the request was successfully sent to the server. slay βFalseβ theXkbSetDeviceInfofunction returnsFalseif the X server implementation does not allow interaction between the X input extension and the Xkb Extension. it's giving "we don't do that here" π«
π§ STRUCTURES π§
Changes to an Xkb extension device may be tracked by listening to XkbDeviceExtensionNotify events and accumulating the changes in an XkbDeviceChangesRec structure. The changes noted in the structure may then be used in subsequent operations to update either a server configuration or a local copy of an Xkb extension device configuration. The changes structure is defined as follows β copy it exactly, bestie, no improvising π
typedef struct _XkbDeviceChanges {
unsigned int changed; /* bits indicating what has changed */
unsigned short first_btn; /* number of first button which changed, if any */
unsigned short num_btns; /* number of buttons that have changed */
XkbDeviceLedChangesRec leds;
} XkbDeviceChangesRec,*XkbDeviceChangesPtr;
π DIAGNOSTICS π
BadAtomβ a name is neither a valid Atom orNoneBadMatchβ a compatible version of Xkb was not available in the server or an argument has correct type and range, but is otherwise invalidBadValueβ an argument is out of range
real talk: these three are the ones that'll ruin your afternoon, so handle them properly π
π SEE ALSO π
go read those too, iykyk π
and that's the whole page, bestie π this was X Version 11, from libX11 1.8.14, dated XkbSetDeviceInfo(3) β go forth and set your device info, mwah πβ¨
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- Copyright (c) 1999, Oracle and/or its affiliates
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms