From 13ead893e2bebdc663bb81c9b424be87ee8abe3f Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 15 Jun 2022 15:50:22 +0100 Subject: [PATCH] Add weston_surface_has_content() Just a trivial wrapper to tell you whether or not the surface has valid content. Signed-off-by: Daniel Stone --- include/libweston/libweston.h | 3 +++ libweston/compositor.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index eb929a1f..552652fa 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -1928,6 +1928,9 @@ weston_surface_attach_solid(struct weston_surface *surface, void weston_buffer_destroy_solid(struct weston_buffer_reference *buffer_ref); +bool +weston_surface_has_content(struct weston_surface *surface); + void weston_view_destroy(struct weston_view *view); diff --git a/libweston/compositor.c b/libweston/compositor.c index 0dedb81f..6b48d74d 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -3609,6 +3609,16 @@ weston_compositor_schedule_repaint(struct weston_compositor *compositor) weston_output_schedule_repaint(output); } +/** + * Returns true if a surface has a buffer attached to it and thus valid + * content available. + */ +WL_EXPORT bool +weston_surface_has_content(struct weston_surface *surface) +{ + return !!surface->buffer_ref.buffer; +} + static void surface_destroy(struct wl_client *client, struct wl_resource *resource) {