From 9099adbbe6fffcd7510b31efc8e547da7fa24f65 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Fri, 19 Apr 2019 22:44:11 -0400 Subject: swaynag: revamp type configs This revamps the type configs for swaynag. All sizing attributes for swaynag are now `ssize_t` instead of `uint32_t` to allow for a default value of `-1`, which allows for `0` to be a valid value. Additionally, the initialization of the type configs has been changed from a simple calloc to use a new function `swaynag_type_new`. `swaynag_type_new` calloc's the memory, checks for an allocation failure, sets the name, and all sizes to -1. The layering order has also been changed to default, general config, type config, and as highest priority command line arguments. Finally, `swaynag_type_merge` has been modified to handle the layering and sizing changes. --- include/swaynag/types.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'include/swaynag/types.h') diff --git a/include/swaynag/types.h b/include/swaynag/types.h index 2183ce22..7f8f6221 100644 --- a/include/swaynag/types.h +++ b/include/swaynag/types.h @@ -8,22 +8,26 @@ struct swaynag_type { char *output; uint32_t anchors; + // Colors uint32_t button_background; uint32_t background; uint32_t text; uint32_t border; uint32_t border_bottom; - uint32_t bar_border_thickness; - uint32_t message_padding; - uint32_t details_border_thickness; - uint32_t button_border_thickness; - uint32_t button_gap; - uint32_t button_gap_close; - uint32_t button_margin_right; - uint32_t button_padding; + // Sizing + ssize_t bar_border_thickness; + ssize_t message_padding; + ssize_t details_border_thickness; + ssize_t button_border_thickness; + ssize_t button_gap; + ssize_t button_gap_close; + ssize_t button_margin_right; + ssize_t button_padding; }; +struct swaynag_type *swaynag_type_new(const char *name); + void swaynag_types_add_default(list_t *types); struct swaynag_type *swaynag_type_get(list_t *types, char *name); -- cgit v1.2.3-54-g00ecf