XQueryPointer(3)

πŸ’– XQueryPointer(3) πŸ’– β€” get pointer coordinates

okay so this lil icon is from XLIB FUNCTIONS, and it’s literally the β€œwhere is the pointer rn?” function. bestie, we’re getting coordinates, windows, and modifier/button state all in one go ✨


✨ SYNTAX ✨

Bool XQueryPointer(Display *display, Window w, Window *root_return,
       Window *child_return, int *root_x_return, int *root_y_return, int
       *win_x_return, int *win_y_return, unsigned int *mask_return);

πŸŽ€ ARGUMENTS πŸŽ€

  • child_return β€” Returns the child window that the pointer is located in, if any. πŸ’…
  • display β€” Specifies the connection to the X server.
  • mask_return β€” Returns the current state of the modifier keys and pointer buttons.
  • root_return β€” Returns the root window that the pointer is in.
  • root_x_return, root_y_return β€” Return the pointer coordinates relative to the root window’s origin.
  • w β€” Specifies the window.
  • win_x_return, win_y_return β€” Return the pointer coordinates relative to the specified window.

πŸ¦‹ DESCRIPTION πŸ¦‹

So XQueryPointer returns the root window the pointer is logically on, plus the pointer coordinates relative to the root window’s origin. iconic behavior, no cap 🌈

If XQueryPointer returns False, the pointer is not on the same screen as the specified window, and XQueryPointer returns None to child_return and zero to win_x_return and win_y_return. 😭

If XQueryPointer returns True, the pointer coordinates returned to win_x_return and win_y_return are relative to the origin of the specified window. In this case, XQueryPointer returns the child that contains the pointer, if any, or else None to child_return. slay πŸ’–

XQueryPointer returns the current logical state of the keyboard buttons and the modifier keys in mask_return. It sets mask_return to the bitwise inclusive OR of one or more of the button or modifier key bitmasks to match the current state of the mouse buttons and the modifier keys. periodt πŸ‘‘

XQueryPointer can generate a BadWindow error.


πŸ’€ DIAGNOSTICS πŸ’€

  • BadWindow β€” A value for a Window argument does not name a defined Window.
bestie pls make sure that Window is actually defined, or this error is gonna vibe-check you πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€


okay bye bestie! this page is signing off from X Version 11, libX11 1.8.14, and yes, the footer also says XQueryPointer(3) β€” we been knew πŸ’…πŸ«Ά

πŸ“¦ where this page comes from