pub fn get_geometry<Conn>(
conn: &Conn,
drawable: Drawable,
) -> Result<Cookie<'_, Conn, GetGeometryReply>, ConnectionError>where
Conn: RequestConnection + ?Sized,
Expand description
Get current window geometry.
Gets the current geometry of the specified drawable (either Window
or Pixmap
).
§Fields
drawable
- The drawable (Window
orPixmap
) of which the geometry will be received.
§Errors
Drawable
- TODO: reasons?Window
- TODO: reasons?
§See
xwininfo
: program
§Example
/*
* Displays the x and y position of the given window.
*
*/
void my_example(xcb_connection_t *c, xcb_window_t window) {
xcb_get_geometry_cookie_t cookie;
xcb_get_geometry_reply_t *reply;
cookie = xcb_get_geometry(c, window);
/* ... do other work here if possible ... */
if ((reply = xcb_get_geometry_reply(c, cookie, NULL))) {
printf("This window is at %d, %d\\n", reply->x, reply->y);
}
free(reply);
}