Package: hsetroot
Version: 1.0.2-1.1
Severity: wishlist
Tags: patch

Hello

hsetroot is the best standalone X wallpaper tool I found so far.

The only thing I am missing is an option to set the background to some
colour which is similar to the image.

Although I did not find a simple way to implement such option I
implemented sort of workaround which works quite well for many images.

Also hsetroot crashes when it cannot connect to the X display.

Thanks

Michal




-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages hsetroot depends on:
ii  libc6                         2.7-16     GNU C Library: Shared libraries
ii  libimlib2                     1.4.0-1.2  powerful image loading and renderi
ii  libx11-6                      2:1.1.5-2  X11 client-side library

hsetroot recommends no packages.

hsetroot suggests no packages.

-- no debconf information
--- src/hsetroot.c      2003-09-05 23:35:21.000000000 +0200
+++ src/hsetroot.c      2008-11-08 02:22:15.000000000 +0100
@@ -254,6 +275,11 @@
   Imlib_Color_Modifier modifier = NULL;
   _display = XOpenDisplay (NULL);
 
+  if(!_display){
+    fprintf (stderr, "Cannot open X display!\n");
+    exit (123);
+  }
+
   for (screen = 0; screen < ScreenCount (_display); screen++)
     {
       display = XOpenDisplay (NULL);
diff -ur hsetroot-1.0.2/src/hsetroot.c hsetroot-1.0.2.mod/src/hsetroot.c
--- src/hsetroot.c	2003-09-05 23:35:21.000000000 +0200
+++ src/hsetroot.c	2008-11-07 22:43:39.000000000 +0100
@@ -8,7 +8,7 @@
 #include "config.h"
 
 typedef enum
-{ Full, Fill, Center, Tile } ImageMode;
+{ Full, Fill, Center, Tile, Xtend } ImageMode;
 
 void
 usage (char *commandline)
@@ -30,6 +30,7 @@
 	  " -center <image>            Render an image centered on screen\n"
 	  " -tile <image>              Render an image tiled\n"
 	  " -full <image>              Render an image maximum aspect\n"
+	  " -extend <image>            Render an image max aspect and fill borders\n"
 	  " -fill <image>              Render an image strechted\n"
 	  "\n"
 	  "Manipulations:\n"
@@ -199,7 +200,7 @@
       imlib_blend_image_onto_image (buffer, 0, 0, 0, imgW, imgH,
 				    0, 0, rootW, rootH);
     }
-  else if (mode == Full)
+  else if ((mode == Full) || (mode == Xtend))
     {
       double aspect = ((double) rootW) / imgW;
       int top, left;
@@ -207,9 +208,29 @@
 	aspect = (double) rootH / (double) imgH;
       top = (rootH - (int) (imgH * aspect)) / 2;
       left = (rootW - (int) (imgW * aspect)) / 2;
+
       imlib_blend_image_onto_image (buffer, 0, 0, 0, imgW, imgH,
 				    left, top, (int) (imgW * aspect),
 				    (int) (imgH * aspect));
+
+      if (mode == Xtend) {
+        int w;
+        if ( left >0 ) {
+          int right = left - 1 + (int) (imgW * aspect);
+          /* check only the right border - left is int divided so the right border is larger */
+          for (w = 1; (right + w < rootW); w <<= 1) {
+            imlib_image_copy_rect (left + 1 - w, 0, w, rootH, left + 1 - w - w, 0);
+            imlib_image_copy_rect (right, 0, w, rootH, right + w, 0);
+          }
+        }
+        if (top >0 ) {
+          int bottom = top - 1 + (int) (imgH * aspect);
+          for (w = 1; (bottom + w < rootH); w <<= 1) {
+            imlib_image_copy_rect (0, top + 1 - w, rootW, w, 0, top + 1 - w - w);
+            imlib_image_copy_rect (0, bottom, rootW, w, 0, bottom + w);
+          }
+        }
+      }
     }
   else
     {
@@ -420,6 +441,20 @@
 		  continue;
 		}
 	    }
+	  else if (strcmp (argv[i], "-extend") == 0)
+	    {
+	      if ((++i) >= argc)
+		{
+		  fprintf (stderr, "Missing image\n");
+		  continue;
+		}
+	      if (load_image (Xtend, argv[i], width, height, alpha, image) ==
+		  0)
+		{
+		  fprintf (stderr, "Bad image (%s)\n", argv[i]);
+		  continue;
+		}
+	    }
 	  else if (strcmp (argv[i], "-tile") == 0)
 	    {
 	      if ((++i) >= argc)
--- hsetroot-1.0.2/debian/hsetroot.1    2008-12-02 13:12:05.000000000 +0100
+++ hsetroot-1.0.2.mod/debian/hsetroot.1        2008-12-02 13:10:53.000000000 
+0100
@@ -47,6 +47,9 @@
 .B \-full <image>              
 Render an image maximum aspect
 .TP
+.B \-extend <image>              
+Render an image maximum aspect, and copy 1px border taken from the image over 
the remaining area so that no black borders are shown.
+.TP
 .B \-fill <image>
 Render an image strechted
 .TP

Reply via email to