diff --git a/src/c2.c b/src/c2.c index 8373f27..ad484a4 100644 --- a/src/c2.c +++ b/src/c2.c @@ -211,6 +211,26 @@ static const c2_predef_t C2_PREDEFS[] = { [C2_L_PROLE] = {"role", C2_L_TSTRING, 0}, }; +/** + * Get the numeric property value from a win_prop_t. + */ +static inline long winprop_get_int(winprop_t prop) { + long tgt = 0; + + if (!prop.nitems) { + return 0; + } + + switch (prop.format) { + case 8: tgt = *(prop.p8); break; + case 16: tgt = *(prop.p16); break; + case 32: tgt = *(prop.p32); break; + default: assert(0); break; + } + + return tgt; +} + /** * Compare next word in a string with another string. */ diff --git a/src/common.h b/src/common.h index ea06624..4477e29 100644 --- a/src/common.h +++ b/src/common.h @@ -41,11 +41,6 @@ #include "backend/gl/glx.h" #endif -// === Macros === - -#define MSTR_(s) #s -#define MSTR(s) MSTR_(s) - // X resource checker #ifdef DEBUG_XRC #include "xrescheck.h" @@ -56,13 +51,9 @@ #include "backend/driver.h" #include "compiler.h" #include "config.h" -#include "kernel.h" -#include "log.h" #include "region.h" -#include "render.h" #include "types.h" #include "utils.h" -#include "win.h" #include "x.h" // === Constants ===0 @@ -84,21 +75,11 @@ typedef struct glx_fbconfig glx_fbconfig_t; struct glx_session; struct atom; -/// Structure representing needed window updates. -typedef struct { - bool shadow : 1; - bool fade : 1; - bool focus : 1; - bool invert_color : 1; -} win_upd_t; - typedef struct _ignore { struct _ignore *next; unsigned long sequence; } ignore_t; -typedef struct _glx_texture glx_texture_t; - #ifdef CONFIG_OPENGL #ifdef DEBUG_GLX_DEBUG_CONTEXT typedef GLXContext (*f_glXCreateContextAttribsARB)(Display *dpy, GLXFBConfig config, @@ -109,31 +90,6 @@ typedef void (*GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severi typedef void (*f_DebugMessageCallback)(GLDEBUGPROC, void *userParam); #endif -/// @brief Wrapper of a binded GLX texture. -struct _glx_texture { - GLuint texture; - GLXPixmap glpixmap; - xcb_pixmap_t pixmap; - GLenum target; - int width; - int height; - bool y_inverted; -}; - -#ifdef CONFIG_OPENGL -typedef struct { - /// Fragment shader for blur. - GLuint frag_shader; - /// GLSL program for blur. - GLuint prog; - /// Location of uniform "offset_x" in blur GLSL program. - GLint unifm_offset_x; - /// Location of uniform "offset_y" in blur GLSL program. - GLint unifm_offset_y; - /// Location of uniform "factor_center" in blur GLSL program. - GLint unifm_factor_center; -} glx_blur_pass_t; - typedef struct glx_prog_main { /// GLSL program. GLuint prog; @@ -148,7 +104,6 @@ typedef struct glx_prog_main { #define GLX_PROG_MAIN_INIT \ { .prog = 0, .unifm_opacity = -1, .unifm_invert_color = -1, .unifm_tex = -1, } -#endif #else struct glx_prog_main {}; #endif @@ -162,9 +117,6 @@ typedef struct _latom { struct _latom *next; } latom_t; -#define REG_DATA_INIT \ - { NULL, 0 } - /// Structure containing all necessary data for a compton session. typedef struct session { // === Event handlers === @@ -545,25 +497,6 @@ static inline bool wid_has_prop(const session_t *ps, xcb_window_t w, xcb_atom_t return false; } -/** - * Get the numeric property value from a win_prop_t. - */ -static inline long winprop_get_int(winprop_t prop) { - long tgt = 0; - - if (!prop.nitems) - return 0; - - switch (prop.format) { - case 8: tgt = *(prop.p8); break; - case 16: tgt = *(prop.p16); break; - case 32: tgt = *(prop.p32); break; - default: assert(0); break; - } - - return tgt; -} - void force_repaint(session_t *ps); /** @name DBus handling diff --git a/src/compton.c b/src/compton.c index 73aca20..38c1c3f 100644 --- a/src/compton.c +++ b/src/compton.c @@ -29,6 +29,7 @@ #include #include "common.h" +#include "config.h" #include "compiler.h" #include "compton.h" #include "err.h" diff --git a/src/dbus.c b/src/dbus.c index cc11e79..4fd027b 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -752,7 +752,7 @@ static bool cdbus_process_win_get(session_t *ps, DBusMessage *msg) { } #define cdbus_m_win_get_do(tgt, apdarg_func) \ - if (!strcmp(MSTR(tgt), target)) { \ + if (!strcmp(#tgt, target)) { \ apdarg_func(ps, msg, w->tgt); \ return true; \ } @@ -957,13 +957,13 @@ static bool cdbus_process_opts_get(session_t *ps, DBusMessage *msg) { return false; #define cdbus_m_opts_get_do(tgt, apdarg_func) \ - if (!strcmp(MSTR(tgt), target)) { \ + if (!strcmp(#tgt, target)) { \ apdarg_func(ps, msg, ps->o.tgt); \ return true; \ } #define cdbus_m_opts_get_stub(tgt, apdarg_func, ret) \ - if (!strcmp(MSTR(tgt), target)) { \ + if (!strcmp(#tgt, target)) { \ apdarg_func(ps, msg, ret); \ return true; \ } @@ -1068,7 +1068,7 @@ static bool cdbus_process_opts_set(session_t *ps, DBusMessage *msg) { return false; #define cdbus_m_opts_set_do(tgt, type, real_type) \ - if (!strcmp(MSTR(tgt), target)) { \ + if (!strcmp(#tgt, target)) { \ real_type val; \ if (!cdbus_msg_get_arg(msg, 1, type, &val)) \ return false; \ diff --git a/src/opengl.h b/src/opengl.h index a776c00..fa1c12f 100644 --- a/src/opengl.h +++ b/src/opengl.h @@ -26,6 +26,19 @@ #include #include +typedef struct { + /// Fragment shader for blur. + GLuint frag_shader; + /// GLSL program for blur. + GLuint prog; + /// Location of uniform "offset_x" in blur GLSL program. + GLint unifm_offset_x; + /// Location of uniform "offset_y" in blur GLSL program. + GLint unifm_offset_y; + /// Location of uniform "factor_center" in blur GLSL program. + GLint unifm_factor_center; +} glx_blur_pass_t; + /// Structure containing GLX-dependent data for a compton session. typedef struct glx_session { // === OpenGL related === @@ -38,6 +51,17 @@ typedef struct glx_session { glx_blur_pass_t blur_passes[MAX_BLUR_PASS]; } glx_session_t; +/// @brief Wrapper of a binded GLX texture. +typedef struct _glx_texture { + GLuint texture; + GLXPixmap glpixmap; + xcb_pixmap_t pixmap; + GLenum target; + int width; + int height; + bool y_inverted; +} glx_texture_t; + #define CGLX_SESSION_INIT \ { .context = NULL } diff --git a/src/win.c b/src/win.c index 9648917..377b02a 100644 --- a/src/win.c +++ b/src/win.c @@ -15,10 +15,10 @@ #include #include +#include "common.h" #include "atom.h" #include "backend/backend.h" #include "c2.h" -#include "common.h" #include "compiler.h" #include "compton.h" #include "config.h"