mirror of
https://github.com/swaywm/sway.git
synced 2026-03-02 01:40:50 -05:00
parse_color: return success + drop fallback color
This is the first in a series of commits to refactor the color handling in sway. This changes parse_color to return whether it was success and no longer uses 0xFFFFFFFF as the fallback color. This also verifies that the string actually contains a valid hexadecimal number along with the length checks. In the process of altering the calls to parse_color, I also took the opportunity to heavily refactor swaybar's ipc_parse_colors function. This allowed for several lines of duplicated code to be removed.
This commit is contained in:
parent
088b374b1a
commit
97f9f0b699
7 changed files with 76 additions and 142 deletions
|
|
@ -265,7 +265,7 @@ static uint32_t render_status_block(cairo_t *cairo,
|
|||
}
|
||||
double text_y = height / 2.0 - text_height / 2.0;
|
||||
cairo_move_to(cairo, offset, (int)floor(text_y));
|
||||
uint32_t color = block->color ? *block->color : config->colors.statusline;
|
||||
uint32_t color = block->color_set ? block->color : config->colors.statusline;
|
||||
color = block->urgent ? config->colors.urgent_workspace.text : color;
|
||||
cairo_set_source_u32(cairo, color);
|
||||
pango_printf(cairo, config->font, output->scale,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue