osd: generalize osd_{classic,thumbnail}_item

This allows us to share common codes for dealing with osd items.
For example:
- Get the clicked osd item to focus its associated window
- Scroll the items when their total height is taller than output height
This commit is contained in:
tokyo4j 2025-10-30 02:51:05 +09:00 committed by Johan Malm
parent 747163fa3e
commit 00f0a46ef7
6 changed files with 43 additions and 31 deletions

View file

@ -24,12 +24,15 @@ destroy_osd_scenes(struct server *server)
{
struct output *output;
wl_list_for_each(output, &server->outputs, link) {
struct osd_item *item, *tmp;
wl_list_for_each_safe(item, tmp, &output->osd_scene.items, link) {
wl_list_remove(&item->link);
free(item);
}
if (output->osd_scene.tree) {
wlr_scene_node_destroy(&output->osd_scene.tree->node);
output->osd_scene.tree = NULL;
}
wl_array_release(&output->osd_scene.items);
wl_array_init(&output->osd_scene.items);
}
}