diff options
Diffstat (limited to 'src/slideshow.c')
-rw-r--r-- | src/slideshow.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/slideshow.c b/src/slideshow.c index de10300..79b931f 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -1,6 +1,7 @@ /* slideshow.c Copyright (C) 1999-2003 Tom Gilbert. +Copyright (C) 2010-2011 Daniel Friesel. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -100,12 +101,15 @@ void feh_reload_image(winwidget w, int resize, int force_new) char *title, *new_title; int len; Imlib_Image tmp; + int old_w, old_h; if (!w->file) { weprintf("couldn't reload, this image has no file associated with it."); return; } + D(("resize %d, force_new %d\n", resize, force_new)); + free(FEH_FILE(w->file->data)->caption); FEH_FILE(w->file->data)->caption = NULL; @@ -115,10 +119,11 @@ void feh_reload_image(winwidget w, int resize, int force_new) title = estrdup(w->name); winwidget_rename(w, new_title); + old_w = gib_imlib_image_get_width(w->im); + old_h = gib_imlib_image_get_height(w->im); + /* force imlib2 not to cache */ - if (force_new) { - winwidget_free_image(w); - } + winwidget_free_image(w); /* if the image has changed in dimensions - we gotta resize */ if ((feh_load_image(&tmp, FEH_FILE(w->file->data))) == 0) { @@ -133,19 +138,13 @@ void feh_reload_image(winwidget w, int resize, int force_new) filelist = feh_file_remove_from_list(filelist, w->file); return; } - if (force_new) { - w->im = tmp; + + if (!resize && ((old_w != gib_imlib_image_get_width(tmp)) || + (old_h != gib_imlib_image_get_height(tmp)))) resize = 1; - winwidget_reset_image(w); - } else { - if ((gib_imlib_image_get_width(w->im) != gib_imlib_image_get_width(tmp)) - || (gib_imlib_image_get_height(w->im) != gib_imlib_image_get_height(tmp))) { - resize = 1; - winwidget_reset_image(w); - } - winwidget_free_image(w); - w->im = tmp; - } + + w->im = tmp; + winwidget_reset_image(w); w->mode = MODE_NORMAL; if ((w->im_w != gib_imlib_image_get_width(w->im)) @@ -162,7 +161,7 @@ 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); } - winwidget_render_image(w, resize, 1); + winwidget_render_image(w, resize, 0); winwidget_rename(w, title); free(title); @@ -251,10 +250,6 @@ void slideshow_change_image(winwidget winwid, int change) filelist = feh_file_remove_from_list(filelist, last); last = NULL; } - s = slideshow_create_name(FEH_FILE(current_file->data)); - - winwidget_rename(winwid, s); - free(s); if ((winwidget_loadimage(winwid, FEH_FILE(current_file->data))) != 0) { @@ -267,7 +262,12 @@ void slideshow_change_image(winwidget winwid, int change) winwidget_reset_image(winwid); winwid->im_w = gib_imlib_image_get_width(winwid->im); winwid->im_h = gib_imlib_image_get_height(winwid->im); - winwidget_render_image(winwid, 1, 1); + winwidget_render_image(winwid, 1, 0); + + s = slideshow_create_name(FEH_FILE(current_file->data)); + winwidget_rename(winwid, s); + free(s); + break; } else last = current_file; |