summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-04-19 22:44:11 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-04-20 09:14:41 -0600
commit9099adbbe6fffcd7510b31efc8e547da7fa24f65 (patch)
tree96535c4292d14ca1e5315d387f0282f78cd7167a /include
parentipc: fix criteria for emitting bar_state_update (diff)
downloadsway-9099adbbe6fffcd7510b31efc8e547da7fa24f65.tar.gz
sway-9099adbbe6fffcd7510b31efc8e547da7fa24f65.tar.zst
sway-9099adbbe6fffcd7510b31efc8e547da7fa24f65.zip
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.
Diffstat (limited to 'include')
-rw-r--r--include/swaynag/types.h20
1 files changed, 12 insertions, 8 deletions
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 {
8 char *output; 8 char *output;
9 uint32_t anchors; 9 uint32_t anchors;
10 10
11 // Colors
11 uint32_t button_background; 12 uint32_t button_background;
12 uint32_t background; 13 uint32_t background;
13 uint32_t text; 14 uint32_t text;
14 uint32_t border; 15 uint32_t border;
15 uint32_t border_bottom; 16 uint32_t border_bottom;
16 17
17 uint32_t bar_border_thickness; 18 // Sizing
18 uint32_t message_padding; 19 ssize_t bar_border_thickness;
19 uint32_t details_border_thickness; 20 ssize_t message_padding;
20 uint32_t button_border_thickness; 21 ssize_t details_border_thickness;
21 uint32_t button_gap; 22 ssize_t button_border_thickness;
22 uint32_t button_gap_close; 23 ssize_t button_gap;
23 uint32_t button_margin_right; 24 ssize_t button_gap_close;
24 uint32_t button_padding; 25 ssize_t button_margin_right;
26 ssize_t button_padding;
25}; 27};
26 28
29struct swaynag_type *swaynag_type_new(const char *name);
30
27void swaynag_types_add_default(list_t *types); 31void swaynag_types_add_default(list_t *types);
28 32
29struct swaynag_type *swaynag_type_get(list_t *types, char *name); 33struct swaynag_type *swaynag_type_get(list_t *types, char *name);