lel

Fork of Hiltjo's Farbfeld image viewer. (It was just for fun, not much use)
Log | Files | Refs | README | LICENSE

commit fc7ea6b72970a2c7d1f38a9ebe6aaaae90ee7ffb
parent 7231c4073e12c366677efea96b4c39f8276b0795
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Sat, 24 Apr 2021 19:58:34 -0700

Add a new view

This view is something I always want and it's really simple.

Diffstat:
Mlel.1 | 3+++
Mlel.c | 12++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/lel.1 b/lel.1 @@ -59,6 +59,9 @@ Fit image. Fit image width. .It Ic e Fit image height. +.It Ic t +Fit image if it exceeds window size leaving it at it's natural scale +otherwise. .It Ic Return Print file to stdout. .El diff --git a/lel.c b/lel.c @@ -373,6 +373,15 @@ view_aspect(unsigned int *w, unsigned int *h) } static void +view_downscale(unsigned int *w, unsigned int *h) +{ + if (img.width > winwidth || img.height > winheight) + view_fit(w, h); + else + view_full(w, h); +} + +static void view_fit(unsigned int *w, unsigned int *h) { if (winwidth * img.height > winheight * img.width) @@ -555,6 +564,9 @@ keypress(XEvent *ev) case XK_e: setview(view_height); break; + case XK_t: + setview(view_downscale); + break; case XK_Escape: case XK_q: done = 1;