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.
This commit is contained in:
Markus Ongyerth 2018-05-24 21:55:52 +02:00
parent acae6ad40f
commit 3fb60b6aed
8 changed files with 14 additions and 8 deletions

View file

@ -17,7 +17,6 @@ lib_sway_common = static_library(
gdk_pixbuf, gdk_pixbuf,
pango, pango,
pangocairo, pangocairo,
wlroots
], ],
include_directories: sway_inc include_directories: sway_inc
) )

View file

@ -1,12 +1,25 @@
#ifndef _SWAY_LOG_H #ifndef _SWAY_LOG_H
#define _SWAY_LOG_H #define _SWAY_LOG_H
#include <wlr/util/log.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
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); void _sway_abort(const char *filename, ...) ATTRIB_PRINTF(1, 2);
#define sway_abort(FMT, ...) \ #define sway_abort(FMT, ...) \
_sway_abort("[%s:%d] " FMT, sway_strip_path(__FILE__), __LINE__, ##__VA_ARGS__) _sway_abort("[%s:%d] " FMT, sway_strip_path(__FILE__), __LINE__, ##__VA_ARGS__)

View file

@ -1,5 +1,4 @@
#include <strings.h> #include <strings.h>
#include <wlr/util/log.h>
#include "log.h" #include "log.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "sway/input/seat.h" #include "sway/input/seat.h"

View file

@ -1,4 +1,3 @@
#include <wlr/util/log.h>
#include "log.h" #include "log.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "sway/input/seat.h" #include "sway/input/seat.h"

View file

@ -4,7 +4,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <wlr/util/log.h>
#include "sway/commands.h" #include "sway/commands.h"
#include "sway/tree/arrange.h" #include "sway/tree/arrange.h"
#include "log.h" #include "log.h"

View file

@ -6,7 +6,6 @@
#include <wlr/types/wlr_layer_shell.h> #include <wlr/types/wlr_layer_shell.h>
#include <wlr/types/wlr_output_damage.h> #include <wlr/types/wlr_output_damage.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/util/log.h>
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "sway/input/seat.h" #include "sway/input/seat.h"
#include "sway/layers.h" #include "sway/layers.h"

View file

@ -10,7 +10,6 @@
#include <unistd.h> #include <unistd.h>
#include <wayland-client.h> #include <wayland-client.h>
#include <wayland-cursor.h> #include <wayland-cursor.h>
#include <wlr/util/log.h>
#ifdef __FreeBSD__ #ifdef __FreeBSD__
#include <dev/evdev/input-event-codes.h> #include <dev/evdev/input-event-codes.h>
#else #else

View file

@ -14,7 +14,6 @@
#include <unistd.h> #include <unistd.h>
#include <wayland-client.h> #include <wayland-client.h>
#include <wordexp.h> #include <wordexp.h>
#include <wlr/util/log.h>
#include "swaylock/seat.h" #include "swaylock/seat.h"
#include "swaylock/swaylock.h" #include "swaylock/swaylock.h"
#include "background-image.h" #include "background-image.h"