mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
draw: use tokenize() in markup parsing
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
7dd1fa0e0b
commit
7803225553
2 changed files with 36 additions and 17 deletions
|
@ -206,37 +206,51 @@ draw_markup_on_element(markup_parser_data_t *p, const char *elem,
|
|||
/* hack: markup.c validates tags so we can avoid strcmps here */
|
||||
switch (*elem) {
|
||||
case 'b': /* bg */
|
||||
for (; *names; names++, values++)
|
||||
{
|
||||
if(!a_strcmp(*names, "color"))
|
||||
for(; *names; names++, values++)
|
||||
switch(a_tokenize(*names, -1))
|
||||
{
|
||||
case A_TK_COLOR:
|
||||
data->has_bg_color = xcolor_new(data->connection, data->phys_screen,
|
||||
*values, &data->bg_color);
|
||||
else if(!a_strcmp(*names, "image"))
|
||||
break;
|
||||
case A_TK_IMAGE:
|
||||
data->bg_image = draw_image_new(*values);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 't': /* text */
|
||||
for (; *names; names++, values++)
|
||||
{
|
||||
if(!a_strcmp(*names, "align"))
|
||||
for(; *names; names++, values++)
|
||||
switch(a_tokenize(*names, -1))
|
||||
{
|
||||
case A_TK_ALIGN:
|
||||
data->align = draw_align_get_from_str(*values);
|
||||
else if(!a_strcmp(*names, "shadow"))
|
||||
break;
|
||||
case A_TK_SHADOW:
|
||||
xcolor_new(data->connection, data->phys_screen, *values,
|
||||
&data->shadow.color);
|
||||
else if(!a_strcmp(*names, "shadow_offset"))
|
||||
break;
|
||||
case A_TK_SHADOW_OFFSET:
|
||||
data->shadow.offset = atoi(*values);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'm': /* margin */
|
||||
for (; *names; names++, values++)
|
||||
{
|
||||
if(!a_strcmp(*names, "left"))
|
||||
switch(a_tokenize(*names, -1))
|
||||
{
|
||||
case A_TK_LEFT:
|
||||
data->margin.left = atoi(*values);
|
||||
else if(!a_strcmp(*names, "right"))
|
||||
break;
|
||||
case A_TK_RIGHT:
|
||||
data->margin.right = atoi(*values);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
align
|
||||
bg
|
||||
border_padding
|
||||
border_width
|
||||
|
@ -6,6 +7,7 @@ bottom
|
|||
bottomleft
|
||||
bottomright
|
||||
center
|
||||
color
|
||||
data
|
||||
draw_style
|
||||
fg
|
||||
|
@ -16,6 +18,7 @@ flex
|
|||
gap
|
||||
grow
|
||||
height
|
||||
image
|
||||
left
|
||||
line
|
||||
max_value
|
||||
|
@ -23,6 +26,8 @@ min_value
|
|||
reverse
|
||||
right
|
||||
scale
|
||||
shadow
|
||||
shadow_offset
|
||||
text
|
||||
ticks_count
|
||||
ticks_gap
|
||||
|
|
Loading…
Reference in a new issue