From 1e0deea57fa59aae95d2b675e529f1fe482ed136 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Fri, 18 Jan 2019 23:30:44 +0000 Subject: [PATCH] Improve the include situation Slightly clean up header inclusion with the help of clang's module system. It's better for files to include the things you need directly. Signed-off-by: Yuxuan Shui --- src/backend/backend_common.c | 1 + src/c2.c | 1 + src/common.h | 30 ++---------------------------- src/compton.c | 4 ++++ src/compton.h | 4 ++++ src/config.h | 11 ++++++++++- src/dbus.c | 1 + src/diagnostic.c | 1 + src/opengl.c | 1 + src/opengl.h | 4 ++++ src/render.c | 1 + src/render.h | 2 +- src/vsync.c | 1 + src/win.c | 1 + src/win.h | 2 ++ src/x.c | 2 ++ src/x.h | 2 ++ 17 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/backend/backend_common.c b/src/backend/backend_common.c index 1d97ee7f..968d7ed1 100644 --- a/src/backend/backend_common.c +++ b/src/backend/backend_common.c @@ -2,6 +2,7 @@ #include "backend.h" #include "backend_common.h" +#include "kernel.h" #include "common.h" #include "x.h" diff --git a/src/c2.c b/src/c2.c index 15160588..af636670 100644 --- a/src/c2.c +++ b/src/c2.c @@ -30,6 +30,7 @@ #include "common.h" #include "win.h" #include "c2.h" +#include "config.h" #include "string_utils.h" #include "utils.h" #include "log.h" diff --git a/src/common.h b/src/common.h index c611738b..f366c023 100644 --- a/src/common.h +++ b/src/common.h @@ -27,29 +27,6 @@ // #define DEBUG_GLX_MARK 1 // #define DEBUG_GLX_PAINTREG 1 -// Whether to enable PCRE regular expression support in blacklists, enabled -// by default -// #define CONFIG_REGEX_PCRE 1 -// Whether to enable JIT support of libpcre. This may cause problems on PaX -// kernels. -// #define CONFIG_REGEX_PCRE_JIT 1 -// Whether to enable parsing of configuration files using libconfig. -// #define CONFIG_LIBCONFIG 1 -// Whether to enable DRM VSync support -// #define CONFIG_VSYNC_DRM 1 -// Whether to enable OpenGL support (include GLSL, FBO) -// #define CONFIG_OPENGL 1 -// Whether to enable DBus support with libdbus. -// #define CONFIG_DBUS 1 -// Whether to enable X Sync support. -// #define CONFIG_XSYNC 1 -// Whether to enable GLX Sync support. -// #define CONFIG_GLX_XSYNC 1 - -#ifndef COMPTON_VERSION -#define COMPTON_VERSION "unknown" -#endif - #define MAX_ALPHA (255) // === Includes === @@ -112,13 +89,10 @@ // FIXME This list of includes should get shorter #include "types.h" #include "win.h" -#include "x.h" #include "region.h" -#include "log.h" -#include "utils.h" -#include "compiler.h" #include "kernel.h" -#include "options.h" +#include "render.h" +#include "config.h" // === Constants === diff --git a/src/compton.c b/src/compton.c index c610bd40..32748c6c 100644 --- a/src/compton.c +++ b/src/compton.c @@ -23,6 +23,7 @@ #include +#include "common.h" #include "compiler.h" #include "compton.h" #ifdef CONFIG_OPENGL @@ -35,6 +36,9 @@ #include "string_utils.h" #include "render.h" #include "utils.h" +#include "region.h" +#include "types.h" +#include "c2.h" #include "kernel.h" #include "vsync.h" #include "log.h" diff --git a/src/compton.h b/src/compton.h index f11c7a0f..9bd6acd8 100644 --- a/src/compton.h +++ b/src/compton.h @@ -34,6 +34,10 @@ #include "x.h" #include "c2.h" #include "log.h" // XXX clean up +#include "region.h" +#include "compiler.h" +#include "types.h" +#include "utils.h" #include "render.h" // == Functions == diff --git a/src/config.h b/src/config.h index 077208fe..205c11c0 100644 --- a/src/config.h +++ b/src/config.h @@ -8,12 +8,21 @@ /// Used for command line arguments and config files #include +#include +#include +#include #ifdef CONFIG_LIBCONFIG #include #endif -#include "common.h" +#include "region.h" +#include "log.h" +#include "compiler.h" +#include "win.h" +#include "types.h" + +typedef struct session session_t; /// VSync modes. typedef enum { diff --git a/src/dbus.c b/src/dbus.c index 8652b497..d162ec90 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -14,6 +14,7 @@ #include #include "common.h" +#include "config.h" #include "compiler.h" #include "win.h" #include "string_utils.h" diff --git a/src/diagnostic.c b/src/diagnostic.c index 0a37dd40..16450bf6 100644 --- a/src/diagnostic.c +++ b/src/diagnostic.c @@ -2,6 +2,7 @@ // Copyright (c) 2018 Yuxuan Shui #include "diagnostic.h" +#include "config.h" #include "common.h" void print_diagnostics(session_t *ps) { diff --git a/src/opengl.c b/src/opengl.c index 2a6c598f..52aea961 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -12,6 +12,7 @@ #include "compiler.h" #include "string_utils.h" #include "log.h" +#include "config.h" #include "opengl.h" diff --git a/src/opengl.h b/src/opengl.h index d3f7225a..87728254 100644 --- a/src/opengl.h +++ b/src/opengl.h @@ -12,6 +12,10 @@ #pragma once #include "common.h" +#include "region.h" +#include "render.h" +#include "compiler.h" +#include "win.h" #include "log.h" #include diff --git a/src/render.c b/src/render.c index 6959c866..fa988cc8 100644 --- a/src/render.c +++ b/src/render.c @@ -12,6 +12,7 @@ #include "vsync.h" #include "win.h" +#include "kernel.h" #include "backend/backend_common.h" #include "render.h" diff --git a/src/render.h b/src/render.h index 12655255..fca0653c 100644 --- a/src/render.h +++ b/src/render.h @@ -3,7 +3,7 @@ #pragma once #include -#include +#include #include "region.h" typedef struct _glx_texture glx_texture_t; diff --git a/src/vsync.c b/src/vsync.c index 4ea17d2c..18c37a84 100644 --- a/src/vsync.c +++ b/src/vsync.c @@ -19,6 +19,7 @@ #include #endif +#include "config.h" #include "vsync.h" #ifdef CONFIG_VSYNC_DRM diff --git a/src/win.c b/src/win.c index db1d50b0..ac03c94e 100644 --- a/src/win.c +++ b/src/win.c @@ -10,6 +10,7 @@ #include "compiler.h" #include "common.h" +#include "config.h" #include "compton.h" #include "c2.h" #include "x.h" diff --git a/src/win.h b/src/win.h index 2d49f98e..aa16cac0 100644 --- a/src/win.h +++ b/src/win.h @@ -11,6 +11,8 @@ #endif #include "x.h" +#include "compiler.h" +#include "region.h" #include "types.h" #include "c2.h" #include "render.h" diff --git a/src/x.c b/src/x.c index 25430117..00448971 100644 --- a/src/x.c +++ b/src/x.c @@ -8,6 +8,8 @@ #include #include +#include "utils.h" +#include "region.h" #include "compiler.h" #include "common.h" #include "x.h" diff --git a/src/x.h b/src/x.h index e5e10a7b..d515b564 100644 --- a/src/x.h +++ b/src/x.h @@ -3,12 +3,14 @@ #pragma once #include #include +#include #include #include #include #include #include +#include "compiler.h" #include "region.h" typedef struct session session_t;