[draw] Rename draw_color_new() to xcolor_new()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
407972eb00
commit
c332971b21
2
client.c
2
client.c
|
@ -902,7 +902,7 @@ luaA_client_border_set(lua_State *L)
|
||||||
client_setborder(*c, width);
|
client_setborder(*c, width);
|
||||||
|
|
||||||
if(colorstr
|
if(colorstr
|
||||||
&& draw_color_new(globalconf.connection, (*c)->phys_screen, colorstr, &color))
|
&& xcolor_new(globalconf.connection, (*c)->phys_screen, colorstr, &color))
|
||||||
xcb_change_window_attributes(globalconf.connection, (*c)->win, XCB_CW_BORDER_PIXEL,
|
xcb_change_window_attributes(globalconf.connection, (*c)->win, XCB_CW_BORDER_PIXEL,
|
||||||
&color.pixel);
|
&color.pixel);
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ draw_text_markup_expand(draw_parser_data_t *data,
|
||||||
if(p->attribute_names[0])
|
if(p->attribute_names[0])
|
||||||
for(i = 0; p->attribute_names[0][i]; i++)
|
for(i = 0; p->attribute_names[0][i]; i++)
|
||||||
if(!a_strcmp(p->attribute_names[0][i], "color"))
|
if(!a_strcmp(p->attribute_names[0][i], "color"))
|
||||||
data->has_bg_color = draw_color_new(data->connection, data->phys_screen,
|
data->has_bg_color = xcolor_new(data->connection, data->phys_screen,
|
||||||
p->attribute_values[0][i], &data->bg_color);
|
p->attribute_values[0][i], &data->bg_color);
|
||||||
|
|
||||||
/* text */
|
/* text */
|
||||||
|
@ -253,7 +253,7 @@ draw_text_markup_expand(draw_parser_data_t *data,
|
||||||
if(!a_strcmp(p->attribute_names[1][i], "align"))
|
if(!a_strcmp(p->attribute_names[1][i], "align"))
|
||||||
data->align = draw_align_get_from_str(p->attribute_values[1][i]);
|
data->align = draw_align_get_from_str(p->attribute_values[1][i]);
|
||||||
else if(!a_strcmp(p->attribute_names[1][i], "shadow"))
|
else if(!a_strcmp(p->attribute_names[1][i], "shadow"))
|
||||||
draw_color_new(data->connection, data->phys_screen,
|
xcolor_new(data->connection, data->phys_screen,
|
||||||
p->attribute_values[1][i], &data->shadow.color);
|
p->attribute_values[1][i], &data->shadow.color);
|
||||||
else if(!a_strcmp(p->attribute_names[1][i], "shadow_offset"))
|
else if(!a_strcmp(p->attribute_names[1][i], "shadow_offset"))
|
||||||
data->shadow.offset = atoi(p->attribute_values[1][i]);
|
data->shadow.offset = atoi(p->attribute_values[1][i]);
|
||||||
|
@ -1009,7 +1009,7 @@ draw_align_get_from_str(const char *align)
|
||||||
* \return true if color allocation was successfull
|
* \return true if color allocation was successfull
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
draw_color_new(xcb_connection_t *conn, int phys_screen, const char *colstr, xcolor_t *color)
|
xcolor_new(xcb_connection_t *conn, int phys_screen, const char *colstr, xcolor_t *color)
|
||||||
{
|
{
|
||||||
xcb_screen_t *s = xcb_aux_get_screen(conn, phys_screen);
|
xcb_screen_t *s = xcb_aux_get_screen(conn, phys_screen);
|
||||||
xcb_alloc_color_reply_t *hexa_color = NULL;
|
xcb_alloc_color_reply_t *hexa_color = NULL;
|
||||||
|
|
|
@ -36,6 +36,7 @@ typedef struct
|
||||||
uint16_t red;
|
uint16_t red;
|
||||||
uint16_t green;
|
uint16_t green;
|
||||||
uint16_t blue;
|
uint16_t blue;
|
||||||
|
uint16_t alpha;
|
||||||
} xcolor_t;
|
} xcolor_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -143,7 +144,7 @@ area_t draw_get_image_size(const char *filename);
|
||||||
void draw_rotate(draw_context_t *, xcb_drawable_t, int, int, double, int, int);
|
void draw_rotate(draw_context_t *, xcb_drawable_t, int, int, double, int, int);
|
||||||
area_t draw_text_extents(xcb_connection_t *, int, font_t *, const char *);
|
area_t draw_text_extents(xcb_connection_t *, int, font_t *, const char *);
|
||||||
alignment_t draw_align_get_from_str(const char *);
|
alignment_t draw_align_get_from_str(const char *);
|
||||||
bool draw_color_new(xcb_connection_t *, int, const char *, xcolor_t *);
|
bool xcolor_new(xcb_connection_t *, int, const char *, xcolor_t *);
|
||||||
|
|
||||||
void area_list_remove(area_t **, area_t *);
|
void area_list_remove(area_t **, area_t *);
|
||||||
|
|
||||||
|
|
8
lua.c
8
lua.c
|
@ -358,10 +358,10 @@ luaA_colors_set(lua_State *L)
|
||||||
const char *fg, *bg;
|
const char *fg, *bg;
|
||||||
luaA_checktable(L, 1);
|
luaA_checktable(L, 1);
|
||||||
if((fg = luaA_getopt_string(L, 1, "fg", NULL)))
|
if((fg = luaA_getopt_string(L, 1, "fg", NULL)))
|
||||||
draw_color_new(globalconf.connection, globalconf.default_screen,
|
xcolor_new(globalconf.connection, globalconf.default_screen,
|
||||||
fg, &globalconf.colors.fg);
|
fg, &globalconf.colors.fg);
|
||||||
if((bg = luaA_getopt_string(L, 1, "bg",NULL)))
|
if((bg = luaA_getopt_string(L, 1, "bg",NULL)))
|
||||||
draw_color_new(globalconf.connection, globalconf.default_screen,
|
xcolor_new(globalconf.connection, globalconf.default_screen,
|
||||||
bg, &globalconf.colors.bg);
|
bg, &globalconf.colors.bg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -459,8 +459,8 @@ luaA_parserc(const char *rcfile)
|
||||||
|
|
||||||
/* \todo move this */
|
/* \todo move this */
|
||||||
globalconf.font = draw_font_new(globalconf.connection, globalconf.default_screen, "sans 8");
|
globalconf.font = draw_font_new(globalconf.connection, globalconf.default_screen, "sans 8");
|
||||||
draw_color_new(globalconf.connection, globalconf.default_screen, "black", &globalconf.colors.fg);
|
xcolor_new(globalconf.connection, globalconf.default_screen, "black", &globalconf.colors.fg);
|
||||||
draw_color_new(globalconf.connection, globalconf.default_screen, "white", &globalconf.colors.bg);
|
xcolor_new(globalconf.connection, globalconf.default_screen, "white", &globalconf.colors.bg);
|
||||||
|
|
||||||
luaA_dostring(L, "package.path = package.path .. \";" AWESOME_LUA_LIB_PATH "/?.lua\"");
|
luaA_dostring(L, "package.path = package.path .. \";" AWESOME_LUA_LIB_PATH "/?.lua\"");
|
||||||
|
|
||||||
|
|
|
@ -551,14 +551,14 @@ luaA_statusbar_new(lua_State *L)
|
||||||
|
|
||||||
lua_getfield(L, 1, "fg");
|
lua_getfield(L, 1, "fg");
|
||||||
if((color = luaL_optstring(L, -1, NULL)))
|
if((color = luaL_optstring(L, -1, NULL)))
|
||||||
draw_color_new(globalconf.connection, globalconf.default_screen,
|
xcolor_new(globalconf.connection, globalconf.default_screen,
|
||||||
color, &(*sb)->colors.fg);
|
color, &(*sb)->colors.fg);
|
||||||
else
|
else
|
||||||
(*sb)->colors.fg = globalconf.colors.fg;
|
(*sb)->colors.fg = globalconf.colors.fg;
|
||||||
|
|
||||||
lua_getfield(L, 1, "bg");
|
lua_getfield(L, 1, "bg");
|
||||||
if((color = luaL_optstring(L, -1, NULL)))
|
if((color = luaL_optstring(L, -1, NULL)))
|
||||||
draw_color_new(globalconf.connection, globalconf.default_screen,
|
xcolor_new(globalconf.connection, globalconf.default_screen,
|
||||||
color, &(*sb)->colors.bg);
|
color, &(*sb)->colors.bg);
|
||||||
else
|
else
|
||||||
(*sb)->colors.bg = globalconf.colors.bg;
|
(*sb)->colors.bg = globalconf.colors.bg;
|
||||||
|
|
|
@ -343,14 +343,14 @@ graph_tell(widget_t *widget, const char *property, const char *new_value)
|
||||||
d->height = atof(new_value);
|
d->height = atof(new_value);
|
||||||
else if(!a_strcmp(property, "bg"))
|
else if(!a_strcmp(property, "bg"))
|
||||||
{
|
{
|
||||||
if(!draw_color_new(globalconf.connection,
|
if(!xcolor_new(globalconf.connection,
|
||||||
globalconf.default_screen,
|
globalconf.default_screen,
|
||||||
new_value, &d->bg))
|
new_value, &d->bg))
|
||||||
return WIDGET_ERROR_FORMAT_COLOR;
|
return WIDGET_ERROR_FORMAT_COLOR;
|
||||||
}
|
}
|
||||||
else if(!a_strcmp(property, "bordercolor"))
|
else if(!a_strcmp(property, "bordercolor"))
|
||||||
{
|
{
|
||||||
if(!draw_color_new(globalconf.connection,
|
if(!xcolor_new(globalconf.connection,
|
||||||
globalconf.default_screen,
|
globalconf.default_screen,
|
||||||
new_value, &d->bordercolor))
|
new_value, &d->bordercolor))
|
||||||
return WIDGET_ERROR_FORMAT_COLOR;
|
return WIDGET_ERROR_FORMAT_COLOR;
|
||||||
|
@ -455,20 +455,20 @@ graph_new(alignment_t align)
|
||||||
d->data_title[i] = a_strdup(cfg_title(cfg));
|
d->data_title[i] = a_strdup(cfg_title(cfg));
|
||||||
|
|
||||||
if((color = cfg_getstr(cfg, "fg")))
|
if((color = cfg_getstr(cfg, "fg")))
|
||||||
draw_color_new(globalconf.connection, statusbar->phys_screen, color, &tmp_color);
|
xcolor_new(globalconf.connection, statusbar->phys_screen, color, &tmp_color);
|
||||||
else
|
else
|
||||||
tmp_color = globalconf.screens[statusbar->screen].styles.normal.fg;
|
tmp_color = globalconf.screens[statusbar->screen].styles.normal.fg;
|
||||||
|
|
||||||
if((color = cfg_getstr(cfg, "fg_center")))
|
if((color = cfg_getstr(cfg, "fg_center")))
|
||||||
{
|
{
|
||||||
ptmp_color_center = p_new(xcolor_t, 1);
|
ptmp_color_center = p_new(xcolor_t, 1);
|
||||||
draw_color_new(globalconf.connection, statusbar->phys_screen, color, ptmp_color_center);
|
xcolor_new(globalconf.connection, statusbar->phys_screen, color, ptmp_color_center);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((color = cfg_getstr(cfg, "fg_end")))
|
if((color = cfg_getstr(cfg, "fg_end")))
|
||||||
{
|
{
|
||||||
ptmp_color_end = p_new(xcolor_t, 1);
|
ptmp_color_end = p_new(xcolor_t, 1);
|
||||||
draw_color_new(globalconf.connection, statusbar->phys_screen, color, ptmp_color_end);
|
xcolor_new(globalconf.connection, statusbar->phys_screen, color, ptmp_color_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfg_getbool(cfg, "scale"))
|
if (cfg_getbool(cfg, "scale"))
|
||||||
|
@ -517,12 +517,12 @@ graph_new(alignment_t align)
|
||||||
}
|
}
|
||||||
|
|
||||||
if((color = cfg_getstr(config, "bg")))
|
if((color = cfg_getstr(config, "bg")))
|
||||||
draw_color_new(globalconf.connection, statusbar->phys_screen, color, &d->bg);
|
xcolor_new(globalconf.connection, statusbar->phys_screen, color, &d->bg);
|
||||||
else
|
else
|
||||||
d->bg = globalconf.screens[statusbar->screen].styles.normal.bg;
|
d->bg = globalconf.screens[statusbar->screen].styles.normal.bg;
|
||||||
|
|
||||||
if((color = cfg_getstr(config, "bordercolor")))
|
if((color = cfg_getstr(config, "bordercolor")))
|
||||||
draw_color_new(globalconf.connection, statusbar->phys_screen, color, &d->bordercolor);
|
xcolor_new(globalconf.connection, statusbar->phys_screen, color, &d->bordercolor);
|
||||||
else
|
else
|
||||||
d->bordercolor = tmp_color;
|
d->bordercolor = tmp_color;
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -75,10 +75,10 @@ progressbar_pcolor_set(xcolor_t **ppcolor, char *new_color)
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
if(!*ppcolor)
|
if(!*ppcolor)
|
||||||
{
|
{
|
||||||
flag = true; /* p_delete && restore to NULL, if draw_color_new unsuccessful */
|
flag = true; /* p_delete && restore to NULL, if xcolor_new unsuccessful */
|
||||||
*ppcolor = p_new(xcolor_t, 1);
|
*ppcolor = p_new(xcolor_t, 1);
|
||||||
}
|
}
|
||||||
if(!(draw_color_new(globalconf.connection,
|
if(!(xcolor_new(globalconf.connection,
|
||||||
globalconf.default_screen,
|
globalconf.default_screen,
|
||||||
new_color, *ppcolor))
|
new_color, *ppcolor))
|
||||||
&& flag)
|
&& flag)
|
||||||
|
@ -461,13 +461,13 @@ progressbar_tell(widget_t *widget, const char *property, const char *new_value)
|
||||||
|
|
||||||
/* change values accordingly... */
|
/* change values accordingly... */
|
||||||
if(!a_strcmp(property, "fg"))
|
if(!a_strcmp(property, "fg"))
|
||||||
draw_color_new(globalconf.connection, globalconf.default_screen, setting, &(d->fg[i]));
|
xcolor_new(globalconf.connection, globalconf.default_screen, setting, &(d->fg[i]));
|
||||||
else if(!a_strcmp(property, "bg"))
|
else if(!a_strcmp(property, "bg"))
|
||||||
draw_color_new(globalconf.connection, globalconf.default_screen, setting, &(d->bg[i]));
|
xcolor_new(globalconf.connection, globalconf.default_screen, setting, &(d->bg[i]));
|
||||||
else if(!a_strcmp(property, "fg_off"))
|
else if(!a_strcmp(property, "fg_off"))
|
||||||
draw_color_new(globalconf.connection, globalconf.default_screen, setting, &(d->fg_off[i]));
|
xcolor_new(globalconf.connection, globalconf.default_screen, setting, &(d->fg_off[i]));
|
||||||
else if(!a_strcmp(property, "bordercolor"))
|
else if(!a_strcmp(property, "bordercolor"))
|
||||||
draw_color_new(globalconf.connection, globalconf.default_screen, setting, &(d->bordercolor[i]));
|
xcolor_new(globalconf.connection, globalconf.default_screen, setting, &(d->bordercolor[i]));
|
||||||
else if(!a_strcmp(property, "fg_center"))
|
else if(!a_strcmp(property, "fg_center"))
|
||||||
progressbar_pcolor_set(&(d->pfg_center[i]), setting);
|
progressbar_pcolor_set(&(d->pfg_center[i]), setting);
|
||||||
else if(!a_strcmp(property, "fg_end"))
|
else if(!a_strcmp(property, "fg_end"))
|
||||||
|
|
Loading…
Reference in New Issue