From e643d34ddce1c462749a5651031ba6982ba1c178 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 5 Mar 2009 03:33:15 +0100 Subject: [PATCH] Use unchecked versions for more speed --- src/handlers.c | 1 - src/layout.c | 8 ++------ src/xcb.c | 30 +++++++++++++----------------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/handlers.c b/src/handlers.c index 98a05379..36f4378b 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -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) diff --git a/src/layout.c b/src/layout.c index 0bf16f38..6a441e8c 100644 --- a/src/layout.c +++ b/src/layout.c @@ -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++; } } diff --git a/src/xcb.c b/src/xcb.c index 203ebc0b..5b426098 100644 --- a/src/xcb.c +++ b/src/xcb.c @@ -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"); - - 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"); - } + 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) + xcb_change_window_attributes(conn, result, XCB_CW_CURSOR, &cursor_id); /* Map the window (= make it visible) */ xcb_map_window(conn, result); -- 2.39.5