From 92eb57ff44ca6b522eb3b21e0b16d63b306fe900 Mon Sep 17 00:00:00 2001 From: XeCycle Date: Mon, 27 Feb 2012 00:35:17 +0800 Subject: [PATCH 1/2] Add option to avoid DND shadows. --- compton.1 | 4 ++++ compton.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/compton.1 b/compton.1 index 31c1677..9f2636d 100644 --- a/compton.1 +++ b/compton.1 @@ -48,6 +48,10 @@ menus, and for all windows on hide and restore events. .BI \-C When \-c is specified, attempts to avoid painting shadows on panels and docks. .TP +.BI \-G +When \-c is specified, attempts to avoid painting shadows on +drag-and-drop windows. +.TP .BI \-F When \-f is specified, also enables the fade effect when windows change their opacity, as with transset(1). diff --git a/compton.c b/compton.c index 5444d9b..2d40ab8 100644 --- a/compton.c +++ b/compton.c @@ -2422,6 +2422,7 @@ main(int argc, char **argv) { char *display = 0; int o; Bool no_dock_shadow = False; + Bool no_dnd_shadow = False; for (i = 0; i < NUM_WINTYPES; ++i) { win_type_fade[i] = False; @@ -2429,7 +2430,7 @@ main(int argc, char **argv) { win_type_opacity[i] = 1.0; } - while ((o = getopt(argc, argv, "D:I:O:d:r:o:m:l:t:i:e:scnfFCaSz")) != -1) { + while ((o = getopt(argc, argv, "D:I:O:d:r:o:m:l:t:i:e:scnfFCaSzG")) != -1) { switch (o) { case 'd': display = optarg; @@ -2503,6 +2504,9 @@ main(int argc, char **argv) { fprintf(stderr, "Warning: " "-n, -a, and -s have been removed.\n"); break; + case 'G': + no_dnd_shadow = True; + break; default: usage(argv[0]); break; @@ -2513,6 +2517,9 @@ main(int argc, char **argv) { win_type_shadow[WINTYPE_DOCK] = False; } + if (no_dnd_shadow) + win_type_shadow[WINTYPE_DND] = False; + dpy = XOpenDisplay(display); if (!dpy) { fprintf(stderr, "Can't open display\n"); From d226a9d98867a78c10c6a5f4b2374e5cb3d126c2 Mon Sep 17 00:00:00 2001 From: XeCycle Date: Mon, 27 Feb 2012 01:02:42 +0800 Subject: [PATCH 2/2] Add -b option to fork to background. --- compton.1 | 7 +++++++ compton.c | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/compton.1 b/compton.1 index 9f2636d..abdfbbd 100644 --- a/compton.1 +++ b/compton.1 @@ -56,6 +56,13 @@ drag-and-drop windows. When \-f is specified, also enables the fade effect when windows change their opacity, as with transset(1). .TP +.BI \-b +Attempts to fork to background after registered composition +manager. Still sits in foreground if fork failed. Maybe useful +if you computer is too fast, in which case some programs +requiring a composite manager may have started before composite +manager is ready. +.TP .BI \-i\ opacity Specifies inactive window transparency. (0.1 - 1.0) .TP diff --git a/compton.c b/compton.c index 2d40ab8..64ef3c9 100644 --- a/compton.c +++ b/compton.c @@ -2423,6 +2423,7 @@ main(int argc, char **argv) { int o; Bool no_dock_shadow = False; Bool no_dnd_shadow = False; + Bool fork_after_register = False; for (i = 0; i < NUM_WINTYPES; ++i) { win_type_fade[i] = False; @@ -2430,7 +2431,7 @@ main(int argc, char **argv) { win_type_opacity[i] = 1.0; } - while ((o = getopt(argc, argv, "D:I:O:d:r:o:m:l:t:i:e:scnfFCaSzG")) != -1) { + while ((o = getopt(argc, argv, "D:I:O:d:r:o:m:l:t:i:e:scnfFCaSzGb")) != -1) { switch (o) { case 'd': display = optarg; @@ -2507,6 +2508,9 @@ main(int argc, char **argv) { case 'G': no_dnd_shadow = True; break; + case 'b': + fork_after_register = True; + break; default: usage(argv[0]); break; @@ -2564,6 +2568,13 @@ main(int argc, char **argv) { } register_cm(scr); + if (fork_after_register) { + int pid = fork(); + if (pid < 0) + fprintf(stderr, "Fork failed\n"); + else if (pid > 0) + exit(0); + } get_atoms(); pa.subwindow_mode = IncludeInferiors;