Skip to content

Commit

Permalink
Simplify --keep-zoom-vp handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ulteq committed Jan 25, 2018
1 parent 44b9784 commit d2e657a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 43 deletions.
37 changes: 0 additions & 37 deletions src/slideshow.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,6 @@ void feh_reload_image(winwidget w, int resize, int force_new)
Imlib_Image tmp;
int old_w, old_h;

unsigned char tmode =0;
int tim_x =0;
int tim_y =0;
double tzoom =0;

tmode = w->mode;
tim_x = w->im_x;
tim_y = w->im_y;
tzoom = w->zoom;

if (!w->file) {
im_weprintf(w, "couldn't reload, this image has no file associated with it.");
winwidget_render_image(w, 0, 0);
Expand Down Expand Up @@ -226,13 +216,6 @@ void feh_reload_image(winwidget w, int resize, int force_new)
w->im_w = gib_imlib_image_get_width(w->im);
w->im_h = gib_imlib_image_get_height(w->im);
}
if (opt.keep_zoom_vp) {
/* put back in: */
w->mode = tmode;
w->im_x = tim_x;
w->im_y = tim_y;
w->zoom = tzoom;
}
winwidget_render_image(w, resize, 0);

winwidget_rename(w, title);
Expand All @@ -253,11 +236,6 @@ void slideshow_change_image(winwidget winwid, int change, int render)
int our_filelist_len = filelist_len;
char *s;

unsigned char tmode =0;
int tim_x =0;
int tim_y =0;
double tzoom =0;

/* Without this, clicking a one-image slideshow reloads it. Not very *
intelligent behaviour :-) */
if (filelist_len < 2 && opt.cycle_once == 0)
Expand Down Expand Up @@ -368,14 +346,6 @@ void slideshow_change_image(winwidget winwid, int change, int render)
last = NULL;
}

if (opt.keep_zoom_vp) {
/* pre loadimage - record settings */
tmode = winwid->mode;
tim_x = winwid->im_x;
tim_y = winwid->im_y;
tzoom = winwid->zoom;
}

if ((winwidget_loadimage(winwid, FEH_FILE(current_file->data)))
!= 0) {
winwid->mode = MODE_NORMAL;
Expand All @@ -386,13 +356,6 @@ void slideshow_change_image(winwidget winwid, int change, int render)
winwidget_reset_image(winwid);
winwid->im_w = gib_imlib_image_get_width(winwid->im);
winwid->im_h = gib_imlib_image_get_height(winwid->im);
if (opt.keep_zoom_vp) {
/* put back in: */
winwid->mode = tmode;
winwid->im_x = tim_x;
winwid->im_y = tim_y;
winwid->zoom = tzoom;
}
if (render) {
winwidget_render_image(winwid, 1, 0);
}
Expand Down
13 changes: 7 additions & 6 deletions src/winwidget.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,7 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias)

if (!winwid->full_screen && resize) {
winwidget_resize(winwid, winwid->im_w, winwid->im_h, 0);
if (!opt.keep_zoom_vp)
winwidget_reset_image(winwid);
winwidget_reset_image(winwid);
}

D(("winwidget_render_image resize %d force_alias %d im %dx%d\n",
Expand Down Expand Up @@ -937,10 +936,12 @@ void feh_debug_print_winwid(winwidget w)

void winwidget_reset_image(winwidget winwid)
{
winwid->zoom = 1.0;
winwid->old_zoom = 1.0;
winwid->im_x = 0;
winwid->im_y = 0;
if (!opt.keep_zoom_vp) {
winwid->zoom = 1.0;
winwid->old_zoom = 1.0;
winwid->im_x = 0;
winwid->im_y = 0;
}
winwid->im_angle = 0.0;
winwid->has_rotated = 0;
return;
Expand Down

0 comments on commit d2e657a

Please sign in to comment.