sway/include/swaybar/i3bar.h
Brian Ashworth 97f9f0b699 parse_color: return success + drop fallback color
This is the first in a series of commits to refactor the color handling
in sway. This changes parse_color to return whether it was success and
no longer uses 0xFFFFFFFF as the fallback color. This also verifies that
the string actually contains a valid hexadecimal number along with
the length checks.

In the process of altering the calls to parse_color, I also took the
opportunity to heavily refactor swaybar's ipc_parse_colors function.
This allowed for several lines of duplicated code to be removed.
2019-12-28 10:07:25 +01:00

35 lines
808 B
C

#ifndef _SWAYBAR_I3BAR_H
#define _SWAYBAR_I3BAR_H
#include "input.h"
#include "status_line.h"
struct i3bar_block {
struct wl_list link; // status_link::blocks
int ref_count;
char *full_text, *short_text, *align, *min_width_str;
bool urgent;
uint32_t color;
bool color_set;
int min_width;
char *name, *instance;
bool separator;
int separator_block_width;
bool markup;
// Airblader features
uint32_t background;
uint32_t border;
int border_top;
int border_bottom;
int border_left;
int border_right;
};
void i3bar_block_unref(struct i3bar_block *block);
bool i3bar_handle_readable(struct status_line *status);
enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
struct i3bar_block *block, int x, int y, int rx, int ry, int w, int h,
uint32_t button);
#endif