From 58a033d8163c922eff8577b34523418c2c2ab432 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 3 May 2018 08:14:17 -0400 Subject: [PATCH] Convert border_colors.text to float[4] --- include/sway/config.h | 2 +- sway/commands/client.c | 2 +- sway/config.c | 10 +++++----- sway/tree/container.c | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/sway/config.h b/include/sway/config.h index 3fb820f0..db942c3f 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -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]; }; diff --git a/sway/commands/client.c b/sway/commands/client.c index 0abd0167..d6b7de1a 100644 --- a/sway/commands/client.c +++ b/sway/commands/client.c @@ -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"); } diff --git a/sway/config.c b/sway/config.c index 0ad9c3a2..5efa0d48 100644 --- a/sway/config.c +++ b/sway/config.c @@ -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); diff --git a/sway/tree/container.c b/sway/tree/container.c index d89019a3..90ca9b2c 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -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,