improve header & macro consistency

This commit is contained in:
Jarcode
2019-09-08 17:08:41 -07:00
parent 0592a422a1
commit d821eeaf0a
5 changed files with 260 additions and 249 deletions

View File

@@ -1,5 +1,10 @@
#ifndef FIFO_H
#define FIFO_H
#include <pthread.h> #include <pthread.h>
#include <stdlib.h>
#include <stdbool.h>
struct audio_data { struct audio_data {
volatile float* audio_out_r; volatile float* audio_out_r;
@@ -34,6 +39,8 @@ static inline void register_audio_impl(struct audio_impl* impl) { audio_impls[au
AUDIO_FUNC(init), \ AUDIO_FUNC(init), \
AUDIO_FUNC(entry), \ AUDIO_FUNC(entry), \
}; \ }; \
void __attribute__((constructor)) _##N##_construct(void) { \ void __attribute__((constructor)) _##N##_construct(void) { \
register_audio_impl(&N##_var); \ register_audio_impl(&N##_var); \
} }
#endif

View File

@@ -1,6 +1,8 @@
#ifndef GLSL_EXT_H
#define GLSL_EXT_H
#define RHANDLER(name, args, ...) \ #include <stdlib.h>
({ void _handler(const char* name, void** args) __VA_ARGS__ _handler; }) #include <stdbool.h>
struct request_handler { struct request_handler {
const char* name; const char* name;
@@ -44,3 +46,5 @@ struct glsl_ext {
void ext_process(struct glsl_ext* ext, const char* f); void ext_process(struct glsl_ext* ext, const char* f);
void ext_free (struct glsl_ext* ext); void ext_free (struct glsl_ext* ext);
bool ext_parse_color(const char* hex, size_t elem_sz, float** results); bool ext_parse_color(const char* hex, size_t elem_sz, float** results);
#endif

View File

@@ -1,3 +1,10 @@
#ifndef PULSE_INPUT_H
#define PULSE_INPUT_H
#include "fifo.h"
void get_pulse_default_sink(struct audio_data* audio); void get_pulse_default_sink(struct audio_data* audio);
void* input_pulse(void* data); void* input_pulse(void* data);
#endif

View File

@@ -391,7 +391,7 @@ static GLuint shaderlink_f(GLuint* arr) {
} }
/* load shaders */ /* load shaders */
#define shaderbuild(gl, shader_path, c, d, r, v, s, ...) \ #define shaderbuild(gl, shader_path, c, d, r, v, s, ...) \
shaderbuild_f(gl, shader_path, c, d, r, v, s, (const char*[]) {__VA_ARGS__, 0}) shaderbuild_f(gl, shader_path, c, d, r, v, s, (const char*[]) {__VA_ARGS__, 0})
static GLuint shaderbuild_f(struct gl_data* gl, static GLuint shaderbuild_f(struct gl_data* gl,
const char* shader_path, const char* shader_path,
@@ -802,10 +802,10 @@ static struct gl_bind_src* lookup_bind_src(const char* str) {
} }
struct glava_renderer* rd_new(const char** paths, const char* entry, struct glava_renderer* rd_new(const char** paths, const char* entry,
const char** requests, const char* force_backend, const char** requests, const char* force_backend,
struct rd_bind* bindings, int stdin_type, struct rd_bind* bindings, int stdin_type,
bool auto_desktop, bool verbose, bool auto_desktop, bool verbose,
bool test_mode) { bool test_mode) {
xwin_wait_for_wm(); xwin_wait_for_wm();
@@ -956,272 +956,262 @@ struct glava_renderer* rd_new(const char** paths, const char* entry,
bool loading_module = true, loading_smooth_pass = false, loading_presets = false;; bool loading_module = true, loading_smooth_pass = false, loading_presets = false;;
struct gl_sfbo* current = NULL; struct gl_sfbo* current = NULL;
size_t t_count = 0; size_t t_count = 0;
#define RHANDLER(name, args, ...) \
({ void _handler(const char* name, void** args) __VA_ARGS__ _handler; })
#define WINDOW_HINT(request) \ #define WINDOW_HINT(request) \
{ .name = "set" #request, .fmt = "b", \ { .name = "set" #request, .fmt = "b", \
.handler = RHANDLER(name, args, { gl->wcb->set_##request(*(bool*) args[0]); }) } .handler = RHANDLER(name, args, { gl->wcb->set_##request(*(bool*) args[0]); }) }
struct request_handler handlers[] = { struct request_handler handlers[] = {
{ { .name = "setopacity", .fmt = "s",
.name = "setopacity", .fmt = "s", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, {
bool native_opacity = !strcmp("native", (char*) args[0]); bool native_opacity = !strcmp("native", (char*) args[0]);
gl->premultiply_alpha = native_opacity; gl->premultiply_alpha = native_opacity;
gl->wcb->set_transparent(native_opacity); gl->wcb->set_transparent(native_opacity);
if (!strcmp("xroot", (char*) args[0])) if (!strcmp("xroot", (char*) args[0]))
gl->copy_desktop = true; gl->copy_desktop = true;
else else
gl->copy_desktop = false; gl->copy_desktop = false;
if (!gl->copy_desktop && !native_opacity && strcmp("none", (char*) args[0])) { if (!gl->copy_desktop && !native_opacity && strcmp("none", (char*) args[0])) {
fprintf(stderr, "Invalid opacity option: '%s'\n", (char*) args[0]); fprintf(stderr, "Invalid opacity option: '%s'\n", (char*) args[0]);
glava_abort(); glava_abort();
} }
}) })
}, },
{ { .name = "setmirror", .fmt = "b",
.name = "setmirror", .fmt = "b", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, { r->mirror_input = *(bool*) args[0];
r->mirror_input = *(bool*) args[0]; gl->mirror_input = *(bool*) args[0];
gl->mirror_input = *(bool*) args[0]; })
})
}, },
{ { .name = "setfullscreencheck", .fmt = "b",
.name = "setfullscreencheck", .fmt = "b", .handler = RHANDLER(name, args, { gl->check_fullscreen = *(bool*) args[0]; })
.handler = RHANDLER(name, args, { gl->check_fullscreen = *(bool*) args[0]; })
}, },
{ { .name = "setbg", .fmt = "s",
.name = "setbg", .fmt = "s", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, { float* results[] = {
float* results[] = { &gl->clear_color.r,
&gl->clear_color.r, &gl->clear_color.g,
&gl->clear_color.g, &gl->clear_color.b,
&gl->clear_color.b, &gl->clear_color.a
&gl->clear_color.a };
}; if (!ext_parse_color((char*) args[0], 2, results)) {
if (!ext_parse_color((char*) args[0], 2, results)) { fprintf(stderr, "Invalid value for `setbg` request: '%s'\n", (char*) args[0]);
fprintf(stderr, "Invalid value for `setbg` request: '%s'\n", (char*) args[0]); glava_abort();
glava_abort(); }
} })
})
}, },
#ifdef GLAVA_DEBUG #ifdef GLAVA_DEBUG
{ { .name = "settesteval", .fmt = "s",
.name = "settesteval", .fmt = "s", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, { float* results[] = {
float* results[] = { &gl->test_eval_color.r,
&gl->test_eval_color.r, &gl->test_eval_color.g,
&gl->test_eval_color.g, &gl->test_eval_color.b,
&gl->test_eval_color.b, &gl->test_eval_color.a
&gl->test_eval_color.a };
}; if (!ext_parse_color((char*) args[0], 2, results)) {
if (!ext_parse_color((char*) args[0], 2, results)) { fprintf(stderr, "Invalid value for `setbg` request: '%s'\n", (char*) args[0]);
fprintf(stderr, "Invalid value for `setbg` request: '%s'\n", (char*) args[0]); glava_abort();
glava_abort(); }
} })
})
}, },
#endif #endif
{ { .name = "setbgf", .fmt = "ffff",
.name = "setbgf", .fmt = "ffff", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, { gl->clear_color.r = *(float*) args[0];
gl->clear_color.r = *(float*) args[0]; gl->clear_color.g = *(float*) args[1];
gl->clear_color.g = *(float*) args[1]; gl->clear_color.b = *(float*) args[2];
gl->clear_color.b = *(float*) args[2]; gl->clear_color.a = *(float*) args[3];
gl->clear_color.a = *(float*) args[3]; })
})
}, },
{ { .name = "mod", .fmt = "s",
.name = "mod", .fmt = "s", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, { if (loading_module) {
if (loading_module) { if (module != NULL) free((char*) module);
if (module != NULL) free((char*) module); size_t len = strlen((char*) args[0]);
size_t len = strlen((char*) args[0]); char* str = malloc(sizeof(char) * (len + 1));
char* str = malloc(sizeof(char) * (len + 1)); strcpy(str, (char*) args[0]);
strcpy(str, (char*) args[0]); module = str;
module = str; }
} })
})
}, },
{ { .name = "nativeonly", .fmt = "b",
.name = "nativeonly", .fmt = "b", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, { fprintf(stderr, "WARNING: `nativeonly` is deprecated, use `#if PREMULTIPLY_ALPHA == 1`!\n");
fprintf(stderr, "WARNING: `nativeonly` is deprecated, use `#if PREMULTIPLY_ALPHA == 1`!\n"); if (current)
if (current) current->nativeonly = *(bool*) args[0];
current->nativeonly = *(bool*) args[0]; else {
else { fprintf(stderr, "`nativeonly` request needs module context\n");
fprintf(stderr, "`nativeonly` request needs module context\n"); glava_abort();
glava_abort(); }
} })
})
}, },
WINDOW_HINT(floating), WINDOW_HINT(floating),
WINDOW_HINT(decorated), WINDOW_HINT(decorated),
WINDOW_HINT(focused), WINDOW_HINT(focused),
WINDOW_HINT(maximized), WINDOW_HINT(maximized),
{ { .name = "setversion", .fmt = "ii",
.name = "setversion", .fmt = "ii", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, { context_version_major = *(int*) args[0];
context_version_major = *(int*) args[0]; context_version_minor = *(int*) args[1];
context_version_minor = *(int*) args[1]; })
})
}, },
{ { .name = "setgeometry", .fmt = "iiii",
.name = "setgeometry", .fmt = "iiii", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, { gl->geometry[0] = *(int*) args[0];
gl->geometry[0] = *(int*) args[0]; gl->geometry[1] = *(int*) args[1];
gl->geometry[1] = *(int*) args[1]; gl->geometry[2] = *(int*) args[2];
gl->geometry[2] = *(int*) args[2]; gl->geometry[3] = *(int*) args[3];
gl->geometry[3] = *(int*) args[3]; })
})
}, },
{ { .name = "addxwinstate", .fmt = "s",
.name = "addxwinstate", .fmt = "s", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, { if (!auto_desktop || loading_presets) {
if (!auto_desktop || loading_presets) { ++xwinstates_sz;
++xwinstates_sz; xwinstates = realloc(xwinstates, sizeof(*xwinstates) * xwinstates_sz);
xwinstates = realloc(xwinstates, sizeof(*xwinstates) * xwinstates_sz); xwinstates[xwinstates_sz - 1] = strdup((char*) args[0]);
xwinstates[xwinstates_sz - 1] = strdup((char*) args[0]); }
} })
})
}, },
{ .name = "setsource", .fmt = "s", { .name = "setsource", .fmt = "s",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (r->audio_source_request) free(r->audio_source_request); if (r->audio_source_request) free(r->audio_source_request);
r->audio_source_request = strdup((char*) args[0]); }) }, r->audio_source_request = strdup((char*) args[0]); }) },
{ .name = "setclickthrough", .fmt = "b", { .name = "setclickthrough", .fmt = "b",
.handler = RHANDLER(name, args, { gl->clickthrough = *(bool*) args[0]; }) }, .handler = RHANDLER(name, args, { gl->clickthrough = *(bool*) args[0]; }) },
{ .name = "setforcegeometry", .fmt = "b", { .name = "setforcegeometry", .fmt = "b",
.handler = RHANDLER(name, args, { gl->force_geometry = *(bool*) args[0]; }) }, .handler = RHANDLER(name, args, { gl->force_geometry = *(bool*) args[0]; }) },
{ .name = "setforceraised", .fmt = "b", { .name = "setforceraised", .fmt = "b",
.handler = RHANDLER(name, args, { gl->force_raised = *(bool*) args[0]; }) }, .handler = RHANDLER(name, args, { gl->force_raised = *(bool*) args[0]; }) },
{ .name = "setxwintype", .fmt = "s", { .name = "setxwintype", .fmt = "s",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (xwintype) free(xwintype); if (xwintype) free(xwintype);
xwintype = strdup((char*) args[0]); }) }, xwintype = strdup((char*) args[0]); }) },
{ .name = "setshaderversion", .fmt = "i", { .name = "setshaderversion", .fmt = "i",
.handler = RHANDLER(name, args, { shader_version = *(int*) args[0]; }) }, .handler = RHANDLER(name, args, { shader_version = *(int*) args[0]; }) },
{ .name = "setswap", .fmt = "i", { .name = "setswap", .fmt = "i",
.handler = RHANDLER(name, args, { gl->wcb->set_swap(*(int*) args[0]); }) }, .handler = RHANDLER(name, args, { gl->wcb->set_swap(*(int*) args[0]); }) },
{ .name = "setframerate", .fmt = "i", { .name = "setframerate", .fmt = "i",
.handler = RHANDLER(name, args, { gl->rate = *(int*) args[0]; }) }, .handler = RHANDLER(name, args, { gl->rate = *(int*) args[0]; }) },
{ .name = "setprintframes", .fmt = "b", { .name = "setprintframes", .fmt = "b",
.handler = RHANDLER(name, args, { gl->print_fps = *(bool*) args[0]; }) }, .handler = RHANDLER(name, args, { gl->print_fps = *(bool*) args[0]; }) },
{ .name = "settitle", .fmt = "s", { .name = "settitle", .fmt = "s",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (wintitle && wintitle != wintitle_default) free((char*) wintitle); if (wintitle && wintitle != wintitle_default) free((char*) wintitle);
wintitle = strdup((char*) args[0]); }) }, wintitle = strdup((char*) args[0]); }) },
{ .name = "setbufsize", .fmt = "i", { .name = "setbufsize", .fmt = "i",
.handler = RHANDLER(name, args, { r->bufsize_request = *(int*) args[0]; }) }, .handler = RHANDLER(name, args, { r->bufsize_request = *(int*) args[0]; }) },
{ .name = "setbufscale", .fmt = "i", { .name = "setbufscale", .fmt = "i",
.handler = RHANDLER(name, args, { gl->bufscale = *(int*) args[0]; }) }, .handler = RHANDLER(name, args, { gl->bufscale = *(int*) args[0]; }) },
{ .name = "setsamplerate", .fmt = "i", { .name = "setsamplerate", .fmt = "i",
.handler = RHANDLER(name, args, { r->rate_request = *(int*) args[0]; }) }, .handler = RHANDLER(name, args, { r->rate_request = *(int*) args[0]; }) },
{ .name = "setsamplesize", .fmt = "i", { .name = "setsamplesize", .fmt = "i",
.handler = RHANDLER(name, args, { r->samplesize_request = *(int*) args[0]; }) }, .handler = RHANDLER(name, args, { r->samplesize_request = *(int*) args[0]; }) },
{ .name = "setavgframes", .fmt = "i", { .name = "setavgframes", .fmt = "i",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (!loading_smooth_pass) gl->avg_frames = *(int*) args[0]; }) }, if (!loading_smooth_pass) gl->avg_frames = *(int*) args[0]; }) },
{ .name = "setavgwindow", .fmt = "b", { .name = "setavgwindow", .fmt = "b",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (!loading_smooth_pass) gl->avg_window = *(bool*) args[0]; }) }, if (!loading_smooth_pass) gl->avg_window = *(bool*) args[0]; }) },
{ .name = "setgravitystep", .fmt = "f", { .name = "setgravitystep", .fmt = "f",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (!loading_smooth_pass) gl->gravity_step = *(float*) args[0]; }) }, if (!loading_smooth_pass) gl->gravity_step = *(float*) args[0]; }) },
{ .name = "setsmoothpass", .fmt = "b", { .name = "setsmoothpass", .fmt = "b",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (!loading_smooth_pass) gl->smooth_pass = *(bool*) args[0]; }) }, if (!loading_smooth_pass) gl->smooth_pass = *(bool*) args[0]; }) },
{ .name = "setsmoothfactor", .fmt = "f", { .name = "setsmoothfactor", .fmt = "f",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (!loading_smooth_pass) gl->smooth_factor = *(float*) args[0]; }) }, if (!loading_smooth_pass) gl->smooth_factor = *(float*) args[0]; }) },
{ .name = "setsmooth", .fmt = "f", { .name = "setsmooth", .fmt = "f",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (!loading_smooth_pass) gl->smooth_distance = *(float*) args[0]; }) }, if (!loading_smooth_pass) gl->smooth_distance = *(float*) args[0]; }) },
{ .name = "setsmoothratio", .fmt = "f", { .name = "setsmoothratio", .fmt = "f",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (!loading_smooth_pass) gl->smooth_ratio = *(float*) args[0]; }) }, if (!loading_smooth_pass) gl->smooth_ratio = *(float*) args[0]; }) },
{ .name = "setinterpolate", .fmt = "b", { .name = "setinterpolate", .fmt = "b",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (!loading_smooth_pass) gl->interpolate = *(bool*) args[0]; }) }, if (!loading_smooth_pass) gl->interpolate = *(bool*) args[0]; }) },
{ .name = "setfftscale", .fmt = "f", { .name = "setfftscale", .fmt = "f",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (!loading_smooth_pass) gl->fft_scale = *(float*) args[0];}) }, if (!loading_smooth_pass) gl->fft_scale = *(float*) args[0];}) },
{ .name = "setfftcutoff", .fmt = "f", { .name = "setfftcutoff", .fmt = "f",
.handler = RHANDLER(name, args, { .handler = RHANDLER(name, args, {
if (!loading_smooth_pass) gl->fft_cutoff = *(float*) args[0];}) }, if (!loading_smooth_pass) gl->fft_cutoff = *(float*) args[0];}) },
{ .name = "timecycle", .fmt = "f", { .name = "timecycle", .fmt = "f",
.handler = RHANDLER(name, args, { gl->timecycle = *(float*) args[0]; }) }, .handler = RHANDLER(name, args, { gl->timecycle = *(float*) args[0]; }) },
{ { .name = "transform", .fmt = "ss",
.name = "transform", .fmt = "ss", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, { size_t t;
size_t t; struct gl_bind* bind = NULL;
struct gl_bind* bind = NULL; for (t = 0; t < current->binds_sz; ++t) {
for (t = 0; t < current->binds_sz; ++t) { if (!strcmp(current->binds[t].name, (const char*) args[0])) {
if (!strcmp(current->binds[t].name, (const char*) args[0])) { bind = &current->binds[t];
bind = &current->binds[t]; break;
break; }
} }
} if (!bind) {
if (!bind) { fprintf(stderr, "Cannot add transformation to uniform '%s':"
fprintf(stderr, "Cannot add transformation to uniform '%s':" " uniform does not exist! (%d present in this unit)\n",
" uniform does not exist! (%d present in this unit)\n", (const char*) args[0], (int) current->binds_sz);
(const char*) args[0], (int) current->binds_sz); glava_abort();
glava_abort(); }
} struct gl_transform* tran = NULL;
struct gl_transform* tran = NULL; for (t = 0; t < sizeof(transform_functions) / sizeof(struct gl_transform); ++t) {
for (t = 0; t < sizeof(transform_functions) / sizeof(struct gl_transform); ++t) { if (!strcmp(transform_functions[t].name, (const char*) args[1])) {
if (!strcmp(transform_functions[t].name, (const char*) args[1])) { tran = &transform_functions[t];
tran = &transform_functions[t]; break;
break; }
} }
} if (!tran) {
if (!tran) { fprintf(stderr, "Cannot add transformation '%s' to uniform '%s':"
fprintf(stderr, "Cannot add transformation '%s' to uniform '%s':" " transform function does not exist!\n",
" transform function does not exist!\n", (const char*) args[1], (const char*) args[0]);
(const char*) args[1], (const char*) args[0]); glava_abort();
glava_abort(); }
} if (tran->type != bind->type) {
if (tran->type != bind->type) { fprintf(stderr, "Cannot apply '%s' to uniform '%s': mismatching types\n",
fprintf(stderr, "Cannot apply '%s' to uniform '%s': mismatching types\n", (const char*) args[1], (const char*) args[0]);
(const char*) args[1], (const char*) args[0]); glava_abort();
glava_abort(); }
} ++bind->t_sz;
++bind->t_sz; bind->transformations =
bind->transformations = realloc(bind->transformations, bind->t_sz * sizeof(void (*)(void*)));
realloc(bind->transformations, bind->t_sz * sizeof(void (*)(void*))); bind->transformations[bind->t_sz - 1] = tran->apply;
bind->transformations[bind->t_sz - 1] = tran->apply; ++t_count;
++t_count; })
})
}, },
{ { .name = "uniform", .fmt = "ss",
.name = "uniform", .fmt = "ss", .handler = RHANDLER(name, args, {
.handler = RHANDLER(name, args, { if (!current) {
if (!current) { fprintf(stderr, "Cannot bind uniform '%s' outside of a context"
fprintf(stderr, "Cannot bind uniform '%s' outside of a context" " (load a module first!)\n", (const char*) args[0]);
" (load a module first!)\n", (const char*) args[0]); glava_abort();
glava_abort(); }
} struct gl_bind_src* src = lookup_bind_src((const char*) args[0]);
struct gl_bind_src* src = lookup_bind_src((const char*) args[0]); if (!src) {
if (!src) { fprintf(stderr, "Cannot bind uniform '%s': bind type does not exist!\n",
fprintf(stderr, "Cannot bind uniform '%s': bind type does not exist!\n", (const char*) args[0]);
(const char*) args[0]); glava_abort();
glava_abort(); }
} ++current->binds_sz;
++current->binds_sz; current->binds = realloc(current->binds, current->binds_sz * sizeof(struct gl_bind));
current->binds = realloc(current->binds, current->binds_sz * sizeof(struct gl_bind)); current->binds[current->binds_sz - 1] = (struct gl_bind) {
current->binds[current->binds_sz - 1] = (struct gl_bind) { .name = strdup((const char*) args[1]),
.name = strdup((const char*) args[1]), .type = src->type,
.type = src->type, .src_type = src->src_type,
.src_type = src->src_type, .transformations = malloc(1),
.transformations = malloc(1), .t_sz = 0,
.t_sz = 0, .sm = {}
.sm = {} };
}; })
})
}, },
{ .name = NULL } { .name = NULL }
}; };
@@ -1887,9 +1877,9 @@ bool rd_update(struct glava_renderer* r, float* lb, float* rb, size_t bsz, bool
"}" "\n"; "}" "\n";
if (!gl->bg_setup) { if (!gl->bg_setup) {
gl->bg_prog = shaderlink(shaderload(NULL, GL_VERTEX_SHADER, VERTEX_SHADER_SRC, gl->bg_prog = shaderlink(shaderload(NULL, GL_VERTEX_SHADER, VERTEX_SHADER_SRC,
NULL, NULL, NULL, 330, true, NULL, gl), NULL, NULL, NULL, 330, true, NULL, gl),
shaderload(NULL, GL_FRAGMENT_SHADER, frag_shader, shaderload(NULL, GL_FRAGMENT_SHADER, frag_shader,
NULL, NULL, NULL, 330, true, NULL, gl)); NULL, NULL, NULL, 330, true, NULL, gl));
gl->bg_utex = glGetUniformLocation(gl->bg_prog, "tex"); gl->bg_utex = glGetUniformLocation(gl->bg_prog, "tex");
gl->bg_screen = glGetUniformLocation(gl->bg_prog, "screen"); gl->bg_screen = glGetUniformLocation(gl->bg_prog, "screen");
glBindFragDataLocation(gl->bg_prog, 1, "fragment"); glBindFragDataLocation(gl->bg_prog, 1, "fragment");

View File

@@ -4,6 +4,9 @@
#ifndef XWIN_H #ifndef XWIN_H
#define XWIN_H #define XWIN_H
#include <stdbool.h>
#include "render.h"
typedef unsigned long int Window; typedef unsigned long int Window;
void xwin_assign_icon_bmp(struct gl_wcb* wcb, void* impl, const char* path); void xwin_assign_icon_bmp(struct gl_wcb* wcb, void* impl, const char* path);