Add debug mode

When enabled, the result will be redirected to a window, and compton
won't take over the screen.

Makes debugging easier.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-07-07 16:12:17 +01:00
parent 640b4b1c99
commit 0b0d896ffe
7 changed files with 81 additions and 24 deletions

View File

@ -25,6 +25,7 @@
#include "backend/gl/gl_common.h"
#include "backend/gl/glx.h"
#include "common.h"
#include "compton.h"
#include "compiler.h"
#include "config.h"
#include "log.h"
@ -221,7 +222,7 @@ static backend_t *glx_init(session_t *ps) {
gd->display = ps->dpy;
gd->screen = ps->scr;
gd->target_win = ps->overlay != XCB_NONE ? ps->overlay : ps->root;
gd->target_win = session_get_target_window(ps);
XVisualInfo *pvis = NULL;
@ -310,10 +311,7 @@ static backend_t *glx_init(session_t *ps) {
}
// Attach GLX context
GLXDrawable tgt = ps->overlay;
if (!tgt) {
tgt = ps->root;
}
GLXDrawable tgt = gd->target_win;
if (!glXMakeCurrent(ps->dpy, tgt, gd->ctx)) {
log_error("Failed to attach GLX context.");
goto end;

View File

@ -14,6 +14,7 @@
#include "backend/backend.h"
#include "backend/backend_common.h"
#include "common.h"
#include "compton.h"
#include "config.h"
#include "kernel.h"
#include "log.h"
@ -532,18 +533,12 @@ backend_t *backend_xrender_init(session_t *ps) {
xd->black_pixel = solid_picture(ps->c, ps->root, true, 1, 0, 0, 0);
xd->white_pixel = solid_picture(ps->c, ps->root, true, 1, 1, 1, 1);
if (ps->overlay != XCB_NONE) {
xd->target = x_create_picture_with_visual_and_pixmap(
ps->c, ps->vis, ps->overlay, 0, NULL);
xd->target_win = ps->overlay;
} else {
xcb_render_create_picture_value_list_t pa = {
.subwindowmode = XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS,
};
xd->target = x_create_picture_with_visual_and_pixmap(
ps->c, ps->vis, ps->root, XCB_RENDER_CP_SUBWINDOW_MODE, &pa);
xd->target_win = ps->root;
}
xd->target_win = session_get_target_window(ps);
xcb_render_create_picture_value_list_t pa = {
.subwindowmode = XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS,
};
xd->target = x_create_picture_with_visual_and_pixmap(
ps->c, ps->vis, xd->target_win, XCB_RENDER_CP_SUBWINDOW_MODE, &pa);
auto pictfmt = x_get_pictform_for_visual(ps->c, ps->vis);
if (!pictfmt) {