XGETFEEDBACKCONTROL(3)

✨ NAME ✨

okay so this is the XGETFEEDBACKCONTROL(3) page bestie!! it's all about XGetFeedbackControl and XChangeFeedbackControl β€” literally the two functions that let you query and change input device feedbacks πŸŽ€


🌸 SYNOPSIS 🌸

#include <X11/extensions/XInput.h>

XFeedbackState *XGetFeedbackControl( Display *display,
                                     XDevice *device,
                                     int *num_feedbacks);

int XChangeFeedbackControl( Display *display,
                            XDevice *device,
                            Mask mask,
                            XFeedbackControl *control);
  • display β€” the connection to the X server, obvi πŸ’…
  • device β€” the device whose feedbacks you wanna query or modify, bestie
  • num_feedbacks β€” an address where the number of feedbacks supported by the device gets written. it's giving "out parameter" energy ✨
  • mask β€” a mask that's specific to each type of feedback, describing how the feedback is to be modified
  • control β€” the address of an XFeedbackControl structure holding the new values for the feedback 🫢

πŸ’– DESCRIPTION πŸ’–

okay so these requests exist to manipulate those input devices that support feedbacks. and no cap β€” if the requested device does not support feedbacks, you get a BadMatch error. rude but valid 😭

how do you even know if a device supports feedbacks?? you check the info that XOpenDevice hands you. for devices that do support feedbacks, XOpenDevice returns an XInputClassInfo structure with the input_class field equal to the constant FeedbackClass (defined in the file XI.h). iykyk πŸ’…

the XGetFeedbackControl request returns a pointer to a list of XFeedbackState structures. each item in that list describes one of the feedbacks supported by the device. and here's the tea β€” the items are variable length, so each one contains its own length to let you traverse to the next item in the list. so iconic of them honestly πŸ¦‹

the feedback classes that are currently defined are: KbdFeedbackClass, PtrFeedbackClass, StringFeedbackClass, IntegerFeedbackClass, LedFeedbackClass, and BellFeedbackClass. these constants live in the file XI.h ✨

an input device may support zero or more classes of feedback, and it may support multiple feedbacks of the same class. each feedback contains a class identifier and an id that is unique within that class for that input device. that id is the whole point β€” it's used to identify the feedback when you make an XChangeFeedbackControl request πŸ‘‘

XGetFeedbackControl can generate a BadDevice or BadMatch error. noted, bestie.

the XChangeFeedbackControl request modifies the values of one feedback on the specified device. the feedback is identified by the id field of the XFeedbackControl structure that's passed with the request. the fields of the feedback that are to be modified are identified by the bits of the mask that's passed with the request 🌈

XChangeFeedbackControl can generate a BadDevice, BadMatch, or BadValue error.


πŸŽ€ Structures πŸŽ€

each class of feedback is described by a structure specific to that class. these structures are defined in the file XInput.h. XFeedbackState and XFeedbackControl are generic structures that contain three fields that sit at the beginning of each class of feedback:

typedef struct {
    XID class;
    int length;
    XID id;
} XFeedbackState, XFeedbackControl;

the XKbdFeedbackState structure defines the attributes that are returned for feedbacks equivalent to those on the X keyboard ⌨️

typedef struct {
    XID class;
    int length;
    XID id;
    int click;
    int percent;
    int pitch;
    int duration;
    int led_mask;
    int global_auto_repeat;
    char auto_repeats[32];
} XKbdFeedbackState;

the XPtrFeedbackState structure defines the attributes that are returned for feedbacks equivalent to those on the the X pointer πŸ–±οΈ (yes it says "the the", i'm not fixing it, that's the source's little moment)

typedef struct {
    XID class;
    int length;
    XID id;
    int accelNum;
    int accelDenom;
    int threshold;
} XPtrFeedbackState;

the XIntegerFeedbackState structure defines attributes that are returned for integer feedbacks πŸ”’

typedef struct {
    XID class;
    int length;
    XID id;
    int resolution;
    int minVal;
    int maxVal;
} XIntegerFeedbackState;

the XStringFeedbackState structure defines the attributes that are returned for string feedbacks 🧡

typedef struct {
    XID class;
    int length;
    XID id;
    int max_symbols;
    int num_syms_supported;
    KeySym *syms_supported;
} XStringFeedbackState;

the XBellFeedbackState structure defines the attributes that are returned for bell feedbacks πŸ””

typedef struct {
    XID class;
    int length;
    XID id;
    int percent;
    int pitch;
    int duration;
} XBellFeedbackState;

the XLedFeedbackState structure defines the attributes that are returned for LED feedbacks πŸ’‘

typedef struct {
    XID class;
    int length;
    XID id;
    int led_values;
} XLedFeedbackState;

the XPrtFeedbackControl structure defines the attributes that can be controlled for pointer feedbacks ✨

typedef struct {
    XID class;
    int length;
    XID id;
    int accelNum;
    int accelDenom;
    int threshold;
} XPtrFeedbackControl;

the XKbdFeedbackControl structure defines the attributes that can be controlled for keyboard feedbacks βŒ¨οΈπŸ’–

typedef struct {
    XID class;
    int length;
    XID id;
    int click;
    int percent;
    int pitch;
    int duration;
    int led_mask;
    int led_value;
    int key;
    int auto_repeat_mode;
} XKbdFeedbackControl;

the XStringFeedbackControl structure defines the attributes that can be controlled for string feedbacks πŸŽ€

typedef struct {
    XID class;
    int length;
    XID id;
    int num_keysyms;
    KeySym  *syms_to_display;
} XStringFeedbackControl;

the XIntegerFeedbackControl structure defines the attributes that can be controlled for integer feedbacks 🌟

typedef struct {
    XID class;
    int length;
    XID id;
    int int_to_display;
} XIntegerFeedbackControl;

the XBellFeedbackControl structure defines the attributes that can be controlled for bell feedbacks πŸ””βœ¨

typedef struct {
    XID     class;
    int     length;
    XID     id;
    int     percent;
    int     pitch;
    int     duration;
} XBellFeedbackControl;

the XLedFeedbackControl structure defines the attributes that can be controlled for LED feedbacks πŸ’‘πŸ’…

typedef struct {
    XID     class;
    int     length;
    XID     id;
    int     led_mask;
    int     led_values;
} XLedFeedbackControl;

πŸ‘‘ DIAGNOSTICS πŸ‘‘

  • BadDevice β€” an invalid device was specified. the specified device does not exist, or it hasn't been opened by this client via XOpenInputDevice. this error may also occur if some other client has caused the specified device to become the X keyboard or X pointer device via the XChangeKeyboardDevice or XChangePointerDevice requests 😀
  • BadMatch β€” this error may occur if an XGetFeedbackControl request was made specifying a device that has no feedbacks, or an XChangeFeedbackControl request was made with an XFeedbackControl structure that contains an invalid feedback type. it may also occur if an invalid combination of mask bits is specified (DvKey but no DvAutoRepeatMode for keyboard feedbacks), or if an invalid KeySym is specified for a string feedback πŸ’€
  • BadValue β€” some numeric value falls outside the range of values accepted by the XChangeFeedbackControl request. unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. any argument defined as a set of alternatives can generate this error πŸ™ˆ
lowkey if you're seeing these errors, check your device, your mask bits, and your KeySyms before you spiral. you got this bestie 🫢

and that's the whole page!! this absolute banger of a man page is XGETFEEDBACKCONTROL(3), dated 05/18/2026 β€” so go forth and control those feedbacks, main character πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from