Skip to content

Commit

Permalink
misc: general chores
Browse files Browse the repository at this point in the history
Organize files into folders, move some code around. Remove unnecessary
`#include`s. And fix some missing copyright declarations.

Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Jun 3, 2024
1 parent 1fa8e70 commit 270bcc4
Show file tree
Hide file tree
Showing 82 changed files with 582 additions and 575 deletions.
4 changes: 2 additions & 2 deletions src/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#include <uthash.h>

#include "compiler.h"
#include "list.h"
#include "log.h"
#include "utils.h"
#include "utils/list.h"
#include "utils/misc.h"

struct backend_plugins {
UT_hash_handle hh;
Expand Down
9 changes: 6 additions & 3 deletions src/atom.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) Yuxuan Shui <[email protected]>

#include <string.h>
#include <uthash.h>
#include <xcb/xcb.h>

#include "atom.h"
#include "cache.h"
#include "common.h"
#include "compiler.h"
#include "log.h"
#include "utils.h"
#include "utils/cache.h"
#include "utils/misc.h"

struct atom_entry {
struct cache_handle entry;
Expand Down Expand Up @@ -163,4 +166,4 @@ struct atom *init_mock_atoms(void) {
abort();
}

#endif
#endif
9 changes: 6 additions & 3 deletions src/atom.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) Yuxuan Shui <[email protected]>

#pragma once
#include <string.h>
#include <xcb/xcb.h>

#include "cache.h"
#include "meta.h"
#include "utils/meta.h"

// clang-format off
// Splitted into 2 lists because of the limitation of our macros
Expand Down Expand Up @@ -79,4 +82,4 @@ void destroy_atoms(struct atom *a);
/// secutive integers as atoms, starting from 1. Calling get_atom_name with atoms
/// previously seen will result in the string that was used to create the atom; if
/// the atom was never returned by get_atom, it will abort.
struct atom *init_mock_atoms(void);
struct atom *init_mock_atoms(void);
5 changes: 3 additions & 2 deletions src/backend/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@

#include <picom/types.h>

#include "backend/backend.h"
#include "common.h"
#include "compiler.h"
#include "config.h"
#include "log.h"
#include "region.h"
#include "win.h"
#include "wm/win.h"
#include "x.h"

#include "backend.h"

