compositor: add weston_surface_set_label_func()
When printing out logs from Weston's actions, mainly for debugging, it
can be very difficult to identify the different surfaces. Inspecting
the configure function pointer is not useful, as the configure functions
may live in modules.
Add vfunc get_label to weston_surface, which will produce a short,
human-readable description of the surface, which allows identifying it
better, rather than just looking at the surface size, for instance.
Set the label function from most parts of Weston, to identify cursors and
drag icons, and panels, backgrounds, screensavers and lock surfaces, and
the desktop shell's application surfaces.
v2: renamed 'description' to 'label', so we get
weston_surface_set_label_func().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/src/compositor.h b/src/compositor.h
index 2bec183..d2574af 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -898,6 +898,7 @@
*/
void (*configure)(struct weston_surface *es, int32_t sx, int32_t sy);
void *configure_private;
+ int (*get_label)(struct weston_surface *surface, char *buf, size_t len);
/* Parent's list of its sub-surfaces, weston_subsurface:parent_link.
* Contains also the parent itself as a dummy weston_subsurface,
@@ -1243,6 +1244,11 @@
struct wl_resource *error_resource,
uint32_t error_code);
+void
+weston_surface_set_label_func(struct weston_surface *surface,
+ int (*desc)(struct weston_surface *,
+ char *, size_t));
+
struct weston_buffer *
weston_buffer_from_resource(struct wl_resource *resource);