Merge pull request #88 from yshui/fmodules
Improve the header includes, cont'd
This commit is contained in:
commit
4bdbd48e55
11
meson.build
11
meson.build
|
@ -33,6 +33,17 @@ if get_option('sanitize')
|
||||||
add_global_link_arguments('-fsanitize='+','.join(sanitizers), language: 'c')
|
add_global_link_arguments('-fsanitize='+','.join(sanitizers), language: 'c')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if get_option('modularize')
|
||||||
|
if not cc.has_argument('-fmodules')
|
||||||
|
error('option \'modularize\' requires clang')
|
||||||
|
endif
|
||||||
|
add_global_arguments(['-fmodules',
|
||||||
|
'-fmodule-map-file='+
|
||||||
|
meson.current_source_dir()+
|
||||||
|
'/src/compton.modulemap'],
|
||||||
|
language: 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
add_global_arguments('-D_GNU_SOURCE', language: 'c')
|
add_global_arguments('-D_GNU_SOURCE', language: 'c')
|
||||||
|
|
||||||
warns = [ 'all', 'extra', 'no-unused-parameter', 'nonnull', 'shadow', 'implicit-fallthrough' ]
|
warns = [ 'all', 'extra', 'no-unused-parameter', 'nonnull', 'shadow', 'implicit-fallthrough' ]
|
||||||
|
|
|
@ -13,3 +13,5 @@ option('xrescheck', type: 'boolean', value: false, description: 'Enable X resour
|
||||||
option('build_docs', type: 'boolean', value: false, description: 'Build documentation and man pages')
|
option('build_docs', type: 'boolean', value: false, description: 'Build documentation and man pages')
|
||||||
|
|
||||||
option('new_backends', type: 'boolean', value: false, description: 'Does not really do anything right now')
|
option('new_backends', type: 'boolean', value: false, description: 'Does not really do anything right now')
|
||||||
|
|
||||||
|
option('modularize', type: 'boolean', value: false, description: 'Build with clang\'s module system')
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#include "backend.h"
|
#include "backend.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "win.h"
|
||||||
|
#include "region.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "compiler.h"
|
||||||
|
|
||||||
backend_info_t *backend_list[NUM_BKEND] = {[BKEND_XRENDER] = &xrender_backend};
|
backend_info_t *backend_list[NUM_BKEND] = {[BKEND_XRENDER] = &xrender_backend};
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
|
#include "compiler.h"
|
||||||
|
|
||||||
typedef struct session session_t;
|
typedef struct session session_t;
|
||||||
typedef struct win win;
|
typedef struct win win;
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#include <xcb/xcb_image.h>
|
#include <xcb/xcb_image.h>
|
||||||
|
#include <xcb/render.h>
|
||||||
|
|
||||||
#include "backend.h"
|
#include "backend.h"
|
||||||
#include "backend_common.h"
|
#include "backend_common.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "log.h"
|
||||||
#include "x.h"
|
#include "x.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,9 +180,9 @@ bool build_shadow(session_t *ps, double opacity, const int width, const int heig
|
||||||
xcb_render_picture_t shadow_pixel, xcb_pixmap_t *pixmap,
|
xcb_render_picture_t shadow_pixel, xcb_pixmap_t *pixmap,
|
||||||
xcb_render_picture_t *pict) {
|
xcb_render_picture_t *pict) {
|
||||||
xcb_image_t *shadow_image = NULL;
|
xcb_image_t *shadow_image = NULL;
|
||||||
xcb_pixmap_t shadow_pixmap = None, shadow_pixmap_argb = None;
|
xcb_pixmap_t shadow_pixmap = XCB_NONE, shadow_pixmap_argb = XCB_NONE;
|
||||||
xcb_render_picture_t shadow_picture = None, shadow_picture_argb = None;
|
xcb_render_picture_t shadow_picture = XCB_NONE, shadow_picture_argb = XCB_NONE;
|
||||||
xcb_gcontext_t gc = None;
|
xcb_gcontext_t gc = XCB_NONE;
|
||||||
|
|
||||||
shadow_image =
|
shadow_image =
|
||||||
make_shadow(ps->c, ps->gaussian_map, opacity, width, height);
|
make_shadow(ps->c, ps->gaussian_map, opacity, width, height);
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "region.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "compiler.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include "backend/gl/gl_common.h"
|
#include "backend/gl/gl_common.h"
|
||||||
|
|
||||||
|
@ -420,8 +424,7 @@ bool gl_blur_dst(session_t *ps, const gl_cap_t *cap, int dx, int dy, int width,
|
||||||
GL_TEXTURE_2D, tex_scr2,
|
GL_TEXTURE_2D, tex_scr2,
|
||||||
0); // XXX wrong, should use tex_tgt
|
0); // XXX wrong, should use tex_tgt
|
||||||
glDrawBuffers(1, (GLenum[]){GL_COLOR_ATTACHMENT0});
|
glDrawBuffers(1, (GLenum[]){GL_COLOR_ATTACHMENT0});
|
||||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) !=
|
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||||
GL_FRAMEBUFFER_COMPLETE) {
|
|
||||||
log_error("Framebuffer attachment failed.");
|
log_error("Framebuffer attachment failed.");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -451,10 +454,8 @@ bool gl_blur_dst(session_t *ps, const gl_cap_t *cap, int dx, int dy, int width,
|
||||||
// Texture coordinates
|
// Texture coordinates
|
||||||
const GLfloat texture_x1 = (crect.x1 - dx) * texfac_x;
|
const GLfloat texture_x1 = (crect.x1 - dx) * texfac_x;
|
||||||
const GLfloat texture_y1 = (crect.y1 - dy) * texfac_y;
|
const GLfloat texture_y1 = (crect.y1 - dy) * texfac_y;
|
||||||
const GLfloat texture_x2 =
|
const GLfloat texture_x2 = texture_x1 + (crect.x2 - crect.x1) * texfac_x;
|
||||||
texture_x1 + (crect.x2 - crect.x1) * texfac_x;
|
const GLfloat texture_y2 = texture_y1 + (crect.y2 - crect.y1) * texfac_y;
|
||||||
const GLfloat texture_y2 =
|
|
||||||
texture_y1 + (crect.y2 - crect.y1) * texfac_y;
|
|
||||||
|
|
||||||
// Vertex coordinates
|
// Vertex coordinates
|
||||||
// For passes before the last one, we are drawing into a buffer,
|
// For passes before the last one, we are drawing into a buffer,
|
||||||
|
@ -470,10 +471,8 @@ bool gl_blur_dst(session_t *ps, const gl_cap_t *cap, int dx, int dy, int width,
|
||||||
GLfloat vx2 = vx1 + (crect.x2 - crect.x1);
|
GLfloat vx2 = vx1 + (crect.x2 - crect.x1);
|
||||||
GLfloat vy2 = vy1 + (crect.y2 - crect.y1);
|
GLfloat vy2 = vy1 + (crect.y2 - crect.y1);
|
||||||
|
|
||||||
GLfloat texture_x[] = {texture_x1, texture_x2, texture_x2,
|
GLfloat texture_x[] = {texture_x1, texture_x2, texture_x2, texture_x1};
|
||||||
texture_x1};
|
GLfloat texture_y[] = {texture_y1, texture_y1, texture_y2, texture_y2};
|
||||||
GLfloat texture_y[] = {texture_y1, texture_y1, texture_y2,
|
|
||||||
texture_y2};
|
|
||||||
GLint vx[] = {vx1, vx2, vx2, vx1};
|
GLint vx[] = {vx1, vx2, vx2, vx1};
|
||||||
GLint vy[] = {vy1, vy1, vy2, vy2};
|
GLint vy[] = {vy1, vy1, vy2, vy2};
|
||||||
|
|
||||||
|
@ -595,7 +594,8 @@ static void attr_unused gl_destroy_win_shader(session_t *ps, gl_win_shader_t *sh
|
||||||
/**
|
/**
|
||||||
* Initialize GL blur filters.
|
* Initialize GL blur filters.
|
||||||
*
|
*
|
||||||
* Fill `passes` with blur filters, won't create more than MAX_BLUR_FILTER number of filters
|
* Fill `passes` with blur filters, won't create more than MAX_BLUR_FILTER number of
|
||||||
|
* filters
|
||||||
*/
|
*/
|
||||||
bool gl_create_blur_filters(session_t *ps, gl_blur_shader_t *passes, const gl_cap_t *cap) {
|
bool gl_create_blur_filters(session_t *ps, gl_blur_shader_t *passes, const gl_cap_t *cap) {
|
||||||
assert(ps->o.blur_kerns[0]);
|
assert(ps->o.blur_kerns[0]);
|
||||||
|
@ -663,8 +663,7 @@ bool gl_create_blur_filters(session_t *ps, gl_blur_shader_t *passes, const gl_ca
|
||||||
int nele = wid * hei - 1;
|
int nele = wid * hei - 1;
|
||||||
unsigned int len =
|
unsigned int len =
|
||||||
strlen(FRAG_SHADER_BLUR_PREFIX) + strlen(sampler_type) +
|
strlen(FRAG_SHADER_BLUR_PREFIX) + strlen(sampler_type) +
|
||||||
strlen(extension) +
|
strlen(extension) + (strlen(shader_add) + strlen(texture_func) + 42) * nele +
|
||||||
(strlen(shader_add) + strlen(texture_func) + 42) * nele +
|
|
||||||
strlen(FRAG_SHADER_BLUR_SUFFIX) + strlen(texture_func) + 12 + 1;
|
strlen(FRAG_SHADER_BLUR_SUFFIX) + strlen(texture_func) + 12 + 1;
|
||||||
char *shader_str = ccalloc(len, char);
|
char *shader_str = ccalloc(len, char);
|
||||||
char *pc = shader_str;
|
char *pc = shader_str;
|
||||||
|
@ -681,8 +680,7 @@ bool gl_create_blur_filters(session_t *ps, gl_blur_shader_t *passes, const gl_ca
|
||||||
if (0.0 == val)
|
if (0.0 == val)
|
||||||
continue;
|
continue;
|
||||||
sum += val;
|
sum += val;
|
||||||
sprintf(pc, shader_add, val, texture_func, k - wid / 2,
|
sprintf(pc, shader_add, val, texture_func, k - wid / 2, j - hei / 2);
|
||||||
j - hei / 2);
|
|
||||||
pc += strlen(pc);
|
pc += strlen(pc);
|
||||||
assert(strlen(shader_str) < len);
|
assert(strlen(shader_str) < len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
// Program and uniforms for window shader
|
// Program and uniforms for window shader
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -10,9 +10,19 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <xcb/xcb.h>
|
||||||
|
|
||||||
#include "backend/backend.h"
|
#include "backend/backend.h"
|
||||||
#include "backend/gl/gl_common.h"
|
#include "backend/gl/gl_common.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "compiler.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "region.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "win.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
/// @brief Wrapper of a GLX FBConfig.
|
/// @brief Wrapper of a GLX FBConfig.
|
||||||
typedef struct glx_fbconfig {
|
typedef struct glx_fbconfig {
|
||||||
|
@ -87,8 +97,7 @@ static void glx_release_pixmap(struct _glx_data *gd, Display *dpy, struct _glx_w
|
||||||
/**
|
/**
|
||||||
* Free a glx_texture_t.
|
* Free a glx_texture_t.
|
||||||
*/
|
*/
|
||||||
static void attr_unused glx_release_win(struct _glx_data *gd, Display *dpy,
|
static void attr_unused glx_release_win(struct _glx_data *gd, Display *dpy, struct _glx_win_data *wd) {
|
||||||
struct _glx_win_data *wd) {
|
|
||||||
glx_release_pixmap(gd, dpy, wd);
|
glx_release_pixmap(gd, dpy, wd);
|
||||||
glDeleteTextures(1, &wd->texture.texture);
|
glDeleteTextures(1, &wd->texture.texture);
|
||||||
|
|
||||||
|
@ -161,8 +170,8 @@ glx_cmp_fbconfig(session_t *ps, const glx_fbconfig_t *pfbc_a, const glx_fbconfig
|
||||||
/**
|
/**
|
||||||
* @brief Update the FBConfig of given depth.
|
* @brief Update the FBConfig of given depth.
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void glx_update_fbconfig_bydepth(session_t *ps, struct _glx_data *gd,
|
||||||
glx_update_fbconfig_bydepth(session_t *ps, struct _glx_data *gd, int depth, glx_fbconfig_t *pfbcfg) {
|
int depth, glx_fbconfig_t *pfbcfg) {
|
||||||
// Make sure the depth is sane
|
// Make sure the depth is sane
|
||||||
if (depth < 0 || depth > OPENGL_MAX_DEPTH)
|
if (depth < 0 || depth > OPENGL_MAX_DEPTH)
|
||||||
return;
|
return;
|
||||||
|
@ -170,8 +179,7 @@ glx_update_fbconfig_bydepth(session_t *ps, struct _glx_data *gd, int depth, glx_
|
||||||
// Compare new FBConfig with current one
|
// Compare new FBConfig with current one
|
||||||
if (glx_cmp_fbconfig(ps, gd->fbconfigs[depth], pfbcfg) < 0) {
|
if (glx_cmp_fbconfig(ps, gd->fbconfigs[depth], pfbcfg) < 0) {
|
||||||
log_debug("(depth %d): %p overrides %p, target %#x.\n", depth, pfbcfg->cfg,
|
log_debug("(depth %d): %p overrides %p, target %#x.\n", depth, pfbcfg->cfg,
|
||||||
gd->fbconfigs[depth] ? gd->fbconfigs[depth]->cfg : 0,
|
gd->fbconfigs[depth] ? gd->fbconfigs[depth]->cfg : 0, pfbcfg->texture_tgts);
|
||||||
pfbcfg->texture_tgts);
|
|
||||||
if (!gd->fbconfigs[depth]) {
|
if (!gd->fbconfigs[depth]) {
|
||||||
gd->fbconfigs[depth] = cmalloc(glx_fbconfig_t);
|
gd->fbconfigs[depth] = cmalloc(glx_fbconfig_t);
|
||||||
}
|
}
|
||||||
|
@ -200,21 +208,18 @@ static bool glx_update_fbconfig(struct _glx_data *gd, session_t *ps) {
|
||||||
// Skip over multi-sampled visuals
|
// Skip over multi-sampled visuals
|
||||||
// http://people.freedesktop.org/~glisse/0001-glx-do-not-use-multisample-visual-config-for-front-o.patch
|
// http://people.freedesktop.org/~glisse/0001-glx-do-not-use-multisample-visual-config-for-front-o.patch
|
||||||
#ifdef GLX_SAMPLES
|
#ifdef GLX_SAMPLES
|
||||||
if (Success == glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_SAMPLES, &val) &&
|
if (Success == glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_SAMPLES, &val) && val > 1)
|
||||||
val > 1)
|
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Success != glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_BUFFER_SIZE, &depth) ||
|
if (Success != glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_BUFFER_SIZE, &depth) ||
|
||||||
Success != glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_ALPHA_SIZE,
|
Success != glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_ALPHA_SIZE, &depth_alpha)) {
|
||||||
&depth_alpha)) {
|
|
||||||
log_error("Failed to retrieve buffer size and alpha size of "
|
log_error("Failed to retrieve buffer size and alpha size of "
|
||||||
"FBConfig %d.",
|
"FBConfig %d.",
|
||||||
id);
|
id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Success != glXGetFBConfigAttrib(ps->dpy, *pcur,
|
if (Success != glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_BIND_TO_TEXTURE_TARGETS_EXT,
|
||||||
GLX_BIND_TO_TEXTURE_TARGETS_EXT,
|
|
||||||
&fbinfo.texture_tgts)) {
|
&fbinfo.texture_tgts)) {
|
||||||
log_error("Failed to retrieve BIND_TO_TEXTURE_TARGETS_EXT of "
|
log_error("Failed to retrieve BIND_TO_TEXTURE_TARGETS_EXT of "
|
||||||
"FBConfig %d.",
|
"FBConfig %d.",
|
||||||
|
@ -238,14 +243,10 @@ static bool glx_update_fbconfig(struct _glx_data *gd, session_t *ps) {
|
||||||
bool rgba = false;
|
bool rgba = false;
|
||||||
|
|
||||||
if (depth >= 32 && depth_alpha &&
|
if (depth >= 32 && depth_alpha &&
|
||||||
Success == glXGetFBConfigAttrib(ps->dpy, *pcur,
|
Success == glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_BIND_TO_TEXTURE_RGBA_EXT, &val) && val)
|
||||||
GLX_BIND_TO_TEXTURE_RGBA_EXT, &val) &&
|
|
||||||
val)
|
|
||||||
rgba = true;
|
rgba = true;
|
||||||
|
|
||||||
if (Success == glXGetFBConfigAttrib(ps->dpy, *pcur,
|
if (Success == glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_BIND_TO_TEXTURE_RGB_EXT, &val) && val)
|
||||||
GLX_BIND_TO_TEXTURE_RGB_EXT, &val) &&
|
|
||||||
val)
|
|
||||||
rgb = true;
|
rgb = true;
|
||||||
|
|
||||||
if (Success == glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_Y_INVERTED_EXT, &val))
|
if (Success == glXGetFBConfigAttrib(ps->dpy, *pcur, GLX_Y_INVERTED_EXT, &val))
|
||||||
|
@ -282,14 +283,12 @@ static bool glx_update_fbconfig(struct _glx_data *gd, session_t *ps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_GLX_DEBUG_CONTEXT
|
#ifdef DEBUG_GLX_DEBUG_CONTEXT
|
||||||
static inline GLXFBConfig
|
static inline GLXFBConfig get_fbconfig_from_visualinfo(session_t *ps, const XVisualInfo *visualinfo) {
|
||||||
get_fbconfig_from_visualinfo(session_t *ps, const XVisualInfo *visualinfo) {
|
|
||||||
int nelements = 0;
|
int nelements = 0;
|
||||||
GLXFBConfig *fbconfigs = glXGetFBConfigs(ps->dpy, visualinfo->screen, &nelements);
|
GLXFBConfig *fbconfigs = glXGetFBConfigs(ps->dpy, visualinfo->screen, &nelements);
|
||||||
for (int i = 0; i < nelements; ++i) {
|
for (int i = 0; i < nelements; ++i) {
|
||||||
int visual_id = 0;
|
int visual_id = 0;
|
||||||
if (Success == glXGetFBConfigAttrib(ps->dpy, fbconfigs[i], GLX_VISUAL_ID,
|
if (Success == glXGetFBConfigAttrib(ps->dpy, fbconfigs[i], GLX_VISUAL_ID, &visual_id) &&
|
||||||
&visual_id) &&
|
|
||||||
visual_id == visualinfo->visualid)
|
visual_id == visualinfo->visualid)
|
||||||
return fbconfigs[i];
|
return fbconfigs[i];
|
||||||
}
|
}
|
||||||
|
@ -521,8 +520,7 @@ void *glx_prepare_win(void *backend_data, session_t *ps, win *w) {
|
||||||
};
|
};
|
||||||
|
|
||||||
auto wd = ccalloc(1, struct _glx_win_data);
|
auto wd = ccalloc(1, struct _glx_win_data);
|
||||||
wd->texture.target =
|
wd->texture.target = (GLX_TEXTURE_2D_EXT == tex_tgt ? GL_TEXTURE_2D : GL_TEXTURE_RECTANGLE);
|
||||||
(GLX_TEXTURE_2D_EXT == tex_tgt ? GL_TEXTURE_2D : GL_TEXTURE_RECTANGLE);
|
|
||||||
wd->texture.y_inverted = pcfg->y_inverted;
|
wd->texture.y_inverted = pcfg->y_inverted;
|
||||||
|
|
||||||
if (ps->has_name_pixmap) {
|
if (ps->has_name_pixmap) {
|
||||||
|
@ -575,8 +573,7 @@ err:
|
||||||
/**
|
/**
|
||||||
* Bind a X pixmap to an OpenGL texture.
|
* Bind a X pixmap to an OpenGL texture.
|
||||||
*/
|
*/
|
||||||
void glx_render_win(void *backend_data, session_t *ps, win *w, void *win_data,
|
void glx_render_win(void *backend_data, session_t *ps, win *w, void *win_data, const region_t *reg_paint) {
|
||||||
const region_t *reg_paint) {
|
|
||||||
struct _glx_data *gd = backend_data;
|
struct _glx_data *gd = backend_data;
|
||||||
struct _glx_win_data *wd = win_data;
|
struct _glx_win_data *wd = win_data;
|
||||||
|
|
||||||
|
@ -594,8 +591,7 @@ void glx_render_win(void *backend_data, session_t *ps, win *w, void *win_data,
|
||||||
/**
|
/**
|
||||||
* Preprocess function before start painting.
|
* Preprocess function before start painting.
|
||||||
*/
|
*/
|
||||||
static void attr_unused
|
static void attr_unused glx_paint_pre(session_t *ps, region_t *preg) {
|
||||||
glx_paint_pre(session_t *ps, region_t *preg) {
|
|
||||||
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
// Get buffer age
|
// Get buffer age
|
||||||
|
@ -614,8 +610,7 @@ glx_paint_pre(session_t *ps, region_t *preg) {
|
||||||
// Query GLX_EXT_buffer_age for buffer age
|
// Query GLX_EXT_buffer_age for buffer age
|
||||||
if (ps->o.glx_swap_method == SWAPM_BUFFER_AGE) {
|
if (ps->o.glx_swap_method == SWAPM_BUFFER_AGE) {
|
||||||
unsigned val = 0;
|
unsigned val = 0;
|
||||||
glXQueryDrawable(ps->dpy, get_tgt_window(ps),
|
glXQueryDrawable(ps->dpy, get_tgt_window(ps), GLX_BACK_BUFFER_AGE_EXT, &val);
|
||||||
GLX_BACK_BUFFER_AGE_EXT, &val);
|
|
||||||
buffer_age = val;
|
buffer_age = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,12 @@
|
||||||
#include "backend/backend.h"
|
#include "backend/backend.h"
|
||||||
#include "backend_common.h"
|
#include "backend_common.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "region.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
#include "x.h"
|
||||||
|
|
||||||
#define auto __auto_type
|
#define auto __auto_type
|
||||||
|
|
||||||
|
@ -108,8 +112,7 @@ static void compose(void *backend_data, session_t *ps, win *w, void *win_data, i
|
||||||
pixman_region32_intersect(®_tmp, ®_tmp, (region_t *)reg_paint);
|
pixman_region32_intersect(®_tmp, ®_tmp, (region_t *)reg_paint);
|
||||||
|
|
||||||
#ifdef CONFIG_XINERAMA
|
#ifdef CONFIG_XINERAMA
|
||||||
if (ps->o.xinerama_shadow_crop && w->xinerama_scr >= 0 &&
|
if (ps->o.xinerama_shadow_crop && w->xinerama_scr >= 0 && w->xinerama_scr < ps->xinerama_nscrs)
|
||||||
w->xinerama_scr < ps->xinerama_nscrs)
|
|
||||||
// There can be a window where number of screens is updated,
|
// There can be a window where number of screens is updated,
|
||||||
// but the screen number attached to the windows have not.
|
// but the screen number attached to the windows have not.
|
||||||
//
|
//
|
||||||
|
@ -128,10 +131,10 @@ static void compose(void *backend_data, session_t *ps, win *w, void *win_data, i
|
||||||
// Detect if the region is empty before painting
|
// Detect if the region is empty before painting
|
||||||
if (pixman_region32_not_empty(®_tmp)) {
|
if (pixman_region32_not_empty(®_tmp)) {
|
||||||
x_set_picture_clip_region(ps, xd->back, 0, 0, ®_tmp);
|
x_set_picture_clip_region(ps, xd->back, 0, 0, ®_tmp);
|
||||||
xcb_render_composite(
|
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_OVER,
|
||||||
ps->c, XCB_RENDER_PICT_OP_OVER, wd->shadow_pict, alpha_pict,
|
wd->shadow_pict, alpha_pict, xd->back, 0, 0, 0,
|
||||||
xd->back, 0, 0, 0, 0, dst_x + w->shadow_dx,
|
0, dst_x + w->shadow_dx, dst_y + w->shadow_dy,
|
||||||
dst_y + w->shadow_dy, w->shadow_width, w->shadow_height);
|
w->shadow_width, w->shadow_height);
|
||||||
}
|
}
|
||||||
pixman_region32_fini(®_tmp);
|
pixman_region32_fini(®_tmp);
|
||||||
pixman_region32_fini(&shadow_reg);
|
pixman_region32_fini(&shadow_reg);
|
||||||
|
@ -154,8 +157,7 @@ static inline void xrfilter_reset(session_t *ps, xcb_render_picture_t p) {
|
||||||
xcb_render_set_picture_filter(ps->c, p, strlen(filter), filter, 0, NULL);
|
xcb_render_set_picture_filter(ps->c, p, strlen(filter), filter, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool blur(void *backend_data, session_t *ps, double opacity, const region_t *reg_paint) {
|
||||||
blur(void *backend_data, session_t *ps, double opacity, const region_t *reg_paint) {
|
|
||||||
struct _xrender_data *xd = backend_data;
|
struct _xrender_data *xd = backend_data;
|
||||||
const pixman_box32_t *reg = pixman_region32_extents((region_t *)reg_paint);
|
const pixman_box32_t *reg = pixman_region32_extents((region_t *)reg_paint);
|
||||||
const int height = reg->y2 - reg->y1;
|
const int height = reg->y2 - reg->y1;
|
||||||
|
@ -203,14 +205,12 @@ blur(void *backend_data, session_t *ps, double opacity, const region_t *reg_pain
|
||||||
// be applied on source picture, to get the nearby pixels outside the
|
// be applied on source picture, to get the nearby pixels outside the
|
||||||
// window.
|
// window.
|
||||||
xcb_render_set_picture_filter(ps->c, src_pict, strlen(XRFILTER_CONVOLUTION),
|
xcb_render_set_picture_filter(ps->c, src_pict, strlen(XRFILTER_CONVOLUTION),
|
||||||
XRFILTER_CONVOLUTION, kwid * khei + 2,
|
XRFILTER_CONVOLUTION, kwid * khei + 2, convolution_blur);
|
||||||
convolution_blur);
|
|
||||||
|
|
||||||
if (ps->o.blur_kerns[i + 1] || i == 0) {
|
if (ps->o.blur_kerns[i + 1] || i == 0) {
|
||||||
// This is not the last pass, or this is the first pass
|
// This is not the last pass, or this is the first pass
|
||||||
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, src_pict,
|
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, src_pict, XCB_NONE,
|
||||||
XCB_NONE, dst_pict, src_x, src_y, 0, 0, 0, 0,
|
dst_pict, src_x, src_y, 0, 0, 0, 0, width, height);
|
||||||
width, height);
|
|
||||||
} else {
|
} else {
|
||||||
// This is the last pass, and this is also not the first
|
// This is the last pass, and this is also not the first
|
||||||
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_OVER, src_pict,
|
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_OVER, src_pict,
|
||||||
|
@ -238,8 +238,8 @@ blur(void *backend_data, session_t *ps, double opacity, const region_t *reg_pain
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void render_win(void *backend_data, session_t *ps, win *w, void *win_data,
|
static void
|
||||||
const region_t *reg_paint) {
|
render_win(void *backend_data, session_t *ps, win *w, void *win_data, const region_t *reg_paint) {
|
||||||
struct _xrender_data *xd = backend_data;
|
struct _xrender_data *xd = backend_data;
|
||||||
struct _xrender_win_data *wd = win_data;
|
struct _xrender_win_data *wd = win_data;
|
||||||
|
|
||||||
|
@ -266,22 +266,21 @@ static void render_win(void *backend_data, session_t *ps, win *w, void *win_data
|
||||||
// Copy the content of the window over to the buffer
|
// Copy the content of the window over to the buffer
|
||||||
x_clear_picture_clip_region(ps, wd->buffer);
|
x_clear_picture_clip_region(ps, wd->buffer);
|
||||||
wd->rendered_pict = wd->buffer;
|
wd->rendered_pict = wd->buffer;
|
||||||
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, wd->pict, None,
|
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, wd->pict, XCB_NONE,
|
||||||
wd->rendered_pict, 0, 0, 0, 0, 0, 0, w->widthb, w->heightb);
|
wd->rendered_pict, 0, 0, 0, 0, 0, 0, w->widthb, w->heightb);
|
||||||
|
|
||||||
if (w->invert_color) {
|
if (w->invert_color) {
|
||||||
// Handle invert color
|
// Handle invert color
|
||||||
x_set_picture_clip_region(ps, wd->rendered_pict, 0, 0, ®_paint_local);
|
x_set_picture_clip_region(ps, wd->rendered_pict, 0, 0, ®_paint_local);
|
||||||
|
|
||||||
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_DIFFERENCE,
|
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_DIFFERENCE, xd->white_pixel, XCB_NONE,
|
||||||
xd->white_pixel, None, wd->rendered_pict, 0, 0, 0, 0,
|
wd->rendered_pict, 0, 0, 0, 0, 0, 0, w->widthb, w->heightb);
|
||||||
0, 0, w->widthb, w->heightb);
|
|
||||||
// We use an extra PictOpInReverse operation to get correct pixel
|
// We use an extra PictOpInReverse operation to get correct pixel
|
||||||
// alpha. There could be a better solution.
|
// alpha. There could be a better solution.
|
||||||
if (win_has_alpha(w))
|
if (win_has_alpha(w))
|
||||||
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_IN_REVERSE,
|
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_IN_REVERSE,
|
||||||
wd->pict, None, wd->rendered_pict, 0, 0, 0,
|
wd->pict, XCB_NONE, wd->rendered_pict, 0, 0,
|
||||||
0, 0, 0, w->widthb, w->heightb);
|
0, 0, 0, 0, w->widthb, w->heightb);
|
||||||
}
|
}
|
||||||
|
|
||||||
const double dopacity = get_opacity_percent(w);
|
const double dopacity = get_opacity_percent(w);
|
||||||
|
@ -302,9 +301,8 @@ static void render_win(void *backend_data, session_t *ps, win *w, void *win_data
|
||||||
|
|
||||||
// Step 2: multiply alpha value
|
// Step 2: multiply alpha value
|
||||||
// XXX test
|
// XXX test
|
||||||
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, xd->white_pixel,
|
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, xd->white_pixel, alpha_pict,
|
||||||
alpha_pict, wd->rendered_pict, 0, 0, 0, 0, 0, 0,
|
wd->rendered_pict, 0, 0, 0, 0, 0, 0, w->widthb, w->heightb);
|
||||||
w->widthb, w->heightb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w->dim) {
|
if (w->dim) {
|
||||||
|
@ -359,8 +357,7 @@ static void *prepare_win(void *backend_data, session_t *ps, win *w) {
|
||||||
// leave this here until we have chance to re-think the backend API
|
// leave this here until we have chance to re-think the backend API
|
||||||
if (w->shadow) {
|
if (w->shadow) {
|
||||||
xcb_pixmap_t pixmap;
|
xcb_pixmap_t pixmap;
|
||||||
build_shadow(ps, 1, w->widthb, w->heightb, xd->shadow_pixel, &pixmap,
|
build_shadow(ps, 1, w->widthb, w->heightb, xd->shadow_pixel, &pixmap, &wd->shadow_pict);
|
||||||
&wd->shadow_pict);
|
|
||||||
xcb_free_pixmap(ps->c, pixmap);
|
xcb_free_pixmap(ps->c, pixmap);
|
||||||
}
|
}
|
||||||
return wd;
|
return wd;
|
||||||
|
@ -383,17 +380,17 @@ static void *init(session_t *ps) {
|
||||||
for (int i = 0; i < 256; ++i) {
|
for (int i = 0; i < 256; ++i) {
|
||||||
double o = (double)i / 255.0;
|
double o = (double)i / 255.0;
|
||||||
xd->alpha_pict[i] = solid_picture(ps, false, o, 0, 0, 0);
|
xd->alpha_pict[i] = solid_picture(ps, false, o, 0, 0, 0);
|
||||||
assert(xd->alpha_pict[i] != None);
|
assert(xd->alpha_pict[i] != XCB_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
xd->black_pixel = solid_picture(ps, true, 1, 0, 0, 0);
|
xd->black_pixel = solid_picture(ps, true, 1, 0, 0, 0);
|
||||||
xd->white_pixel = solid_picture(ps, true, 1, 1, 1, 1);
|
xd->white_pixel = solid_picture(ps, true, 1, 1, 1, 1);
|
||||||
xd->shadow_pixel = solid_picture(ps, true, 1, ps->o.shadow_red,
|
xd->shadow_pixel =
|
||||||
ps->o.shadow_green, ps->o.shadow_blue);
|
solid_picture(ps, true, 1, ps->o.shadow_red, ps->o.shadow_green, ps->o.shadow_blue);
|
||||||
|
|
||||||
if (ps->overlay != XCB_NONE) {
|
if (ps->overlay != XCB_NONE) {
|
||||||
xd->target = x_create_picture_with_visual_and_pixmap(
|
xd->target =
|
||||||
ps, ps->vis, ps->overlay, 0, NULL);
|
x_create_picture_with_visual_and_pixmap(ps, ps->vis, ps->overlay, 0, NULL);
|
||||||
xd->target_win = ps->overlay;
|
xd->target_win = ps->overlay;
|
||||||
} else {
|
} else {
|
||||||
xcb_render_create_picture_value_list_t pa = {
|
xcb_render_create_picture_value_list_t pa = {
|
||||||
|
@ -412,15 +409,14 @@ static void *init(session_t *ps) {
|
||||||
|
|
||||||
xd->back_pixmap =
|
xd->back_pixmap =
|
||||||
x_create_pixmap(ps, pictfmt->depth, ps->root, ps->root_width, ps->root_height);
|
x_create_pixmap(ps, pictfmt->depth, ps->root, ps->root_width, ps->root_height);
|
||||||
xd->back =
|
xd->back = x_create_picture_with_pictfmt_and_pixmap(ps, pictfmt, xd->back_pixmap, 0, NULL);
|
||||||
x_create_picture_with_pictfmt_and_pixmap(ps, pictfmt, xd->back_pixmap, 0, NULL);
|
|
||||||
|
|
||||||
xcb_pixmap_t root_pixmap = x_get_root_back_pixmap(ps);
|
xcb_pixmap_t root_pixmap = x_get_root_back_pixmap(ps);
|
||||||
if (root_pixmap == XCB_NONE) {
|
if (root_pixmap == XCB_NONE) {
|
||||||
xd->root_pict = solid_picture(ps, false, 1, 0.5, 0.5, 0.5);
|
xd->root_pict = solid_picture(ps, false, 1, 0.5, 0.5, 0.5);
|
||||||
} else {
|
} else {
|
||||||
xd->root_pict = x_create_picture_with_visual_and_pixmap(
|
xd->root_pict =
|
||||||
ps, ps->vis, root_pixmap, 0, NULL);
|
x_create_picture_with_visual_and_pixmap(ps, ps->vis, root_pixmap, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps->present_exists) {
|
if (ps->present_exists) {
|
||||||
|
@ -472,11 +468,11 @@ static void present(void *backend_data, session_t *ps) {
|
||||||
|
|
||||||
if (ps->o.vsync != VSYNC_NONE && ps->present_exists) {
|
if (ps->o.vsync != VSYNC_NONE && ps->present_exists) {
|
||||||
// Only reset the fence when we are sure we will trigger it again.
|
// Only reset the fence when we are sure we will trigger it again.
|
||||||
// To make sure rendering won't get stuck if user toggles vsync on the fly.
|
// To make sure rendering won't get stuck if user toggles vsync on the
|
||||||
|
// fly.
|
||||||
xcb_sync_reset_fence(ps->c, xd->idle_fence);
|
xcb_sync_reset_fence(ps->c, xd->idle_fence);
|
||||||
xcb_present_pixmap(ps->c, xd->target_win, xd->back_pixmap, 0, XCB_NONE,
|
xcb_present_pixmap(ps->c, xd->target_win, xd->back_pixmap, 0, XCB_NONE, XCB_NONE,
|
||||||
XCB_NONE, 0, 0, XCB_NONE, XCB_NONE, xd->idle_fence, 0,
|
0, 0, XCB_NONE, XCB_NONE, xd->idle_fence, 0, 0, 1, 0, 0, NULL);
|
||||||
0, 1, 0, 0, NULL);
|
|
||||||
} else {
|
} else {
|
||||||
// compose() sets clip region, so clear it first to make
|
// compose() sets clip region, so clear it first to make
|
||||||
// sure we update the whole screen.
|
// sure we update the whole screen.
|
||||||
|
@ -484,9 +480,8 @@ static void present(void *backend_data, session_t *ps) {
|
||||||
|
|
||||||
// TODO buffer-age-like optimization might be possible here.
|
// TODO buffer-age-like optimization might be possible here.
|
||||||
// but that will require a different backend API
|
// but that will require a different backend API
|
||||||
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, xd->back, None,
|
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, xd->back, XCB_NONE, xd->target,
|
||||||
xd->target, 0, 0, 0, 0, 0, 0, ps->root_width,
|
0, 0, 0, 0, 0, 0, ps->root_width, ps->root_height);
|
||||||
ps->root_height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
src/c2.c
20
src/c2.c
|
@ -27,13 +27,19 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <xcb/xcb.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "c2.h"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "x.h"
|
||||||
|
#include "compiler.h"
|
||||||
|
|
||||||
|
#include "c2.h"
|
||||||
|
|
||||||
#pragma GCC diagnostic error "-Wunused-parameter"
|
#pragma GCC diagnostic error "-Wunused-parameter"
|
||||||
|
|
||||||
|
@ -103,7 +109,7 @@ struct _c2_l {
|
||||||
} match : 3;
|
} match : 3;
|
||||||
bool match_ignorecase : 1;
|
bool match_ignorecase : 1;
|
||||||
char *tgt;
|
char *tgt;
|
||||||
Atom tgtatom;
|
xcb_atom_t tgtatom;
|
||||||
bool tgt_onframe;
|
bool tgt_onframe;
|
||||||
int index;
|
int index;
|
||||||
enum {
|
enum {
|
||||||
|
@ -341,7 +347,7 @@ c2h_dump_str_type(const c2_l_t *pleaf);
|
||||||
static void attr_unused
|
static void attr_unused
|
||||||
c2_dump(c2_ptr_t p);
|
c2_dump(c2_ptr_t p);
|
||||||
|
|
||||||
static Atom
|
static xcb_atom_t
|
||||||
c2_get_atom_type(const c2_l_t *pleaf);
|
c2_get_atom_type(const c2_l_t *pleaf);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -1331,7 +1337,7 @@ c2_dump(c2_ptr_t p) {
|
||||||
/**
|
/**
|
||||||
* Get the type atom of a condition.
|
* Get the type atom of a condition.
|
||||||
*/
|
*/
|
||||||
static Atom
|
static xcb_atom_t
|
||||||
c2_get_atom_type(const c2_l_t *pleaf) {
|
c2_get_atom_type(const c2_l_t *pleaf) {
|
||||||
switch (pleaf->type) {
|
switch (pleaf->type) {
|
||||||
case C2_L_TCARDINAL:
|
case C2_L_TCARDINAL:
|
||||||
|
@ -1348,9 +1354,7 @@ c2_get_atom_type(const c2_l_t *pleaf) {
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
unreachable;
|
||||||
assert(0);
|
|
||||||
return AnyPropertyType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1454,7 +1458,7 @@ c2_match_once_leaf(session_t *ps, win *w, const c2_l_t *pleaf,
|
||||||
else if (C2_L_TATOM == pleaf->type) {
|
else if (C2_L_TATOM == pleaf->type) {
|
||||||
winprop_t prop = wid_get_prop_adv(ps, wid, pleaf->tgtatom,
|
winprop_t prop = wid_get_prop_adv(ps, wid, pleaf->tgtatom,
|
||||||
idx, 1L, c2_get_atom_type(pleaf), pleaf->format);
|
idx, 1L, c2_get_atom_type(pleaf), pleaf->format);
|
||||||
Atom atom = winprop_get_int(prop);
|
xcb_atom_t atom = winprop_get_int(prop);
|
||||||
if (atom) {
|
if (atom) {
|
||||||
xcb_get_atom_name_reply_t *reply =
|
xcb_get_atom_name_reply_t *reply =
|
||||||
xcb_get_atom_name_reply(ps->c, xcb_get_atom_name(ps->c, atom), NULL);
|
xcb_get_atom_name_reply(ps->c, xcb_get_atom_name(ps->c, atom), NULL);
|
||||||
|
|
33
src/common.h
33
src/common.h
|
@ -93,6 +93,10 @@
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "compiler.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "x.h"
|
||||||
|
|
||||||
// === Constants ===
|
// === Constants ===
|
||||||
|
|
||||||
|
@ -206,35 +210,6 @@ typedef void (*f_BindTexImageEXT) (Display *display, GLXDrawable drawable, int b
|
||||||
typedef void (*f_ReleaseTexImageEXT) (Display *display, GLXDrawable drawable, int buffer);
|
typedef void (*f_ReleaseTexImageEXT) (Display *display, GLXDrawable drawable, int buffer);
|
||||||
|
|
||||||
#ifdef CONFIG_OPENGL
|
#ifdef CONFIG_OPENGL
|
||||||
// Looks like duplicate typedef of the same type is safe?
|
|
||||||
typedef int64_t GLint64;
|
|
||||||
typedef uint64_t GLuint64;
|
|
||||||
typedef struct __GLsync *GLsync;
|
|
||||||
|
|
||||||
#ifndef GL_SYNC_FLUSH_COMMANDS_BIT
|
|
||||||
#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GL_TIMEOUT_IGNORED
|
|
||||||
#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GL_ALREADY_SIGNALED
|
|
||||||
#define GL_ALREADY_SIGNALED 0x911A
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GL_TIMEOUT_EXPIRED
|
|
||||||
#define GL_TIMEOUT_EXPIRED 0x911B
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GL_CONDITION_SATISFIED
|
|
||||||
#define GL_CONDITION_SATISFIED 0x911C
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GL_WAIT_FAILED
|
|
||||||
#define GL_WAIT_FAILED 0x911D
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef GLsync (*f_FenceSync) (GLenum condition, GLbitfield flags);
|
typedef GLsync (*f_FenceSync) (GLenum condition, GLbitfield flags);
|
||||||
typedef GLboolean (*f_IsSync) (GLsync sync);
|
typedef GLboolean (*f_IsSync) (GLsync sync);
|
||||||
typedef void (*f_DeleteSync) (GLsync sync);
|
typedef void (*f_DeleteSync) (GLsync sync);
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
// modulemap
|
||||||
|
// Generated by: modularize -module-map-path=modulemap list -I. -I/usr/include/pixman-1 -x c -I/usr/include/dbus-1.0 -DCONFIG_XINERAMA -DCONFIG_LIBCONFIG -DCONFIG_REGEX_PCRE -DCONFIG_REGEX_PCRE_JIT -DCONFIG_OPENGL -DCONFIG_DBUS -DGL_GLEXT_PROTOTYPES -I/usr/lib/dbus-1.0/include
|
||||||
|
|
||||||
|
module compiler {
|
||||||
|
header "compiler.h"
|
||||||
|
}
|
||||||
|
module string_utils {
|
||||||
|
header "string_utils.h"
|
||||||
|
}
|
||||||
|
module dbus {
|
||||||
|
header "dbus.h"
|
||||||
|
}
|
||||||
|
module kernel {
|
||||||
|
header "kernel.h"
|
||||||
|
}
|
||||||
|
module utils {
|
||||||
|
header "utils.h"
|
||||||
|
}
|
||||||
|
module region {
|
||||||
|
header "region.h"
|
||||||
|
}
|
||||||
|
module compton {
|
||||||
|
header "compton.h"
|
||||||
|
exclude header "/usr/include/X11/Xlib.h"
|
||||||
|
}
|
||||||
|
module types {
|
||||||
|
header "types.h"
|
||||||
|
}
|
||||||
|
module c2 {
|
||||||
|
header "c2.h"
|
||||||
|
}
|
||||||
|
module render {
|
||||||
|
header "render.h"
|
||||||
|
}
|
||||||
|
module options {
|
||||||
|
header "options.h"
|
||||||
|
}
|
||||||
|
module opengl {
|
||||||
|
header "opengl.h"
|
||||||
|
}
|
||||||
|
module diagnostic {
|
||||||
|
header "diagnostic.h"
|
||||||
|
}
|
||||||
|
module win {
|
||||||
|
header "win.h"
|
||||||
|
exclude header "/usr/include/GL/glx.h"
|
||||||
|
}
|
||||||
|
module log {
|
||||||
|
header "log.h"
|
||||||
|
}
|
||||||
|
module x {
|
||||||
|
header "x.h"
|
||||||
|
}
|
||||||
|
module vsync {
|
||||||
|
header "vsync.h"
|
||||||
|
}
|
||||||
|
module common {
|
||||||
|
header "common.h"
|
||||||
|
exclude header "/usr/include/X11/Xlib.h"
|
||||||
|
exclude header "/usr/include/GL/glx.h"
|
||||||
|
}
|
||||||
|
module config {
|
||||||
|
header "config.h"
|
||||||
|
}
|
||||||
|
module xrescheck {
|
||||||
|
header "xrescheck.h"
|
||||||
|
}
|
||||||
|
module backend {
|
||||||
|
module gl {
|
||||||
|
module gl_common {
|
||||||
|
header "backend/gl/gl_common.h"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module backend {
|
||||||
|
header "backend/backend.h"
|
||||||
|
}
|
||||||
|
module backend_common {
|
||||||
|
header "backend/backend_common.h"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module Xlib {
|
||||||
|
header "/usr/include/X11/Xlib.h"
|
||||||
|
export *
|
||||||
|
}
|
|
@ -11,6 +11,9 @@
|
||||||
#include "c2.h"
|
#include "c2.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "region.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "win.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,10 @@
|
||||||
/// Common functions and definitions for configuration parsing
|
/// Common functions and definitions for configuration parsing
|
||||||
/// Used for command line arguments and config files
|
/// Used for command line arguments and config files
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <strings.h>
|
#include <string.h>
|
||||||
#include <xcb/xfixes.h>
|
#include <xcb/xfixes.h>
|
||||||
|
|
||||||
#ifdef CONFIG_LIBCONFIG
|
#ifdef CONFIG_LIBCONFIG
|
||||||
|
|
|
@ -10,10 +10,13 @@
|
||||||
#include <basedir_fs.h>
|
#include <basedir_fs.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "compiler.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "win.h"
|
||||||
|
|
||||||
#pragma GCC diagnostic error "-Wunused-parameter"
|
#pragma GCC diagnostic error "-Wunused-parameter"
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,14 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <xcb/xcb.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "types.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "compiler.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef CONFIG_OPENGL
|
#ifdef CONFIG_OPENGL
|
||||||
#include <opengl.h>
|
#include <GL/glx.h>
|
||||||
|
#include "opengl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
|
|
|
@ -9,10 +9,16 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <GL/glx.h>
|
||||||
|
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "win.h"
|
||||||
|
#include "region.h"
|
||||||
|
|
||||||
#include "opengl.h"
|
#include "opengl.h"
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "win.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
|
|
13
src/render.c
13
src/render.c
|
@ -13,6 +13,13 @@
|
||||||
#include "vsync.h"
|
#include "vsync.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
|
#include "compiler.h"
|
||||||
|
#include "x.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "region.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include "backend/backend_common.h"
|
#include "backend/backend_common.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
@ -175,7 +182,7 @@ void paint_one(session_t *ps, win *w, const region_t *reg_paint) {
|
||||||
// XRender: Build picture
|
// XRender: Build picture
|
||||||
if (bkend_use_xrender(ps) && !w->paint.pict) {
|
if (bkend_use_xrender(ps) && !w->paint.pict) {
|
||||||
xcb_render_create_picture_value_list_t pa = {
|
xcb_render_create_picture_value_list_t pa = {
|
||||||
.subwindowmode = IncludeInferiors,
|
.subwindowmode = XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS,
|
||||||
};
|
};
|
||||||
|
|
||||||
w->paint.pict = x_create_picture_with_pictfmt_and_pixmap(
|
w->paint.pict = x_create_picture_with_pictfmt_and_pixmap(
|
||||||
|
@ -394,7 +401,7 @@ static bool get_root_tile(session_t *ps) {
|
||||||
|
|
||||||
// Create Picture
|
// Create Picture
|
||||||
xcb_render_create_picture_value_list_t pa = {
|
xcb_render_create_picture_value_list_t pa = {
|
||||||
.repeat = True,
|
.repeat = true,
|
||||||
};
|
};
|
||||||
ps->root_tile_paint.pict = x_create_picture_with_visual_and_pixmap(
|
ps->root_tile_paint.pict = x_create_picture_with_visual_and_pixmap(
|
||||||
ps, ps->vis, pixmap, XCB_RENDER_CP_REPEAT, &pa);
|
ps, ps->vis, pixmap, XCB_RENDER_CP_REPEAT, &pa);
|
||||||
|
@ -933,7 +940,7 @@ void paint_all(session_t *ps, region_t *region, const region_t *region_real, win
|
||||||
if (ps->o.vsync_aggressive)
|
if (ps->o.vsync_aggressive)
|
||||||
vsync_wait(ps);
|
vsync_wait(ps);
|
||||||
|
|
||||||
XFlush(ps->dpy);
|
xcb_flush(ps->c);
|
||||||
|
|
||||||
#ifdef CONFIG_OPENGL
|
#ifdef CONFIG_OPENGL
|
||||||
if (glx_has_context(ps)) {
|
if (glx_has_context(ps)) {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
// Copyright (c) 2018 Yuxuan Shui <yshuiv7@gmail.com>
|
// Copyright (c) 2018 Yuxuan Shui <yshuiv7@gmail.com>
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Copyright (c) 2011-2013, Christopher Jeffrey
|
// Copyright (c) 2011-2013, Christopher Jeffrey
|
||||||
// Copyright (c) 2013 Richard Grenville <pyxlcy@gmail.com>
|
// Copyright (c) 2013 Richard Grenville <pyxlcy@gmail.com>
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
#include <xcb/render.h>
|
#include <xcb/render.h>
|
||||||
#include <xcb/damage.h>
|
#include <xcb/damage.h>
|
||||||
#include <xcb/xcb_renderutil.h>
|
#include <xcb/xcb_renderutil.h>
|
||||||
|
@ -17,6 +18,9 @@
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "region.h"
|
||||||
|
#include "render.h"
|
||||||
|
|
||||||
#ifdef CONFIG_DBUS
|
#ifdef CONFIG_DBUS
|
||||||
#include "dbus.h"
|
#include "dbus.h"
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "c2.h"
|
#include "c2.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
typedef struct session session_t;
|
typedef struct session session_t;
|
||||||
typedef struct _glx_texture glx_texture_t;
|
typedef struct _glx_texture glx_texture_t;
|
||||||
|
|
Loading…
Reference in New Issue