- Fix a bug that glx_bind_pixmap() doesn't work with mesa drivers. Thanks to Janhouse and mkraemer for reporting. (#7) - Use stencil buffer to attempt to eliminate potential double-paint issue in glx_render(). X Fixes doesn't guarantee the rectangles in a region do not overlap, and this may cause some regions to be painted twice, which would be a problem if we are painting transparent things. Now the target window must have a stencil buffer. Compiz uses its own region implementation to deal with this, but as a lightweight compositor we can't really do the same. It may have a positive or negative effort over performance. Callgrind result indicates basically no change in performance, but this may or may not be true. - Correctly distinguish GL extensions and GLX extensions. Sorry. :-D - Handle screen size. Thanks to tsmithe for reporting. (#7) - Rename OpenGL backend to GLX backend, because, we might have a EGL backend someday. - Add configuration file option `backend` to specify backend. Add `backend` to D-Bus `opts_get`. - Add OpenGL shader compilation code, but currently unused. - Minor adjustments. - Known issue: Window content doesn't get updated in VirtualBox, probably because its OpenGL implementation requires constant rebinding of texture. But that's really slow... - Known issue: Blur feature is still unimplemented in GLX backend.
87 lines
1.9 KiB
C
87 lines
1.9 KiB
C
/*
|
|
* Compton - a compositor for X11
|
|
*
|
|
* Based on `xcompmgr` - Copyright (c) 2003, Keith Packard
|
|
*
|
|
* Copyright (c) 2011-2013, Christopher Jeffrey
|
|
* See LICENSE for more information.
|
|
*
|
|
*/
|
|
|
|
#include "common.h"
|
|
|
|
#include <ctype.h>
|
|
|
|
/**
|
|
* Check if a word is in string.
|
|
*/
|
|
static inline bool
|
|
wd_is_in_str(const char *haystick, const char *needle) {
|
|
if (!haystick)
|
|
return false;
|
|
|
|
assert(*needle);
|
|
|
|
const char *pos = haystick - 1;
|
|
while ((pos = strstr(pos + 1, needle))) {
|
|
// Continue if it isn't a word boundary
|
|
if (((pos - haystick) && !isspace(*(pos - 1)))
|
|
|| (strlen(pos) > strlen(needle) && !isspace(pos[strlen(needle)])))
|
|
continue;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Check if a GLX extension exists.
|
|
*/
|
|
static inline bool
|
|
glx_hasglxext(session_t *ps, const char *ext) {
|
|
const char *glx_exts = glXQueryExtensionsString(ps->dpy, ps->scr);
|
|
if (!glx_exts) {
|
|
printf_errf("(): Failed get GLX extension list.");
|
|
return false;
|
|
}
|
|
|
|
bool found = wd_is_in_str(glx_exts, ext);
|
|
if (!found)
|
|
printf_errf("(): Missing GLX extension %s.", ext);
|
|
|
|
return found;
|
|
}
|
|
|
|
/**
|
|
* Check if a GLX extension exists.
|
|
*/
|
|
static inline bool
|
|
glx_hasglext(session_t *ps, const char *ext) {
|
|
const char *gl_exts = (const char *) glGetString(GL_EXTENSIONS);
|
|
if (!gl_exts) {
|
|
printf_errf("(): Failed get GL extension list.");
|
|
return false;
|
|
}
|
|
|
|
bool found = wd_is_in_str(gl_exts, ext);
|
|
if (!found)
|
|
printf_errf("(): Missing GL extension %s.", ext);
|
|
|
|
return found;
|
|
}
|
|
|
|
static inline XVisualInfo *
|
|
get_visualinfo_from_visual(session_t *ps, Visual *visual) {
|
|
XVisualInfo vreq = { .visualid = XVisualIDFromVisual(visual) };
|
|
int nitems = 0;
|
|
|
|
return XGetVisualInfo(ps->dpy, VisualIDMask, &vreq, &nitems);
|
|
}
|
|
|
|
static bool
|
|
glx_update_fbconfig(session_t *ps);
|
|
|
|
static int
|
|
glx_cmp_fbconfig(session_t *ps,
|
|
const glx_fbconfig_t *pfbc_a, const glx_fbconfig_t *pfbc_b);
|