static struct backend_info {
UT_hash_handle hh;
const char *name;
Expand Down
9 changes: 5 additions & 4 deletions src/backend/backend_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
#include <xcb/xcb_image.h>
#include <xcb/xcb_renderutil.h>

#include "backend/backend_common.h"
#include "common.h"
#include "config.h"
#include "kernel.h"
#include "log.h"
#include "utils.h"
#include "win.h"
#include "utils/kernel.h"
#include "utils/misc.h"
#include "wm/win.h"
#include "x.h"

#include "backend_common.h"

/**
* Generate a 1x1 <code>Picture</code> of a particular color.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/backend/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#include <xcb/randr.h>
#include <xcb/xcb.h>

#include "backend/backend.h"
#include "backend/driver.h"
#include "common.h"
#include "compiler.h"
#include "log.h"

#include "driver.h"

/// Apply driver specified global workarounds. It's safe to call this multiple times.
void apply_driver_workarounds(struct session *ps, enum driver driver) {
if (driver & DRIVER_NVIDIA) {
Expand Down
2 changes: 1 addition & 1 deletion src/backend/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <xcb/xcb.h>

#include "config.h"
#include "utils.h"
#include "utils/misc.h"

struct session;
struct backend_base;
Expand Down
4 changes: 2 additions & 2 deletions src/backend/dummy/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include "config.h"
#include "log.h"
#include "region.h"
#include "uthash_extra.h"
#include "utils.h"
#include "utils/misc.h"
#include "utils/uthash_extra.h"
#include "x.h"

struct dummy_image {
Expand Down
3 changes: 1 addition & 2 deletions src/backend/gl/blur.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include <locale.h>
#include <stdbool.h>

#include <backend/backend.h>
#include <backend/backend_common.h>
#include "backend/backend_common.h"

#include "gl_common.h"

Expand Down
7 changes: 4 additions & 3 deletions src/backend/gl/egl.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@

#include "backend/backend.h"
#include "backend/backend_common.h"
#include "backend/gl/egl.h"
#include "backend/gl/gl_common.h"
#include "common.h"
#include "compiler.h"
#include "config.h"
#include "log.h"
#include "picom.h"
#include "utils.h"
#include "utils/misc.h"
#include "x.h"

#include "egl.h"
#include "gl_common.h"

struct egl_data {
struct gl_data gl;
EGLDisplay display;
Expand Down
5 changes: 0 additions & 5 deletions src/backend/gl/egl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
#include <xcb/render.h>
#include <xcb/xcb.h>

#include "compiler.h"
#include "log.h"
#include "utils.h"
#include "x.h"

struct eglext_info {
bool initialized;
bool has_EGL_MESA_query_driver;
Expand Down
6 changes: 3 additions & 3 deletions src/backend/gl/gl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

#include <picom/types.h>

#include "backend/backend_common.h"
#include "common.h"
#include "compiler.h"
#include "config.h"
#include "log.h"
#include "region.h"
#include "utils.h"
#include "utils/misc.h"

#include "backend/backend_common.h"
#include "backend/gl/gl_common.h"
#include "gl_common.h"

void gl_prepare(backend_t *base, const region_t *reg attr_unused) {
auto gd = (struct gl_data *)base;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/gl/gl_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <xcb/xproto.h>

#include "backend/backend.h"
#include "backend/backend_common.h"

#include "log.h"
#include "region.h"

Expand Down
14 changes: 7 additions & 7 deletions src/backend/gl/glx.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@
* See LICENSE-mit for more information.
*
*/

#include <X11/Xlib-xcb.h>
#include <limits.h>
#include <pixman.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

#include <X11/Xlib-xcb.h>
#include <pixman.h>
#include <uthash.h>
#include <xcb/composite.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>

#include "backend/backend.h"
#include "backend/backend_common.h"
#include "backend/gl/gl_common.h"
#include "backend/gl/glx.h"
#include "common.h"
#include "compiler.h"
#include "config.h"
#include "log.h"
#include "picom.h"
#include "utils.h"
#include "win.h"
#include "utils/misc.h"
#include "x.h"

#include "gl_common.h"
#include "glx.h"

struct _glx_data {
struct gl_data gl;
xcb_window_t target_win;
Expand Down
6 changes: 2 additions & 4 deletions src/backend/gl/glx.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) Yuxuan Shui <[email protected]>
#pragma once
#include <stdbool.h>

#include <X11/Xlib.h>
#include <epoxy/glx.h>
#include <stdbool.h>
#include <xcb/render.h>
#include <xcb/xcb.h>

#include "compiler.h"
#include "log.h"
#include "utils.h"
#include "x.h"

struct glx_fbconfig_info {
Expand Down
1 change: 1 addition & 0 deletions src/backend/gl/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
srcs += [ files('blur.c', 'egl.c', 'gl_common.c', 'glx.c', 'shaders.c') ]
7 changes: 2 additions & 5 deletions src/backend/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
srcs += [
files(
'dummy/dummy.c',
'xrender/xrender.c',
'backend.c',
'backend_common.c',
'driver.c',
),
]

subdir('xrender')
# enable opengl
if get_option('opengl')
srcs += [
files('gl/blur.c', 'gl/egl.c', 'gl/gl_common.c', 'gl/glx.c', 'gl/shaders.c'),
]
subdir('gl')
endif
1 change: 1 addition & 0 deletions src/backend/xrender/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
srcs += [ files('xrender.c') ]
5 changes: 2 additions & 3 deletions src/backend/xrender/xrender.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
#include "common.h"
#include "compiler.h"
#include "config.h"
#include "kernel.h"
#include "log.h"
#include "picom.h"
#include "region.h"
#include "utils.h"
#include "win.h"
#include "utils/kernel.h"
#include "utils/misc.h"
#include "x.h"

struct xrender_image_data_inner {
Expand Down
19 changes: 5 additions & 14 deletions src/c2.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
// SPDX-License-Identifier: MIT

/*
* Compton - a compositor for X11
*
* Based on `xcompmgr` - Copyright (c) 2003, Keith Packard
*
* Copyright (c) 2011-2013, Christopher Jeffrey
* See LICENSE-mit for more information.
*
*/
// Copyright (c) 2011-2013, Christopher Jeffrey
// Copyright (c) 2018 Yuxuan Shui <[email protected]>

#include <assert.h>
#include <ctype.h>
Expand All @@ -34,11 +26,10 @@
#include "compiler.h"
#include "config.h"
#include "log.h"
#include "string_utils.h"
#include "test.h"
#include "uthash_extra.h"
#include "utils.h"
#include "win.h"
#include "utils/str.h"
#include "utils/uthash_extra.h"
#include "wm/win.h"
#include "x.h"

#include "c2.h"
Expand Down
11 changes: 2 additions & 9 deletions src/c2.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// SPDX-License-Identifier: MIT
/*
* Compton - a compositor for X11
*
* Based on `xcompmgr` - Copyright (c) 2003, Keith Packard
*
* Copyright (c) 2011-2013, Christopher Jeffrey
* See LICENSE-mit for more information.
*
*/
// Copyright (c) 2011-2013, Christopher Jeffrey
// Copyright (c) 2018 Yuxuan Shui <[email protected]>

#pragma once

Expand Down
19 changes: 5 additions & 14 deletions src/common.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
// SPDX-License-Identifier: MIT
/*
* Compton - a compositor for X11
*
* Based on `xcompmgr` - Copyright (c) 2003, Keith Packard
*
* Copyright (c) 2011-2013, Christopher Jeffrey
* Copyright (c) 2018, Yuxuan Shui <[email protected]>
*
* See LICENSE-mit for more information.
*
*/
// Copyright (c) 2011-2013, Christopher Jeffrey
// Copyright (c) 2018, Yuxuan Shui <[email protected]>

#pragma once

Expand All @@ -28,14 +19,14 @@
// === Includes ===

// For some special functions
#include <assert.h>
#include <stdbool.h>
#include <sys/time.h>
#include <time.h>

#include <X11/Xlib.h>
#include <ev.h>
#include <pixman.h>
#include <uthash.h>
#include <xcb/render.h>
#include <xcb/sync.h>
#include <xcb/xproto.h>
Expand All @@ -57,8 +48,8 @@
#include "config.h"
#include "region.h"
#include "render.h"
#include "statistics.h"
#include "win_defs.h"
#include "utils/statistics.h"
#include "wm/defs.h"
#include "x.h"

// === Constants ===0
Expand Down
1 change: 1 addition & 0 deletions src/compiler.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) 2018 Yuxuan Shui <[email protected]>

#pragma once

#ifdef HAS_STDC_PREDEF_H
Expand Down
Loading

0 comments on commit 270bcc4

Please sign in to comment.