Commit ed5f55e9 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

feh_reload_image: Try to reload unloadable (still existing) images ad infinitum

This commit removes the feh_file_remove_from_list call from feh_reload_image.
We can safely do this because if the file itself was removed, cb_reload_timer
will take care of updating the filelist, and in all other cases it is intended
to leave the image in the filelist and retry.

A warning will be displayed in the image if the reload failed.
parent 910e2e3d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@ git HEAD
    * The --filelist option now supports /dev/stdin (or "-" as shortcut)
    * Several Xinerama fixes, only --fullscreen on screen != 0 is still broken
      <https://github.com/derf/feh/issues/5>
    * Fix segfault when reloading no longer loadable (but still existing) images.
      feh will now display a warning and try to reload ad infinitum

Tue, 16 Aug 2011 22:48:06 +0200  Daniel Friesel <derf@finalrewind.org>

+6 −0
Original line number Diff line number Diff line
@@ -412,6 +412,12 @@ Reload filelist and current image after
seconds.  Useful for viewing HTTP webcams or frequently changing directories.
.Pq Note that the filelist reloading is still experimental.
.
.Pp
.
If an image is removed, feh will either show the next one or quit.  However,
if an image still exists, but can no longer be loaded, feh will continue to
try loading it.
.
.It Cm -n , --reverse
.
Reverse the sort order.  Use this to invert the order of the filelist.
+5 −4
Original line number Diff line number Diff line
@@ -149,6 +149,7 @@ void feh_reload_image(winwidget w, int resize, int force_new)

	if (!w->file) {
		im_weprintf(w, "couldn't reload, this image has no file associated with it.");
		winwidget_render_image(w, 0, 0);
		return;
	}

@@ -166,20 +167,17 @@ void feh_reload_image(winwidget w, int resize, int force_new)
	old_w = gib_imlib_image_get_width(w->im);
	old_h = gib_imlib_image_get_height(w->im);

	/* force imlib2 not to cache */
	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) {
		if (force_new) {
			eprintf("failed to reload image\n");
		} else {
			im_weprintf(w, "Couldn't reload image. Is it still there?");
			winwidget_render_image(w, 0, 0);
		}
		winwidget_rename(w, title);
		free(title);
		free(new_title);
		filelist = feh_file_remove_from_list(filelist, w->file);
		return;
	}

@@ -187,6 +185,9 @@ void feh_reload_image(winwidget w, int resize, int force_new)
			(old_h != gib_imlib_image_get_height(tmp))))
		resize = 1;

	/* force imlib2 not to cache */
	winwidget_free_image(w);

	w->im = tmp;
	winwidget_reset_image(w);