nsxiv88f77bc
Implement fill scale mode
+10 −2
5 files changed
- M config.def.h +1 −0
- M image.c +3 −0
- M options.c +1 −1
- M sxiv.1 +4 −1
- M sxiv.h +1 −0
| @@ -127,6 +127,7 @@ static const keymap_t keys[] = { | |||
| 127 | 127 | { 0, XK_equal, i_set_zoom, 100 }, | |
| 128 | 128 | { 0, XK_w, i_fit_to_win, SCALE_DOWN }, | |
| 129 | 129 | { 0, XK_W, i_fit_to_win, SCALE_FIT }, | |
| 130 | + | { 0, XK_F, i_fit_to_win, SCALE_FILL }, | |
| 130 | 131 | { 0, XK_e, i_fit_to_win, SCALE_WIDTH }, | |
| 131 | 132 | { 0, XK_E, i_fit_to_win, SCALE_HEIGHT }, | |
| 132 | 133 | { 0, XK_less, i_rotate, DEGREE_270 }, | |
| @@ -402,6 +402,9 @@ bool img_fit(img_t *img) | |||
| 402 | 402 | zh = (float) img->win->h / (float) img->h; | |
| 403 | 403 | ||
| 404 | 404 | switch (img->scalemode) { | |
| 405 | + | case SCALE_FILL: | |
| 406 | + | z = MAX(zw, zh); | |
| 407 | + | break; | |
| 405 | 408 | case SCALE_WIDTH: | |
| 406 | 409 | z = zw; | |
| 407 | 410 | break; | |
| @@ -44,7 +44,7 @@ void parse_options(int argc, char **argv) | |||
| 44 | 44 | { | |
| 45 | 45 | int n, opt; | |
| 46 | 46 | char *end, *s; | |
| 47 | − | const char *scalemodes = "dfwh"; | |
| 47 | + | const char *scalemodes = "dfFwh"; | |
| 48 | 48 | ||
| 49 | 49 | progname = strrchr(argv[0], '/'); | |
| 50 | 50 | progname = progname ? progname + 1 : argv[0]; | |
| @@ -97,7 +97,7 @@ may be a floating point number. | |||
| 97 | 97 | .TP | |
| 98 | 98 | .BI "\-s " MODE | |
| 99 | 99 | Set scale mode according to MODE character. Supported modes are: [d]own, | |
| 100 | − | [f]it, [w]idth, [h]eight. | |
| 100 | + | [f]it, [F]ill, [w]idth, [h]eight. | |
| 101 | 101 | .TP | |
| 102 | 102 | .B \-t | |
| 103 | 103 | Start in thumbnail mode. | |
| @@ -311,6 +311,9 @@ Set zoom level to 100%, but fit large images into window. | |||
| 311 | 311 | .B W | |
| 312 | 312 | Fit image to window. | |
| 313 | 313 | .TP | |
| 314 | + | .B F | |
| 315 | + | Fill image to window. | |
| 316 | + | .TP | |
| 314 | 317 | .B e | |
| 315 | 318 | Fit image to window width. | |
| 316 | 319 | .TP | |
| @@ -88,6 +88,7 @@ typedef enum { | |||
| 88 | 88 | typedef enum { | |
| 89 | 89 | SCALE_DOWN, | |
| 90 | 90 | SCALE_FIT, | |
| 91 | + | SCALE_FILL, | |
| 91 | 92 | SCALE_WIDTH, | |
| 92 | 93 | SCALE_HEIGHT, | |
| 93 | 94 | SCALE_ZOOM | |