Remove a couple of unwanted options

* -d: because the standard way is to use $DISPLAY
* no-name-pixmap: undocumented debugging option
* -S: debugging option, not very useful

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2018-12-20 23:42:38 +00:00
parent 9880245200
commit 9b121447b9
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
6 changed files with 35 additions and 82 deletions

View File

@ -22,9 +22,6 @@ OPTIONS
*-h*, *--help*:: *-h*, *--help*::
Get the usage text embedded in program code, which may be more up-to-date than this man page. Get the usage text embedded in program code, which may be more up-to-date than this man page.
*-d* 'DISPLAY'::
Display to be managed.
*-r*, *--shadow-radius*='RADIUS':: *-r*, *--shadow-radius*='RADIUS'::
The blur radius for shadows, in pixels. (defaults to 12) The blur radius for shadows, in pixels. (defaults to 12)
@ -73,9 +70,6 @@ OPTIONS
*-b*, *--daemon*:: *-b*, *--daemon*::
Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
*-S*::
Enable synchronous X operation (for debugging).
*--log-level*:: *--log-level*::
Set the log level. Possible values are "TRACE", "DEBUG", "INFO", "WARN", "ERROR", in increasing level of importance. Case doesn't matter. Set the log level. Possible values are "TRACE", "DEBUG", "INFO", "WARN", "ERROR", in increasing level of importance. Case doesn't matter.

View File

