From 8c71f3fcbe8c5b101f749f93caeb8047be052625 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 27 Jan 2019 23:57:43 +0000 Subject: [PATCH] Move some macros around Signed-off-by: Yuxuan Shui --- src/backend/gl/gl_common.c | 10 +++++----- src/backend/gl/gl_common.h | 2 ++ src/common.h | 4 ---- src/compton.c | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index 02e7bb16..25883801 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -4,7 +4,7 @@ #include #include #include -#include // for xcb_render_fixed_t, XXX +#include // for xcb_render_fixed_t, XXX #include "common.h" #include "compiler.h" @@ -16,7 +16,7 @@ #include "backend/gl/gl_common.h" -#define P_PAINTREG_START(var) \ +#define P_PAINTREG_START(reg_tgt, var) \ do { \ region_t reg_new; \ int nrects; \ @@ -244,7 +244,7 @@ bool gl_compose(const gl_texture_t *ptex, int x, int y, int dx, int dy, int widt } // Painting - P_PAINTREG_START(crect) { + P_PAINTREG_START(reg_tgt, crect) { // Calculate texture coordinates GLfloat texture_x1 = (double)(crect.x1 - dx + x); GLfloat texture_y1 = (double)(crect.y1 - dy + y); @@ -317,7 +317,7 @@ bool gl_dim_reg(session_t *ps, int dx, int dy, int width, int height, float z, glColor4f(0.0f, 0.0f, 0.0f, factor); { - P_PAINTREG_START(crect) { + P_PAINTREG_START(reg_tgt, crect) { glVertex3i(crect.x1, crect.y1, z); glVertex3i(crect.x2, crect.y1, z); glVertex3i(crect.x2, crect.y2, z); @@ -473,7 +473,7 @@ bool gl_blur_dst(session_t *ps, const gl_cap_t *cap, int dx, int dy, int width, // XXX use multiple draw calls is probably going to be slow than // just simply blur the whole area. - P_PAINTREG_START(crect) { + P_PAINTREG_START(reg_tgt, crect) { // Texture coordinates const GLfloat texture_x1 = (crect.x1 - dx) * texfac_x; const GLfloat texture_y1 = (crect.y1 - dy) * texfac_y; diff --git a/src/backend/gl/gl_common.h b/src/backend/gl/gl_common.h index c07376f1..f09d3786 100644 --- a/src/backend/gl/gl_common.h +++ b/src/backend/gl/gl_common.h @@ -8,6 +8,8 @@ #include "region.h" #include "log.h" +#define CASESTRRET(s) case s: return #s + // Program and uniforms for window shader typedef struct { /// GLSL program. diff --git a/src/common.h b/src/common.h index 7aa1f773..abd17252 100644 --- a/src/common.h +++ b/src/common.h @@ -77,10 +77,6 @@ #define MSTR_(s) #s #define MSTR(s) MSTR_(s) -// Use #s here to prevent macro expansion -/// Macro used for shortening some debugging code. -#define CASESTRRET(s) case s: return #s - // X resource checker #ifdef DEBUG_XRC #include "xrescheck.h" diff --git a/src/compton.c b/src/compton.c index 7ffb7f33..66f3ada9 100644 --- a/src/compton.c +++ b/src/compton.c @@ -50,7 +50,7 @@ #endif #include "options.h" -#define auto __auto_type +#define CASESTRRET(s) case s: return #s /// Get session_t pointer from a pointer to a member of session_t #define session_ptr(ptr, member) ({ \