XIWARPPOINTER(3)
π XIWARPPOINTER π
okay bestie, sit down, because today we're talking about XIWarpPointer β she moves a device's pointer, and she does it with main character energy. β¨ This is a page from the X11 manual, section 3 (that's the library-functions section, iykyk), and we're gonna go through every single bit of her. no skipping. periodt. π
β¨ NAME β¨
XIWarpPointer β move a device's pointer. literally what it says on the tin, no plot twist π¦
πΈ SYNOPSIS πΈ
first things first, you gotta include the header, bestie:
#include <X11/extensions/XInput2.h>
then here's the whole function, character for character, don't you dare typo it:
Bool XIWarpPointer( Display *display,
int deviceid,
Window src_w,
Window dest_w,
double src_x,
double src_y,
int src_width,
int src_height,
double dest_x,
double dest_y);
and now the β¨cast of charactersβ¨ (aka what every argument means):
dest_wβ the destination window, orNone. she's the one deciding where we're going πdest_x,dest_yβ the x and y coordinates within the destination window. the exact spot. the coordinates of destiny πdeviceidβ which device we're moving: a master pointer device, or a floating slave device. pick your girl πdisplayβ the connection to the X server. the phone line to the mothership, fr fr πsrc_x,src_y,src_width,src_heightβ these four describe a rectangle in the source window. it's giving "you must be at least this tall to ride" π’src_wβ the source window, orNoneπ
π« DESCRIPTION π«
so here's the tea. if dest_w is None, then XIWarpPointer moves the pointer by the offsets (dest_x, dest_y) relative to the current position of the pointer. like, scoot over a lil bit, bestie. π
but if dest_w is a window? then XIWarpPointer moves the pointer to the offsets (dest_x, dest_y) relative to the origin of dest_w. different anchor point, different vibe. β
HOWEVER. plot twist. π if src_w is a window, the move only takes place if:
- the window
src_wcontains the pointer, AND - the specified rectangle of
src_wcontains the pointer.
both conditions, babes. no exceptions. it's giving bouncer at the club π
now about those coordinates β src_x and src_y are relative to the origin of src_w. and there's a lil auto-fill situation:
- if
src_heightis zero, it gets replaced with the current height ofsrc_wminussrc_y. - if
src_widthis zero, it gets replaced with the current width ofsrc_wminussrc_x.
so zero doesn't mean zero here, it means "you finish the math for me, bestie" β¨
ok now the part where I have to be a responsible friend: there is seldom any reason for calling this function. the pointer should normally be left to the user. that's not me being dramatic, that's literally in the docs. hands off the mouse, girl, let the user drive π
but if you do use it, know this: it generates events just as if the user had instantaneously moved the pointer from one position to another. so all your event listeners are gonna wake up like "who moved??" π
and here's a big one: you cannot use XIWarpPointer to move the pointer outside the confine_to window of an active pointer grab. if you try, it'll only move the pointer as far as the closest edge of the confine_to window. like walking into a wall. the wall wins. π§±
also, in case you were wondering about her cousin: XIWarpPointer is identical to XWarpPointer but specifies the device explicitly. same girl, but she names names. π«Ά
and finally β XIWarpPointer can generate a BadDevice and a BadWindow error. foreshadowing. keep reading. π
π₯ DIAGNOSTICS π₯
π BadDevice
an invalid device was specified. the device does not exist, or it's not a pointer device. so either she's not real, or she's not the right kind of girl for this job. tragic. π
π BadWindow
a value for a Window argument does not name a defined window. you pointed at a window that isn't there. ghost window. spooky. π»
π¦ SEE ALSO π¦
XWarpPointer(3)β the original, the blueprint, the mother of invention π
that's the whole page, bestie, every flag, every coordinate, every error, all of it. π this was XIWARPPOINTER(3) from the X11 manual, dated 05/18/2026 β go forth and warp responsibly, and remember: the pointer belongs to the user, not to you. slay. π
β¨π
π¦ where this page comes from
- fedora 44: libXi-devel 1.8.3-1.fc44 Β· MIT-open-group AND SMLNJ AND MIT
- fedora 44: libXi-devel 1.8.3-1.fc44 Β· MIT-open-group AND SMLNJ AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms