src/ssd/ssd_part.c: ensure button is found

This fixes an issue detected by the static analyzer.
It currently is not a real bug but it could become
one in the future if `add_toggled_icon()` is called
before `add_scene_button()`.

Rather than having `add_toggled_icon()` go through
the list, find the root button and then fetch its
node descriptor just supply the button as argument.
This commit is contained in:
Consolatis 2024-04-08 17:56:56 +02:00
parent b959e23d6d
commit 59c95ceb26
3 changed files with 13 additions and 10 deletions

View file

@ -123,9 +123,9 @@ struct ssd_part *add_scene_button(
struct wlr_scene_tree *parent, float *bg_color,
struct wlr_buffer *icon_buffer, struct wlr_buffer *hover_buffer,
int x, struct view *view);
void
add_toggled_icon(struct wl_list *part_list, enum ssd_part_type type,
struct wlr_buffer *icon_buffer, struct wlr_buffer *hover_buffer);
void add_toggled_icon(struct ssd_button *button, struct wl_list *part_list,
enum ssd_part_type type, struct wlr_buffer *icon_buffer,
struct wlr_buffer *hover_buffer);
struct ssd_part *add_scene_button_corner(
struct wl_list *part_list, enum ssd_part_type type,
enum ssd_part_type corner_type, struct wlr_scene_tree *parent,