diff --git a/src/help.raw b/src/help.raw index 86bb617f..fe46497e 100644 --- a/src/help.raw +++ b/src/help.raw @@ -24,6 +24,7 @@ OPTIONS before attempting to display anything -., --scale-down Automatically scale down images to fit screen size -F, --fullscreen Make the window full screen + --begin-top Force view point at the top of the image -Z, --auto-zoom Zoom picture to screen size in fullscreen/geom mode --zoom PERCENT Zooms images by a PERCENT, when in full screen mode or when window geometry is fixed. If combined diff --git a/src/options.c b/src/options.c index 3d114826..8634b1a5 100644 --- a/src/options.c +++ b/src/options.c @@ -414,6 +414,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"xinerama-index", 1, 0, 239}, {"insecure" , 0, 0, 240}, {"no-recursive" , 0, 0, 241}, + {"begin-top" , 0, 0, 242}, {"cache-size" , 1, 0, 243}, {"version-sort" , 0, 0, 246}, {0, 0, 0, 0} @@ -773,6 +774,8 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 241: opt.recursive = 0; + case 242: + opt.begin_top = 1; break; case 243: opt.cache_size = atoi(optarg); diff --git a/src/options.h b/src/options.h index d4de3c5d..c4edfc7b 100644 --- a/src/options.h +++ b/src/options.h @@ -113,6 +113,7 @@ struct __fehoptions { unsigned int geom_h; int default_zoom; int zoom_mode; + int begin_top; unsigned char adjust_reload; int xinerama_index; diff --git a/src/winwidget.c b/src/winwidget.c index bb6181aa..76ce37f0 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -551,8 +551,15 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) } else if (need_center && !winwid->full_screen && (winwid->type != WIN_TYPE_THUMBNAIL) && !opt.keep_zoom_vp) { + int image_smaller; winwid->im_x = (int) (winwid->w - (winwid->im_w * winwid->zoom)) >> 1; winwid->im_y = (int) (winwid->h - (winwid->im_h * winwid->zoom)) >> 1; + + image_smaller = ((winwid->im_w < winwid->w) + && (winwid->im_h < winwid->h)); + + if (!image_smaller && opt.begin_top) + winwid->im_y = 0; } /* Now we ensure only to render the area we're looking at */