From b9b84ee55d6b255bcf39a4f8ca6195749ef1fc5c Mon Sep 17 00:00:00 2001 From: ulteq Date: Sun, 14 Jan 2018 17:20:14 +0100 Subject: Handle --min-dimension and --max-dimension without preload This will (by default) check the image dimension on-the-fly, but you can still do it beforehand by specifying the preload flag. --- src/filelist.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/filelist.c') diff --git a/src/filelist.c b/src/filelist.c index b569b8a..0066efd 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -464,9 +464,7 @@ int feh_cmp_format(void *file1, void *file2) void feh_prepare_filelist(void) { - if (opt.list || opt.customlist || (opt.sort > SORT_MTIME) - || opt.preload || opt.min_width || opt.min_height - || (opt.max_width != UINT_MAX) || (opt.max_height != UINT_MAX)) { + if (opt.list || opt.preload || opt.customlist || (opt.sort > SORT_MTIME)) { /* For these sort options, we have to preload images */ filelist = feh_file_info_preload(filelist); if (!gib_list_length(filelist)) -- cgit v1.2.3 From 7acf83ea6d6f36e418f43a3408632944fbb7bcde Mon Sep 17 00:00:00 2001 From: ulteq Date: Thu, 18 Jan 2018 11:07:45 +0100 Subject: Add natural sort of (version) numbers --- src/feh.h | 1 + src/filelist.c | 19 +++++++++++++++---- src/help.raw | 1 + src/options.c | 4 ++++ src/options.h | 1 + 5 files changed, 22 insertions(+), 4 deletions(-) (limited to 'src/filelist.c') diff --git a/src/feh.h b/src/feh.h index a4a0a7b..da08aba 100644 --- a/src/feh.h +++ b/src/feh.h @@ -27,6 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef FEH_H #define FEH_H +#define _GNU_SOURCE #include #include #include diff --git a/src/filelist.c b/src/filelist.c index b569b8a..3157e32 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -399,12 +399,18 @@ void feh_file_dirname(char *dst, feh_file * f, int maxlen) int feh_cmp_filename(void *file1, void *file2) { - return(strcmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename)); + if (!opt.version_sort) + return(strcmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename)); + else + return(strverscmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename)); } int feh_cmp_name(void *file1, void *file2) { - return(strcmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name)); + if (!opt.version_sort) + return(strcmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name)); + else + return(strverscmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name)); } int feh_cmp_dirname(void *file1, void *file2) @@ -413,8 +419,13 @@ int feh_cmp_dirname(void *file1, void *file2) int cmp; feh_file_dirname(dir1, FEH_FILE(file1), PATH_MAX); feh_file_dirname(dir2, FEH_FILE(file2), PATH_MAX); - if ((cmp = strcmp(dir1, dir2)) != 0) - return(cmp); + if (!opt.version_sort) { + if ((cmp = strcmp(dir1, dir2)) != 0) + return(cmp); + } else { + if ((cmp = strverscmp(dir1, dir2)) != 0) + return(cmp); + } return(feh_cmp_name(file1, file2)); } diff --git a/src/help.raw b/src/help.raw index 37e0e71..8c83b5b 100644 --- a/src/help.raw +++ b/src/help.raw @@ -52,6 +52,7 @@ OPTIONS name, filename, mtime, width, height, pixels, size, or format -n, --reverse Reverse sort order + --version-sort Natural sort of (version) numbers within text -A, --action [;]ACTION Specify action to perform when pressing . Executed by /bin/sh, may contain FORMAT SPECIFIERS reloads image with \";\", switches to next otherwise diff --git a/src/options.c b/src/options.c index c874832..3fcbdef 100644 --- a/src/options.c +++ b/src/options.c @@ -412,6 +412,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"insecure" , 0, 0, 240}, {"no-recursive" , 0, 0, 241}, {"cache-size" , 1, 0, 243}, + {"version-sort" , 0, 0, 246}, {0, 0, 0, 0} }; int optch = 0, cmdx = 0; @@ -782,6 +783,9 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) if (opt.cache_size > 2048) opt.cache_size = 2048; break; + case 246: + opt.version_sort = 1; + break; default: break; } diff --git a/src/options.h b/src/options.h index c6959c8..277cede 100644 --- a/src/options.h +++ b/src/options.h @@ -103,6 +103,7 @@ struct __fehoptions { unsigned int thumb_redraw; double reload; int sort; + int version_sort; int debug; int geom_flags; int geom_x; -- cgit v1.2.3 From 5e75b5ef3e7d0270913c04645398bc3596c2a90a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 14 Feb 2018 22:33:38 +0100 Subject: Only check image dimensions on the fly in multiwindow and slideshow mode This introduces a new feh_should_ignore_image function which is called at appropriate places in those modes to skip images which are loadable but undesired. --- src/feh.h | 1 + src/filelist.c | 12 +++++++++++- src/imlib.c | 12 ++++++++++++ src/options.c | 2 ++ src/options.h | 1 + src/slideshow.c | 14 ++++++-------- src/winwidget.c | 2 +- 7 files changed, 34 insertions(+), 10 deletions(-) (limited to 'src/filelist.c') diff --git a/src/feh.h b/src/feh.h index bfd71db..60baade 100644 --- a/src/feh.h +++ b/src/feh.h @@ -133,6 +133,7 @@ void init_list_mode(void); void init_loadables_mode(void); void init_unloadables_mode(void); void feh_clean_exit(void); +int feh_should_ignore_image(Imlib_Image * im); int feh_load_image(Imlib_Image * im, feh_file * file); void show_mini_usage(void); void slideshow_change_image(winwidget winwid, int change, int render); diff --git a/src/filelist.c b/src/filelist.c index 0066efd..9a4af27 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -464,7 +464,17 @@ int feh_cmp_format(void *file1, void *file2) void feh_prepare_filelist(void) { - if (opt.list || opt.preload || opt.customlist || (opt.sort > SORT_MTIME)) { + /* + * list and customlist mode as well as the somewhat more fancy sort modes + * need access to file infos. Preloading them is also useful for + * list/customlist as --min-dimension/--max-dimension may filter images + * which should not be processed. + * Finally, if --min-dimension/--max-dimension (-> opt.filter_by_dimensions) + * is set and we're in thumbnail mode, we need to filter images first so + * we can create a properly sized thumbnail list. + */ + if (opt.list || opt.preload || opt.customlist || (opt.sort > SORT_MTIME) + || (opt.filter_by_dimensions && (opt.index || opt.collage || opt.thumbs || opt.bgmode))) { /* For these sort options, we have to preload images */ filelist = feh_file_info_preload(filelist); if (!gib_list_length(filelist)) diff --git a/src/imlib.c b/src/imlib.c index 6de6bdb..d9c5cd0 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -139,6 +139,18 @@ void init_x_and_imlib(void) return; } +int feh_should_ignore_image(Imlib_Image * im) +{ + if (opt.filter_by_dimensions) { + unsigned int w = gib_imlib_image_get_width(im); + unsigned int h = gib_imlib_image_get_height(im); + if (w < opt.min_width || w > opt.max_width || h < opt.min_height || h > opt.max_height) { + return 1; + } + } + return 0; +} + int feh_load_image_char(Imlib_Image * im, char *filename) { feh_file *file; diff --git a/src/options.c b/src/options.c index bf5c67c..76d70c5 100644 --- a/src/options.c +++ b/src/options.c @@ -433,6 +433,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.debug = 1; break; case '<': + opt.filter_by_dimensions = 1; XParseGeometry(optarg, &discard, &discard, &opt.max_width, &opt.max_height); if (opt.max_width == 0) opt.max_width = UINT_MAX; @@ -440,6 +441,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.max_height = UINT_MAX; break; case '>': + opt.filter_by_dimensions = 1; XParseGeometry(optarg, &discard, &discard, &opt.min_width, &opt.min_height); break; case '.': diff --git a/src/options.h b/src/options.h index c6959c8..9bf2763 100644 --- a/src/options.h +++ b/src/options.h @@ -75,6 +75,7 @@ struct __fehoptions { unsigned char no_fehbg; unsigned char keep_zoom_vp; unsigned char insecure_ssl; + unsigned char filter_by_dimensions; char *output_file; char *output_dir; diff --git a/src/slideshow.c b/src/slideshow.c index 6ab56fa..d56c1b6 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -361,17 +361,15 @@ void slideshow_change_image(winwidget winwid, int change, int render) } if (winwidget_loadimage(winwid, FEH_FILE(current_file->data))) { - unsigned int w = gib_imlib_image_get_width(winwid->im); - unsigned int h = gib_imlib_image_get_height(winwid->im); - if (opt.min_width || opt.min_height || (opt.max_width != UINT_MAX) || (opt.max_height != UINT_MAX)) { - if (w < opt.min_width || w > opt.max_width || h < opt.min_height || h > opt.max_height) { - last = current_file; - continue; - } + int w = gib_imlib_image_get_width(winwid->im); + int h = gib_imlib_image_get_height(winwid->im); + if (feh_should_ignore_image(winwid->im)) { + last = current_file; + continue; } winwid->mode = MODE_NORMAL; winwid->file = current_file; - if ((winwid->im_w != (int)w) || (winwid->im_h != (int)h)) + if ((winwid->im_w != w) || (winwid->im_h != h)) winwid->had_resize = 1; winwidget_reset_image(winwid); winwid->im_w = w; diff --git a/src/winwidget.c b/src/winwidget.c index 3311383..9600465 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -115,7 +115,7 @@ winwidget winwidget_create_from_file(gib_list * list, char type) ret->file = list; ret->type = type; - if (winwidget_loadimage(ret, file) == 0) { + if ((winwidget_loadimage(ret, file) == 0) || feh_should_ignore_image(ret->im)) { winwidget_destroy(ret); return(NULL); } -- cgit v1.2.3 From 4567042b5145b097c962499f26511aa5106f0e60 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 28 Feb 2018 17:53:51 +0100 Subject: Add Makefile flag to disable version sorting on C libraries without strverscmp --- README.md | 1 + config.mk | 10 +++++++++- man/Makefile | 1 + man/feh.pre | 3 ++- src/feh.h | 7 +++++++ src/filelist.c | 29 +++++++++++++++-------------- 6 files changed, 35 insertions(+), 16 deletions(-) (limited to 'src/filelist.c') diff --git a/README.md b/README.md index 328897a..7848158 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ Available flags are: | exif | 0 | Builtin EXIF tag display support | | help | 0 | include help text (refers to the manpage otherwise) | | stat64 | 0 | Support CIFS shares from 64bit hosts on 32bit machines | +| verscmp | 1 | Support naturing sorting (`--version-sort`). Requires a GNU-compatible libc exposing `strverscmp` | | xinerama | 1 | Support Xinerama/XRandR multiscreen setups | So, by default **libcurl** and **Xinerama** are enabled, the rest is disabled. diff --git a/config.mk b/config.mk index 8769b1d..226c612 100644 --- a/config.mk +++ b/config.mk @@ -5,9 +5,10 @@ app ?= 0 cam ?= 0 curl ?= 1 debug ?= 0 +exif ?= 0 help ?= 0 +verscmp ?= 1 xinerama ?= 1 -exif ?= 0 # Prefix for all installed files PREFIX ?= /usr/local @@ -63,6 +64,13 @@ ifeq (${stat64},1) CFLAGS += -D_FILE_OFFSET_BITS=64 endif +ifeq (${verscmp},1) + CFLAGS += -DHAVE_VERSCMP + MAN_VERSCMP = enabled +else + MAN_VERSCMP = disabled +endif + ifeq (${xinerama},1) CFLAGS += -DHAVE_LIBXINERAMA LDLIBS += -lXinerama diff --git a/man/Makefile b/man/Makefile index 65f2bc2..9209de1 100644 --- a/man/Makefile +++ b/man/Makefile @@ -12,6 +12,7 @@ all: ${TARGETS} -e 's/\$$MAN_CURL\$$/${MAN_CURL}/' \ -e 's/\$$MAN_DEBUG\$$/${MAN_DEBUG}/' \ -e 's/\$$MAN_EXIF\$$/${MAN_EXIF}/' \ + -e 's/\$$MAN_VERSCMP\$$/${MAN_VERSCMP}/' \ -e 's/\$$MAN_XINERAMA\$$/${MAN_XINERAMA}/' \ < ${@:.1=.pre} > $@ diff --git a/man/feh.pre b/man/feh.pre index d332774..640ae3f 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -24,7 +24,8 @@ $VERSION$ . .Pp . -Compile-time switches: libcurl support $MAN_CURL$, Xinerama support +Compile-time switches: libcurl support $MAN_CURL$, natural sorting support +$MAN_VERSCMP$, Xinerama support $MAN_XINERAMA$, builtin EXIF support $MAN_EXIF$$MAN_DEBUG$ . . diff --git a/src/feh.h b/src/feh.h index 4e7a3ff..3e0cdda 100644 --- a/src/feh.h +++ b/src/feh.h @@ -27,7 +27,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef FEH_H #define FEH_H +/* + * strverscmp(3) is a GNU extension. In most supporting C libraries it + * requires _GNU_SOURCE to be defined. + */ +#ifdef HAVE_VERSCMP #define _GNU_SOURCE +#endif + #include #include #include diff --git a/src/filelist.c b/src/filelist.c index 159491a..453f795 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -397,20 +397,26 @@ void feh_file_dirname(char *dst, feh_file * f, int maxlen) dst[n] = '\0'; } -int feh_cmp_filename(void *file1, void *file2) +#ifdef HAVE_VERSCMP +inline int strcmp_or_strverscmp(const char *s1, const char *s2) { if (!opt.version_sort) - return(strcmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename)); + return(strcmp(s1, s2)); else - return(strverscmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename)); + return(strverscmp(s1, s2)); +} +#else +#define strcmp_or_strverscmp strcmp +#endif + +int feh_cmp_filename(void *file1, void *file2) +{ + return(strcmp_or_strverscmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename)); } int feh_cmp_name(void *file1, void *file2) { - if (!opt.version_sort) - return(strcmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name)); - else - return(strverscmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name)); + return(strcmp_or_strverscmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name)); } int feh_cmp_dirname(void *file1, void *file2) @@ -419,13 +425,8 @@ int feh_cmp_dirname(void *file1, void *file2) int cmp; feh_file_dirname(dir1, FEH_FILE(file1), PATH_MAX); feh_file_dirname(dir2, FEH_FILE(file2), PATH_MAX); - if (!opt.version_sort) { - if ((cmp = strcmp(dir1, dir2)) != 0) - return(cmp); - } else { - if ((cmp = strverscmp(dir1, dir2)) != 0) - return(cmp); - } + if ((cmp = strcmp_or_strverscmp(dir1, dir2)) != 0) + return(cmp); return(feh_cmp_name(file1, file2)); } -- cgit v1.2.3 From 204dbfc81febe94ae86a985c653ef4875bb93853 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 7 Mar 2018 15:00:25 +0100 Subject: filelist: Fix misinterpretation of C99 inline semantics --- src/filelist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/filelist.c') diff --git a/src/filelist.c b/src/filelist.c index 453f795..08da331 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -398,7 +398,7 @@ void feh_file_dirname(char *dst, feh_file * f, int maxlen) } #ifdef HAVE_VERSCMP -inline int strcmp_or_strverscmp(const char *s1, const char *s2) +static inline int strcmp_or_strverscmp(const char *s1, const char *s2) { if (!opt.version_sort) return(strcmp(s1, s2)); -- cgit v1.2.3 From 3c675a64a5842f0fe824a22bc9d3af025c1d17fe Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 11 May 2018 20:51:24 +0200 Subject: Update copyright notice --- man/feh.pre | 2 +- src/collage.c | 2 +- src/debug.h | 2 +- src/events.c | 2 +- src/feh.h | 2 +- src/filelist.c | 2 +- src/imlib.c | 2 +- src/index.c | 2 +- src/index.h | 2 +- src/keyevents.c | 2 +- src/list.c | 2 +- src/main.c | 2 +- src/menu.c | 2 +- src/menu.h | 2 +- src/options.c | 2 +- src/options.h | 2 +- src/signals.c | 2 +- src/slideshow.c | 2 +- src/structs.h | 2 +- src/thumbnail.c | 2 +- src/thumbnail.h | 2 +- src/timers.c | 2 +- src/wallpaper.c | 2 +- src/wallpaper.h | 2 +- src/winwidget.c | 2 +- src/winwidget.h | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/filelist.c') diff --git a/man/feh.pre b/man/feh.pre index a358714..d2c2cea 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -1943,7 +1943,7 @@ Make zoom options more intuitive . Copyright (C) 1999, 2000 by Paul Duncan. Copyright (C) 1999, 2000 by Tom Gilbert (and various contributors). -Copyright (C) 2010-2016 by Daniel Friesel (and even more contributors). +Copyright (C) 2010-2018 by Daniel Friesel (and even more contributors). . .Pp . diff --git a/src/collage.c b/src/collage.c index 431d3b6..2a4d9f9 100644 --- a/src/collage.c +++ b/src/collage.c @@ -1,7 +1,7 @@ /* collage.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/debug.h b/src/debug.h index eb929e3..38cf83f 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,7 +1,7 @@ /* debug.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/events.c b/src/events.c index 947e69f..4a24935 100644 --- a/src/events.c +++ b/src/events.c @@ -1,7 +1,7 @@ /* events.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/feh.h b/src/feh.h index 3e0cdda..009f45b 100644 --- a/src/feh.h +++ b/src/feh.h @@ -1,7 +1,7 @@ /* feh.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/filelist.c b/src/filelist.c index 08da331..eb8e294 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -1,7 +1,7 @@ /* filelist.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/imlib.c b/src/imlib.c index 28dc1a6..5be0539 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -1,7 +1,7 @@ /* imlib.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/index.c b/src/index.c index c8c34c5..ca1664b 100644 --- a/src/index.c +++ b/src/index.c @@ -1,7 +1,7 @@ /* index.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/index.h b/src/index.h index 08ab337..b022f1a 100644 --- a/src/index.h +++ b/src/index.h @@ -1,6 +1,6 @@ /* index.h -Copyright (C) 2011 Daniel Friesel. +Copyright (C) 2018 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 diff --git a/src/keyevents.c b/src/keyevents.c index 12a8eb9..689aebd 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -1,7 +1,7 @@ /* keyevents.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/list.c b/src/list.c index 09b23f4..2f6cf76 100644 --- a/src/list.c +++ b/src/list.c @@ -1,7 +1,7 @@ /* list.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/main.c b/src/main.c index 534b89e..f1fca24 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,7 @@ /* main.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/menu.c b/src/menu.c index ddb2db1..2f8875d 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,7 +1,7 @@ /* menu.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/menu.h b/src/menu.h index 403728f..b53b32f 100644 --- a/src/menu.h +++ b/src/menu.h @@ -1,7 +1,7 @@ /* menu.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/options.c b/src/options.c index bc95604..8ddf2fa 100644 --- a/src/options.c +++ b/src/options.c @@ -1,7 +1,7 @@ /* options.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/options.h b/src/options.h index ed8641a..61de5dc 100644 --- a/src/options.h +++ b/src/options.h @@ -1,7 +1,7 @@ /* options.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/signals.c b/src/signals.c index 8a3a8f7..c08d5df 100644 --- a/src/signals.c +++ b/src/signals.c @@ -1,6 +1,6 @@ /* signals.c -Copyright (C) 2010 by Daniel Friesel +Copyright (C) 2010-2018 by 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 diff --git a/src/slideshow.c b/src/slideshow.c index 7bad2c9..0e560d8 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -1,7 +1,7 @@ /* slideshow.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/structs.h b/src/structs.h index 3942bc0..ce30eb9 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,7 +1,7 @@ /* structs.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/thumbnail.c b/src/thumbnail.c index 3e99bfb..cf38cfc 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -1,7 +1,7 @@ /* thumbnail.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/thumbnail.h b/src/thumbnail.h index f22ff77..09cd771 100644 --- a/src/thumbnail.h +++ b/src/thumbnail.h @@ -1,7 +1,7 @@ /* thumbnail.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/timers.c b/src/timers.c index 1cac94b..95fc9f8 100644 --- a/src/timers.c +++ b/src/timers.c @@ -1,7 +1,7 @@ /* timers.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/wallpaper.c b/src/wallpaper.c index 6aa5c6d..7cf2468 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -1,7 +1,7 @@ /* wallpaper.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/wallpaper.h b/src/wallpaper.h index 0921129..02a6997 100644 --- a/src/wallpaper.h +++ b/src/wallpaper.h @@ -1,7 +1,7 @@ /* wallpaper.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/winwidget.c b/src/winwidget.c index 7aae191..cd5a745 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -1,7 +1,7 @@ /* winwidget.c Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 diff --git a/src/winwidget.h b/src/winwidget.h index dd8489a..3d998b4 100644 --- a/src/winwidget.h +++ b/src/winwidget.h @@ -1,7 +1,7 @@ /* winwidget.h Copyright (C) 1999-2003 Tom Gilbert. -Copyright (C) 2010-2011 Daniel Friesel. +Copyright (C) 2010-2018 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 -- cgit v1.2.3 From 607374d4c7f7a133d3d1c5c012a6a5af9e2e60bf Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 5 Aug 2018 13:57:45 +0200 Subject: Merge --dcraw-timeout and --magick-timeout into --conversion-timeout --- src/filelist.c | 8 ++++---- src/imlib.c | 10 +++++----- src/options.c | 10 +++++----- src/options.h | 3 +-- 4 files changed, 15 insertions(+), 16 deletions(-) (limited to 'src/filelist.c') diff --git a/src/filelist.c b/src/filelist.c index eb8e294..b492965 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -574,7 +574,7 @@ gib_list *feh_read_filelist(char *filename) Imlib_Load_Error err = IMLIB_LOAD_ERROR_NONE; Imlib_Image tmp_im; struct stat st; - signed short tmp_magick_timeout; + signed short tmp_conversion_timeout; if (!filename) return(NULL); @@ -582,8 +582,8 @@ gib_list *feh_read_filelist(char *filename) /* * feh_load_image will fail horribly if filename is not seekable */ - tmp_magick_timeout = opt.magick_timeout; - opt.magick_timeout = -1; + tmp_conversion_timeout = opt.conversion_timeout; + opt.conversion_timeout = -1; if (!stat(filename, &st) && S_ISREG(st.st_mode)) { tmp_im = imlib_load_image_with_error_return(filename, &err); if (err == IMLIB_LOAD_ERROR_NONE) { @@ -594,7 +594,7 @@ gib_list *feh_read_filelist(char *filename) return NULL; } } - opt.magick_timeout = tmp_magick_timeout; + opt.conversion_timeout = tmp_conversion_timeout; errno = 0; diff --git a/src/imlib.c b/src/imlib.c index 2d1b47a..f41cdcd 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -230,7 +230,7 @@ int feh_load_image(Imlib_Image * im, feh_file * file) if ((tmpname = feh_http_load_image(file->filename)) == NULL) err = IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST; } - else if (opt.dcraw_timeout >= 0 && feh_file_is_raw(file->filename)) { + else if (opt.conversion_timeout >= 0 && feh_file_is_raw(file->filename)) { image_source = SRC_DCRAW; tmpname = feh_dcraw_load_image(file->filename); if (!tmpname) @@ -239,7 +239,7 @@ int feh_load_image(Imlib_Image * im, feh_file * file) else *im = imlib_load_image_with_error_return(file->filename, &err); - if (opt.magick_timeout >= 0 && ( + if (opt.conversion_timeout >= 0 && ( (err == IMLIB_LOAD_ERROR_UNKNOWN) || (err == IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT))) { image_source = SRC_MAGICK; @@ -377,7 +377,7 @@ static char *feh_dcraw_load_image(char *filename) dup(fd); close(fd); - alarm(opt.dcraw_timeout); + alarm(opt.conversion_timeout); execlp("dcraw", "dcraw", "-c", "-e", filename, NULL); _exit(1); } @@ -481,10 +481,10 @@ static char *feh_magick_load_image(char *filename) _exit(1); } else { - alarm(opt.magick_timeout); + alarm(opt.conversion_timeout); waitpid(childpid, &status, 0); kill(childpid, SIGKILL); - if (opt.magick_timeout > 0 && !alarm(0)) { + if (opt.conversion_timeout > 0 && !alarm(0)) { unlink(sfn); free(sfn); sfn = NULL; diff --git a/src/options.c b/src/options.c index b0d67cd..af0f07d 100644 --- a/src/options.c +++ b/src/options.c @@ -55,8 +55,7 @@ void init_parse_options(int argc, char **argv) opt.display = 1; opt.aspect = 1; opt.slideshow_delay = 0.0; - opt.dcraw_timeout = -1; - opt.magick_timeout = -1; + opt.conversion_timeout = -1; opt.thumb_w = 60; opt.thumb_h = 60; opt.thumb_redraw = 10; @@ -416,7 +415,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"insecure" , 0, 0, 240}, {"no-recursive" , 0, 0, 241}, {"cache-size" , 1, 0, 243}, - {"dcraw-timeout" , 1, 0, 245}, + {"conversion-timeout" , 1, 0, 245}, {"version-sort" , 0, 0, 246}, {"offset" , 1, 0, 247}, {0, 0, 0, 0} @@ -695,7 +694,8 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.index_info = estrdup(optarg); break; case 208: - opt.magick_timeout = atoi(optarg); + weprintf("--magick-timeout is deprecated, please use --conversion-timeout instead"); + opt.conversion_timeout = atoi(optarg); break; case 209: opt.actions[1] = estrdup(optarg); @@ -786,7 +786,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.cache_size = 2048; break; case 245: - opt.dcraw_timeout = atoi(optarg); + opt.conversion_timeout = atoi(optarg); break; case 246: opt.version_sort = 1; diff --git a/src/options.h b/src/options.h index 741b0c7..936b4bd 100644 --- a/src/options.h +++ b/src/options.h @@ -133,8 +133,7 @@ struct __fehoptions { double slideshow_delay; - signed short dcraw_timeout; - signed short magick_timeout; + signed int conversion_timeout; Imlib_Font menu_fn; }; -- cgit v1.2.3