Skip to content

Commit

Permalink
Update .clang-format
Browse files Browse the repository at this point in the history
And reformat the existing code

Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Aug 18, 2020
1 parent 2b677c8 commit b0a3c4e
Show file tree
Hide file tree
Showing 34 changed files with 227 additions and 196 deletions.
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ BinPackArguments: true
BinPackParameters: true
#ReflowComments: true
AlignTrailingComments: true
AlignConsecutiveMacros: true
SpacesBeforeTrailingComments: 8
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
AllowShortIfStatementsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: false
IndentCaseLabels: false
IndentPPDirectives: None
IndentPPDirectives: AfterHash
PenaltyReturnTypeOnItsOwnLine: 0
PenaltyBreakAssignment: 0
PenaltyBreakBeforeFirstCallParameter: 1
Expand Down
2 changes: 1 addition & 1 deletion src/atom.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include "atom.h"
#include "common.h"
#include "utils.h"
#include "log.h"
#include "utils.h"

static inline void *atom_getter(void *ud, const char *atom_name, int *err) {
xcb_connection_t *c = ud;
Expand Down
2 changes: 1 addition & 1 deletion src/atom.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <xcb/xcb.h>

#include "meta.h"
#include "cache.h"
#include "meta.h"

// clang-format off
// Splitted into 2 lists because of the limitation of our macros
Expand Down
2 changes: 1 addition & 1 deletion src/backend/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include <stdbool.h>

#include "config.h"
#include "compiler.h"
#include "config.h"
#include "driver.h"
#include "kernel.h"
#include "region.h"
Expand Down
4 changes: 2 additions & 2 deletions src/backend/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ struct backend_base;
/// also the generic modesetting driver.
/// This enum represents _both_ drivers.
enum driver {
DRIVER_AMDGPU = 1, // AMDGPU for DDX, radeonsi for OpenGL
DRIVER_RADEON = 2, // ATI for DDX, mesa r600 for OpenGL
DRIVER_AMDGPU = 1, // AMDGPU for DDX, radeonsi for OpenGL
DRIVER_RADEON = 2, // ATI for DDX, mesa r600 for OpenGL
DRIVER_FGLRX = 4,
DRIVER_NVIDIA = 8,
DRIVER_NOUVEAU = 16,
Expand Down
2 changes: 1 addition & 1 deletion src/backend/gl/gl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "backend/gl/gl_common.h"

#define GLSL(version, ...) "#version " #version "\n" #__VA_ARGS__
#define QUOTE(...) #__VA_ARGS__
#define QUOTE(...) #__VA_ARGS__

static const GLuint vert_coord_loc = 0;
static const GLuint vert_in_texcoord_loc = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/gl/glx.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include "backend/gl/glx.h"
#include "common.h"
#include "compiler.h"
#include "picom.h"
#include "config.h"
#include "log.h"
#include "picom.h"
#include "region.h"
#include "utils.h"
#include "win.h"
Expand Down
9 changes: 4 additions & 5 deletions src/backend/gl/glx.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
#include <stdbool.h>
// Older version of glx.h defines function prototypes for these extensions...
// Rename them to avoid conflicts
#define glXSwapIntervalMESA glXSwapIntervalMESA_
#define glXBindTexImageEXT glXBindTexImageEXT_
#define glXSwapIntervalMESA glXSwapIntervalMESA_
#define glXBindTexImageEXT glXBindTexImageEXT_
#define glXReleaseTexImageEXT glXReleaseTexImageEXT
#include <GL/glx.h>
#undef glXSwapIntervalMESA
#undef glXBindTexImageEXT
#undef glXReleaseTexImageEXT
#include <X11/Xlib.h>
#include <xcb/xcb.h>
#include <xcb/render.h>
#include <xcb/xcb.h>

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

Expand All @@ -43,7 +43,6 @@ struct glx_fbconfig_criteria {

struct glx_fbconfig_info *glx_find_fbconfig(Display *, int screen, struct xvisual_info);


struct glxext_info {
bool initialized;
bool has_GLX_SGI_video_sync;
Expand Down
18 changes: 9 additions & 9 deletions src/c2.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

// libpcre
#ifdef CONFIG_REGEX_PCRE
#include <pcre.h>
# include <pcre.h>

// For compatibility with <libpcre-8.20
#ifndef PCRE_STUDY_JIT_COMPILE
#define PCRE_STUDY_JIT_COMPILE 0
#define LPCRE_FREE_STUDY(extra) pcre_free(extra)
#else
#define LPCRE_FREE_STUDY(extra) pcre_free_study(extra)
#endif
# ifndef PCRE_STUDY_JIT_COMPILE
# define PCRE_STUDY_JIT_COMPILE 0
# define LPCRE_FREE_STUDY(extra) pcre_free(extra)
# else
# define LPCRE_FREE_STUDY(extra) pcre_free_study(extra)
# endif

#endif

Expand Down Expand Up @@ -1060,14 +1060,14 @@ static bool c2_l_postprocess(session_t *ps, c2_l_t *pleaf) {
pleaf->ptnstr, erroffset, error);
return false;
}
#ifdef CONFIG_REGEX_PCRE_JIT
# ifdef CONFIG_REGEX_PCRE_JIT
pleaf->regex_pcre_extra =
pcre_study(pleaf->regex_pcre, PCRE_STUDY_JIT_COMPILE, &error);
if (!pleaf->regex_pcre_extra) {
printf("Pattern \"%s\": PCRE regular expression study failed: %s",
pleaf->ptnstr, error);
}
#endif
# endif

// Free the target string
// free(pleaf->tgt);
Expand Down
3 changes: 2 additions & 1 deletion src/c2.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ c2_lptr_t *c2_parse(c2_lptr_t **pcondlst, const char *pattern, void *data);

c2_lptr_t *c2_free_lptr(c2_lptr_t *lp);

bool c2_match(session_t *ps, const struct managed_win *w, const c2_lptr_t *condlst, void **pdata);
bool c2_match(session_t *ps, const struct managed_win *w, const c2_lptr_t *condlst,
void **pdata);

bool c2_list_postprocess(session_t *ps, c2_lptr_t *list);
2 changes: 1 addition & 1 deletion src/cache.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <uthash.h>

#include "cache.h"
#include "compiler.h"
#include "utils.h"
#include "cache.h"

struct cache_entry {
char *key;
Expand Down
28 changes: 14 additions & 14 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,30 @@
#include <X11/Xlib.h>
#include <ev.h>
#include <pixman.h>
#include <xcb/xproto.h>
#include <xcb/render.h>
#include <xcb/sync.h>
#include <xcb/xproto.h>

#include "uthash_extra.h"
#ifdef CONFIG_OPENGL
#include "backend/gl/glx.h"
# include "backend/gl/glx.h"
#endif

// X resource checker
#ifdef DEBUG_XRC
#include "xrescheck.h"
# include "xrescheck.h"
#endif

// FIXME This list of includes should get shorter
#include "backend/backend.h"
#include "backend/driver.h"
#include "compiler.h"
#include "config.h"
#include "list.h"
#include "region.h"
#include "render.h"
#include "types.h"
#include "utils.h"
#include "list.h"
#include "render.h"
#include "win_defs.h"
#include "x.h"

Expand Down Expand Up @@ -89,14 +89,14 @@ typedef struct _ignore {
} ignore_t;

#ifdef CONFIG_OPENGL
#ifdef DEBUG_GLX_DEBUG_CONTEXT
# ifdef DEBUG_GLX_DEBUG_CONTEXT
typedef GLXContext (*f_glXCreateContextAttribsARB)(Display *dpy, GLXFBConfig config,
GLXContext share_context, Bool direct,
const int *attrib_list);
typedef void (*GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar *message, GLvoid *userParam);
typedef void (*f_DebugMessageCallback)(GLDEBUGPROC, void *userParam);
#endif
# endif

typedef struct glx_prog_main {
/// GLSL program.
Expand All @@ -111,11 +111,11 @@ typedef struct glx_prog_main {
GLint unifm_time;
} glx_prog_main_t;

#define GLX_PROG_MAIN_INIT \
{ \
.prog = 0, .unifm_opacity = -1, .unifm_invert_color = -1, \
.unifm_tex = -1, .unifm_time = -1 \
}
# define GLX_PROG_MAIN_INIT \
{ \
.prog = 0, .unifm_opacity = -1, .unifm_invert_color = -1, \
.unifm_tex = -1, .unifm_time = -1 \
}

#else
struct glx_prog_main {};
Expand Down Expand Up @@ -250,11 +250,11 @@ typedef struct session {
// Cached blur convolution kernels.
struct x_convolution_kernel **blur_kerns_cache;
/// If we should quit
bool quit:1;
bool quit : 1;
/// Whether there are pending updates, like window creation, etc.
/// TODO use separate flags for dfferent kinds of updates so we don't
/// waste our time.
bool pending_updates:1;
bool pending_updates : 1;

// === Expose event related ===
/// Pointer to an array of <code>XRectangle</code>-s of exposed region.
Expand Down
Loading

0 comments on commit b0a3c4e

Please sign in to comment.