@ -23,9 +23,6 @@ static attr_noret void usage(int ret) {
"usage: compton [options]\n" "usage: compton [options]\n"
"Options:\n" "Options:\n"
"\n" "\n"
"-d display\n"
" Which display should be managed.\n"
"\n"
"-r radius\n" "-r radius\n"
" The blur radius for shadows. (default 12)\n" " The blur radius for shadows. (default 12)\n"
"\n" "\n"
@ -78,9 +75,6 @@ static attr_noret void usage(int ret) {
"-b\n" "-b\n"
" Daemonize process.\n" " Daemonize process.\n"
"\n" "\n"
"-S\n"
" Enable synchronous operation (for debugging).\n"
"\n"
"--show-all-xerrors\n" "--show-all-xerrors\n"
" Show all X errors (for debugging).\n" " Show all X errors (for debugging).\n"
"\n" "\n"
@ -482,18 +476,17 @@ void get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
(o = getopt_long(argc, argv, shortopts, longopts, &longopt_idx))) { (o = getopt_long(argc, argv, shortopts, longopts, &longopt_idx))) {
if (256 == o) if (256 == o)
ps->o.config_file = strdup(optarg); ps->o.config_file = strdup(optarg);
else if ('d' == o) else if ('d' == o) {
ps->o.display = strdup(optarg); log_warn("-d will be ignored, please use the DISPLAY "
else if ('S' == o) "environment variable");
ps->o.synchronize = true; } else if (314 == o)
else if (314 == o)
ps->o.show_all_xerrors = true; ps->o.show_all_xerrors = true;
else if (318 == o) { else if (318 == o) {
printf("%s\n", COMPTON_VERSION); printf("%s\n", COMPTON_VERSION);
exit(0); exit(0);
} else if (320 == o) } else if (320 == o) {
ps->o.no_name_pixmap = true; log_warn("--no-name-pixmap will be ignored");
else if ('?' == o || ':' == o) } else if ('?' == o || ':' == o)
usage(1); usage(1);
} }
@ -577,11 +570,9 @@ void get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
case 'e': ps->o.frame_opacity = atof(optarg); break; case 'e': ps->o.frame_opacity = atof(optarg); break;
case 'z': case 'z':
log_warn("clear-shadow is removed, shadows are automatically " log_warn("clear-shadow is removed, shadows are automatically "
"cleared now. " "cleared now. If you want to prevent shadow from been "
"If you want to prevent shadow from been cleared under " "cleared under certain types of windows, you can use "
"certain types of windows, " "the \"full-shadow\" per window type option.");
"you can use the \"full-shadow\" per window type "
"option.");
break; break;
case 'n': case 'n':
case 'a': case 'a':
@ -629,14 +620,12 @@ void get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
case 271: case 271:
// --alpha-step // --alpha-step
log_warn("--alpha-step has been removed, compton now tries to " log_warn("--alpha-step has been removed, compton now tries to "
"make use" "make use of all alpha values");
" of all alpha values");
break; break;
case 272: log_warn("use of --dbe is deprecated"); break; case 272: log_warn("use of --dbe is deprecated"); break;
case 273: case 273:
log_warn("--paint-on-overlay has been removed, and is enabled " log_warn("--paint-on-overlay has been removed, and is enabled "
"when " "when possible");
"possible");
break; break;
P_CASEBOOL(274, sw_opti); P_CASEBOOL(274, sw_opti);
P_CASEBOOL(275, vsync_aggressive); P_CASEBOOL(275, vsync_aggressive);
@ -717,9 +706,8 @@ void get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
case 305: case 305:
// --shadow-exclude-reg // --shadow-exclude-reg
ps->o.shadow_exclude_reg_str = strdup(optarg); ps->o.shadow_exclude_reg_str = strdup(optarg);
log_warn("--shadow-exclude-reg is deprecated. " log_warn("--shadow-exclude-reg is deprecated. You are likely "
"You are likely better off using --shadow-exclude " "better off using --shadow-exclude anyway");
"anyway");
break; break;
case 306: case 306:
// --paint-exclude // --paint-exclude
@ -742,10 +730,9 @@ void get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
P_CASEBOOL(316, force_win_blend); P_CASEBOOL(316, force_win_blend);
case 317: case 317:
ps->o.glx_fshader_win_str = strdup(optarg); ps->o.glx_fshader_win_str = strdup(optarg);
log_warn("--glx-fshader-win is being deprecated, and might be" log_warn("--glx-fshader-win is being deprecated, and might be "
" removed in the future. If you really need this " "removed in the future. If you really need this "
"feature, please report" "feature, please report an issue to let us know");
" an issue to let us know");
break; break;
case 321: { case 321: {
enum log_level tmp_level = string_to_log_level(optarg); enum log_level tmp_level = string_to_log_level(optarg);

View File

@ -399,11 +399,6 @@ typedef struct options_t {
char *config_file; char *config_file;
/// Path to write PID to. /// Path to write PID to.
char *write_pid_path; char *write_pid_path;
/// The display name we used. NULL means we are using the value of the
/// <code>DISPLAY</code> environment variable.
char *display;
/// Safe representation of display name.
char *display_repr;
/// The backend in use. /// The backend in use.
enum backend backend; enum backend backend;
/// Whether to sync X drawing to avoid certain delay issues with /// Whether to sync X drawing to avoid certain delay issues with
@ -458,10 +453,6 @@ typedef struct options_t {
Window benchmark_wid; Window benchmark_wid;
/// A list of conditions of windows not to paint. /// A list of conditions of windows not to paint.
c2_lptr_t *paint_blacklist; c2_lptr_t *paint_blacklist;
/// Whether to avoid using xcb_composite_name_window_pixmap(), for debugging.
bool no_name_pixmap;
/// Whether to work under synchronized mode for debugging.
bool synchronize;
/// Whether to show all X errors. /// Whether to show all X errors.
bool show_all_xerrors; bool show_all_xerrors;
/// Whether to avoid acquiring X Selection. /// Whether to avoid acquiring X Selection.

View File

@ -2569,7 +2569,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
.reg_win = None, .reg_win = None,
.o = { .o = {
.config_file = NULL, .config_file = NULL,
.display = NULL,
.backend = BKEND_XRENDER, .backend = BKEND_XRENDER,
.glx_no_stencil = false, .glx_no_stencil = false,
#ifdef CONFIG_OPENGL #ifdef CONFIG_OPENGL
@ -2578,7 +2577,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
.mark_wmwin_focused = false, .mark_wmwin_focused = false,
.mark_ovredir_focused = false, .mark_ovredir_focused = false,
.fork_after_register = false, .fork_after_register = false,
.synchronize = false,
.detect_rounded_corners = false, .detect_rounded_corners = false,
.resize_damage = 0, .resize_damage = 0,
.unredir_if_possible = false, .unredir_if_possible = false,
@ -2741,7 +2739,7 @@ session_init(session_t *ps_old, int argc, char **argv) {
// Open Display // Open Display
if (!ps->dpy) { if (!ps->dpy) {
ps->dpy = XOpenDisplay(ps->o.display); ps->dpy = XOpenDisplay(NULL);
if (!ps->dpy) { if (!ps->dpy) {
log_fatal("Can't open display."); log_fatal("Can't open display.");
exit(1); exit(1);
@ -2752,9 +2750,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
const xcb_query_extension_reply_t *ext_info; const xcb_query_extension_reply_t *ext_info;
XSetErrorHandler(xerror); XSetErrorHandler(xerror);
if (ps->o.synchronize) {
XSynchronize(ps->dpy, 1);
}
ps->scr = DefaultScreen(ps->dpy); ps->scr = DefaultScreen(ps->dpy);
ps->root = RootWindow(ps->dpy, ps->scr); ps->root = RootWindow(ps->dpy, ps->scr);
@ -2806,8 +2801,7 @@ session_init(session_t *ps_old, int argc, char **argv) {
xcb_composite_query_version(ps->c, XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION), xcb_composite_query_version(ps->c, XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION),
NULL); NULL);
if (!ps->o.no_name_pixmap if (reply && (reply->major_version > 0 || reply->minor_version >= 2)) {
&& reply && (reply->major_version > 0 || reply->minor_version >= 2)) {
ps->has_name_pixmap = true; ps->has_name_pixmap = true;
} }
free(reply); free(reply);
@ -2833,27 +2827,6 @@ session_init(session_t *ps_old, int argc, char **argv) {
xcb_discard_reply(ps->c, xcb_discard_reply(ps->c,
xcb_xfixes_query_version(ps->c, XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION).sequence); xcb_xfixes_query_version(ps->c, XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION).sequence);
// Build a safe representation of display name
{
char *display_repr = DisplayString(ps->dpy);
if (!display_repr)
display_repr = "unknown";
display_repr = strdup(display_repr);
// Convert all special characters in display_repr name to underscore
{
char *pdisp = display_repr;
while (*pdisp) {
if (!isalnum(*pdisp))
*pdisp = '_';
++pdisp;
}
}
ps->o.display_repr = display_repr;
}
// Second pass // Second pass
get_cfg(ps, argc, argv, false); get_cfg(ps, argc, argv, false);
@ -3002,7 +2975,7 @@ session_init(session_t *ps_old, int argc, char **argv) {
// Initialize DBus. We need to do this early, because add_win might call dbus functions // Initialize DBus. We need to do this early, because add_win might call dbus functions
if (ps->o.dbus) { if (ps->o.dbus) {
#ifdef CONFIG_DBUS #ifdef CONFIG_DBUS
cdbus_init(ps); cdbus_init(ps, DisplayString(ps->dpy));
if (!ps->dbus_data) { if (!ps->dbus_data) {
ps->o.dbus = false; ps->o.dbus = false;
} }
@ -3160,8 +3133,6 @@ session_destroy(session_t *ps) {
free(ps->o.config_file); free(ps->o.config_file);
free(ps->o.write_pid_path); free(ps->o.write_pid_path);
free(ps->o.display);
free(ps->o.display_repr);
free(ps->o.logpath); free(ps->o.logpath);
for (int i = 0; i < MAX_BLUR_PASS; ++i) { for (int i = 0; i < MAX_BLUR_PASS; ++i) {
free(ps->o.blur_kerns[i]); free(ps->o.blur_kerns[i]);

View File

@ -85,7 +85,7 @@ cdbus_callback_watch_toggled(DBusWatch *watch, void *data);
* Initialize D-Bus connection. * Initialize D-Bus connection.
*/ */
bool bool
cdbus_init(session_t *ps) { cdbus_init(session_t *ps, const char *uniq) {
auto cd = cmalloc(struct cdbus_data); auto cd = cmalloc(struct cdbus_data);
cd->dbus_service = NULL; cd->dbus_service = NULL;
@ -117,7 +117,18 @@ cdbus_init(session_t *ps) {
// Request service name // Request service name
{ {
// Build service name // Build service name
char *service = mstrjoin3(CDBUS_SERVICE_NAME, ".", ps->o.display_repr); size_t service_len = strlen(CDBUS_SERVICE_NAME)+strlen(uniq)+2;
char *service = ccalloc(service_len, char);
snprintf(service, service_len, "%s.%s", CDBUS_SERVICE_NAME, uniq);
// Make a valid dbus name by converting non alphanumeric characters to underscore
char *tmp = service + strlen(CDBUS_SERVICE_NAME)+1;
while (*tmp) {
if (!isalnum(*tmp)) {
*tmp = '_';
}
tmp++;
}
cd->dbus_service = service; cd->dbus_service = service;
// Request for the name // Request for the name
@ -1001,7 +1012,6 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg) {
} }
cdbus_m_opts_get_do(config_file, cdbus_reply_string); cdbus_m_opts_get_do(config_file, cdbus_reply_string);
cdbus_m_opts_get_do(display_repr, cdbus_reply_string);
cdbus_m_opts_get_do(write_pid_path, cdbus_reply_string); cdbus_m_opts_get_do(write_pid_path, cdbus_reply_string);
cdbus_m_opts_get_do(mark_wmwin_focused, cdbus_reply_bool); cdbus_m_opts_get_do(mark_wmwin_focused, cdbus_reply_bool);
cdbus_m_opts_get_do(mark_ovredir_focused, cdbus_reply_bool); cdbus_m_opts_get_do(mark_ovredir_focused, cdbus_reply_bool);
@ -1018,7 +1028,7 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg) {
cdbus_m_opts_get_do(redirected_force, cdbus_reply_enum); cdbus_m_opts_get_do(redirected_force, cdbus_reply_enum);
cdbus_m_opts_get_do(stoppaint_force, cdbus_reply_enum); cdbus_m_opts_get_do(stoppaint_force, cdbus_reply_enum);
cdbus_m_opts_get_do(logpath, cdbus_reply_string); cdbus_m_opts_get_do(logpath, cdbus_reply_string);
cdbus_m_opts_get_do(synchronize, cdbus_reply_bool); cdbus_m_opts_get_stub(synchronize, cdbus_reply_bool, false);
cdbus_m_opts_get_do(refresh_rate, cdbus_reply_int32); cdbus_m_opts_get_do(refresh_rate, cdbus_reply_int32);
cdbus_m_opts_get_do(sw_opti, cdbus_reply_bool); cdbus_m_opts_get_do(sw_opti, cdbus_reply_bool);

View File

@ -26,7 +26,7 @@ static inline const char *cdbus_repr_msgtype(DBusMessage *msg) {
/** /**
* Initialize D-Bus connection. * Initialize D-Bus connection.
*/ */
bool cdbus_init(session_t *ps); bool cdbus_init(session_t *ps, const char *uniq_name);
/** /**
* Destroy D-Bus connection. * Destroy D-Bus connection.