ssd: support window icons

The default `titleLayout` is updated to `icon:iconify,max,close` which
replaces the window menu button with the window icon.

When the icon file is not found or could not be loaded, the window menu
icon as before is shown.

The icon theme can be selected with `<theme><icon>`.

This commit adds libsfdo as an optional dependency. `-Dicon=disabled` can
be passsed to `meson setup` command in order to disable window icon, in
which case the window icon is always replaced with a window menu button.
This commit is contained in:
tokyo4j 2024-09-06 17:00:40 +09:00 committed by Hiroaki Yamamoto
parent b9414d8b8d
commit a745f91169
32 changed files with 452 additions and 142 deletions

View file

@ -104,6 +104,23 @@ get_scale_box(struct wlr_buffer *buffer, double container_width,
return icon_geo;
}
void
update_window_icon_buffer(struct wlr_scene_node *button_node,
struct wlr_buffer *buffer)
{
struct wlr_scene_buffer *scene_buffer =
wlr_scene_buffer_from_node(button_node);
struct wlr_box icon_geo = get_scale_box(buffer,
rc.theme->window_button_width,
rc.theme->title_height);
wlr_scene_buffer_set_buffer(scene_buffer, buffer);
wlr_scene_buffer_set_dest_size(scene_buffer,
icon_geo.width, icon_geo.height);
wlr_scene_node_set_position(button_node, icon_geo.x, icon_geo.y);
}
struct ssd_part *
add_scene_button(struct wl_list *part_list, enum ssd_part_type type,
struct wlr_scene_tree *parent, struct wlr_buffer *icon_buffer,