summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-04-16 21:44:57 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-04-16 21:44:57 +0200
commit44987e991f923eb1fee80f6a5d9538adc0c88d30 (patch)
treec3afb48091c90d643c1c4b30f32cfab50ba16faf /src
parent4abe831aa00eeb2fbbbe5d0b5905e07b047fca71 (diff)
feh_reload_image: Work around broken Imlib2 caching (closes #39)
Diffstat (limited to 'src')
-rw-r--r--src/signals.c1
-rw-r--r--src/slideshow.c28
2 files changed, 13 insertions, 16 deletions
diff --git a/src/signals.c b/src/signals.c
index 85104a6..956c861 100644
--- a/src/signals.c
+++ b/src/signals.c
@@ -69,7 +69,6 @@ void feh_handle_signal(int signo)
else if (signo == SIGUSR2)
slideshow_change_image(winwid, SLIDE_PREV);
} else if (opt.multiwindow) {
- puts("yo");
for (i = window_num - 1; i >= 0; i--)
feh_reload_image(windows[i], 0, 0);
}
diff --git a/src/slideshow.c b/src/slideshow.c
index 497b9bc..79b931f 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -101,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;
@@ -116,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) {
@@ -134,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))