diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/feh.h | 2 | ||||
| -rw-r--r-- | src/options.c | 5 | ||||
| -rw-r--r-- | src/support.c | 42 | 
3 files changed, 47 insertions, 2 deletions
| @@ -89,7 +89,7 @@ enum mode_type { MODE_NORMAL = 0, MODE_PAN, MODE_ZOOM, MODE_ROTATE, MODE_BLUR, M  };  enum bgmode_type { BG_MODE_NONE = 0, BG_MODE_TILE, BG_MODE_CENTER, -	BG_MODE_SEAMLESS, BG_MODE_SCALE, BG_MODE_FILL +	BG_MODE_SEAMLESS, BG_MODE_SCALE, BG_MODE_FILL, BG_MODE_MAX  };  enum slide_change { SLIDE_NEXT, SLIDE_PREV, SLIDE_RAND, SLIDE_FIRST, SLIDE_LAST, diff --git a/src/options.c b/src/options.c index 606e2ee..f7381a7 100644 --- a/src/options.c +++ b/src/options.c @@ -411,6 +411,7 @@ static void feh_parse_option_array(int argc, char **argv)  		{"action8"       , 1, 0, 216},  		{"action9"       , 1, 0, 217},  		{"bg-fill"       , 1, 0, 218}, +		{"bg-max"        , 1, 0, 219},  		{"index-name"    , 1, 0, 230},  		{"index-size"    , 1, 0, 231},  		{"index-dim"     , 1, 0, 232}, @@ -682,6 +683,10 @@ static void feh_parse_option_array(int argc, char **argv)  			opt.bgmode = BG_MODE_FILL;  			opt.output_file = estrdup(optarg);  			break; +		case 219: +			opt.bgmode = BG_MODE_MAX; +			opt.output_file = estrdup(optarg); +			break;  		case 204:  			free(opt.menu_style);  			opt.menu_style = estrdup(optarg); diff --git a/src/support.c b/src/support.c index 3e80828..3b13416 100644 --- a/src/support.c +++ b/src/support.c @@ -63,6 +63,8 @@ void feh_wm_set_bg_file(char *file, unsigned char bgmode)  			break;  		case BG_MODE_FILL:  			feh_wm_set_bg(file, im, 0, 0, 1, 0, 1); +		case BG_MODE_MAX: +			feh_wm_set_bg(file, im, 0, 0, 2, 0, 1);  			break;  		default:  			feh_wm_set_bg(file, im, 1, 0, 0, 0, 1); @@ -205,7 +207,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,  			gib_imlib_render_image_on_drawable(pmap_d1, im, x, y, 1, 0, 0);  			XFreeGC(disp, gc);  			fehbg = estrjoin(" ", "feh --bg-center", filbuf, NULL); -		} else if (filled) { +		} else if (filled == 1) {  			int x = scr->width;  			int y = scr->height;  			int u = gib_imlib_image_get_width(im); @@ -226,6 +228,44 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,  			gib_imlib_render_image_on_drawable_at_size(pmap_d1, im, s, t,  					w, h, 1, 0, 1);  			fehbg = estrjoin(" ", "feh --bg-fill", filbuf, NULL); +		} else if (filled == 2) { +			int x = scr->width; +			int y = scr->height; +			int u = gib_imlib_image_get_width(im); +			int v = gib_imlib_image_get_height(im); +			int s = 0; +			int t = 0; +			XGCValues gcval; + +			if(u>v) { +				w = x; +				h = (((x * 10) / u) * v) / 10; +				t = (y - h) / 2; +				if(h>y) { +					h = y; +					w = (((y * 10) / h) * w) / 10; +					s = (x - w) / 2; +					t = 0; +				} +			} else { +				h = y; +				w = (((y * 10) / v) * u) / 10; +				s = (x - w) / 2; +				if(w>x) { +					w = x; +					h = (((x * 10) / w) * h) / 10; +					s = 0; +					t = (y - h) / 2; +				} +			} + +			pmap_d1 = XCreatePixmap(disp, root, x, y, depth); +			gcval.foreground = BlackPixel(disp, DefaultScreen(disp)); +			gc = XCreateGC(disp, root, GCForeground, &gcval); +			XFillRectangle(disp, pmap_d1, gc, 0, 0, x, y); +			gib_imlib_render_image_on_drawable_at_size(pmap_d1, im, s, t, w, h, 1, 0, 1); +			XFreeGC(disp, gc); +			fehbg = estrjoin(" ", "feh --bg-max", filbuf, NULL);  		} else {  			w = gib_imlib_image_get_width(im);  			h = gib_imlib_image_get_height(im); | 
