libweston: Add weston_view::map_signal

It fires when a view is mapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2023-06-19 23:25:53 +01:00
parent 07103d1842
commit 7e1d446279
2 changed files with 7 additions and 0 deletions

View File

@ -1638,6 +1638,7 @@ struct weston_view {
struct weston_surface *surface;
struct wl_list surface_link;
struct wl_signal destroy_signal;
struct wl_signal map_signal;
struct wl_signal unmap_signal;
/* struct weston_paint_node::view_link */

View File

@ -476,6 +476,7 @@ weston_view_create(struct weston_surface *surface)
wl_list_insert(&surface->views, &view->surface_link);
wl_signal_init(&view->destroy_signal);
wl_signal_init(&view->map_signal);
wl_signal_init(&view->unmap_signal);
wl_list_init(&view->link);
wl_list_init(&view->layer_link.link);
@ -3528,6 +3529,8 @@ WL_EXPORT void
weston_view_move_to_layer(struct weston_view *view,
struct weston_layer_entry *layer)
{
bool was_mapped = view->is_mapped;
if (layer == &view->layer_link)
return;
@ -3550,6 +3553,9 @@ weston_view_move_to_layer(struct weston_view *view,
weston_view_geometry_dirty(view);
weston_view_update_transform(view);
weston_surface_damage(view->surface);
if (!was_mapped)
weston_signal_emit_mutable(&view->map_signal, view);
}
WL_EXPORT void