Use unchecked versions for more speed

This commit is contained in:
Michael Stapelberg
2009-03-05 03:33:15 +01:00
parent 56393c823e
commit e643d34ddc
3 changed files with 14 additions and 23 deletions

View File

@ -120,7 +120,6 @@ xcb_window_t create_window(xcb_connection_t *conn, Rect dims, uint16_t window_cl
xcb_window_t root = xcb_setup_roots_iterator(xcb_get_setup(conn)).data->root;
xcb_window_t result = xcb_generate_id(conn);
xcb_cursor_t cursor_id = xcb_generate_id(conn);
xcb_void_cookie_t cookie;
/* If the window class is XCB_WINDOW_CLASS_INPUT_ONLY, depth has to be 0 */
uint16_t depth = (window_class == XCB_WINDOW_CLASS_INPUT_ONLY ? 0 : XCB_COPY_FROM_PARENT);
@ -133,22 +132,19 @@ xcb_window_t create_window(xcb_connection_t *conn, Rect dims, uint16_t window_cl
0, 0, 0, 65535, 65535, 65535);
}
cookie = xcb_create_window_checked(conn,
depth,
result, /* the window id */
root, /* parent == root */
dims.x, dims.y, dims.width, dims.height, /* dimensions */
0, /* border = 0, we draw our own */
window_class,
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */
mask,
values);
check_error(conn, cookie, "Could not create window");
xcb_create_window(conn,
depth,
result, /* the window id */
root, /* parent == root */
dims.x, dims.y, dims.width, dims.height, /* dimensions */
0, /* border = 0, we draw our own */
window_class,
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */
mask,
values);
if (cursor > -1) {
cookie = xcb_change_window_attributes_checked(conn, result, XCB_CW_CURSOR, &cursor_id);
check_error(conn, cookie, "Could not change window attributes");
}
if (cursor > -1)
xcb_change_window_attributes(conn, result, XCB_CW_CURSOR, &cursor_id);
/* Map the window (= make it visible) */
xcb_map_window(conn, result);