NAME
xcbgetgeometry - Get current window geometry SYNOPSIS
#include
Request function xcbgetgeometrycookiet xcbgetgeometry(xcbconnectiont *conn, xcbdrawablet drawable); Reply datastructure typedef struct xcbgetgeometryreplyt { uint8t responsetype; uint8t depth; uint16t sequence; uint32t length; xcbwindowt root; int16t x; int16t y; uint16t width; uint16t height; uint16t borderwidth; uint8t pad0[2]; } xcbgetgeometryreplyt; Reply function xcbgetgeometryreplyt *xcbgetgeometryreply(xcbconnectiont *conn, xcbgetgeometrycookiet cookie, xcbgenericerrort **e); REQUEST ARGUMENTS conn The XCB connection to X11. drawable The drawable (Window or Pixmap) of which the geometry will be received. REPLY FIELDS responsetype The type of this reply, in this case XCBGETGEOMETRY. This field is also present in the xcbgenericreplyt and can be used to tell replies apart from each other. sequence The sequence number of the last request processed by the X11 server. length The length of the reply, in words (a word is 4 bytes). depth The depth of the drawable (bits per pixel for the object). root Root window of the screen containing drawable. x The X coordinate of drawable. If drawable is a window, the coordinate specifies the upper-left outer corner relative to its parent's origin. If drawable is a pixmap, the X coordi‐ nate is always 0. y The Y coordinate of drawable. If drawable is a window, the
coordinate specifies the upper-left outer corner relative to its parent's origin. If drawable is a pixmap, the Y coordi‐ nate is always 0. width The width of drawable. height The height of drawable. borderwidth The border width (in pixels). DESCRIPTION Gets the current geometry of the specified drawable (either Window or Pixmap). RETURN VALUE Returns an xcbgetgeometrycookiet. Errors have to be handled when calling the reply function xcbgetgeometryreply. If you want to handle errors in the event loop instead, use xcbgetge‐
ometryunchecked. See xcb-requests(3) for details. ERRORS xcbdrawableerrort TODO: reasons? xcbwindowerrort TODO: reasons? EXAMPLE /* * Displays the x and y position of the given window. * */ void myexample(xcbconnectiont *c, xcbwindowt window) { xcbgetgeometrycookiet cookie; xcbgetgeometryreplyt *reply; cookie = xcbgetgeometry(c, window); /* ... do other work here if possible ... */ if ((reply = xcbgetgeometryreply(c, cookie, NULL))) {
printf("This window is at %d, %d\n", reply->x, reply->y); } free(reply); } SEE ALSO
xcb-requests(3), xcb-examples(3), xwininfo(1) AUTHOR Generated from xproto.xml. Contact xcb@lists.freedesktop.org for cor‐ rections and improvements. X Version 11 libxcb 1.13 xcbgetgeometry(3)