From 9932c6a1f1f295531989d9e76494b0ca43509cd4 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Sun, 16 Sep 2018 11:24:24 +0100 Subject: swaybar: fix empty function prototypes --- include/swaybar/event_loop.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') 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 -- cgit v1.2.3 From 70245c2cd5c34586fa91eb784e58471869ba66bd Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Mon, 17 Sep 2018 13:43:27 +0100 Subject: 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. --- include/swaybar/status_line.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/swaybar/status_line.h b/include/swaybar/status_line.h index 150267cd..857948a5 100644 --- a/include/swaybar/status_line.h +++ b/include/swaybar/status_line.h @@ -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; }; -- cgit v1.2.3 From 7882ac66ef4308922045fd100e6a9e12942a240b Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Mon, 17 Sep 2018 14:10:57 +0100 Subject: swaybar: rewrite i3bar protocol handling This now correctly handles an incoming json infinite array by shifting most of the heavy listing to the json-c parser, as well as sending multiple statuses at once. It also removes the struct i3bar_protocol_state and moves its members into the status_line struct, allowing the same buffer to be used for both protocols. --- include/swaybar/status_line.h | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/swaybar/status_line.h b/include/swaybar/status_line.h index 857948a5..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 #include #include #include @@ -12,23 +13,6 @@ enum status_protocol { PROTOCOL_I3BAR, }; -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; @@ -58,9 +42,13 @@ struct status_line { const char *text; struct wl_list blocks; // i3bar_block::link + bool click_events; char *buffer; size_t buffer_size; - struct i3bar_protocol_state i3bar_state; + size_t buffer_index; + bool started; + bool expecting_comma; + json_tokener *tokener; }; struct status_line *status_line_init(char *cmd); -- cgit v1.2.3 From db2845963408dd0d66a3587469c6f26bfa4d9e1f Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 19 Sep 2018 21:54:27 +1000 Subject: Introduce create_output command (for developer use) Should help with testing hotplugging. --- include/sway/commands.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/sway/commands.h b/include/sway/commands.h index e51b12fd..226cf932 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -103,6 +103,7 @@ sway_cmd cmd_client_urgent; sway_cmd cmd_client_placeholder; sway_cmd cmd_client_background; sway_cmd cmd_commands; +sway_cmd cmd_create_output; sway_cmd cmd_debuglog; sway_cmd cmd_default_border; sway_cmd cmd_default_floating_border; -- cgit v1.2.3 From 81f3fda6fa9b0789c8b40582a4b85b2e9501c185 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Wed, 19 Sep 2018 22:21:09 +0100 Subject: ipc: add pid information for views in layout tree --- include/sway/tree/view.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 439dc1bf..d10251dd 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -61,6 +61,8 @@ struct sway_view { struct sway_container *container; // NULL if unmapped and transactions finished struct wlr_surface *surface; // NULL for unmapped views + pid_t pid; + // Geometry of the view itself (excludes borders) in layout coordinates double x, y; int width, height; -- cgit v1.2.3