From: dolio Date: Sat, 18 Sep 2004 00:13:15 +0000 (+0000) Subject: Added various options for client-side shadows (offset, opacity, X-Git-Tag: XCOMPMGR_1_1_2~9 X-Git-Url: http://git.openbox.org/?p=dana%2Fxcompmgr.git;a=commitdiff_plain;h=34c09f7b7fdc0fd96fd4adf69a00f295858ac11a Added various options for client-side shadows (offset, opacity, blur-radius) based on the work of Thomas Luebking, along with the man entries and usage information to go along with them. --- diff --git a/ChangeLog b/ChangeLog index 4ee365e..d2a4ed3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2004-09-17 Dan Doel + * xcompmgr.c: (win_extents), (usage), (main): + Added various client-side shadow options (opacity, offset, radius) + based on the work of Thomas Luebking. + * xcompmgr.1: + Added descriptions of the options in the man page. + +2004-09-17 Dan Doel + * xcompmgr.c: (usage): Changed the usage function to describe the available options. diff --git a/xcompmgr.1 b/xcompmgr.1 index d5d43d8..6495932 100644 --- a/xcompmgr.1 +++ b/xcompmgr.1 @@ -4,7 +4,7 @@ xcompmgr \- sample X compositing manager .SH SYNOPSIS .nf -.B xcompmgr [\-d display] [\-acfnsCFS] +.B xcompmgr [\-d display] [\-r radius] [\-o opacity] [\-l left-offset] [\-t top-offset] [\-acCfFnsS] .fi .SH DESCRIPTION .B xcompmgr @@ -15,6 +15,18 @@ and COMPOSITE extensions. It enables basic eye-candy effects. .BI \-d\ display Specifies the display to manage. .TP +.BI \-r\ radius +Specifies the blur radius for client-side shadows. +.TP +.BI \-o\ opacity +Specifies the opacity for client-side shadows. +.TP +.BI \-l\ left-offset +Specifies the left offset for client-side shadows. +.TP +.BI \-t\ top-offset +Specifies the top offset for client-side shadows. +.TP .BI \-a Automatic server-side compositing. This instructs the server to use the standard composition rules. Useful for debugging. @@ -45,4 +57,4 @@ Enables synchronous operation. Useful for debugging. Probably. Please report any you find to http://bugs.freedesktop.org/. .SH AUTHORS Keith Packard, with contributions from Matthew Allum, Eric Anholt, Dan Doel, -Matthew Hawn, Ely Levy, Phil Blundell, and Carl Worth. +Thomas Luebking, Matthew Hawn, Ely Levy, Phil Blundell, and Carl Worth. diff --git a/xcompmgr.c b/xcompmgr.c index 01a4c7e..185aee8 100644 --- a/xcompmgr.c +++ b/xcompmgr.c @@ -178,6 +178,9 @@ win_extents (Display *dpy, win *w); CompMode compMode = CompSimple; int shadowRadius = 12; +int shadowOffsetX = -15; +int shadowOffsetY = -15; +double shadowOpacity = .75; double fade_in_step = 0.028; double fade_out_step = 0.03; @@ -361,10 +364,6 @@ run_fades (Display *dpy) fade_time = now + fade_delta; } -#define SHADOW_OPACITY 0.75 -#define SHADOW_OFFSET_X (-shadowRadius * 5 / 4) -#define SHADOW_OFFSET_Y (-shadowRadius * 5 / 4) - static double gaussian (double r, double x, double y) { @@ -779,11 +778,11 @@ win_extents (Display *dpy, win *w) } else { - w->shadow_dx = SHADOW_OFFSET_X; - w->shadow_dy = SHADOW_OFFSET_Y; + w->shadow_dx = shadowOffsetX; + w->shadow_dy = shadowOffsetY; if (!w->shadow) { - double opacity = SHADOW_OPACITY; + double opacity = shadowOpacity; if (w->mode == WINDOW_TRANS) opacity = opacity * ((double)w->opacity)/((double)OPAQUE); w->shadow = shadow_picture (dpy, opacity, w->alphaPict, @@ -1757,9 +1756,13 @@ ev_window (XEvent *ev) void usage (char *program) { - fprintf (stderr, "usage: %s [-d display] [-acCfFnsS]\n", program); + fprintf (stderr, "usage: %s [options]\n", program); fprintf (stderr, "Options\n"); fprintf (stderr, " -d display\n Specifies which display should be managed.\n"); + fprintf (stderr, " -r radius\n Specifies the blur radius for client-side shadows. (default 12)\n"); + fprintf (stderr, " -o opacity\n Specifies the translucency for client-side shadows. (default .75)\n"); + fprintf (stderr, " -l left-offset\n Specifies the left offset for client-side shadows. (default -15)\n"); + fprintf (stderr, " -t top-offset\n Specifies the top offset for clinet-side shadows. (default -15)\n"); fprintf (stderr, " -a\n Use automatic server-side compositing. Faster, but no special effects.\n"); fprintf (stderr, " -c\n Draw client-side shadows with fuzzy edges.\n"); fprintf (stderr, " -C\n Avoid drawing shadows on dock/panel windows.\n"); @@ -1795,7 +1798,7 @@ main (int argc, char **argv) char *display = 0; int o; - while ((o = getopt (argc, argv, "d:scnfFCaS")) != -1) + while ((o = getopt (argc, argv, "d:r:o:l:t:scnfFCaS")) != -1) { switch (o) { case 'd': @@ -1825,6 +1828,18 @@ main (int argc, char **argv) case 'S': synchronize = True; break; + case 'r': + shadowRadius = atoi (optarg); + break; + case 'o': + shadowOpacity = atof (optarg); + break; + case 'l': + shadowOffsetX = atoi (optarg); + break; + case 't': + shadowOffsetY = atoi (optarg); + break; default: usage (argv[0]); break;