Convert border_colors.text to float[4]

This commit is contained in:
Drew DeVault 2018-05-03 08:14:17 -04:00
parent 8f06aa7598
commit 58a033d816
4 changed files with 10 additions and 9 deletions

View file

@ -206,7 +206,7 @@ struct bar_config {
struct border_colors {
float border[4];
float background[4];
uint32_t text; // uint32_t because that's the format that cairo uses
float text[4];
float indicator[4];
float child_border[4];
};

View file

@ -64,7 +64,7 @@ static struct cmd_results *handle_command(int argc, char **argv,
"Unable to parse background color");
}
if (!parse_color_int(argv[2], &class->text)) {
if (!parse_color_float(argv[2], class->text)) {
return cmd_results_new(CMD_INVALID, cmd_name,
"Unable to parse text color");
}

View file

@ -210,31 +210,31 @@ static void config_defaults(struct sway_config *config) {
set_color(config->border_colors.focused.border, 0x4C7899);
set_color(config->border_colors.focused.border, 0x4C7899);
set_color(config->border_colors.focused.background, 0x285577);
config->border_colors.focused.text = 0xFFFFFFFF;
set_color(config->border_colors.focused.text, 0xFFFFFFFF);
set_color(config->border_colors.focused.indicator, 0x2E9EF4);
set_color(config->border_colors.focused.child_border, 0x285577);
set_color(config->border_colors.focused_inactive.border, 0x333333);
set_color(config->border_colors.focused_inactive.background, 0x5F676A);
config->border_colors.focused_inactive.text = 0xFFFFFFFF;
set_color(config->border_colors.focused_inactive.text, 0xFFFFFFFF);
set_color(config->border_colors.focused_inactive.indicator, 0x484E50);
set_color(config->border_colors.focused_inactive.child_border, 0x5F676A);
set_color(config->border_colors.unfocused.border, 0x333333);
set_color(config->border_colors.unfocused.background, 0x222222);
config->border_colors.unfocused.text = 0x888888FF;
set_color(config->border_colors.unfocused.text, 0xFFFFFFFF);
set_color(config->border_colors.unfocused.indicator, 0x292D2E);
set_color(config->border_colors.unfocused.child_border, 0x222222);
set_color(config->border_colors.urgent.border, 0x2F343A);
set_color(config->border_colors.urgent.background, 0x900000);
config->border_colors.urgent.text = 0xFFFFFFFF;
set_color(config->border_colors.urgent.text, 0xFFFFFFFF);
set_color(config->border_colors.urgent.indicator, 0x900000);
set_color(config->border_colors.urgent.child_border, 0x900000);
set_color(config->border_colors.placeholder.border, 0x000000);
set_color(config->border_colors.placeholder.background, 0x0C0C0C);
config->border_colors.placeholder.text = 0xFFFFFFFF;
set_color(config->border_colors.placeholder.text, 0xFFFFFFFF);
set_color(config->border_colors.placeholder.indicator, 0x000000);
set_color(config->border_colors.placeholder.child_border, 0x0C0C0C);

View file

@ -585,9 +585,10 @@ static void update_title_texture(struct sway_container *con,
cairo_set_source_rgba(cairo, class->background[0], class->background[1],
class->background[2], class->background[3]);
cairo_paint(cairo);
cairo_set_antialias(cairo, CAIRO_ANTIALIAS_BEST);
PangoContext *pango = pango_cairo_create_context(cairo);
cairo_set_source_u32(cairo, class->text);
cairo_set_antialias(cairo, CAIRO_ANTIALIAS_BEST);
cairo_set_source_rgba(cairo, class->text[0], class->text[1],
class->text[2], class->text[3]);
cairo_move_to(cairo, 0, 0);
pango_printf(cairo, config->font, output->sway_output->wlr_output->scale,