From d9bcc0b17106be0e8f4e1a0234b14f4d726fb532 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Thu, 13 Dec 2018 23:03:30 +0200 Subject: [PATCH] libweston/weston-debug: Add a easy way to determine if the debug protocol has been enabled This allows additional debug features to depend on the debug protocol being enabled Signed-off-by: Marius Vlad --- libweston/weston-debug.c | 10 ++++++++++ libweston/weston-debug.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/libweston/weston-debug.c b/libweston/weston-debug.c index 04895ad53..2776c8816 100644 --- a/libweston/weston-debug.c +++ b/libweston/weston-debug.c @@ -350,6 +350,16 @@ weston_compositor_enable_debug_protocol(struct weston_compositor *compositor) "information leak.\n"); } +/** Determine if the debug protocol has been enabled + * + * \param wc The libweston compositor to verify if debug protocol has been enabled + */ +WL_EXPORT bool +weston_compositor_is_debug_protocol_enabled(struct weston_compositor *wc) +{ + return wc->weston_debug->global != NULL; +} + /** Register a new debug stream name, creating a debug scope * * \param compositor The libweston compositor where to add. diff --git a/libweston/weston-debug.h b/libweston/weston-debug.h index c76cec852..157752509 100644 --- a/libweston/weston-debug.h +++ b/libweston/weston-debug.h @@ -39,6 +39,9 @@ struct weston_compositor; void weston_compositor_enable_debug_protocol(struct weston_compositor *); +bool +weston_compositor_is_debug_protocol_enabled(struct weston_compositor *); + struct weston_debug_scope; struct weston_debug_stream;