Convert print_errf/dbgf in win.c and compton.c

And improve some of the log messages. Like, when compton exits because
of unsupported options, explain which options are causing compton to
quit.

Convert some debugging messages that are guarded behind ifdef's to log_trace,
so user don't need to re-compile to enabled them.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2018-12-20 02:49:29 +00:00
parent 185c0ce97c
commit 833eb966f1
6 changed files with 115 additions and 202 deletions

20
src/x.c
View File

@ -196,7 +196,7 @@ x_create_picture(session_t *ps, int wid, int hei,
pictfmt = x_get_pictform_for_visual(ps, ps->vis);
if (!pictfmt) {
printf_errf("(): default visual is invalid");
log_fatal("Default visual is invalid");
abort();
}
@ -219,7 +219,7 @@ bool x_fetch_region(session_t *ps, xcb_xfixes_region_t r, pixman_region32_t *res
xcb_xfixes_fetch_region_reply_t *xr = xcb_xfixes_fetch_region_reply(ps->c,
xcb_xfixes_fetch_region(ps->c, r), &e);
if (!xr) {
printf_errf("(): failed to fetch rectangles");
log_error("Failed to fetch rectangles");
return false;
}
@ -257,7 +257,7 @@ void x_set_picture_clip_region(session_t *ps, xcb_render_picture_t pict,
xcb_request_check(ps->c, xcb_render_set_picture_clip_rectangles_checked(ps->c, pict,
clip_x_origin, clip_y_origin, nrects, xrects));
if (e)
printf_errf("(): failed to set clip region");
log_error("Failed to set clip region");
free(e);
free(xrects);
return;
@ -277,8 +277,8 @@ x_print_error(unsigned long serial, uint8_t major, uint8_t minor, uint8_t error_
if (major == ps->composite_opcode
&& minor == XCB_COMPOSITE_REDIRECT_SUBWINDOWS) {
fprintf(stderr, "Another composite manager is already running "
"(and does not handle _NET_WM_CM_Sn correctly)\n");
log_fatal("Another composite manager is already running "
"(and does not handle _NET_WM_CM_Sn correctly)");
exit(1);
}
@ -349,16 +349,12 @@ x_print_error(unsigned long serial, uint8_t major, uint8_t minor, uint8_t error_
#undef CASESTRRET2
print_timestamp(ps);
{
char buf[BUF_LEN] = "";
XGetErrorText(ps->dpy, error_code, buf, BUF_LEN);
printf("error %4d %-12s request %4d minor %4d serial %6lu: \"%s\"\n",
error_code, name, major,
minor, serial, buf);
log_warn("X error %d %s request %d minor %d serial %lu: \"%s\"",
error_code, name, major, minor, serial, buf);
}
// print_backtrace();
}
/**
@ -372,7 +368,7 @@ x_create_pixmap(session_t *ps, uint8_t depth, xcb_drawable_t drawable, uint16_t
if (err == NULL)
return pix;
printf_err("Failed to create pixmap:");
log_error("Failed to create pixmap:");
ev_xcb_error(ps, err);
free(err);
return XCB_NONE;