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

@ -501,7 +501,6 @@ int handle_windowname_change(void *data, xcb_connection_t *conn, uint8_t state,
*
*/
int handle_expose_event(void *data, xcb_connection_t *conn, xcb_expose_event_t *event) {
printf("got expose_event\n");
/* event->count is the number of minimum remaining expose events for this window, so we
skip all events but the last one */
if (event->count != 0)

View File

@ -154,9 +154,7 @@ void decorate_window(xcb_connection_t *conn, Client *client, xcb_drawable_t draw
/* TODO: utf8? */
char *label;
asprintf(&label, "%.*s", client->name_len, client->name);
xcb_void_cookie_t text_cookie = xcb_image_text_8_checked(conn, strlen(label), drawable,
gc, 3 /* X */, offset + font->height /* Y = baseline of font */, label);
check_error(conn, text_cookie, "Could not draw client's title");
xcb_image_text_8(conn, strlen(label), drawable, gc, 3 /* X */, offset + font->height /* Y = baseline of font */, label);
free(label);
}
@ -391,10 +389,8 @@ static void render_internal_bar(xcb_connection_t *conn, Workspace *r_ws, int wid
snprintf(label, sizeof(label), "%d", c+1);
xcb_change_gc_single(conn, screen->bargc, XCB_GC_FOREGROUND, text_color[set]);
xcb_change_gc_single(conn, screen->bargc, XCB_GC_BACKGROUND, background_color[set]);
xcb_void_cookie_t text_cookie = xcb_image_text_8_checked(conn, strlen(label), screen->bar,
screen->bargc, drawn * height + 5 /* X */,
xcb_image_text_8(conn, strlen(label), screen->bar, screen->bargc, drawn * height + 5 /* X */,
font->height + 1 /* Y = baseline of font */, label);
check_error(conn, text_cookie, "Could not draw workspace title");
drawn++;
}
}

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);