我正在尝试通过XCB检索根窗口的大小,以便创建该大小的窗口。
我可以使用xcb_get_geometry_reply()
获取几何,但是如何将其转换为uint16_t
数组,以便可以将其传递给xcb_create_window()
(作为宽度和高度)?
来自this page:
就像我们可以设置窗口的各种属性一样,我们也可以要求X服务器提供这些属性的当前值。例如,我们可以检查窗口在屏幕上的位置,窗口的当前大小,是否被映射等。包含某些信息的结构是
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;
因此,宽度/高度可以通过geomtry->width
和geomtry->height
简单访问