hsetroot/hsetroot-1.0.2_03_cover-mode.patch

63 lines
1.8 KiB
Diff

Description: Add the '-cover' option
Origin: vendor
Bug: http://bugs.debian.org/718829
Forwarded: no
Author: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Alessandro Ghedini <ghedo@debian.org>
Last-Update: 2013-08-07
--- a/src/hsetroot.c
+++ b/src/hsetroot.c
@@ -8,7 +8,7 @@
#include "config.h"
typedef enum
-{ Full, Fill, Center, Tile, Xtend } ImageMode;
+{ Full, Fill, Center, Tile, Xtend, Cover } ImageMode;
void
usage (char *commandline)
@@ -28,6 +28,7 @@
"\n"
"Image files:\n"
" -center <image> Render an image centered on screen\n"
+ " -cover <image> Render an image centered on screen scaled to fill the screen fully\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"
@@ -200,11 +201,11 @@
imlib_blend_image_onto_image (buffer, 0, 0, 0, imgW, imgH,
0, 0, rootW, rootH);
}
- else if ((mode == Full) || (mode == Xtend))
+ else if ((mode == Full) || (mode == Xtend) || (mode == Cover))
{
double aspect = ((double) rootW) / imgW;
int top, left;
- if ((int) (imgH * aspect) > rootH)
+ if (((int) (imgH * aspect) > rootH) != /*xor*/ (mode == Cover))
aspect = (double) rootH / (double) imgH;
top = (rootH - (int) (imgH * aspect)) / 2;
left = (rootW - (int) (imgW * aspect)) / 2;
@@ -485,6 +486,20 @@
0)
{
fprintf (stderr, "Bad image (%s)\n", argv[i]);
+ continue;
+ }
+ }
+ else if (strcmp (argv[i], "-cover") == 0)
+ {
+ if ((++i) >= argc)
+ {
+ fprintf (stderr, "Missing image\n");
+ continue;
+ }
+ if (load_image (Cover, argv[i], width, height, alpha, image) ==
+ 0)
+ {
+ fprintf (stderr, "Bad image (%s)\n", argv[i]);
continue;
}
}