From 3fb60b6aedef6012ef97d3b668978b247ffdb664 Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Thu, 24 May 2018 21:55:52 +0200 Subject: [PATCH] remove wlroots dependency from common code Removes the wlroots dependency from the common code. To remove the dependency on the header, the defines and log-level enum are copied over. This causes a redefine error if both the wlr and the sway log.h are included. --- common/meson.build | 1 - include/log.h | 15 ++++++++++++++- sway/commands/focus.c | 1 - sway/commands/kill.c | 1 - sway/commands/resize.c | 1 - sway/desktop/layer_shell.c | 1 - swaybar/bar.c | 1 - swaylock/main.c | 1 - 8 files changed, 14 insertions(+), 8 deletions(-) diff --git a/common/meson.build b/common/meson.build index 44a295084..06311f555 100644 --- a/common/meson.build +++ b/common/meson.build @@ -17,7 +17,6 @@ lib_sway_common = static_library( gdk_pixbuf, pango, pangocairo, - wlroots ], include_directories: sway_inc ) diff --git a/include/log.h b/include/log.h index 2599c9aa2..3773dca2f 100644 --- a/include/log.h +++ b/include/log.h @@ -1,12 +1,25 @@ #ifndef _SWAY_LOG_H #define _SWAY_LOG_H -#include #include #include #include #include +typedef enum { + L_SILENT = 0, + L_ERROR = 1, + L_INFO = 2, + L_DEBUG = 3, + L_LAST, +} log_importance_t; + +#ifdef __GNUC__ +#define ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end))) +#else +#define ATTRIB_PRINTF(start, end) +#endif + void _sway_abort(const char *filename, ...) ATTRIB_PRINTF(1, 2); #define sway_abort(FMT, ...) \ _sway_abort("[%s:%d] " FMT, sway_strip_path(__FILE__), __LINE__, ##__VA_ARGS__) diff --git a/sway/commands/focus.c b/sway/commands/focus.c index 74d9d5359..e6a9d76cc 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c @@ -1,5 +1,4 @@ #include -#include #include "log.h" #include "sway/input/input-manager.h" #include "sway/input/seat.h" diff --git a/sway/commands/kill.c b/sway/commands/kill.c index f3fa52f14..6fc5f7836 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c @@ -1,4 +1,3 @@ -#include #include "log.h" #include "sway/input/input-manager.h" #include "sway/input/seat.h" diff --git a/sway/commands/resize.c b/sway/commands/resize.c index f8e0b2f2f..1b39ac8e0 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c @@ -4,7 +4,6 @@ #include #include #include -#include #include "sway/commands.h" #include "sway/tree/arrange.h" #include "log.h" diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index c093888e3..873e288de 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -6,7 +6,6 @@ #include #include #include -#include #include "sway/input/input-manager.h" #include "sway/input/seat.h" #include "sway/layers.h" diff --git a/swaybar/bar.c b/swaybar/bar.c index f53b6315a..946651ec4 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c @@ -10,7 +10,6 @@ #include #include #include -#include #ifdef __FreeBSD__ #include #else diff --git a/swaylock/main.c b/swaylock/main.c index e2579e7d4..8efb38b88 100644 --- a/swaylock/main.c +++ b/swaylock/main.c @@ -14,7 +14,6 @@ #include #include #include -#include #include "swaylock/seat.h" #include "swaylock/swaylock.h" #include "background-image.h"