osd: destroy old osd_tree children

This commit is contained in:
Johan Malm 2022-02-12 22:04:27 +00:00
parent 5934ed6682
commit 4593909744
2 changed files with 19 additions and 3 deletions

View file

@ -50,8 +50,7 @@ keyboard_modifiers_notify(struct wl_listener *listener, void *data)
server->cycle_view); server->cycle_view);
desktop_move_to_front(server->cycle_view); desktop_move_to_front(server->cycle_view);
server->cycle_view = NULL; server->cycle_view = NULL;
wlr_scene_node_set_enabled( osd_finish(server);
&server->osd_tree->node, false);
} }
} }

View file

@ -74,11 +74,29 @@ get_osd_height(struct wl_list *views)
return height; return height;
} }
static void
destroy_osd_nodes(struct server *server)
{
struct wlr_scene_node *child, *next;
struct wl_list *children = &server->osd_tree->node.state.children;
wl_list_for_each_safe(child, next, children, state.link) {
wlr_scene_node_destroy(child);
}
}
void
osd_finish(struct server *server)
{
destroy_osd_nodes(server);
wlr_scene_node_set_enabled(&server->osd_tree->node, false);
}
void void
osd_update(struct server *server) osd_update(struct server *server)
{ {
struct theme *theme = server->theme; struct theme *theme = server->theme;
destroy_osd_nodes(server);
struct output *output; struct output *output;
wl_list_for_each(output, &server->outputs, link) { wl_list_for_each(output, &server->outputs, link) {
float scale = output->wlr_output->scale; float scale = output->wlr_output->scale;
@ -176,7 +194,6 @@ osd_update(struct server *server)
pango_cairo_show_layout(cairo, layout); pango_cairo_show_layout(cairo, layout);
y += OSD_ITEM_HEIGHT; y += OSD_ITEM_HEIGHT;
} }
g_object_unref(layout); g_object_unref(layout);
cairo_surface_flush(surf); cairo_surface_flush(surf);