diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-09-18 22:52:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-18 22:52:36 -0400 |
commit | cdce604d8e166ae905b394306fece4e7f035cedd (patch) | |
tree | fbbd9612c860fb60bfdee882346f843668b1b8fa /include/swaybar | |
parent | 15dadaaa4496085e064f290708267e703b3cd029 (diff) | |
parent | 47a66da5de37faccac1207615ce0914b4ab32220 (diff) |
Merge pull request #2640 from ianyfan/swaybar
Overhaul swaybar protocol handling (+fixes)
Diffstat (limited to 'include/swaybar')
-rw-r--r-- | include/swaybar/event_loop.h | 4 | ||||
-rw-r--r-- | include/swaybar/status_line.h | 32 |
2 files changed, 10 insertions, 26 deletions
diff --git a/include/swaybar/event_loop.h b/include/swaybar/event_loop.h index 99f6ed36..47be5b79 100644 --- a/include/swaybar/event_loop.h +++ b/include/swaybar/event_loop.h @@ -19,8 +19,8 @@ bool remove_event(int fd); bool remove_timer(timer_t timer); // Blocks and returns after sending callbacks -void event_loop_poll(); +void event_loop_poll(void); -void init_event_loop(); +void init_event_loop(void); #endif diff --git a/include/swaybar/status_line.h b/include/swaybar/status_line.h index 150267cd..d3eabdf6 100644 --- a/include/swaybar/status_line.h +++ b/include/swaybar/status_line.h @@ -1,5 +1,6 @@ #ifndef _SWAYBAR_STATUS_LINE_H #define _SWAYBAR_STATUS_LINE_H +#include <json-c/json.h> #include <stdint.h> #include <stdio.h> #include <stdbool.h> @@ -12,28 +13,6 @@ enum status_protocol { PROTOCOL_I3BAR, }; -struct text_protocol_state { - char *buffer; - size_t buffer_size; -}; - -enum json_node_type { - JSON_NODE_UNKNOWN, - JSON_NODE_ARRAY, - JSON_NODE_STRING, -}; - -struct i3bar_protocol_state { - bool click_events; - char *buffer; - size_t buffer_size; - size_t buffer_index; - const char *current_node; - bool escape; - size_t depth; - enum json_node_type nodes[16]; -}; - struct i3bar_block { struct wl_list link; int ref_count; @@ -63,8 +42,13 @@ struct status_line { const char *text; struct wl_list blocks; // i3bar_block::link - struct text_protocol_state text_state; - struct i3bar_protocol_state i3bar_state; + bool click_events; + char *buffer; + size_t buffer_size; + size_t buffer_index; + bool started; + bool expecting_comma; + json_tokener *tokener; }; struct status_line *status_line_init(char *cmd); |