XICHANGEHIERARCHY(3)

πŸ’– XICHANGEHIERARCHY(3) πŸ’–

ok so bestie, welcome to the XICHANGEHIERARCHY page, section 3 of the manual. this is the one where you get to rearrange the whole device hierarchy like you're redecorating your room at 2am. let's get into it πŸŽ€


✨ NAME ✨

XIChangeHierarchy β€” change the device hierarchy. yes literally just that. iconic behaviour honestly πŸ’…


🌸 SYNOPSIS 🌸

#include <X11/extensions/XInput2.h>

Status XIChangeHierarchy( Display *display,
                          XIAnyHierarchyChangeInfo *changes,
                          int num_changes);
  • display β€” the connection to the X server. your lil phone line to the server, basically 🫢
  • num_changes β€” how many elements are chillin' in changes. count them bestie, don't guess.
  • changes β€” the actual changes you wanna make. the to-do list πŸ“

πŸ¦‹ DESCRIPTION πŸ¦‹

so XIChangeHierarchy modifies the device hierarchy by creating or removing master devices, or by changing the attachment of slave devices. glow-up for your input devices fr fr ✨

if num_changes is non-zero, changes is an array of XIAnyHierarchyChangeInfo structures. if num_changes is equal or less than zero, XIChangeHierarchy does nothing. literally nothing. it's giving "i'm not doing this today" πŸ’€

XIChangeHierarchy processes changes in order, effective immediately. if an error occurs, processing is aborted and the error is reported to the client. and here's the part you need to clock: changes already made remain effective. no takebacks, no undo, no ctrl+z 😭

the list of changes is any combination of XIAnyHierarchyChangeInfo. the type of a hierarchy change can be XIAddMaster, XIRemoveMaster, XIAttachSlave or XIDetachSlave. pick your fighter πŸŽ€

typedef union {
    int type;
    XIAddMasterInfo add;
    XIRemoveMasterInfo remove;
    XIAttachSlave attach;
    XIDetachSlave detach;
} XIAnyHierarchyChangeInfo;
typedef struct {
    int type; /* XIAddMaster */
    char* name;
    Bool send_core;
    Bool enable;
} XIAddMasterInfo;
typedef struct {
    int type; /* XIRemoveMaster */
    int deviceid;
    int return_mode;
    int return_pointer;
    int return_keyboard;
} XIRemoveMasterInfo;
typedef struct {
    int type; /* XIAttachSlave */
    int deviceid;
    int new_master;
} XIAttachSlaveInfo;
typedef struct {
    int type; /* XIDetachSlave */
    int deviceid;
} XIDetachSlaveInfo;

πŸ‘‘ the changes, one by one πŸ‘‘

XIAddMasterInfo creates a new master pointer and a new master keyboard, labeled "name pointer" and "name keyboard" respectively. if sendCore is True, the devices will send core events. if enable is True, the device is enabled immediately. new master just dropped, main character energy fr πŸ¦‹

XIAddMasterInfo can generate a BadValue error.

XIRemoveMasterInfo removes device and its paired master device. if returnMode is XIAttachToMaster, all pointers attached to device or its paired master device are attached to returnPointer. likewise, all keyboards are attached to returnKeyboard. if returnMode is XIFloating, all attached devices are set to floating. everyone's getting reassigned, it's giving ✨group project✨

XIRemoveMasterInfo can generate a BadValue and a BadDevice error.

XIAttachSlaveInfo attaches device to new_master. if the device is currently attached to a master device, it is detached from the master device and attached to the new master device. it's a soft launch, then a hard launch πŸ’…

XIAttachSlaveInfo can generate a BadDevice error.

XIDetachSlaveInfo detaches device from the current master device and sets it floating. if the device is already floating, no changes are made. it's already free bestie, leave it alone 😌

XIDetachSlaveInfo can generate a BadDevice error.

XIChangeHierarchy generates an XIHierarchyEvent if any modifications were successful. we love a success notification πŸŽ‰


πŸ’€ DIAGNOSTICS πŸ’€

  • BadDevice β€” an invalid device was specified. the device does not exist, or is not appropriate for the type of change. wrong device, wrong vibe, blocked 🚫
  • BadValue β€” some numeric value falls out of the allowed range. the number said "no ❀️" and honestly same.

ok that's the whole page bestie, you're officially fluent in hierarchy changes. go forth and rearrange your devices, but remember: changes already made remain effective, so maybe think before you click πŸ™ˆ

this was page XICHANGEHIERARCHY(3), dated 05/18/2026, and it's giving XICHANGEHIERARCHY(3) energy from start to finish. mwah, slay, periodt πŸ’–πŸŽ€πŸ«Ά

πŸ“¦ where this page comes from