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, or None. 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, or None 🌈

πŸ’« 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_w contains the pointer, AND
  • the specified rectangle of src_w contains 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_height is zero, it gets replaced with the current height of src_w minus src_y.
  • if src_width is zero, it gets replaced with the current width of src_w minus src_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