This commit fixes a segfault in swaybar on FreeBSD that was caused by
using getdelim with EOF as delimiter on an infinite stream. The FreeBSD
implementation handles the "no more data, delimiter not found, and EOF
not reached" scenario as an error, so it can't be used to read the
output of status command. This commit replaces the getline/getdelim
calls with reading all available data from the stream in one go.
This prevents an signed-to-unsigned conversion error on buffer_index if
getdelim fails and returns -1, which caused swaybar to try to search the
header for the array and immediately failing
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.
This now uses the getline function to receive the header, replacing
read_line_buffer, which has been deleted since it is otherwise unused.
Furthermore, once the protocol has been determined, the current status
is handled immediately to be shown (though this has not been added for
the i3bar protocol since it has not yet been rewritten to handle this).
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 prevents blocks from being destroyed before their hotspots are destroyed,
in case it is used for a pending click event that fires between the bar
receiving a new status, which destroys the block, and the bar rendering the new
status, which destroys the hotspot; this problem can be easily produced by
scrolling on a block that immediately causes a new status to be sent, with
multiple outputs
- Fix workspace events (security config isn't in use so it wasn't being
sent)
- Kill status bar process when swaybar exits
- Don't rearrange windows on every layer surface commit
This starts up the event loop and wayland display and shims out the
basic top level rendering concepts. Also includes some changes to
incorporate pango into the 1.x codebase properly.
In the i3bar protocol the value of the markup field is a string: "pango"
or "none" rather than a bool. This patch makes swaybar compatible with
that.
http://i3wm.org/docs/i3bar-protocol.html