aboutsummaryrefslogtreecommitdiffstats
path: root/include/swaybar/status_line.h
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-09-12 08:28:28 +0100
committerLibravatar Ian Fan <ianfan0@gmail.com>2018-09-12 08:28:28 +0100
commit2eaef802061836dd83bbf753174fcb8488b2d8cd (patch)
tree33fcd285cc70a6cea257b1f3b6d24121d340a270 /include/swaybar/status_line.h
parentMerge pull request #2620 from ianyfan/commands (diff)
downloadsway-2eaef802061836dd83bbf753174fcb8488b2d8cd.tar.gz
sway-2eaef802061836dd83bbf753174fcb8488b2d8cd.tar.zst
sway-2eaef802061836dd83bbf753174fcb8488b2d8cd.zip
i3bar: count references to blocks
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
Diffstat (limited to 'include/swaybar/status_line.h')
-rw-r--r--include/swaybar/status_line.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/swaybar/status_line.h b/include/swaybar/status_line.h
index de9b98d7..150267cd 100644
--- a/include/swaybar/status_line.h
+++ b/include/swaybar/status_line.h
@@ -36,6 +36,7 @@ struct i3bar_protocol_state {
36 36
37struct i3bar_block { 37struct i3bar_block {
38 struct wl_list link; 38 struct wl_list link;
39 int ref_count;
39 char *full_text, *short_text, *align; 40 char *full_text, *short_text, *align;
40 bool urgent; 41 bool urgent;
41 uint32_t *color; 42 uint32_t *color;
@@ -73,7 +74,7 @@ void status_line_free(struct status_line *status);
73bool i3bar_handle_readable(struct status_line *status); 74bool i3bar_handle_readable(struct status_line *status);
74enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, 75enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
75 struct i3bar_block *block, int x, int y, enum x11_button button); 76 struct i3bar_block *block, int x, int y, enum x11_button button);
76void i3bar_block_free(struct i3bar_block *block); 77void i3bar_block_unref(struct i3bar_block *block);
77enum x11_button wl_button_to_x11_button(uint32_t button); 78enum x11_button wl_button_to_x11_button(uint32_t button);
78enum x11_button wl_axis_to_x11_button(uint32_t axis, wl_fixed_t value); 79enum x11_button wl_axis_to_x11_button(uint32_t axis, wl_fixed_t value);
79 80