Misc: Add --version & --no-x-selection

- Add --version. (#206)

- Add --no-x-selection for debugging. (#207)
This commit is contained in:
Richard Grenville 2014-07-13 09:34:38 +08:00
parent a29b7958cf
commit 4e8ccea252
2 changed files with 12 additions and 1 deletions

View File

@ -598,6 +598,8 @@ typedef struct _options_t {
bool synchronize; 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.
bool no_x_selection;
// === VSync & software optimization === // === VSync & software optimization ===
/// User-specified refresh rate. /// User-specified refresh rate.

View File

@ -4759,7 +4759,8 @@ register_cm(session_t *ps) {
printf_errf("(): Failed to set COMPTON_VERSION."); printf_errf("(): Failed to set COMPTON_VERSION.");
} }
{ // Acquire X Selection _NET_WM_CM_S?
if (!ps->o.no_x_selection) {
unsigned len = strlen(REGISTER_PROP) + 2; unsigned len = strlen(REGISTER_PROP) + 2;
int s = ps->scr; int s = ps->scr;
@ -5614,6 +5615,8 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
{ "no-fading-destroyed-argb", no_argument, NULL, 315 }, { "no-fading-destroyed-argb", no_argument, NULL, 315 },
{ "force-win-blend", no_argument, NULL, 316 }, { "force-win-blend", no_argument, NULL, 316 },
{ "glx-fshader-win", required_argument, NULL, 317 }, { "glx-fshader-win", required_argument, NULL, 317 },
{ "version", no_argument, NULL, 318 },
{ "no-x-selection", no_argument, NULL, 319 },
// Must terminate with a NULL entry // Must terminate with a NULL entry
{ NULL, 0, NULL, 0 }, { NULL, 0, NULL, 0 },
}; };
@ -5636,6 +5639,10 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
ps->o.synchronize = true; 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) {
printf("%s\n", COMPTON_VERSION);
exit(0);
}
else if ('?' == o || ':' == o) else if ('?' == o || ':' == o)
usage(1); usage(1);
} }
@ -5690,6 +5697,7 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
case 'd': case 'd':
case 'S': case 'S':
case 314: case 314:
case 318:
break; break;
P_CASELONG('D', fade_delta); P_CASELONG('D', fade_delta);
case 'I': case 'I':
@ -5874,6 +5882,7 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) {
case 317: case 317:
ps->o.glx_fshader_win_str = mstrcpy(optarg); ps->o.glx_fshader_win_str = mstrcpy(optarg);
break; break;
P_CASEBOOL(319, no_x_selection);
default: default:
usage(1); usage(1);
break; break;