weston-log: add function to avoid direct access to compositor members in non-core code

If we use the function weston_log_context_add_log_scope()
in non-core code, it's necessary to access
weston_compositor::weston_log_ctx.

This is not ideal, since the goal is to make core structs
(weston_compositor, weston_surface, weston_output, etc)
opaque.

Add function weston_compositor_add_log_scope(), so non-core
users are able to pass weston_compositor as argument instead
of weston_compositor::weston_log_ctx.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
This commit is contained in:
Leandro Ribeiro
2019-12-26 16:03:04 -03:00
committed by Pekka Paalanen
parent ac691a89cd
commit f66685d9db
3 changed files with 56 additions and 10 deletions
+9 -1
View File
@@ -55,7 +55,7 @@ struct weston_debug_stream;
*
* @param sub The subscription.
* @param user_data The \c user_data argument given to
* weston_log_ctx_add_log_scope()
* weston_log_ctx_add_log_scope() or weston_compositor_add_log_scope().
*
* @memberof weston_log_scope
*/
@@ -70,6 +70,14 @@ weston_log_ctx_add_log_scope(struct weston_log_context *log_ctx,
weston_log_scope_cb destroy_subscription,
void *user_data);
struct weston_log_scope *
weston_compositor_add_log_scope(struct weston_compositor *compositor,
const char *name,
const char *description,
weston_log_scope_cb new_subscription,
weston_log_scope_cb destroy_subscription,
void *user_data);
void
weston_log_scope_destroy(struct weston_log_scope *scope);