1xcb_get_geometry(3)              XCB Requests              xcb_get_geometry(3)
2
3
4

NAME

6       xcb_get_geometry - Get current window geometry
7

SYNOPSIS

9       #include <xcb/xproto.h>
10
11   Request function
12       xcb_get_geometry_cookie_t xcb_get_geometry(xcb_connection_t *conn,
13              xcb_drawable_t drawable);
14
15   Reply datastructure
16       typedef struct xcb_get_geometry_reply_t {
17           uint8_t      response_type;
18           uint8_t      depth;
19           uint16_t     sequence;
20           uint32_t     length;
21           xcb_window_t root;
22           int16_t      x;
23           int16_t      y;
24           uint16_t     width;
25           uint16_t     height;
26           uint16_t     border_width;
27           uint8_t      pad0[2];
28       } xcb_get_geometry_reply_t;
29
30   Reply function
31       xcb_get_geometry_reply_t
32              *xcb_get_geometry_reply(xcb_connection_t *conn,
33              xcb_get_geometry_cookie_t cookie, xcb_generic_error_t **e);
34

REQUEST ARGUMENTS

36       conn      The XCB connection to X11.
37
38       drawable  The drawable (Window or Pixmap) of which the geometry will be
39                 received.
40

REPLY FIELDS

42       response_type
43                 The type of this reply, in this case XCB_GET_GEOMETRY. This
44                 field is also present in the xcb_generic_reply_t and can be
45                 used to tell replies apart from each other.
46
47       sequence  The sequence number of the last request processed by the X11
48                 server.
49
50       length    The length of the reply, in words (a word is 4 bytes).
51
52       depth     The depth of the drawable (bits per pixel for the object).
53
54       root      Root window of the screen containing drawable.
55
56       x         The X coordinate of drawable. If drawable is a window, the
57                 coordinate specifies the upper-left outer corner relative to
58                 its parent's origin. If drawable is a pixmap, the X coordi‐
59                 nate is always 0.
60
61       y         The Y coordinate of drawable. If drawable is a window, the
62                 coordinate specifies the upper-left outer corner relative to
63                 its parent's origin. If drawable is a pixmap, the Y coordi‐
64                 nate is always 0.
65
66       width     The width of drawable.
67
68       height    The height of drawable.
69
70       border_width
71                 The border width (in pixels).
72

DESCRIPTION

74       Gets the current geometry of the specified drawable (either Window or
75       Pixmap).
76

RETURN VALUE

78       Returns an xcb_get_geometry_cookie_t. Errors have to be handled when
79       calling the reply function xcb_get_geometry_reply.
80
81       If you want to handle errors in the event loop instead, use xcb_get_ge‐
82       ometry_unchecked. See xcb-requests(3) for details.
83

ERRORS

85       xcb_drawable_error_t
86                 TODO: reasons?
87
88       xcb_window_error_t
89                 TODO: reasons?
90

EXAMPLE

92       /*
93        * Displays the x and y position of the given window.
94        *
95        */
96       void my_example(xcb_connection_t *c, xcb_window_t window) {
97           xcb_get_geometry_cookie_t cookie;
98           xcb_get_geometry_reply_t *reply;
99
100           cookie = xcb_get_geometry(c, window);
101           /* ... do other work here if possible ... */
102           if ((reply = xcb_get_geometry_reply(c, cookie, NULL))) {
103               printf("This window is at %d, %d\n", reply->x, reply->y);
104           }
105           free(reply);
106       }
107

SEE ALSO

109       xcb-requests(3), xcb-examples(3), xwininfo(1)
110

AUTHOR

112       Generated from xproto.xml. Contact xcb@lists.freedesktop.org for cor‐
113       rections and improvements.
114
115
116
117X Version 11                     libxcb 1.13.1             xcb_get_geometry(3)
Impressum