Use a more efficient struct for storing colors, validate/parse them more easily

This commit is contained in:
Michael Stapelberg
2009-05-30 22:20:32 +02:00
parent 65bcf170ed
commit cbc3880007
3 changed files with 67 additions and 79 deletions

View File

@ -112,16 +112,16 @@ void decorate_window(xcb_connection_t *conn, Client *client, xcb_drawable_t draw
if (client->floating || client->container->currently_focused == client) {
/* Distinguish if the window is currently focused… */
if (client->floating || CUR_CELL->currently_focused == client)
background_color = get_colorpixel(conn, config.client_focused_background_active);
background_color = get_colorpixel(conn, config.client.focused.background);
/* …or if it is the focused window in a not focused container */
else background_color = get_colorpixel(conn, config.client_focused_background_inactive);
else background_color = get_colorpixel(conn, config.client.focused_inactive.background);
text_color = get_colorpixel(conn, config.client_focused_text);
border_color = get_colorpixel(conn, config.client_focused_border);
text_color = get_colorpixel(conn, config.client.focused.text);
border_color = get_colorpixel(conn, config.client.focused.border);
} else {
background_color = get_colorpixel(conn, config.client_unfocused_background);
text_color = get_colorpixel(conn, config.client_unfocused_text);
border_color = get_colorpixel(conn, config.client_unfocused_border);
background_color = get_colorpixel(conn, config.client.unfocused.background);
text_color = get_colorpixel(conn, config.client.unfocused.text);
border_color = get_colorpixel(conn, config.client.unfocused.border);
}
/* Our plan is the following:
@ -409,13 +409,13 @@ static void render_internal_bar(xcb_connection_t *conn, Workspace *r_ws, int wid
black = get_colorpixel(conn, "#000000");
background_color[SET_NORMAL] = get_colorpixel(conn, config.bar_unfocused_background);
text_color[SET_NORMAL] = get_colorpixel(conn, config.bar_unfocused_text);
border_color[SET_NORMAL] = get_colorpixel(conn, config.bar_unfocused_border);
background_color[SET_NORMAL] = get_colorpixel(conn, config.bar.unfocused.background);
text_color[SET_NORMAL] = get_colorpixel(conn, config.bar.unfocused.text);
border_color[SET_NORMAL] = get_colorpixel(conn, config.bar.unfocused.border);
background_color[SET_FOCUSED] = get_colorpixel(conn, config.bar_focused_background);
text_color[SET_FOCUSED] = get_colorpixel(conn, config.bar_focused_text);
border_color[SET_FOCUSED] = get_colorpixel(conn, config.bar_focused_border);
background_color[SET_FOCUSED] = get_colorpixel(conn, config.bar.focused.background);
text_color[SET_FOCUSED] = get_colorpixel(conn, config.bar.focused.text);
border_color[SET_FOCUSED] = get_colorpixel(conn, config.bar.focused.border);
/* Fill the whole bar in black */
xcb_change_gc_single(conn, screen->bargc, XCB_GC_FOREGROUND, black);