A color name can be passed to specify the background fill color to use
if no root window pixmap is set.  If it is not specified, the previous
default (a gray) is used.

Signed-off-by: Forest Bond <[email protected]>
---
 xcompmgr.c |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/xcompmgr.c b/xcompmgr.c
index 3a01cce..12dcaea 100644
--- a/xcompmgr.c
+++ b/xcompmgr.c
@@ -120,6 +120,7 @@ static Bool         clipChanged;
 #if HAS_NAME_WINDOW_PIXMAP
 static Bool            hasNamePixmap;
 #endif
+static XRenderColor    fill_color;
 static int             root_height, root_width;
 static ignore          *ignore_head, **ignore_tail = &ignore_head;
 static int             xfixes_event, xfixes_error;
@@ -801,11 +802,7 @@ root_tile (Display *dpy)
                                    CPRepeat, &pa);
     if (fill)
     {
-       XRenderColor    c;
-       
-       c.red = c.green = c.blue = 0x8080;
-       c.alpha = 0xffff;
-       XRenderFillRectangle (dpy, PictOpSrc, picture, &c, 
+       XRenderFillRectangle (dpy, PictOpSrc, picture, &fill_color,
                              0, 0, 1, 1);
     }
     return picture;
@@ -1863,6 +1860,7 @@ usage (char *program)
     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, "   -b color\n      Specifies the background color to use 
if no root pixmap is set. (default is a gray)\n");
     fprintf (stderr, "   -I fade-in-step\n      Specifies the opacity change 
between steps while fading in. (default 0.028)\n");
     fprintf (stderr, "   -O fade-out-step\n      Specifies the opacity change 
between steps while fading out. (default 0.03)\n");
     fprintf (stderr, "   -D fade-delta-time\n      Specifies the time between 
steps in a fade in milliseconds. (default 10)\n");
@@ -1945,8 +1943,9 @@ main (int argc, char **argv)
     int                    composite_major, composite_minor;
     char           *display = NULL;
     int                    o;
+    char           *fill_color_name = NULL;
 
-    while ((o = getopt (argc, argv, "D:I:O:d:r:o:l:t:scnfFCaS")) != -1)
+    while ((o = getopt (argc, argv, "D:I:O:d:r:o:l:t:b:scnfFCaS")) != -1)
     {
        switch (o) {
        case 'd':
@@ -2003,6 +2002,9 @@ main (int argc, char **argv)
        case 't':
            shadowOffsetY = atoi (optarg);
            break;
+       case 'b':
+           fill_color_name = optarg;
+           break;
        default:
            usage (argv[0]);
            break;
@@ -2074,6 +2076,26 @@ main (int argc, char **argv)
        presum_gaussian (gaussianMap);
     }
 
+    if (fill_color_name) {
+       XColor c;
+       if (! XParseColor (dpy, DefaultColormap (dpy, scr),
+                          fill_color_name, &c)) {
+           fprintf (stderr, "Could not parse fill color.\n");
+           exit (1);
+       }
+       if (! XAllocColor (dpy, DefaultColormap (dpy, scr), &c)) {
+           fprintf (stderr, "Could not allocate color.\n");
+           exit (1);
+       }
+
+       fill_color.red = c.red;
+       fill_color.green = c.green;
+       fill_color.blue = c.blue;
+    } else {
+       fill_color.red = fill_color.green = fill_color.blue = 0x8080;
+    }
+    fill_color.alpha = 0xffff;
+
     root_width = DisplayWidth (dpy, scr);
     root_height = DisplayHeight (dpy, scr);
 
-- 
1.7.0.4
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to