Fix compiler warning about unused parameters

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-07-25 02:27:02 +01:00
parent c3c0578d14
commit bb756b2238
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
15 changed files with 122 additions and 90 deletions

View File

@ -280,9 +280,9 @@ static void _gl_compose(backend_t *base, struct gl_image *img, GLuint target,
/// @param[in] root_height height of the back buffer
/// @param[in] y_inverted whether the texture is y inverted
/// @param[out] coord, indices output
static void x_rect_to_coords(int nrects, const rect_t *rects, int dst_x, int dst_y,
int width, int height, int root_height, bool y_inverted,
GLint *coord, GLuint *indices) {
static void
x_rect_to_coords(int nrects, const rect_t *rects, int dst_x, int dst_y, int height,
int root_height, bool y_inverted, GLint *coord, GLuint *indices) {
dst_y = root_height - dst_y;
if (y_inverted) {
dst_y -= height;
@ -334,8 +334,9 @@ static void x_rect_to_coords(int nrects, const rect_t *rects, int dst_x, int dst
}
}
// TODO: make use of reg_visible
void gl_compose(backend_t *base, void *image_data, int dst_x, int dst_y,
const region_t *reg_tgt, const region_t *reg_visible) {
const region_t *reg_tgt, const region_t *reg_visible attr_unused) {
struct gl_data *gd = (void *)base;
struct gl_image *img = image_data;
@ -357,8 +358,8 @@ void gl_compose(backend_t *base, void *image_data, int dst_x, int dst_y,
auto coord = ccalloc(nrects * 16, GLint);
auto indices = ccalloc(nrects * 6, GLuint);
x_rect_to_coords(nrects, rects, dst_x, dst_y, img->inner->width, img->inner->height,
gd->height, img->inner->y_inverted, coord, indices);
x_rect_to_coords(nrects, rects, dst_x, dst_y, img->inner->height, gd->height,
img->inner->y_inverted, coord, indices);
_gl_compose(base, img, 0, coord, indices, nrects);
free(indices);
@ -369,7 +370,7 @@ void gl_compose(backend_t *base, void *image_data, int dst_x, int dst_y,
* Blur contents in a particular region.
*/
bool gl_blur(backend_t *base, double opacity, void *ctx, const region_t *reg_blur,
const region_t *reg_visible) {
const region_t *reg_visible attr_unused) {
struct gl_blur_context *bctx = ctx;
struct gl_data *gd = (void *)base;
@ -441,14 +442,13 @@ bool gl_blur(backend_t *base, double opacity, void *ctx, const region_t *reg_blu
auto coord = ccalloc(nrects * 16, GLint);
auto indices = ccalloc(nrects * 6, GLuint);
x_rect_to_coords(nrects, rects, extent_resized->x1, extent_resized->y2,
bctx->texture_width, bctx->texture_height, gd->height, false,
coord, indices);
bctx->texture_height, gd->height, false, coord, indices);
auto coord_resized = ccalloc(nrects_resized * 16, GLint);
auto indices_resized = ccalloc(nrects_resized * 6, GLuint);
x_rect_to_coords(nrects_resized, rects_resized, extent_resized->x1,
extent_resized->y2, bctx->texture_width, bctx->texture_height,
bctx->texture_height, false, coord_resized, indices_resized);
extent_resized->y2, bctx->texture_height, bctx->texture_height,
false, coord_resized, indices_resized);
pixman_region32_fini(&reg_blur_resized);
GLuint vao[2];
@ -729,7 +729,8 @@ void gl_release_image(backend_t *base, void *image_data) {
gl_check_err();
}
void *gl_copy(backend_t *base, const void *image_data, const region_t *reg_visible) {
void *gl_copy(backend_t *base attr_unused, const void *image_data,
const region_t *reg_visible attr_unused) {
const struct gl_image *img = image_data;
auto new_img = ccalloc(1, struct gl_image);
*new_img = *img;
@ -745,7 +746,7 @@ static inline void gl_free_blur_shader(gl_blur_shader_t *shader) {
shader->prog = 0;
}
void gl_destroy_blur_context(backend_t *base, void *ctx) {
void gl_destroy_blur_context(backend_t *base attr_unused, void *ctx) {
struct gl_blur_context *bctx = ctx;
// Free GLSL shaders/programs
for (int i = 0; i < bctx->npasses; ++i) {
@ -1105,7 +1106,7 @@ static void gl_image_apply_alpha(backend_t *base, struct gl_image *img,
/// stub for backend_operations::image_op
bool gl_image_op(backend_t *base, enum image_operations op, void *image_data,
const region_t *reg_op, const region_t *reg_visible, void *arg) {
const region_t *reg_op, const region_t *reg_visible attr_unused, void *arg) {
struct gl_image *tex = image_data;
int *iargs = arg;
switch (op) {
@ -1129,7 +1130,7 @@ bool gl_image_op(backend_t *base, enum image_operations op, void *image_data,
return true;
}
bool gl_is_image_transparent(backend_t *base, void *image_data) {
bool gl_is_image_transparent(backend_t *base attr_unused, void *image_data) {
struct gl_image *img = image_data;
return img->has_alpha;
}

View File

@ -25,8 +25,8 @@
#include "backend/gl/gl_common.h"
#include "backend/gl/glx.h"
#include "common.h"
#include "compton.h"
#include "compiler.h"
#include "compton.h"
#include "config.h"
#include "log.h"
#include "region.h"
@ -203,7 +203,7 @@ void glx_deinit(backend_t *base) {
free(gd);
}
static void *glx_decouple_user_data(backend_t * attr_unused base, void * attr_unused ud) {
static void *glx_decouple_user_data(backend_t *base attr_unused, void *ud attr_unused) {
auto ret = cmalloc(struct _glx_pixmap);
ret->owned = false;
ret->glpixmap = 0;

View File

@ -361,7 +361,7 @@ static int buffer_age(backend_t *backend_data) {
return xd->buffer_age[xd->curr_back];
}
static bool is_image_transparent(backend_t *bd, void *image) {
static bool is_image_transparent(backend_t *bd attr_unused, void *image) {
struct _xrender_image_data *img = image;
return img->has_alpha;
}
@ -484,7 +484,7 @@ static void *copy(backend_t *base, const void *image, const region_t *reg) {
return new_img;
}
void *create_blur_context(backend_t *base, enum blur_method method, void *args) {
void *create_blur_context(backend_t *base attr_unused, enum blur_method method, void *args) {
auto ret = ccalloc(1, struct _xrender_blur_context);
if (!method || method >= BLUR_METHOD_INVALID) {
ret->method = BLUR_METHOD_NONE;
@ -521,7 +521,7 @@ void *create_blur_context(backend_t *base, enum blur_method method, void *args)
return ret;
}
void destroy_blur_context(backend_t *base, void *ctx_) {
void destroy_blur_context(backend_t *base attr_unused, void *ctx_) {
struct _xrender_blur_context *ctx = ctx_;
for (int i = 0; i < ctx->x_blur_kernel_count; i++) {
free(ctx->x_blur_kernel[i]);

View File

@ -96,7 +96,7 @@ void set_root_flags(session_t *ps, uint64_t flags) {
ps->root_flags |= flags;
}
static inline void quit_compton(session_t *ps) {
void quit_compton(session_t *ps) {
ps->quit = true;
ev_break(ps->loop, EVBREAK_ALL);
}
@ -178,8 +178,9 @@ static inline struct managed_win *find_win_all(session_t *ps, const xcb_window_t
void queue_redraw(session_t *ps) {
// If --benchmark is used, redraw is always queued
if (!ps->redraw_needed && !ps->o.benchmark)
if (!ps->redraw_needed && !ps->o.benchmark) {
ev_idle_start(ps->loop, &ps->draw_idle);
}
ps->redraw_needed = true;
}
@ -1225,7 +1226,7 @@ static void redir_stop(session_t *ps) {
}
// Handle queued events before we go to sleep
static void handle_queued_x_events(EV_P_ ev_prepare *w, int revents) {
static void handle_queued_x_events(EV_P attr_unused, ev_prepare *w, int revents attr_unused) {
session_t *ps = session_ptr(w, event_check);
xcb_generic_event_t *ev;
while ((ev = xcb_poll_for_queued_event(ps->c))) {
@ -1288,18 +1289,18 @@ static void refresh_stale_images(session_t *ps) {
/**
* Unredirection timeout callback.
*/
static void tmout_unredir_callback(EV_P_ ev_timer *w, int revents) {
static void tmout_unredir_callback(EV_P attr_unused, ev_timer *w, int revents attr_unused) {
session_t *ps = session_ptr(w, unredir_timer);
ps->tmout_unredir_hit = true;
queue_redraw(ps);
}
static void fade_timer_callback(EV_P_ ev_timer *w, int revents) {
static void fade_timer_callback(EV_P attr_unused, ev_timer *w, int revents attr_unused) {
session_t *ps = session_ptr(w, fade_timer);
queue_redraw(ps);
}
static void _draw_callback(EV_P_ session_t *ps, int revents) {
static void _draw_callback(EV_P_ session_t *ps, int revents attr_unused) {
if (ps->pending_updates) {
log_debug("Delayed handling of events, entering critical section");
auto e = xcb_request_check(ps->c, xcb_grab_server_checked(ps->c));
@ -1311,7 +1312,7 @@ static void _draw_callback(EV_P_ session_t *ps, int revents) {
}
// Catching up with X server
handle_queued_x_events(ps->loop, &ps->event_check, 0);
handle_queued_x_events(EV_A_ & ps->event_check, 0);
// Call fill_win on new windows
handle_new_windows(ps);
@ -1373,10 +1374,10 @@ static void _draw_callback(EV_P_ session_t *ps, int revents) {
// Start/stop fade timer depends on whether window are fading
if (!fade_running && ev_is_active(&ps->fade_timer)) {
ev_timer_stop(ps->loop, &ps->fade_timer);
ev_timer_stop(EV_A_ & ps->fade_timer);
} else if (fade_running && !ev_is_active(&ps->fade_timer)) {
ev_timer_set(&ps->fade_timer, fade_timeout(ps), 0);
ev_timer_start(ps->loop, &ps->fade_timer);
ev_timer_start(EV_A_ & ps->fade_timer);
}
// If the screen is unredirected, free all_damage to stop painting
@ -1408,8 +1409,9 @@ static void draw_callback(EV_P_ ev_idle *w, int revents) {
_draw_callback(EV_A_ ps, revents);
// Don't do painting non-stop unless we are in benchmark mode
if (!ps->o.benchmark)
ev_idle_stop(ps->loop, &ps->draw_idle);
if (!ps->o.benchmark) {
ev_idle_stop(EV_A_ & ps->draw_idle);
}
}
static void delayed_draw_timer_callback(EV_P_ ev_timer *w, int revents) {
@ -1431,7 +1433,7 @@ static void delayed_draw_callback(EV_P_ ev_idle *w, int revents) {
double delay = swopti_handle_timeout(ps);
if (delay < 1e-6) {
if (!ps->o.benchmark) {
ev_idle_stop(ps->loop, &ps->draw_idle);
ev_idle_stop(EV_A_ & ps->draw_idle);
}
return _draw_callback(EV_A_ ps, revents);
}
@ -1446,13 +1448,13 @@ static void delayed_draw_callback(EV_P_ ev_idle *w, int revents) {
// We do this anyway even if we are in benchmark mode. That means we will
// have to restart draw_idle after the draw actually happened when we are in
// benchmark mode.
ev_idle_stop(ps->loop, &ps->draw_idle);
ev_idle_stop(EV_A_ & ps->draw_idle);
ev_timer_set(&ps->delayed_draw_timer, delay, 0);
ev_timer_start(ps->loop, &ps->delayed_draw_timer);
ev_timer_start(EV_A_ & ps->delayed_draw_timer);
}
static void x_event_callback(EV_P_ ev_io *w, int revents) {
static void x_event_callback(EV_P attr_unused, ev_io *w, int revents attr_unused) {
session_t *ps = (session_t *)w;
xcb_generic_event_t *ev = xcb_poll_for_event(ps->c);
if (ev) {
@ -1466,13 +1468,12 @@ static void x_event_callback(EV_P_ ev_io *w, int revents) {
*
* This will result in compton resetting itself after next paint.
*/
static void reset_enable(EV_P_ ev_signal *w, int revents) {
session_t *ps = session_ptr(w, usr1_signal);
static void reset_enable(EV_P_ ev_signal *w attr_unused, int revents attr_unused) {
log_info("compton is resetting...");
ev_break(ps->loop, EVBREAK_ALL);
ev_break(EV_A_ EVBREAK_ALL);
}
static void exit_enable(EV_P_ ev_signal *w, int revents) {
static void exit_enable(EV_P attr_unused, ev_signal *w, int revents attr_unused) {
session_t *ps = session_ptr(w, int_signal);
log_info("compton is quitting...");
quit_compton(ps);

View File

@ -59,6 +59,8 @@ void discard_ignore(session_t *ps, unsigned long sequence);
void set_root_flags(session_t *ps, uint64_t flags);
void quit_compton(session_t *ps);
xcb_window_t session_get_target_window(session_t *);
/**

View File

@ -226,7 +226,7 @@ typedef struct ev_dbus_timer {
/**
* Callback for handling a D-Bus timeout.
*/
static void cdbus_callback_handle_timeout(EV_P_ ev_timer *w, int revents) {
static void cdbus_callback_handle_timeout(EV_P attr_unused, ev_timer *w, int revents attr_unused) {
ev_dbus_timer *t = (void *)w;
dbus_timeout_handle(t->t);
}
@ -289,7 +289,7 @@ typedef struct ev_dbus_io {
DBusWatch *dw;
} ev_dbus_io;
void cdbus_io_callback(EV_P_ ev_io *w, int revents) {
void cdbus_io_callback(EV_P attr_unused, ev_io *w, int revents) {
ev_dbus_io *dw = (void *)w;
DBusWatchFlags flags = 0;
if (revents & EV_READ)
@ -368,7 +368,7 @@ static void cdbus_callback_watch_toggled(DBusWatch *watch, void *data) {
/**
* Callback to append a bool argument to a message.
*/
static bool cdbus_apdarg_bool(session_t *ps, DBusMessage *msg, const void *data) {
static bool cdbus_apdarg_bool(session_t *ps attr_unused, DBusMessage *msg, const void *data) {
assert(data);
dbus_bool_t val = *(const bool *)data;
@ -384,7 +384,7 @@ static bool cdbus_apdarg_bool(session_t *ps, DBusMessage *msg, const void *data)
/**
* Callback to append an int32 argument to a message.
*/
static bool cdbus_apdarg_int32(session_t *ps, DBusMessage *msg, const void *data) {
static bool cdbus_apdarg_int32(session_t *ps attr_unused, DBusMessage *msg, const void *data) {
if (!dbus_message_append_args(msg, DBUS_TYPE_INT32, data, DBUS_TYPE_INVALID)) {
log_error("Failed to append argument.");
return false;
@ -396,7 +396,8 @@ static bool cdbus_apdarg_int32(session_t *ps, DBusMessage *msg, const void *data
/**
* Callback to append an uint32 argument to a message.
*/
static bool cdbus_apdarg_uint32(session_t *ps, DBusMessage *msg, const void *data) {
static bool
cdbus_apdarg_uint32(session_t *ps attr_unused, DBusMessage *msg, const void *data) {
if (!dbus_message_append_args(msg, DBUS_TYPE_UINT32, data, DBUS_TYPE_INVALID)) {
log_error("Failed to append argument.");
return false;
@ -408,7 +409,8 @@ static bool cdbus_apdarg_uint32(session_t *ps, DBusMessage *msg, const void *dat
/**
* Callback to append a double argument to a message.
*/
static bool cdbus_apdarg_double(session_t *ps, DBusMessage *msg, const void *data) {
static bool
cdbus_apdarg_double(session_t *ps attr_unused, DBusMessage *msg, const void *data) {
if (!dbus_message_append_args(msg, DBUS_TYPE_DOUBLE, data, DBUS_TYPE_INVALID)) {
log_error("Failed to append argument.");
return false;
@ -420,7 +422,7 @@ static bool cdbus_apdarg_double(session_t *ps, DBusMessage *msg, const void *dat
/**
* Callback to append a Window argument to a message.
*/
static bool cdbus_apdarg_wid(session_t *ps, DBusMessage *msg, const void *data) {
static bool cdbus_apdarg_wid(session_t *ps attr_unused, DBusMessage *msg, const void *data) {
assert(data);
cdbus_window_t val = *(const xcb_window_t *)data;
@ -435,7 +437,7 @@ static bool cdbus_apdarg_wid(session_t *ps, DBusMessage *msg, const void *data)
/**
* Callback to append an cdbus_enum_t argument to a message.
*/
static bool cdbus_apdarg_enum(session_t *ps, DBusMessage *msg, const void *data) {
static bool cdbus_apdarg_enum(session_t *ps attr_unused, DBusMessage *msg, const void *data) {
assert(data);
if (!dbus_message_append_args(msg, CDBUS_TYPE_ENUM, data, DBUS_TYPE_INVALID)) {
log_error("Failed to append argument.");
@ -448,7 +450,8 @@ static bool cdbus_apdarg_enum(session_t *ps, DBusMessage *msg, const void *data)
/**
* Callback to append a string argument to a message.
*/
static bool cdbus_apdarg_string(session_t *ps, DBusMessage *msg, const void *data) {
static bool
cdbus_apdarg_string(session_t *ps attr_unused, DBusMessage *msg, const void *data) {
const char *str = data;
if (!str)
str = "";
@ -464,7 +467,7 @@ static bool cdbus_apdarg_string(session_t *ps, DBusMessage *msg, const void *dat
/**
* Callback to append all window IDs to a message.
*/
static bool cdbus_apdarg_wids(session_t *ps, DBusMessage *msg, const void *data) {
static bool cdbus_apdarg_wids(session_t *ps, DBusMessage *msg, const void *data attr_unused) {
// Get the number of wids we are to include
unsigned count = 0;
HASH_ITER2(ps->windows, w) {
@ -752,7 +755,7 @@ static bool cdbus_process_win_get(session_t *ps, DBusMessage *msg) {
}
#define cdbus_m_win_get_do(tgt, apdarg_func) \
if (!strcmp(#tgt, target)) { \
if (!strcmp(#tgt, target)) { \
apdarg_func(ps, msg, w->tgt); \
return true; \
}
@ -876,7 +879,7 @@ static bool cdbus_process_win_set(session_t *ps, DBusMessage *msg) {
cdbus_enum_t val = UNSET;
if (!cdbus_msg_get_arg(msg, 2, CDBUS_TYPE_ENUM, &val))
return false;
win_set_fade_force(ps, w, val);
win_set_fade_force(w, val);
goto cdbus_process_win_set_success;
}
@ -956,13 +959,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(#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(#tgt, target)) { \
if (!strcmp(#tgt, target)) { \
apdarg_func(ps, msg, ret); \
return true; \
}
@ -1067,7 +1070,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(#tgt, target)) { \
if (!strcmp(#tgt, target)) { \
real_type val; \
if (!cdbus_msg_get_arg(msg, 1, type, &val)) \
return false; \
@ -1216,7 +1219,8 @@ static bool cdbus_process_introspect(session_t *ps, DBusMessage *msg) {
/**
* Process a message from D-Bus.
*/
static DBusHandlerResult cdbus_process(DBusConnection *c, DBusMessage *msg, void *ud) {
static DBusHandlerResult
cdbus_process(DBusConnection *c attr_unused, DBusMessage *msg, void *ud) {
session_t *ps = ud;
bool handled = false;

View File

@ -613,7 +613,7 @@ ev_selection_clear(session_t *ps, xcb_selection_clear_event_t attr_unused *ev) {
// If we lose that one, we should exit.
log_fatal("Another composite manager started and took the _NET_WM_CM_Sn "
"selection.");
exit(1);
quit_compton(ps);
}
void ev_handle(session_t *ps, xcb_generic_event_t *ev) {

View File

@ -225,13 +225,13 @@ struct log_target *null_logger_new(void) {
return &null_logger_target;
}
static void null_logger_write(struct log_target *attr_unused tgt,
const char *attr_unused str, size_t attr_unused len) {
static void null_logger_write(struct log_target *tgt attr_unused,
const char *str attr_unused, size_t len attr_unused) {
return;
}
static void null_logger_writev(struct log_target *attr_unused tgt,
const struct iovec *attr_unused vec, int attr_unused vcnt) {
static void null_logger_writev(struct log_target *tgt attr_unused,
const struct iovec *vec attr_unused, int vcnt attr_unused) {
return;
}
@ -247,25 +247,25 @@ struct file_logger {
struct log_ops ops;
};
void file_logger_write(struct log_target *tgt, const char *str, size_t len) {
static void file_logger_write(struct log_target *tgt, const char *str, size_t len) {
auto f = (struct file_logger *)tgt;
fwrite(str, 1, len, f->f);
}
void file_logger_writev(struct log_target *tgt, const struct iovec *vec, int vcnt) {
static void file_logger_writev(struct log_target *tgt, const struct iovec *vec, int vcnt) {
auto f = (struct file_logger *)tgt;
fflush(f->f);
writev(fileno(f->f), vec, vcnt);
}
void file_logger_destroy(struct log_target *tgt) {
static void file_logger_destroy(struct log_target *tgt) {
auto f = (struct file_logger *)tgt;
fclose(f->f);
free(tgt);
}
#define ANSI(x) "\033[" x "m"
const char *terminal_colorize_begin(enum log_level level) {
static const char *terminal_colorize_begin(enum log_level level) {
switch (level) {
case LOG_LEVEL_TRACE: return ANSI("30;2");
case LOG_LEVEL_DEBUG: return ANSI("37;2");
@ -277,7 +277,7 @@ const char *terminal_colorize_begin(enum log_level level) {
}
}
const char *terminal_colorize_end(enum log_level level) {
static const char *terminal_colorize_end(enum log_level level attr_unused) {
return ANSI("0");
}
#undef PREFIX
@ -335,7 +335,7 @@ struct gl_string_marker_logger {
PFNGLSTRINGMARKERGREMEDYPROC gl_string_marker;
};
void gl_string_marker_logger_write(struct log_target *tgt, const char *str, size_t len) {
static void gl_string_marker_logger_write(struct log_target *tgt, const char *str, size_t len) {
auto g = (struct gl_string_marker_logger *)tgt;
g->gl_string_marker((GLsizei)len, str);
}

View File

@ -208,7 +208,7 @@ glx_init_end:
return success;
}
static void glx_free_prog_main(session_t *ps, glx_prog_main_t *pprogram) {
static void glx_free_prog_main(glx_prog_main_t *pprogram) {
if (!pprogram)
return;
if (pprogram->prog) {
@ -242,7 +242,7 @@ void glx_destroy(session_t *ps) {
}
free(ps->psglx->blur_passes);
glx_free_prog_main(ps, &ps->glx_prog_win);
glx_free_prog_main(&ps->glx_prog_win);
gl_check_err();
@ -419,7 +419,7 @@ bool glx_init_blur(session_t *ps) {
/**
* Load a GLSL main program from shader strings.
*/
bool glx_load_prog_main(session_t *ps, const char *vshader_str, const char *fshader_str,
bool glx_load_prog_main(const char *vshader_str, const char *fshader_str,
glx_prog_main_t *pprogram) {
assert(pprogram);
@ -662,7 +662,7 @@ void glx_set_clip(session_t *ps, const region_t *reg) {
\
pixman_region32_fini(&reg_new);
static inline GLuint glx_gen_texture(session_t *ps, GLenum tex_tgt, int width, int height) {
static inline GLuint glx_gen_texture(GLenum tex_tgt, int width, int height) {
GLuint tex = 0;
glGenTextures(1, &tex);
if (!tex)
@ -738,10 +738,10 @@ bool glx_blur_dst(session_t *ps, int dx, int dy, int width, int height, float z,
// Generate FBO and textures if needed
if (!pbc->textures[0])
pbc->textures[0] = glx_gen_texture(ps, tex_tgt, mwidth, mheight);
pbc->textures[0] = glx_gen_texture(tex_tgt, mwidth, mheight);
GLuint tex_scr = pbc->textures[0];
if (more_passes && !pbc->textures[1])
pbc->textures[1] = glx_gen_texture(ps, tex_tgt, mwidth, mheight);
pbc->textures[1] = glx_gen_texture(tex_tgt, mwidth, mheight);
pbc->width = mwidth;
pbc->height = mheight;
GLuint tex_scr2 = pbc->textures[1];

View File

@ -81,7 +81,7 @@ void glx_on_root_change(session_t *ps);
bool glx_init_blur(session_t *ps);
#ifdef CONFIG_OPENGL
bool glx_load_prog_main(session_t *ps, const char *vshader_str, const char *fshader_str,
bool glx_load_prog_main(const char *vshader_str, const char *fshader_str,
glx_prog_main_t *pprogram);
#endif
@ -144,7 +144,7 @@ static inline void free_texture_r(session_t *ps, GLuint *ptexture) {
/**
* Free a GLX Framebuffer object.
*/
static inline void free_glx_fbo(session_t *ps, GLuint *pfbo) {
static inline void free_glx_fbo(GLuint *pfbo) {
if (*pfbo) {
glDeleteFramebuffers(1, pfbo);
*pfbo = 0;
@ -166,7 +166,7 @@ static inline void free_glx_bc_resize(session_t *ps, glx_blur_cache_t *pbc) {
* Free a glx_blur_cache_t
*/
static inline void free_glx_bc(session_t *ps, glx_blur_cache_t *pbc) {
free_glx_fbo(ps, &pbc->fbo);
free_glx_fbo(&pbc->fbo);
free_glx_bc_resize(ps, pbc);
}

View File

@ -1091,7 +1091,7 @@ bool init_render(session_t *ps) {
// Initialize window GL shader
if (BKEND_GLX == ps->o.backend && ps->o.glx_fshader_win_str) {
#ifdef CONFIG_OPENGL
if (!glx_load_prog_main(ps, NULL, ps->o.glx_fshader_win_str, &ps->glx_prog_win))
if (!glx_load_prog_main(NULL, ps->o.glx_fshader_win_str, &ps->glx_prog_win))
return false;
#else
log_error("GLSL supported not compiled in, can't load "

View File

@ -36,7 +36,7 @@ safe_isnan(double a) {
#define CASESTRRET(s) \
case s: return #s
/// Same as assert false, but make sure we abort _even in release builds_.
/// Same as assert(false), but make sure we abort _even in release builds_.
/// Silence compiler warning caused by release builds making some code paths reachable.
#define BUG() \
do { \
@ -47,11 +47,35 @@ safe_isnan(double a) {
/// Same as assert, but evaluates the expression even in release builds
#define CHECK(expr) \
do { \
__auto_type _ = (expr); \
auto _ = (expr); \
/* make sure the original expression appears in the assertion message */ \
assert((CHECK_EXPR(expr), _)); \
(void)_; \
} while (0)
/// Asserts that var is within [lower, upper]. Silence compiler warning about expressions
/// being always true or false.
#define ASSERT_IN_RANGE(var, lower, upper) \
do { \
auto __tmp = (var); \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wtype-limits\""); \
assert(__tmp >= lower); \
assert(__tmp <= upper); \
_Pragma("GCC diagnostic pop"); \
} while (0)
/// Asserts that var >= lower. Silence compiler warning about expressions
/// being always true or false.
#define ASSERT_GEQ(var, lower) \
do { \
auto __tmp = (var); \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wtype-limits\""); \
assert(__tmp >= lower); \
_Pragma("GCC diagnostic pop"); \
} while (0)
// Some macros for checked cast
// Note these macros are not complete, as in, they won't work for every integer types. But
// they are good enough for compton.
@ -59,28 +83,28 @@ safe_isnan(double a) {
#define to_int_checked(val) \
({ \
int64_t tmp = (val); \
assert(tmp >= INT_MIN && tmp <= INT_MAX); \
ASSERT_IN_RANGE(tmp, INT_MIN, INT_MAX); \
(int)tmp; \
})
#define to_char_checked(val) \
({ \
int64_t tmp = (val); \
assert(tmp >= CHAR_MIN && tmp <= CHAR_MAX); \
ASSERT_IN_RANGE(tmp, CHAR_MIN, CHAR_MAX); \
(char)tmp; \
})
#define to_u16_checked(val) \
({ \
auto tmp = (val); \
assert(tmp >= 0 && tmp <= UINT16_MAX); \
ASSERT_IN_RANGE(tmp, 0, UINT16_MAX); \
(uint16_t) tmp; \
})
#define to_i16_checked(val) \
({ \
int64_t tmp = (val); \
assert(tmp >= INT16_MIN && tmp <= INT16_MAX); \
ASSERT_IN_RANGE(tmp, INT16_MIN, INT16_MAX); \
(int16_t) tmp; \
})
@ -89,7 +113,7 @@ safe_isnan(double a) {
auto tmp = (val); \
int64_t max = UINT32_MAX; /* silence clang tautological \
comparison warning*/ \
CHECK(tmp >= 0 && tmp <= max); \
ASSERT_IN_RANGE(tmp, 0, max); \
(uint32_t) tmp; \
})
/**
@ -171,7 +195,7 @@ allocchk_(const char *func_name, const char *file, unsigned int line, void *ptr)
#define ccalloc(nmemb, type) \
({ \
auto tmp = (nmemb); \
assert(tmp >= 0); \
ASSERT_GEQ(tmp, 0); \
((type *)allocchk(calloc((size_t)tmp, sizeof(type)))); \
})
@ -179,7 +203,7 @@ allocchk_(const char *func_name, const char *file, unsigned int line, void *ptr)
#define crealloc(ptr, nmemb) \
({ \
auto tmp = (nmemb); \
assert(tmp >= 0); \
ASSERT_GEQ(tmp, 0); \
((__typeof__(ptr))allocchk(realloc((ptr), (size_t)tmp * sizeof(*(ptr))))); \
})

View File

@ -124,7 +124,7 @@ static bool vsync_opengl_swc_init(session_t *ps) {
/**
* Wait for next VSync, OpenGL method.
*/
static int vsync_opengl_wait(session_t *ps) {
static int vsync_opengl_wait(session_t *ps attr_unused) {
unsigned vblank_count = 0;
glXGetVideoSyncSGI(&vblank_count);

View File

@ -673,7 +673,7 @@ void win_set_invert_color_force(session_t *ps, struct managed_win *w, switch_t v
*
* Doesn't affect fading already in progress
*/
void win_set_fade_force(session_t *ps, struct managed_win *w, switch_t val) {
void win_set_fade_force(struct managed_win *w, switch_t val) {
w->fade_force = val;
}
@ -1659,7 +1659,7 @@ static void finish_destroy_win(session_t *ps, struct managed_win **_w) {
assert(false);
}
static void finish_map_win(session_t *ps, struct managed_win **_w) {
static void finish_map_win(struct managed_win **_w) {
auto w = *_w;
w->in_openclose = false;
w->state = WSTATE_MAPPED;
@ -1853,7 +1853,7 @@ void win_check_fade_finished(session_t *ps, struct managed_win **_w) {
switch (w->state) {
case WSTATE_UNMAPPING: return finish_unmap_win(ps, _w);
case WSTATE_DESTROYING: return finish_destroy_win(ps, _w);
case WSTATE_MAPPING: return finish_map_win(ps, _w);
case WSTATE_MAPPING: return finish_map_win(_w);
case WSTATE_FADING: w->state = WSTATE_MAPPED; break;
default: unreachable;
}

View File

@ -331,7 +331,7 @@ int win_get_name(session_t *ps, struct managed_win *w);
int win_get_role(session_t *ps, struct managed_win *w);
winmode_t attr_pure win_calc_mode(const struct managed_win *w);
void win_set_shadow_force(session_t *ps, struct managed_win *w, switch_t val);
void win_set_fade_force(session_t *ps, struct managed_win *w, switch_t val);
void win_set_fade_force(struct managed_win *w, switch_t val);
void win_set_focused_force(session_t *ps, struct managed_win *w, switch_t val);
void win_set_invert_color_force(session_t *ps, struct managed_win *w, switch_t val);
/**