aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-12-27 23:56:11 -0500
committerLibravatar Simon Ser <contact@emersion.fr>2019-12-28 10:07:25 +0100
commit66dc33296ca97b10f60daaff8c5e4b3f95fac8cd (patch)
tree95cb83ff86cf43d096df4f10a3cfb402d34315f7 /include
parentparse_color: return success + drop fallback color (diff)
downloadsway-66dc33296ca97b10f60daaff8c5e4b3f95fac8cd.tar.gz
sway-66dc33296ca97b10f60daaff8c5e4b3f95fac8cd.tar.zst
sway-66dc33296ca97b10f60daaff8c5e4b3f95fac8cd.zip
cmd_client_*: refactor duplicated code
This is the second in a series of commits to refactor the color handling in sway. This removes the duplicated color parsing code in sway/commands/client.c. Additionally, this combines the parsing of colors to float arrays with that in sway/config.c and introduces a color_to_rgba function in commom/util.c. As an added bonus, this also makes it so non of the colors in a border color class will be changed unless all of the colors specified are valid. This ensures that an invalid command does not get partially applied.
Diffstat (limited to 'include')
-rw-r--r--include/util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h
index 931ac691..867eb0a4 100644
--- a/include/util.h
+++ b/include/util.h
@@ -17,6 +17,8 @@ int wrap(int i, int max);
17 */ 17 */
18bool parse_color(const char *color, uint32_t *result); 18bool parse_color(const char *color, uint32_t *result);
19 19
20void color_to_rgba(float dest[static 4], uint32_t color);
21
20/** 22/**
21 * Given a string that represents a boolean, return the boolean value. This 23 * Given a string that represents a boolean, return the boolean value. This
22 * function also takes in the current boolean value to support toggling. If 24 * function also takes in the current boolean value to support toggling. If