diff options
-rw-r--r-- | include/wlr/types/wlr_output.h | 2 | ||||
-rw-r--r-- | include/wlr/util/log.h | 4 | ||||
-rw-r--r-- | rootston/main.c | 1 | ||||
-rw-r--r-- | types/wlr_output.c | 6 | ||||
-rw-r--r-- | util/log.c | 13 |
5 files changed, 22 insertions, 4 deletions
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 8e4f5446..6374ae9b 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -55,7 +55,7 @@ struct wlr_output { float transform_matrix[16]; - /* Note: some backends may have zero modes */ + // Note: some backends may have zero modes struct wl_list modes; struct wlr_output_mode *current_mode; diff --git a/include/wlr/util/log.h b/include/wlr/util/log.h index b017cc96..3d3f25f9 100644 --- a/include/wlr/util/log.h +++ b/include/wlr/util/log.h @@ -16,7 +16,9 @@ typedef enum { typedef void (*log_callback_t)(log_importance_t importance, const char *fmt, va_list args); -void wlr_log_init(log_callback_t callback); +// Will log all messages less than or equal to `verbosity` +// If `callback` is NULL, wlr will use its default logger. +void wlr_log_init(log_importance_t verbosity, log_callback_t callback); #ifdef __GNUC__ #define ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end))) diff --git a/rootston/main.c b/rootston/main.c index 33ca6504..46ec3671 100644 --- a/rootston/main.c +++ b/rootston/main.c @@ -28,6 +28,7 @@ static void ready(struct wl_listener *listener, void *data) { } int main(int argc, char **argv) { + wlr_log_init(L_DEBUG, NULL); assert(server.config = roots_config_create_from_args(argc, argv)); assert(server.wl_display = wl_display_create()); assert(server.wl_event_loop = wl_display_get_event_loop(server.wl_display)); diff --git a/types/wlr_output.c b/types/wlr_output.c index c76f85f5..14d12da9 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -272,6 +272,7 @@ void wlr_output_destroy(struct wlr_output *output) { } wlr_output_destroy_global(output); + wlr_output_set_fullscreen_surface(output, NULL); wl_signal_emit(&output->events.destroy, output); @@ -281,6 +282,11 @@ void wlr_output_destroy(struct wlr_output *output) { free(mode); } + struct wlr_output_cursor *cursor, *tmp_cursor; + wl_list_for_each_safe(cursor, tmp_cursor, &output->cursors, link) { + wlr_output_cursor_destroy(cursor); + } + if (output->impl && output->impl->destroy) { output->impl->destroy(output); } else { @@ -9,6 +9,7 @@ #include <wlr/util/log.h> static bool colored = true; +static log_importance_t log_importance = L_ERROR; static const char *verbosity_colors[] = { [L_SILENT] = "", @@ -18,6 +19,9 @@ static const char *verbosity_colors[] = { }; void wlr_log_stderr(log_importance_t verbosity, const char *fmt, va_list args) { + if (verbosity > log_importance) { + return; + } // prefix the time to the log message struct tm result; time_t t = time(NULL); @@ -44,8 +48,13 @@ void wlr_log_stderr(log_importance_t verbosity, const char *fmt, va_list args) { static log_callback_t log_callback = wlr_log_stderr; -void wlr_log_init(log_callback_t callback) { - log_callback = callback; +void wlr_log_init(log_importance_t verbosity, log_callback_t callback) { + if (verbosity < L_LAST) { + log_importance = verbosity; + } + if (callback) { + log_callback = callback; + } } void _wlr_vlog(log_importance_t verbosity, const char *fmt, va_list args) { |