swaybar: rewrite text protocol handling

This now uses getline to correctly handle multiple or long statuses. It
also removes the struct text_protocol_state and moves its members into
the status_line struct.
This commit is contained in:
Ian Fan 2018-09-17 13:43:27 +01:00
parent babd9618b9
commit 70245c2cd5
2 changed files with 26 additions and 22 deletions

View file

@ -12,11 +12,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,
@ -63,7 +58,8 @@ struct status_line {
const char *text;
struct wl_list blocks; // i3bar_block::link
struct text_protocol_state text_state;
char *buffer;
size_t buffer_size;
struct i3bar_protocol_state i3bar_state;
};