Reputation: 145
I'm attempting to retrieve the size of the root window via XCB, so as to create a window that size.
I can use xcb_get_geometry_reply()
to get the geometry, but how can I convert that to uint16_t
so that I can pass it to xcb_create_window()
(as width and height)?
Upvotes: 1
Views: 401
Reputation: 145
From this page:
Just like we can set various attributes of our windows, we can also ask the X server supply the current values of these attributes. For example, we can check where a window is located on the screen, what is its current size, whether it is mapped or not, etc. The structure that contains some of this information is
typedef struct {
uint8_t response_type;
uint8_t depth; /* depth of the window */
uint16_t sequence;
uint32_t length;
xcb_window_t root; /* Id of the root window *>
int16_t x; /* X coordinate of the window's location */
int16_t y; /* Y coordinate of the window's location */
uint16_t width; /* Width of the window */
uint16_t height; /* Height of the window */
uint16_t border_width; /* Width of the window's border */
} xcb_get_geometry_reply_t;
Therefore, the width/height simply be accessed with geomtry->width
and geomtry->height
Upvotes: 1