From 193a73c5d9cec6309458d206d6e46ef175c2bc70 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine Date: Tue, 12 Aug 2008 14:53:57 +0200 Subject: [PATCH] draw: make xcolor_init() asynchronous. --- awesome.c | 16 ++++- client.c | 6 +- common/draw.c | 140 ++++++++++++++++++++++++++++-------------- common/draw.h | 19 +++++- lua.c | 18 ++++-- statusbar.c | 30 ++++++--- titlebar.c | 43 +++++++++---- widgets/graph.c | 37 ++++++++--- widgets/progressbar.c | 41 +++++++++---- 9 files changed, 253 insertions(+), 97 deletions(-) diff --git a/awesome.c b/awesome.c index 3f9360187..d1f4042db 100644 --- a/awesome.c +++ b/awesome.c @@ -277,7 +277,8 @@ int main(int argc, char **argv) { const char *confpath = NULL; - int xfd, i, screen_nbr, opt; + int xfd, i, screen_nbr, opt, colors_nbr; + xcolor_init_request_t colors_reqs[2]; ssize_t cmdlen = 1; client_t *c; static struct option long_options[] = @@ -406,9 +407,15 @@ main(int argc, char **argv) } /* init default font and colors */ + colors_reqs[0] = xcolor_init_unchecked(globalconf.connection, &globalconf.colors.fg, + globalconf.default_screen, "black", + sizeof("black")-1); + + colors_reqs[1] = xcolor_init_unchecked(globalconf.connection, &globalconf.colors.bg, + globalconf.default_screen, "white", + sizeof("white")-1); + globalconf.font = draw_font_new(globalconf.connection, globalconf.default_screen, "sans 8"); - xcolor_init(&globalconf.colors.fg, globalconf.connection, globalconf.default_screen, "black", sizeof("black")-1); - xcolor_init(&globalconf.colors.bg, globalconf.connection, globalconf.default_screen, "white", sizeof("white")-1); /* init cursors */ globalconf.cursor[CurNormal] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_LEFT_PTR); @@ -421,6 +428,9 @@ main(int argc, char **argv) globalconf.cursor[CurBotRight] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_BOTTOM_RIGHT_CORNER); globalconf.cursor[CurBotLeft] = xutil_cursor_new(globalconf.connection, XUTIL_CURSOR_BOTTOM_LEFT_CORNER); + for(colors_nbr = 0; colors_nbr < 2; colors_nbr++) + xcolor_init_reply(globalconf.connection, colors_reqs[colors_nbr]); + /* init lua */ luaA_init(); diff --git a/client.c b/client.c index 0630ad541..d7f82a136 100644 --- a/client.c +++ b/client.c @@ -1128,7 +1128,11 @@ luaA_client_newindex(lua_State *L) break; case A_TK_BORDER_COLOR: if((buf = luaL_checklstring(L, 3, &len)) - && xcolor_init(&(*c)->border_color, globalconf.connection, (*c)->phys_screen, buf, len)) + && xcolor_init_reply(globalconf.connection, + xcolor_init_unchecked(globalconf.connection, + &(*c)->border_color, + (*c)->phys_screen, buf, + len))) xcb_change_window_attributes(globalconf.connection, (*c)->win, XCB_CW_BORDER_PIXEL, &(*c)->border_color.pixel); break; diff --git a/common/draw.c b/common/draw.c index b21173521..fe1946649 100644 --- a/common/draw.c +++ b/common/draw.c @@ -219,6 +219,9 @@ draw_markup_on_element(markup_parser_data_t *p, const char *elem, { draw_parser_data_t *data = p->priv; + xcolor_init_request_t reqs[3]; + int8_t i, bg_color_nbr = -1, reqs_nbr = -1; + /* hack: markup.c validates tags so we can avoid strcmps here */ switch (*elem) { case 'b': @@ -227,11 +230,13 @@ draw_markup_on_element(markup_parser_data_t *p, const char *elem, switch(a_tokenize(*names, -1)) { case A_TK_COLOR: - data->has_bg_color = xcolor_init(&data->bg_color, - data->connection, - data->phys_screen, - *values, - a_strlen(*values)); + reqs[++reqs_nbr] = xcolor_init_unchecked(data->connection, + &data->bg_color, + data->phys_screen, + *values, + a_strlen(*values)); + + bg_color_nbr = reqs_nbr; break; case A_TK_IMAGE: if(data->bg_image) @@ -251,8 +256,11 @@ draw_markup_on_element(markup_parser_data_t *p, const char *elem, switch(a_tokenize(*names, -1)) { case A_TK_COLOR: - xcolor_init(&data->border.color, data->connection, - data->phys_screen, *values, a_strlen(*values)); + reqs[++reqs_nbr] = xcolor_init_unchecked(data->connection, + &data->border.color, + data->phys_screen, + *values, + a_strlen(*values)); break; case A_TK_WIDTH: data->border.width = atoi(*values); @@ -269,8 +277,11 @@ draw_markup_on_element(markup_parser_data_t *p, const char *elem, data->align = draw_align_fromstr(*values, -1); break; case A_TK_SHADOW: - xcolor_init(&data->shadow.color, data->connection, - data->phys_screen, *values, a_strlen(*values)); + reqs[++reqs_nbr] = xcolor_init_unchecked(data->connection, + &data->shadow.color, + data->phys_screen, + *values, + a_strlen(*values)); break; case A_TK_SHADOW_OFFSET: data->shadow.offset = atoi(*values); @@ -294,6 +305,12 @@ draw_markup_on_element(markup_parser_data_t *p, const char *elem, } break; } + + for(i = 0; i <= reqs_nbr; i++) + if(i == bg_color_nbr) + data->has_bg_color = xcolor_init_reply(data->connection, reqs[i]); + else + xcolor_init_reply(data->connection, reqs[i]); } bool @@ -1084,29 +1101,36 @@ draw_align_tostr(alignment_t a) #define RGB_COLOR_8_TO_16(i) (65535 * ((i) & 0xff) / 255) -/** Initialize an X color. - * \param color xcolor_t struct to store color into. +/** Send a request to initialize a X color. * \param conn Connection ref. + * \param color xcolor_t struct to store color into. * \param phys_screen Physical screen number. * \param colstr Color specification. - * \return True if color allocation was successfull. + * \return request informations. */ -bool -xcolor_init(xcolor_t *color, xcb_connection_t *conn, int phys_screen, - const char *colstr, ssize_t len) +xcolor_init_request_t +xcolor_init_unchecked(xcb_connection_t *conn, xcolor_t *color, int phys_screen, + const char *colstr, ssize_t len) { xcb_screen_t *s = xutil_screen_get(conn, phys_screen); + xcolor_init_request_t req; unsigned long colnum; - uint16_t red, green, blue, alpha = 0xffff; + uint16_t red, green, blue; + + p_clear(&req, 1); if(!len) - return false; + { + req.has_error = true; + return req; + } + + req.alpha = 0xffff; + req.color = color; /* The color is given in RGB value */ if(colstr[0] == '#') { - xcb_alloc_color_cookie_t cookie; - xcb_alloc_color_reply_t *hexa_color; char *p; if(len == 7) @@ -1121,60 +1145,84 @@ xcolor_init(xcolor_t *color, xcb_connection_t *conn, int phys_screen, colnum = strtoul(colstr + 1, &p, 16); if(p - colstr != 9) goto invalid; - alpha = RGB_COLOR_8_TO_16(colnum); + req.alpha = RGB_COLOR_8_TO_16(colnum); colnum >>= 8; } else { invalid: warn("awesome: error, invalid color '%s'", colstr); - return false; + req.has_error = true; + return req; } red = RGB_COLOR_8_TO_16(colnum >> 16); green = RGB_COLOR_8_TO_16(colnum >> 8); blue = RGB_COLOR_8_TO_16(colnum); - cookie = xcb_alloc_color_unchecked(conn, s->default_colormap, - red, green, blue), - hexa_color = xcb_alloc_color_reply(conn, cookie, NULL); + req.is_hexa = true; + req.cookie_hexa = xcb_alloc_color_unchecked(conn, s->default_colormap, + red, green, blue); + } + else + { + req.is_hexa = false; + req.cookie_named = xcb_alloc_named_color_unchecked(conn, s->default_colormap, len, + colstr); + } - if(hexa_color) + req.has_error = false; + req.colstr = colstr; + + return req; +} + +/** Initialize a X color. + * \param conn Connection ref. + * \param req xcolor_init request. + * \return True if color allocation was successfull. + */ +bool +xcolor_init_reply(xcb_connection_t *conn, + xcolor_init_request_t req) +{ + if(req.has_error) + return false; + + if(req.is_hexa) + { + xcb_alloc_color_reply_t *hexa_color; + + if((hexa_color = xcb_alloc_color_reply(conn, req.cookie_hexa, NULL))) { - color->pixel = hexa_color->pixel; - color->red = hexa_color->red; - color->green = hexa_color->green; - color->blue = hexa_color->blue; - color->alpha = alpha; - color->initialized = true; + req.color->pixel = hexa_color->pixel; + req.color->red = hexa_color->red; + req.color->green = hexa_color->green; + req.color->blue = hexa_color->blue; + req.color->alpha = req.alpha; + req.color->initialized = true; p_delete(&hexa_color); return true; } } else { - xcb_alloc_named_color_reply_t *named_color = NULL; - xcb_alloc_named_color_cookie_t cookie; + xcb_alloc_named_color_reply_t *named_color; - cookie = xcb_alloc_named_color_unchecked(conn, s->default_colormap, len, - colstr), - named_color = xcb_alloc_named_color_reply(conn, cookie, NULL); - - if(named_color) + if((named_color = xcb_alloc_named_color_reply(conn, req.cookie_named, NULL))) { - color->pixel = named_color->pixel; - color->red = named_color->visual_red; - color->green = named_color->visual_green; - color->blue = named_color->visual_blue; - color->alpha = 0xffff; - color->alpha = alpha; - color->initialized = true; + req.color->pixel = named_color->pixel; + req.color->red = named_color->visual_red; + req.color->green = named_color->visual_green; + req.color->blue = named_color->visual_blue; + req.color->alpha = req.alpha; + req.color->initialized = true; p_delete(&named_color); return true; } } - warn("awesome: error, cannot allocate color '%s'", colstr); + warn("awesome: error, cannot allocate color '%s'", req.colstr); return false; } diff --git a/common/draw.h b/common/draw.h index 99af158e1..dd0a43080 100644 --- a/common/draw.h +++ b/common/draw.h @@ -220,7 +220,24 @@ area_t draw_text_extents(xcb_connection_t *, int, font_t *, const char *, ssize_ alignment_t draw_align_fromstr(const char *, ssize_t); const char *draw_align_tostr(alignment_t); -bool xcolor_init(xcolor_t *c, xcb_connection_t *, int, const char *, ssize_t); +typedef struct +{ + union + { + xcb_alloc_color_cookie_t cookie_hexa; + xcb_alloc_named_color_cookie_t cookie_named; + }; + + uint16_t alpha; + xcolor_t *color; + bool is_hexa, has_error; + const char *colstr; +} xcolor_init_request_t; + +xcolor_init_request_t xcolor_init_unchecked(xcb_connection_t *, xcolor_t *, int, + const char *, ssize_t); + +bool xcolor_init_reply(xcb_connection_t *, xcolor_init_request_t); void area_array_remove(area_array_t *, area_t); diff --git a/lua.c b/lua.c index 037901244..b00acd202 100644 --- a/lua.c +++ b/lua.c @@ -279,16 +279,26 @@ luaA_colors_set(lua_State *L) { const char *buf; size_t len; + int8_t colors_nbr = -1, i; + xcolor_init_request_t reqs[2]; luaA_checktable(L, 1); if((buf = luaA_getopt_lstring(L, 1, "fg", NULL, &len))) - xcolor_init(&globalconf.colors.fg, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++colors_nbr] = xcolor_init_unchecked(globalconf.connection, + &globalconf.colors.fg, + globalconf.default_screen, + buf, len); if((buf = luaA_getopt_lstring(L, 1, "bg", NULL, &len))) - xcolor_init(&globalconf.colors.bg, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++colors_nbr] = xcolor_init_unchecked(globalconf.connection, + &globalconf.colors.bg, + globalconf.default_screen, + buf, len); + + for(i = 0; i <= colors_nbr; i++) + xcolor_init_reply(globalconf.connection, reqs[i]); + return 0; } diff --git a/statusbar.c b/statusbar.c index 97d0f18fc..92b6b1fac 100644 --- a/statusbar.c +++ b/statusbar.c @@ -436,6 +436,8 @@ luaA_statusbar_new(lua_State *L) statusbar_t *sb; const char *buf; size_t len; + xcolor_init_request_t reqs[2]; + int8_t i, reqs_nbr = -1; luaA_checktable(L, 2); @@ -448,13 +450,17 @@ luaA_statusbar_new(lua_State *L) sb->colors.fg = globalconf.colors.fg; if((buf = luaA_getopt_lstring(L, 2, "fg", NULL, &len))) - xcolor_init(&sb->colors.fg, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &sb->colors.fg, + globalconf.default_screen, + buf, len); sb->colors.bg = globalconf.colors.bg; if((buf = luaA_getopt_lstring(L, 2, "bg", NULL, &len))) - xcolor_init(&sb->colors.bg, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &sb->colors.bg, + globalconf.default_screen, + buf, len); buf = luaA_getopt_lstring(L, 2, "align", "left", &len); sb->align = draw_align_fromstr(buf, len); @@ -472,6 +478,9 @@ luaA_statusbar_new(lua_State *L) sb->screen = SCREEN_UNDEF; + for(i = 0; i <= reqs_nbr; i++) + xcolor_init_reply(globalconf.connection, reqs[i]); + return luaA_statusbar_userdata_new(L, sb); } @@ -615,8 +624,11 @@ luaA_statusbar_newindex(lua_State *L) break; case A_TK_FG: if((buf = luaL_checklstring(L, 3, &len))) - if(xcolor_init(&(*statusbar)->colors.fg, globalconf.connection, - globalconf.default_screen, buf, len)) + if(xcolor_init_reply(globalconf.connection, + xcolor_init_unchecked(globalconf.connection, + &(*statusbar)->colors.fg, + globalconf.default_screen, + buf, len))) { if((*statusbar)->ctx) (*statusbar)->ctx->fg = (*statusbar)->colors.fg; @@ -625,8 +637,10 @@ luaA_statusbar_newindex(lua_State *L) break; case A_TK_BG: if((buf = luaL_checklstring(L, 3, &len))) - if(xcolor_init(&(*statusbar)->colors.bg, globalconf.connection, - globalconf.default_screen, buf, len)) + if(xcolor_init_reply(globalconf.connection, + xcolor_init_unchecked(globalconf.connection, + &(*statusbar)->colors.bg, + globalconf.default_screen, buf, len))) { if((*statusbar)->ctx) (*statusbar)->ctx->bg = (*statusbar)->colors.bg; diff --git a/titlebar.c b/titlebar.c index 3cf2ca4ca..976fd0dae 100644 --- a/titlebar.c +++ b/titlebar.c @@ -312,6 +312,8 @@ luaA_titlebar_new(lua_State *L) titlebar_t *tb; const char *buf; size_t len; + xcolor_init_request_t reqs[3]; + int8_t i, reqs_nbr = -1; luaA_checktable(L, 2); @@ -331,21 +333,30 @@ luaA_titlebar_new(lua_State *L) tb->colors.fg = globalconf.colors.fg; if((buf = luaA_getopt_lstring(L, 2, "fg", NULL, &len))) - xcolor_init(&tb->colors.fg, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &tb->colors.fg, + globalconf.default_screen, + buf, len); tb->colors.bg = globalconf.colors.bg; if((buf = luaA_getopt_lstring(L, 2, "bg", NULL, &len))) - xcolor_init(&tb->colors.bg, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &tb->colors.bg, + globalconf.default_screen, + buf, len); tb->border.color = globalconf.colors.fg; if((buf = luaA_getopt_lstring(L, 2, "border_color", NULL, &len))) - xcolor_init(&tb->border.color, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &tb->border.color, + globalconf.default_screen, + buf, len); tb->border.width = luaA_getopt_number(L, 2, "border_width", 0); + for(i = 0; i <= reqs_nbr; i++) + xcolor_init_reply(globalconf.connection, reqs[i]); + return luaA_titlebar_userdata_new(globalconf.L, tb); } @@ -411,22 +422,30 @@ luaA_titlebar_newindex(lua_State *L) break; case A_TK_BORDER_COLOR: if((buf = luaL_checklstring(L, 3, &len))) - if(xcolor_init(&(*titlebar)->border.color, globalconf.connection, - globalconf.default_screen, buf, len)) + if(xcolor_init_reply(globalconf.connection, + xcolor_init_unchecked(globalconf.connection, + &(*titlebar)->border.color, + globalconf.default_screen, buf, len))) if((*titlebar)->sw) xcb_change_window_attributes(globalconf.connection, (*titlebar)->sw->window, XCB_CW_BORDER_PIXEL, &(*titlebar)->border.color.pixel); return 0; case A_TK_FG: if((buf = luaL_checklstring(L, 3, &len))) - if(xcolor_init(&(*titlebar)->colors.fg, globalconf.connection, - globalconf.default_screen, buf, len)) + if(xcolor_init_reply(globalconf.connection, + xcolor_init_unchecked(globalconf.connection, + &(*titlebar)->colors.fg, + globalconf.default_screen, + buf, len))) (*titlebar)->need_update = true; return 0; case A_TK_BG: if((buf = luaL_checklstring(L, 3, &len))) - if(xcolor_init(&(*titlebar)->colors.bg, globalconf.connection, - globalconf.default_screen, buf, len)) + if(xcolor_init_reply(globalconf.connection, + xcolor_init_unchecked(globalconf.connection, + &(*titlebar)->colors.bg, + globalconf.default_screen, + buf, len))) (*titlebar)->need_update = true; return 0; case A_TK_WIDGETS: diff --git a/widgets/graph.c b/widgets/graph.c index 54695e172..8ae55f6a2 100644 --- a/widgets/graph.c +++ b/widgets/graph.c @@ -288,6 +288,8 @@ luaA_graph_plot_properties_set(lua_State *L) const char *title, *buf; size_t len; plot_t *plot; + xcolor_init_request_t reqs[3]; + int8_t i, reqs_nbr = -1; title = luaL_checkstring(L, 2); luaA_checktable(L, 3); @@ -300,16 +302,22 @@ luaA_graph_plot_properties_set(lua_State *L) plot = graph_plot_add(d, title); if((buf = luaA_getopt_lstring(L, 3, "fg", NULL, &len))) - xcolor_init(&plot->color_start, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &plot->color_start, + globalconf.default_screen, + buf, len); if((buf = luaA_getopt_lstring(L, 3, "fg_center", NULL, &len))) - xcolor_init(&plot->pcolor_center, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &plot->pcolor_center, + globalconf.default_screen, + buf, len); if((buf = luaA_getopt_lstring(L, 3, "fg_end", NULL, &len))) - xcolor_init(&plot->pcolor_end, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &plot->pcolor_end, + globalconf.default_screen, + buf, len); plot->vertical_gradient = luaA_getopt_boolean(L, 3, "vertical_gradient", plot->vertical_gradient); plot->scale = luaA_getopt_boolean(L, 3, "scale", plot->scale); @@ -334,6 +342,9 @@ luaA_graph_plot_properties_set(lua_State *L) break; } + for(i = 0; i <= reqs_nbr; i++) + xcolor_init_reply(globalconf.connection, reqs[i]); + widget_invalidate_bywidget(*widget); return 0; @@ -511,8 +522,11 @@ luaA_graph_newindex(lua_State *L, awesome_token_t token) case A_TK_BG: if((buf = luaL_checklstring(L, 3, &len))) { - if(xcolor_init(&color, globalconf.connection, - globalconf.default_screen, buf, len)) + if(xcolor_init_reply(globalconf.connection, + xcolor_init_unchecked(globalconf.connection, + &color, + globalconf.default_screen, + buf, len))) d->bg = color; else return 0; @@ -521,8 +535,11 @@ luaA_graph_newindex(lua_State *L, awesome_token_t token) case A_TK_BORDER_COLOR: if((buf = luaL_checklstring(L, 3, &len))) { - if(xcolor_init(&color, globalconf.connection, - globalconf.default_screen, buf, len)) + if(xcolor_init_reply(globalconf.connection, + xcolor_init_unchecked(globalconf.connection, + &color, + globalconf.default_screen, + buf, len))) d->border_color = color; else return 0; diff --git a/widgets/progressbar.c b/widgets/progressbar.c index 0d561faf4..6d8eb9a7e 100644 --- a/widgets/progressbar.c +++ b/widgets/progressbar.c @@ -416,6 +416,8 @@ luaA_progressbar_bar_properties_set(lua_State *L) const char *buf, *title = luaL_checkstring(L, 2); bar_t *bar; progressbar_data_t *d = (*widget)->data; + xcolor_init_request_t reqs[6]; + int8_t i, reqs_nbr = -1; luaA_checktable(L, 3); @@ -429,28 +431,40 @@ luaA_progressbar_bar_properties_set(lua_State *L) bar = progressbar_bar_add(d, title); if((buf = luaA_getopt_lstring(L, 3, "fg", NULL, &len))) - xcolor_init(&bar->fg, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &bar->fg, + globalconf.default_screen, + buf, len); if((buf = luaA_getopt_lstring(L, 3, "fg_off", NULL, &len))) - xcolor_init(&bar->fg_off, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &bar->fg_off, + globalconf.default_screen, + buf, len); if((buf = luaA_getopt_lstring(L, 3, "bg", NULL, &len))) - xcolor_init(&bar->bg, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &bar->bg, + globalconf.default_screen, + buf, len); if((buf = luaA_getopt_lstring(L, 3, "border_color", NULL, &len))) - xcolor_init(&bar->border_color, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &bar->border_color, + globalconf.default_screen, + buf, len); if((buf = luaA_getopt_lstring(L, 3, "fg_center", NULL, &len))) - xcolor_init(&bar->fg_center, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &bar->fg_center, + globalconf.default_screen, + buf, len); if((buf = luaA_getopt_lstring(L, 3, "fg_end", NULL, &len))) - xcolor_init(&bar->fg_end, globalconf.connection, - globalconf.default_screen, buf, len); + reqs[++reqs_nbr] = xcolor_init_unchecked(globalconf.connection, + &bar->fg_end, + globalconf.default_screen, + buf, len); bar->min_value = luaA_getopt_number(L, 3, "min_value", bar->min_value); /* hack to prevent max_value beeing less than min_value @@ -469,6 +483,9 @@ luaA_progressbar_bar_properties_set(lua_State *L) bar->reverse = luaA_getopt_boolean(L, 3, "reverse", bar->reverse); + for(i = 0; i <= reqs_nbr; i++) + xcolor_init_reply(globalconf.connection, reqs[i]); + widget_invalidate_bywidget(*widget); return 0;