mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
Add fill screen scale to wmsetbg
I noticed that I can have different background with wmmsetbg for each desktop and wanted to use it, but it was missing option to fill the screen with proportionally scaled image, so here it is.
This commit is contained in:
committed by
Carlos R. Mafra
parent
21a5f41c08
commit
fc5c0fe1a4
@@ -175,9 +175,18 @@ applyImage(RContext * rc, BackgroundTexture * texture, RImage * image, char type
|
||||
switch (toupper(type)) {
|
||||
case 'S':
|
||||
case 'M':
|
||||
case 'F':
|
||||
if (toupper(type) == 'S') {
|
||||
w = width;
|
||||
h = height;
|
||||
} else if(toupper(type) == 'F') {
|
||||
if (image->width * height > image->height * width) {
|
||||
w = (height * image->width) / image->height;
|
||||
h = height;
|
||||
} else {
|
||||
w = width;
|
||||
h = (width * image->height) / image->width;
|
||||
}
|
||||
} else {
|
||||
if (image->width * height > image->height * width) {
|
||||
w = width;
|
||||
@@ -465,7 +474,7 @@ BackgroundTexture *parseTexture(RContext * rc, char *text)
|
||||
|
||||
texture->pixmap = pixmap;
|
||||
} else if (strcasecmp(type, "cpixmap") == 0
|
||||
|| strcasecmp(type, "spixmap") == 0
|
||||
|| strcasecmp(type, "spixmap") == 0 || strcasecmp(type, "fpixmap") == 0
|
||||
|| strcasecmp(type, "mpixmap") == 0 || strcasecmp(type, "tpixmap") == 0) {
|
||||
XColor color;
|
||||
Pixmap pixmap = None;
|
||||
@@ -528,6 +537,7 @@ BackgroundTexture *parseTexture(RContext * rc, char *text)
|
||||
case 'S':
|
||||
case 'M':
|
||||
case 'C':
|
||||
case 'F':
|
||||
{
|
||||
Pixmap tpixmap =
|
||||
XCreatePixmap(dpy, root, scrWidth, scrHeight, DefaultDepth(dpy, scr));
|
||||
@@ -1136,6 +1146,7 @@ void print_help()
|
||||
puts(" -e, --center center image");
|
||||
puts(" -s, --scale scale image (default)");
|
||||
puts(" -a, --maxscale scale image and keep aspect ratio");
|
||||
puts(" -f, --fillscale scale image to fill screen and keep aspect ratio");
|
||||
puts(" -u, --update-wmaker update WindowMaker domain database");
|
||||
puts(" -D, --update-domain <domain> update <domain> database");
|
||||
puts(" -c, --colors <cpc> colors per channel to use");
|
||||
@@ -1227,6 +1238,8 @@ int main(int argc, char **argv)
|
||||
style = "cpixmap";
|
||||
} else if (strcmp(argv[i], "-a") == 0 || strcmp(argv[i], "--maxscale") == 0) {
|
||||
style = "mpixmap";
|
||||
} else if (strcmp(argv[i], "-f") == 0 || strcmp(argv[i], "--fillscale") == 0) {
|
||||
style = "fpixmap";
|
||||
} else if (strcmp(argv[i], "-d") == 0 || strcmp(argv[i], "--dither") == 0) {
|
||||
render_mode = RDitheredRendering;
|
||||
obey_user++;
|
||||
|
||||
Reference in New Issue
Block a user