summaryrefslogtreecommitdiff
path: root/src/imlib.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-12-28 19:04:52 +0100
committerDaniel Friesel <derf@finalrewind.org>2017-12-28 19:04:52 +0100
commit68373bb7f5aa78aae0d40311e8cada7f4832387d (patch)
treefd42dc8e86e68e10afb1a2a5bd8c93cb37a7d908 /src/imlib.c
parent51ed4f02a56ac292a95f4347fbd0d385335a239c (diff)
parent91b331f0fa6999dff69fa1da90a8816b8d855ccc (diff)
Merge branch 'ulteq-cache-size-option'
Diffstat (limited to 'src/imlib.c')
-rw-r--r--src/imlib.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/imlib.c b/src/imlib.c
index 5b96e8a..73b7039 100644
--- a/src/imlib.c
+++ b/src/imlib.c
@@ -131,6 +131,8 @@ void init_x_and_imlib(void)
imlib_context_set_operation(IMLIB_OP_COPY);
wmDeleteWindow = XInternAtom(disp, "WM_DELETE_WINDOW", False);
+ imlib_set_cache_size(opt.cache_size * 1024 * 1024);
+
/* Initialise random numbers */
srand(getpid() * time(NULL) % ((unsigned int) -1));
@@ -254,6 +256,16 @@ int feh_load_image(Imlib_Image * im, feh_file * file)
return(0);
}
+ /*
+ * By default, Imlib2 unconditionally loads a cached file without checking
+ * if it was modified on disk. However, feh (or rather its users) should
+ * expect image changes to appear at the next reload. So we tell Imlib2 to
+ * always check the file modification time and only use a cached image if
+ * the mtime was not changed. The performance penalty is usually negligible.
+ */
+ imlib_context_set_image(*im);
+ imlib_image_set_changes_on_disk();
+
#ifdef HAVE_LIBEXIF
int orientation = 0;
ExifData *exifData = exif_data_new_from_file(file->filename);