Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added --begin-top option to force view point at the top of the image #278

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/help.raw
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/options.c
Expand Up @@ -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}
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/options.h
Expand Up @@ -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;

Expand Down
7 changes: 7 additions & 0 deletions src/winwidget.c
Expand Up @@ -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 */
Expand Down