From 0ba7761bd533371899600c12624c3415f1eb3c3e Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sat, 10 Aug 2019 00:56:04 +0100 Subject: [PATCH] Untangle headers Thanks, clang -fmodules. Signed-off-by: Yuxuan Shui --- src/atom.c | 2 + src/backend/backend.c | 1 + src/backend/backend.h | 9 +--- src/backend/backend_common.c | 3 ++ src/backend/driver.c | 4 ++ src/backend/dummy/dummy.c | 7 +++- src/backend/gl/gl_common.c | 2 + src/backend/gl/gl_common.h | 1 - src/backend/xrender/xrender.c | 1 + src/cache.c | 1 + src/common.h | 8 +++- src/compton.c | 1 + src/compton.modulemap | 3 ++ src/config.h | 11 ++++- src/event.c | 8 ++++ src/opengl.h | 1 + src/render.c | 1 + src/win.h | 78 ++--------------------------------- src/win_defs.h | 74 +++++++++++++++++++++++++++++++++ src/x.h | 1 + 20 files changed, 129 insertions(+), 88 deletions(-) create mode 100644 src/win_defs.h diff --git a/src/atom.c b/src/atom.c index 4f62274..3fef799 100644 --- a/src/atom.c +++ b/src/atom.c @@ -1,8 +1,10 @@ +#include #include #include "atom.h" #include "common.h" #include "utils.h" +#include "log.h" static inline void *atom_getter(void *ud, const char *atom_name, int *err) { xcb_connection_t *c = ud; diff --git a/src/backend/backend.c b/src/backend/backend.c index 7525d7f..46bfd1c 100644 --- a/src/backend/backend.c +++ b/src/backend/backend.c @@ -8,6 +8,7 @@ #include "config.h" #include "log.h" #include "region.h" +#include "types.h" #include "win.h" extern struct backend_operations xrender_ops, dummy_ops; diff --git a/src/backend/backend.h b/src/backend/backend.h index 6568291..4e69070 100644 --- a/src/backend/backend.h +++ b/src/backend/backend.h @@ -5,6 +5,7 @@ #include +#include "config.h" #include "compiler.h" #include "driver.h" #include "kernel.h" @@ -48,14 +49,6 @@ enum image_operations { IMAGE_OP_RESIZE_TILE, }; -enum blur_method { - BLUR_METHOD_NONE = 0, - BLUR_METHOD_KERNEL, - BLUR_METHOD_BOX, - BLUR_METHOD_GAUSSIAN, - BLUR_METHOD_INVALID, -}; - struct gaussian_blur_args { int size; double deviation; diff --git a/src/backend/backend_common.c b/src/backend/backend_common.c index 9561c9a..ccdcaac 100644 --- a/src/backend/backend_common.c +++ b/src/backend/backend_common.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (c) Yuxuan Shui #include +#include #include #include #include @@ -9,6 +10,8 @@ #include "backend/backend_common.h" #include "common.h" #include "kernel.h" +#include "config.h" +#include "utils.h" #include "log.h" #include "win.h" #include "x.h" diff --git a/src/backend/driver.c b/src/backend/driver.c index cea58f9..5346067 100644 --- a/src/backend/driver.c +++ b/src/backend/driver.c @@ -1,5 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (c) Yuxuan Shui +#include +#include #include #include @@ -7,6 +9,8 @@ #include "backend/backend.h" #include "backend/driver.h" #include "common.h" +#include "compiler.h" +#include "log.h" enum driver detect_driver(xcb_connection_t *c, backend_t *backend_data, xcb_window_t window) { enum driver ret = 0; diff --git a/src/backend/dummy/dummy.c b/src/backend/dummy/dummy.c index fd541b7..2f0604e 100644 --- a/src/backend/dummy/dummy.c +++ b/src/backend/dummy/dummy.c @@ -1,11 +1,17 @@ #include #include +#include "backend/backend.h" #include "backend/backend_common.h" #include "common.h" #include "compiler.h" +#include "config.h" +#include "log.h" +#include "region.h" +#include "types.h" #include "uthash_extra.h" #include "utils.h" +#include "x.h" struct dummy_image { xcb_pixmap_t pixmap; @@ -132,7 +138,6 @@ void *dummy_create_blur_context(struct backend_base *base attr_unused, } void dummy_destroy_blur_context(struct backend_base *base attr_unused, void *ctx attr_unused) { - } void dummy_get_blur_size(void *ctx attr_unused, int *width, int *height) { diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index a469ab7..7a0bdfd 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -8,6 +8,7 @@ #include #include // for xcb_render_fixed_t, XXX +#include "backend/backend.h" #include "common.h" #include "compiler.h" #include "config.h" @@ -15,6 +16,7 @@ #include "log.h" #include "region.h" #include "string_utils.h" +#include "types.h" #include "utils.h" #include "backend/backend_common.h" diff --git a/src/backend/gl/gl_common.h b/src/backend/gl/gl_common.h index d0644d8..0687513 100644 --- a/src/backend/gl/gl_common.h +++ b/src/backend/gl/gl_common.h @@ -7,7 +7,6 @@ #include #include "backend/backend.h" -#include "config.h" #include "log.h" #include "region.h" diff --git a/src/backend/xrender/xrender.c b/src/backend/xrender/xrender.c index 4e28ea9..33b9ce8 100644 --- a/src/backend/xrender/xrender.c +++ b/src/backend/xrender/xrender.c @@ -22,6 +22,7 @@ #include "utils.h" #include "win.h" #include "x.h" +#include "types.h" typedef struct _xrender_data { backend_t base; diff --git a/src/cache.c b/src/cache.c index d1ddda7..bab1874 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1,5 +1,6 @@ #include +#include "compiler.h" #include "utils.h" #include "cache.h" diff --git a/src/common.h b/src/common.h index 87d1408..33e7e01 100644 --- a/src/common.h +++ b/src/common.h @@ -36,6 +36,9 @@ #include #include #include +#include +#include +#include #include "uthash_extra.h" #ifdef CONFIG_OPENGL @@ -55,6 +58,8 @@ #include "region.h" #include "types.h" #include "utils.h" +#include "list.h" +#include "render.h" #include "x.h" // === Constants ===0 @@ -75,6 +80,7 @@ typedef struct glx_fbconfig glx_fbconfig_t; struct glx_session; struct atom; +struct conv; typedef struct _ignore { struct _ignore *next; @@ -269,7 +275,7 @@ typedef struct session { /// 1x1 white Picture. xcb_render_picture_t white_picture; /// Gaussian map of shadow. - conv *gaussian_map; + struct conv *gaussian_map; // for shadow precomputation /// A region in which shadow is not painted on. region_t shadow_exclude_reg; diff --git a/src/compton.c b/src/compton.c index 3ed6c9a..e04994e 100644 --- a/src/compton.c +++ b/src/compton.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/src/compton.modulemap b/src/compton.modulemap index eddb85c..ffd7458 100644 --- a/src/compton.modulemap +++ b/src/compton.modulemap @@ -63,6 +63,9 @@ module config { module xrescheck { header "xrescheck.h" } +module cache { + header "cache.h" +} module backend { module gl { module gl_common { diff --git a/src/config.h b/src/config.h index 6507e18..c1ab8af 100644 --- a/src/config.h +++ b/src/config.h @@ -19,13 +19,12 @@ #include #endif -#include "backend/backend.h" #include "compiler.h" #include "kernel.h" #include "log.h" #include "region.h" +#include "win_defs.h" #include "types.h" -#include "win.h" typedef struct session session_t; @@ -56,6 +55,14 @@ typedef struct win_option { double opacity; } win_option_t; +enum blur_method { + BLUR_METHOD_NONE = 0, + BLUR_METHOD_KERNEL, + BLUR_METHOD_BOX, + BLUR_METHOD_GAUSSIAN, + BLUR_METHOD_INVALID, +}; + typedef struct _c2_lptr c2_lptr_t; /// Structure representing all options. diff --git a/src/event.c b/src/event.c index bf95171..c1b7930 100644 --- a/src/event.c +++ b/src/event.c @@ -1,9 +1,12 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2019, Yuxuan Shui +#include + #include #include #include +#include #include "atom.h" #include "common.h" @@ -11,6 +14,11 @@ #include "compton.h" #include "event.h" #include "utils.h" +#include "region.h" +#include "config.h" +#include "x.h" +#include "win.h" +#include "log.h" /// Event handling with X is complicated. Handling events with other events possibly /// in-flight is no good. Because your internal state won't be up to date. Also, querying diff --git a/src/opengl.h b/src/opengl.h index da304b6..fd3fe9c 100644 --- a/src/opengl.h +++ b/src/opengl.h @@ -19,6 +19,7 @@ #include "win.h" #include +#include #include #include #include diff --git a/src/render.c b/src/render.c index 6ac22fd..c0e33e3 100644 --- a/src/render.c +++ b/src/render.c @@ -33,6 +33,7 @@ #include "win.h" #include "x.h" +#include "backend/backend.h" #include "backend/backend_common.h" #include "render.h" diff --git a/src/win.h b/src/win.h index 78d64b2..bdb06ce 100644 --- a/src/win.h +++ b/src/win.h @@ -14,7 +14,7 @@ #include #endif -#include "backend/backend.h" +#include "win_defs.h" #include "c2.h" #include "compiler.h" #include "list.h" @@ -24,6 +24,7 @@ #include "utils.h" #include "x.h" +struct backend_base; typedef struct session session_t; typedef struct _glx_texture glx_texture_t; @@ -49,79 +50,6 @@ typedef struct { } glx_blur_cache_t; #endif -typedef enum { - WINTYPE_UNKNOWN, - WINTYPE_DESKTOP, - WINTYPE_DOCK, - WINTYPE_TOOLBAR, - WINTYPE_MENU, - WINTYPE_UTILITY, - WINTYPE_SPLASH, - WINTYPE_DIALOG, - WINTYPE_NORMAL, - WINTYPE_DROPDOWN_MENU, - WINTYPE_POPUP_MENU, - WINTYPE_TOOLTIP, - WINTYPE_NOTIFICATION, - WINTYPE_COMBO, - WINTYPE_DND, - NUM_WINTYPES -} wintype_t; - -/// Enumeration type of window painting mode. -typedef enum { - WMODE_TRANS, // The window body is (potentially) transparent - WMODE_FRAME_TRANS, // The window body is opaque, but the frame is not - WMODE_SOLID, // The window is opaque including the frame -} winmode_t; - -/// Transition table: -/// (DESTROYED is when the win struct is destroyed and freed) -/// ('o' means in all other cases) -/// (Window is created in the UNMAPPED state) -/// +-------------+---------+----------+-------+-------+--------+--------+---------+ -/// | |UNMAPPING|DESTROYING|MAPPING|FADING |UNMAPPED| MAPPED |DESTROYED| -/// +-------------+---------+----------+-------+-------+--------+--------+---------+ -/// | UNMAPPING | o | Window |Window | - | Fading | - | - | -/// | | |destroyed |mapped | |finished| | | -/// +-------------+---------+----------+-------+-------+--------+--------+---------+ -/// | DESTROYING | - | o | - | - | - | - | Fading | -/// | | | | | | | |finished | -/// +-------------+---------+----------+-------+-------+--------+--------+---------+ -/// | MAPPING | Window | Window | o | - | - | Fading | - | -/// | |unmapped |destroyed | | | |finished| | -/// +-------------+---------+----------+-------+-------+--------+--------+---------+ -/// | FADING | Window | Window | - | o | - | Fading | - | -/// | |unmapped |destroyed | | | |finished| | -/// +-------------+---------+----------+-------+-------+--------+--------+---------+ -/// | UNMAPPED | - | - |Window | - | o | - | Window | -/// | | | |mapped | | | |destroyed| -/// +-------------+---------+----------+-------+-------+--------+--------+---------+ -/// | MAPPED | Window | Window | - |Opacity| - | o | - | -/// | |unmapped |destroyed | |change | | | | -/// +-------------+---------+----------+-------+-------+--------+--------+---------+ -typedef enum { - // The window is being faded out because it's unmapped. - WSTATE_UNMAPPING, - // The window is being faded out because it's destroyed, - WSTATE_DESTROYING, - // The window is being faded in - WSTATE_MAPPING, - // Window opacity is not at the target level - WSTATE_FADING, - // The window is mapped, no fading is in progress. - WSTATE_MAPPED, - // The window is unmapped, no fading is in progress. - WSTATE_UNMAPPED, -} winstate_t; - -enum win_flags { - /// win_image/shadow_image is out of date - WIN_FLAGS_IMAGE_STALE = 1, - /// there was an error trying to bind the images - WIN_FLAGS_IMAGE_ERROR = 2, -}; - /// An entry in the window stack. May or may not correspond to a window we know about. struct window_stack_entry { struct list_node stack_neighbour; @@ -324,7 +252,7 @@ struct managed_win { #endif }; -void win_release_image(backend_t *base, struct managed_win *w); +void win_release_image(struct backend_base *base, struct managed_win *w); bool must_use win_bind_image(session_t *ps, struct managed_win *w); /// Attempt a rebind of window's images. If that failed, the original images are kept. diff --git a/src/win_defs.h b/src/win_defs.h new file mode 100644 index 0000000..423ea9b --- /dev/null +++ b/src/win_defs.h @@ -0,0 +1,74 @@ +#pragma once + +typedef enum { + WINTYPE_UNKNOWN, + WINTYPE_DESKTOP, + WINTYPE_DOCK, + WINTYPE_TOOLBAR, + WINTYPE_MENU, + WINTYPE_UTILITY, + WINTYPE_SPLASH, + WINTYPE_DIALOG, + WINTYPE_NORMAL, + WINTYPE_DROPDOWN_MENU, + WINTYPE_POPUP_MENU, + WINTYPE_TOOLTIP, + WINTYPE_NOTIFICATION, + WINTYPE_COMBO, + WINTYPE_DND, + NUM_WINTYPES +} wintype_t; + +/// Enumeration type of window painting mode. +typedef enum { + WMODE_TRANS, // The window body is (potentially) transparent + WMODE_FRAME_TRANS, // The window body is opaque, but the frame is not + WMODE_SOLID, // The window is opaque including the frame +} winmode_t; + +/// Transition table: +/// (DESTROYED is when the win struct is destroyed and freed) +/// ('o' means in all other cases) +/// (Window is created in the UNMAPPED state) +/// +-------------+---------+----------+-------+-------+--------+--------+---------+ +/// | |UNMAPPING|DESTROYING|MAPPING|FADING |UNMAPPED| MAPPED |DESTROYED| +/// +-------------+---------+----------+-------+-------+--------+--------+---------+ +/// | UNMAPPING | o | Window |Window | - | Fading | - | - | +/// | | |destroyed |mapped | |finished| | | +/// +-------------+---------+----------+-------+-------+--------+--------+---------+ +/// | DESTROYING | - | o | - | - | - | - | Fading | +/// | | | | | | | |finished | +/// +-------------+---------+----------+-------+-------+--------+--------+---------+ +/// | MAPPING | Window | Window | o | - | - | Fading | - | +/// | |unmapped |destroyed | | | |finished| | +/// +-------------+---------+----------+-------+-------+--------+--------+---------+ +/// | FADING | Window | Window | - | o | - | Fading | - | +/// | |unmapped |destroyed | | | |finished| | +/// +-------------+---------+----------+-------+-------+--------+--------+---------+ +/// | UNMAPPED | - | - |Window | - | o | - | Window | +/// | | | |mapped | | | |destroyed| +/// +-------------+---------+----------+-------+-------+--------+--------+---------+ +/// | MAPPED | Window | Window | - |Opacity| - | o | - | +/// | |unmapped |destroyed | |change | | | | +/// +-------------+---------+----------+-------+-------+--------+--------+---------+ +typedef enum { + // The window is being faded out because it's unmapped. + WSTATE_UNMAPPING, + // The window is being faded out because it's destroyed, + WSTATE_DESTROYING, + // The window is being faded in + WSTATE_MAPPING, + // Window opacity is not at the target level + WSTATE_FADING, + // The window is mapped, no fading is in progress. + WSTATE_MAPPED, + // The window is unmapped, no fading is in progress. + WSTATE_UNMAPPED, +} winstate_t; + +enum win_flags { + /// win_image/shadow_image is out of date + WIN_FLAGS_IMAGE_STALE = 1, + /// there was an error trying to bind the images + WIN_FLAGS_IMAGE_ERROR = 2, +}; diff --git a/src/x.h b/src/x.h index 72e0dfe..9d41a38 100644 --- a/src/x.h +++ b/src/x.h @@ -13,6 +13,7 @@ #include "compiler.h" #include "kernel.h" #include "region.h" +#include "log.h" typedef struct session session_t;