aboutsummaryrefslogtreecommitdiff
path: root/src/block.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/block.h')
-rw-r--r--src/block.h42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/block.h b/src/block.h
index 3df760b..2179348 100644
--- a/src/block.h
+++ b/src/block.h
@@ -5,6 +5,8 @@
#include <stdbool.h>
#include <time.h>
+#include "event.h"
+
// Color representation normalized to [0, 1]
//
typedef struct {
@@ -36,37 +38,33 @@ typedef void (*block_event_t)(block_t *block, event_t *event);
//
typedef void (*block_update_t)(block_t *block);
-// Generic block type
+// Block struct
//
-typedef struct block {
- block_type_t type;
+struct block {
bool hidden;
color_t color;
color_t line_color;
int line_width;
int x_padding, y_padding;
int min_width, max_width;
- block_event_t event_cb;
-};
-
-// Block text type
-//
-typedef struct {
- block_t block;
- const char *text;
- color_t text_color;
- align_t text_align;
- int text_width;
int update_interval;
struct timespec update_last;
block_update_t update_cb;
-} block_text_t;
-
-// Block group type
-//
-typedef struct block_group {
- block_t block;
- struct block_group *next;
-} block_group_t;
+ block_event_t event_cb;
+ block_type_t type;
+ union {
+ struct {
+ const char *text;
+ color_t text_color;
+ align_t text_align;
+ int text_size;
+ } text;
+ struct {
+ int spacing;
+ int n_children;
+ struct block *children;
+ } group;
+ };
+};
#endif