Hello community,

here is the log from the commit of package feh for openSUSE:Factory checked in 
at 2019-11-06 14:35:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/feh (Old)
 and      /work/SRC/openSUSE:Factory/.feh.new.2990 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "feh"

Wed Nov  6 14:35:10 2019 rev:32 rq:745482 version:3.2.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/feh/feh.changes  2019-02-20 14:14:04.454884422 
+0100
+++ /work/SRC/openSUSE:Factory/.feh.new.2990/feh.changes        2019-11-06 
14:35:11.258613081 +0100
@@ -1,0 +2,9 @@
+Tue Nov  5 12:40:12 UTC 2019 - Ondřej Súkup <[email protected]>
+
+- update to 3.2.1
+ * Use --no-fehbg option in ~/.fehbg
+ * Fix TOCTTOU when setting the file mode of ~/.fehbg
+ * Fix insufficient error handling when updating ~/.fehbg
+ * Reload current image(s) when receiving SIGUSR1 or SIGUSR2 
+
+-------------------------------------------------------------------

Old:
----
  feh-3.1.3.tar.bz2
  feh-3.1.3.tar.bz2.asc

New:
----
  feh-3.2.1.tar.bz2
  feh-3.2.1.tar.bz2.asc

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ feh.spec ++++++
--- /var/tmp/diff_new_pack.GN0yp3/_old  2019-11-06 14:35:12.010613890 +0100
+++ /var/tmp/diff_new_pack.GN0yp3/_new  2019-11-06 14:35:12.014613894 +0100
@@ -17,11 +17,10 @@
 
 
 Name:           feh
-Version:        3.1.3
+Version:        3.2.1
 Release:        0
 Summary:        X11 image viewer
 License:        MIT AND LGPL-2.0-or-later
-Group:          Productivity/Graphics/Viewers
 URL:            https://feh.finalrewind.org/
 Source:         https://feh.finalrewind.org/%{name}-%{version}.tar.bz2
 Source1:        https://feh.finalrewind.org/%{name}-%{version}.tar.bz2.asc

++++++ feh-3.1.3.tar.bz2 -> feh-3.2.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/.travis.yml new/feh-3.2.1/.travis.yml
--- old/feh-3.1.3/.travis.yml   2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/.travis.yml   2019-07-22 20:26:34.000000000 +0200
@@ -27,3 +27,4 @@
   - stat64=1
   - verscmp=0
   - xinerama=0
+  - inotify=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/ChangeLog new/feh-3.2.1/ChangeLog
--- old/feh-3.1.3/ChangeLog     2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/ChangeLog     2019-07-22 20:26:34.000000000 +0200
@@ -1,3 +1,23 @@
+Mon, 22 Jul 2019 20:17:03 +0200  Daniel Friesel <[email protected]>
+
+* Release v3.2.1
+    * Use --no-fehbg option in ~/.fehbg. This fixes cases where an X11
+      setup change may inadvertently alter the commandline stored in .fehbg.
+    * Fix insufficient error handling when updating ~/.fehbg. Previously,
+      a stat() error may have caused .fehbg to be update with excessive file
+      permissions (patch by Tobias Stoeckmann)
+    * Fix TOCTTOU when setting the file mode of ~/.fehbg
+      (patch by Tobias Stoeckmann)
+
+Wed, 10 Jul 2019 17:40:29 +0200  Daniel Friesel <[email protected]>
+
+* Release v3.2
+    * Build feh with inotify=1 to automatically reload changed files in
+      slideshow mode. Introduces the inotify build flag and the --auto-reload
+      option.
+    * Reload current image(s) when receiving SIGUSR1 or SIGUSR2 in single-image
+      slideshows or in multiwindow mode
+
 Sun, 17 Feb 2019 08:41:53 +0100  Daniel Friesel <[email protected]>
 
 * Releasev v3.1.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/README.md new/feh-3.2.1/README.md
--- old/feh-3.1.3/README.md     2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/README.md     2019-07-22 20:26:34.000000000 +0200
@@ -89,6 +89,7 @@
 | debug | 0 | debug build, enables `--debug` |
 | exif | 0 | Builtin EXIF tag display support |
 | help | 0 | include help text (refers to the manpage otherwise) |
+| inotify | 0 | enable inotify, needed for `--auto-reload` |
 | 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 |
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/config.mk new/feh-3.2.1/config.mk
--- old/feh-3.1.3/config.mk     2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/config.mk     2019-07-22 20:26:34.000000000 +0200
@@ -1,5 +1,5 @@
 PACKAGE ?= feh
-VERSION ?= 3.1.3
+VERSION ?= 3.2.1
 
 app ?= 0
 curl ?= 1
@@ -50,9 +50,9 @@
 
 ifeq (${debug},1)
        CFLAGS += -DDEBUG -O0
-       MAN_DEBUG = . This is a debug build.
+       MAN_DEBUG = This is a debug build.
 else
-       MAN_DEBUG =
+       MAN_DEBUG = .
 endif
 
 ifeq (${help},1)
@@ -65,9 +65,9 @@
 
 ifeq (${verscmp},1)
        CFLAGS += -DHAVE_VERSCMP
-       MAN_VERSCMP = enabled
+       MAN_VERSCMP = available
 else
-       MAN_VERSCMP = disabled
+       MAN_VERSCMP = not available
 endif
 
 ifeq (${xinerama},1)
@@ -81,12 +81,19 @@
 ifeq (${exif},1)
        CFLAGS += -DHAVE_LIBEXIF
        LDLIBS += -lexif
-       MAN_EXIF = enabled
+       MAN_EXIF = available
 else
-       MAN_EXIF = disabled
+       MAN_EXIF = not available
 endif
 
-MAN_DATE ?= February 17, 2019
+ifeq (${inotify},1)
+       CFLAGS += -DHAVE_INOTIFY
+       MAN_INOTIFY = enabled
+else
+       MAN_INOTIFY = disabled
+endif
+
+MAN_DATE ?= July 22, 2019
 
 # Uncomment this to use dmalloc
 #CFLAGS += -DWITH_DMALLOC
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/examples/find-lowres 
new/feh-3.2.1/examples/find-lowres
--- old/feh-3.1.3/examples/find-lowres  2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/examples/find-lowres  2019-07-22 20:26:34.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env zsh
+#!/bin/sh
 # Recursively find images below a certain resolution
 #
 # Usage: find-lowres [-r] [directory [dimension]]
@@ -10,20 +10,23 @@
 
 remove=0
 
-while [[ $1 == -* ]]; do
+while true
+do
        case $1 in
                -r) remove=1 ;;
+               -*) echo "option \"$1\" ignored" ;;
                -|--) shift; break ;;
+               *) break ;;
        esac
        shift
 done
 
-base=${1-.}
-dimension=${2-1000x800}
+dir=${1:-.}
+dimension=${2:-1000x800}
 
-if (( remove ))
+if [ "$remove" = "1" ]
 then
-       feh --action 'rm %F' -rlV --max-dim ${dimension} ${base}
+       feh --action 'rm %F' -rlV --max-dim "${dimension}" "${dir}"
 else
-       feh -rlV --max-dim ${dimension} ${base}
+       feh -rlV --max-dim "${dimension}" "${dir}"
 fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/man/Makefile new/feh-3.2.1/man/Makefile
--- old/feh-3.1.3/man/Makefile  2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/man/Makefile  2019-07-22 20:26:34.000000000 +0200
@@ -12,6 +12,7 @@
        -e 's/\$$MAN_CURL\$$/${MAN_CURL}/' \
        -e 's/\$$MAN_DEBUG\$$/${MAN_DEBUG}/' \
        -e 's/\$$MAN_EXIF\$$/${MAN_EXIF}/' \
+       -e 's/\$$MAN_INOTIFY\$$/${MAN_INOTIFY}/' \
        -e 's/\$$MAN_VERSCMP\$$/${MAN_VERSCMP}/' \
        -e 's/\$$MAN_XINERAMA\$$/${MAN_XINERAMA}/' \
        < ${@:.1=.pre} > $@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/man/feh.pre new/feh-3.2.1/man/feh.pre
--- old/feh-3.1.3/man/feh.pre   2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/man/feh.pre   2019-07-22 20:26:34.000000000 +0200
@@ -24,9 +24,28 @@
 .
 .Pp
 .
-Compile-time switches: libcurl support $MAN_CURL$, natural sorting support
-$MAN_VERSCMP$, Xinerama support
-$MAN_XINERAMA$, builtin EXIF support $MAN_EXIF$$MAN_DEBUG$
+Compile-time switches in this build:
+.
+.Bl -bullet -compact
+.
+.It
+remote file support: libcurl $MAN_CURL$
+.
+.It
+natural sorting option $MAN_VERSCMP$
+.
+.It
+Xinerama multi-monitor support $MAN_XINERAMA$
+.
+.It
+builtin EXIF reader $MAN_EXIF$
+.
+.It
+inotify-based auto-reload of changed files $MAN_INOTIFY$
+.
+.El
+.
+$MAN_DEBUG$
 .
 .
 .Sh DESCRIPTION
@@ -208,6 +227,18 @@
 .
 Extra actions which can be set and triggered using the appropriate number key.
 .
+.It Cm --auto-reload
+.
+.Pq optional feature, $MAN_INOTIFY$ in this build
+automatically reload image when the underlying file changes.
+Note that auto-reload
+.Pq if enabled in the build
+is on by default.
+This option is only useful to re-enable auto-reload after it has been
+disabled by a preceding
+.Cm --reload=0
+option.
+.
 .It Cm --auto-rotate
 .
 .Pq optional feature, $MAN_EXIF$ in this build
@@ -303,7 +334,8 @@
 .
 .It Cm --edit
 .
-Enable basic editing of files. This makes rotation and mirroring
+Enable basic editing of files.
+This makes rotation and mirroring
 .Pq bound to Qo < Qc , Qo > Qc , Qo | Qc , and Qo _ Qc by default
 change the underlying file and not just its displayed content.
 .
@@ -465,9 +497,9 @@
 .
 .It Cm --insecure
 .
-When viewing files with HTTPS, this option disables all certificate checks.  It
-allows images on sites with self-signed or expired certificates to be opened,
-but is no more secure than plain HTTP.
+When viewing files with HTTPS, this option disables all certificate checks.
+It allows images on sites with self-signed or expired certificates to be
+opened, but is no more secure than plain HTTP.
 .
 .It Cm -k , --keep-http
 .
@@ -643,6 +675,7 @@
 seconds.
 Useful for viewing HTTP webcams or frequently changing directories.
 .Pq Note that filelist reloading is still experimental.
+Set to zero to disable any kind of automatic reloading.
 .
 .Pp
 .
@@ -653,6 +686,10 @@
 .Nm
 will continue to try loading it.
 .
+.Pp
+.
+Setting this option causes inotify-based auto-reload to be disabled.
+.
 .It Cm -n , --reverse
 .
 Reverse the sort order.
@@ -679,7 +716,8 @@
 .Ar count
 pixels whenever scroll_up, scroll_down, scroll_left or scroll_right is pressed.
 Note that this option accepts negative numbers in case you need to reverse the
-scroll direction. See
+scroll direction.
+See
 .Sx KEYS CONFIG SYNTAX
 for how to reverse it permanently.
 Default: 20
@@ -1037,6 +1075,12 @@
 .Qq ~/.fehbg &
 to your X startup script
 .Pq such as Pa ~/.xinitrc .
+Note that the commandline written to
+.Pa ~/.fehbg
+always includes the
+.Cm --no-fehbg
+option to ensure that it is not inadvertently changed by differences in
+X11 screen layout or similar.
 .
 .Pp
 .
@@ -1856,7 +1900,7 @@
 .
 .Sh SIGNALS
 .
-In slideshow mode,
+In slideshow and multiwindow mode,
 .Nm
 handles the following signals:
 .
@@ -1864,11 +1908,15 @@
 .
 .It Dv SIGUSR1
 .
-Switch to next image
+Slideshow mode: switch to next image;
+reload current image if the slideshow consists of a single file.
+Multiwindow mode: reload all images.
 .
 .It Dv SIGUSR2
 .
-Switch to previous image
+Slideshow mode: switch to previous image;
+reload current image if the slideshow consists of a single file.
+Multiwindow mode: reload all images.
 .
 .El
 .
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/deps.mk new/feh-3.2.1/src/deps.mk
--- old/feh-3.1.3/src/deps.mk   2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/deps.mk   2019-07-22 20:26:34.000000000 +0200
@@ -15,7 +15,7 @@
 gib_style.o: gib_style.c gib_style.h gib_list.h utils.h debug.h
 imlib.o: imlib.c feh.h gib_hash.h gib_list.h gib_imlib.h gib_style.h \
   structs.h menu.h utils.h getopt.h debug.h filelist.h signals.h \
-  winwidget.h options.h
+  winwidget.h options.h exif.h
 index.o: index.c feh.h gib_hash.h gib_list.h gib_imlib.h gib_style.h \
   structs.h menu.h utils.h getopt.h debug.h filelist.h winwidget.h \
   options.h index.h
@@ -37,7 +37,8 @@
 options.o: options.c feh.h gib_hash.h gib_list.h gib_imlib.h gib_style.h \
   structs.h menu.h utils.h getopt.h debug.h filelist.h options.h
 signals.o: signals.c feh.h gib_hash.h gib_list.h gib_imlib.h gib_style.h \
-  structs.h menu.h utils.h getopt.h debug.h winwidget.h options.h
+  structs.h menu.h utils.h getopt.h debug.h filelist.h winwidget.h \
+  options.h
 slideshow.o: slideshow.c feh.h gib_hash.h gib_list.h gib_imlib.h \
   gib_style.h structs.h menu.h utils.h getopt.h debug.h filelist.h \
   timers.h winwidget.h options.h signals.h
@@ -54,3 +55,12 @@
 winwidget.o: winwidget.c feh.h gib_hash.h gib_list.h gib_imlib.h \
   gib_style.h structs.h menu.h utils.h getopt.h debug.h filelist.h \
   winwidget.h options.h events.h
+exif.o: exif.c feh.h gib_hash.h gib_list.h gib_imlib.h gib_style.h \
+  structs.h menu.h utils.h getopt.h debug.h options.h exif.h \
+  exif_canon.h exif_nikon.h exif_cfg.h
+exif_canon.o: exif_canon.c feh.h gib_hash.h gib_list.h gib_imlib.h \
+  gib_style.h structs.h menu.h utils.h getopt.h debug.h exif.h \
+  exif_canon.h
+exif_nikon.o: exif_nikon.c feh.h gib_hash.h gib_list.h gib_imlib.h \
+  gib_style.h structs.h menu.h utils.h getopt.h debug.h exif.h \
+  exif_nikon.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/feh.h new/feh-3.2.1/src/feh.h
--- old/feh-3.1.3/src/feh.h     2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/feh.h     2019-07-22 20:26:34.000000000 +0200
@@ -152,7 +152,7 @@
 void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym 
keysym, unsigned int button);
 fehkey *feh_str_to_kb(char * action);
 void feh_action_run(feh_file * file, char *action, winwidget winwid);
-char *format_size(int size);
+char *format_size(double size);
 char *feh_printf(char *str, feh_file * file, winwidget winwid);
 void im_weprintf(winwidget w, char *fmt, ...);
 void feh_draw_zoom(winwidget w);
@@ -179,6 +179,9 @@
 gib_list *feh_wrap_string(char *text, int wrap_width, Imlib_Font fn, gib_style 
* style);
 char *build_caption_filename(feh_file * file, short create_dir);
 gib_list *feh_list_jump(gib_list * root, gib_list * l, int direction, int num);
+#ifdef HAVE_INOTIFY
+void feh_event_handle_inotify(void);
+#endif
 
 /* Imlib stuff */
 extern Display *disp;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/filelist.c new/feh-3.2.1/src/filelist.c
--- old/feh-3.1.3/src/filelist.c        2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/filelist.c        2019-07-22 20:26:34.000000000 +0200
@@ -76,7 +76,7 @@
 #ifdef HAVE_LIBEXIF
        if (file->ed)
                exif_data_unref(file->ed);
-#endif         
+#endif
        free(file);
        return;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/help.raw new/feh-3.2.1/src/help.raw
--- old/feh-3.1.3/src/help.raw  2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/help.raw  2019-07-22 20:26:34.000000000 +0200
@@ -99,6 +99,7 @@
      --max-dimension WxH   Only show images with width <= W and height <= H
      --scroll-step COUNT   scroll COUNT pixels when movement key is pressed
      --cache-size NUM      imlib cache size in mebibytes (0 .. 2048)
+     --auto-reload         automatically reload shown image if file was changed
 
 MONTAGE MODE OPTIONS
  -X, --ignore-aspect       Set thumbnail to specified width/height without
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/main.c new/feh-3.2.1/src/main.c
--- old/feh-3.1.3/src/main.c    2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/main.c    2019-07-22 20:26:34.000000000 +0200
@@ -34,6 +34,10 @@
 #include "wallpaper.h"
 #include <termios.h>
 
+#ifdef HAVE_INOTIFY
+#include <sys/inotify.h>
+#endif
+
 char **cmdargv = NULL;
 int cmdargc = 0;
 char *mode = NULL;
@@ -53,6 +57,16 @@
                init_x_and_imlib();
                init_keyevents();
                init_buttonbindings();
+#ifdef HAVE_INOTIFY
+        if (opt.auto_reload) {
+            opt.inotify_fd = inotify_init();
+            if (opt.inotify_fd < 0) {
+                opt.auto_reload = 0;
+                weprintf("inotify_init failed:");
+                weprintf("Disabling inotify-based auto-reload");
+            }
+        }
+#endif
        }
 
        feh_event_init();
@@ -146,6 +160,13 @@
        FD_SET(xfd, &fdset);
        if (control_via_stdin)
                FD_SET(STDIN_FILENO, &fdset);
+#ifdef HAVE_INOTIFY
+    if (opt.auto_reload) {
+        FD_SET(opt.inotify_fd, &fdset);
+        if (opt.inotify_fd >= fdsize)
+            fdsize = opt.inotify_fd + 1;
+    }
+#endif
 
        /* Timers */
        ft = first_timer;
@@ -191,6 +212,10 @@
                        }
                        else if ((count > 0) && (FD_ISSET(0, &fdset)))
                                feh_event_handle_stdin();
+#ifdef HAVE_INOTIFY
+                       else if ((count > 0) && (FD_ISSET(opt.inotify_fd, 
&fdset)))
+                feh_event_handle_inotify();
+#endif
                }
        } else {
                /* Don't block if there are events in the queue. That's a bit 
rude ;-) */
@@ -204,6 +229,10 @@
                                eprintf("Connection to X display lost");
                        else if ((count > 0) && (FD_ISSET(0, &fdset)))
                                feh_event_handle_stdin();
+#ifdef HAVE_INOTIFY
+                       else if ((count > 0) && (FD_ISSET(opt.inotify_fd, 
&fdset)))
+                feh_event_handle_inotify();
+#endif
                }
        }
        if (window_num == 0 || sig_exit != 0)
@@ -218,6 +247,12 @@
 
        free(opt.menu_font);
 
+#ifdef HAVE_INOTIFY
+    if (opt.auto_reload)
+        if (close(opt.inotify_fd))
+            eprintf("inotify close failed");
+#endif
+
        if(disp)
                XCloseDisplay(disp);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/options.c new/feh-3.2.1/src/options.c
--- old/feh-3.1.3/src/options.c 2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/options.c 2019-07-22 20:26:34.000000000 +0200
@@ -25,7 +25,6 @@
 */
 
 #include <strings.h>
-
 #include "feh.h"
 #include "filelist.h"
 #include "options.h"
@@ -74,6 +73,9 @@
        opt.xinerama = 1;
        opt.xinerama_index = -1;
 #endif                         /* HAVE_LIBXINERAMA */
+#ifdef HAVE_INOTIFY
+       opt.auto_reload = 1;
+#endif                         /* HAVE_INOTIFY */
 
        feh_getopt_theme(argc, argv);
 
@@ -425,6 +427,9 @@
                {"conversion-timeout" , 1, 0, 245},
                {"version-sort"  , 0, 0, 246},
                {"offset"        , 1, 0, 247},
+#ifdef HAVE_INOTIFY
+               {"auto-reload"   , 0, 0, 248},
+#endif
                {0, 0, 0, 0}
        };
        int optch = 0, cmdx = 0;
@@ -517,6 +522,9 @@
                        break;
                case 'R':
                        opt.reload = atof(optarg);
+#ifdef HAVE_INOTIFY
+                       opt.auto_reload = 0;
+#endif
                        break;
                case 'S':
                        if (!strcasecmp(optarg, "name"))
@@ -810,6 +818,11 @@
                        opt.offset_flags = XParseGeometry(optarg, &opt.offset_x,
                                        &opt.offset_y, (unsigned int 
*)&discard, (unsigned int *)&discard);
                        break;
+#ifdef HAVE_INOTIFY
+               case 248:
+                       opt.auto_reload = 1;
+                       break;
+#endif
                default:
                        break;
                }
@@ -897,6 +910,10 @@
                "exif "
 #endif
 
+#ifdef HAVE_INOTIFY
+               "inotify "
+#endif
+
 #ifdef INCLUDE_HELP
                "help "
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/options.h new/feh-3.2.1/src/options.h
--- old/feh-3.1.3/src/options.h 2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/options.h 2019-07-22 20:26:34.000000000 +0200
@@ -58,6 +58,10 @@
        unsigned char draw_exif;
        unsigned char auto_rotate;
 #endif
+#ifdef HAVE_INOTIFY
+       unsigned char auto_reload;
+    int inotify_fd;
+#endif
        unsigned char list;
        unsigned char quiet;
        unsigned char preload;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/signals.c new/feh-3.2.1/src/signals.c
--- old/feh-3.1.3/src/signals.c 2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/signals.c 2019-07-22 20:26:34.000000000 +0200
@@ -24,6 +24,7 @@
 */
 
 #include "feh.h"
+#include "filelist.h"
 #include "winwidget.h"
 #include "options.h"
 
@@ -94,10 +95,14 @@
        winwid = winwidget_get_first_window_of_type(WIN_TYPE_SLIDESHOW);
 
        if (winwid) {
-               if (signo == SIGUSR1)
-                       slideshow_change_image(winwid, SLIDE_NEXT, 1);
-               else if (signo == SIGUSR2)
-                       slideshow_change_image(winwid, SLIDE_PREV, 1);
+               if (filelist_len > 1) {
+                       if (signo == SIGUSR1)
+                               slideshow_change_image(winwid, SLIDE_NEXT, 1);
+                       else if (signo == SIGUSR2)
+                               slideshow_change_image(winwid, SLIDE_PREV, 1);
+               } else {
+                       feh_reload_image(winwid, 0, 0);
+               }
        } else if (opt.multiwindow) {
                for (i = window_num - 1; i >= 0; i--)
                        feh_reload_image(windows[i], 0, 0);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/slideshow.c 
new/feh-3.2.1/src/slideshow.c
--- old/feh-3.1.3/src/slideshow.c       2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/slideshow.c       2019-07-22 20:26:34.000000000 +0200
@@ -445,7 +445,7 @@
        return;
 }
 
-char *format_size(int size)
+char *format_size(double size)
 {
        static char ret[5];
        char units[] = {' ', 'k', 'M', 'G', 'T'};
@@ -454,7 +454,7 @@
                size /= 1000;
                postfix++;
        }
-       snprintf(ret, 5, "%3d%c", size, units[postfix]);
+       snprintf(ret, 5, "%3.0f%c", size, units[postfix]);
        return ret;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/thumbnail.c 
new/feh-3.2.1/src/thumbnail.c
--- old/feh-3.1.3/src/thumbnail.c       2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/thumbnail.c       2019-07-22 20:26:34.000000000 +0200
@@ -93,7 +93,6 @@
 
        if (!opt.thumb_title)
                opt.thumb_title = "%n";
-
        mode = "thumbnail";
 
        if (opt.font)
@@ -177,6 +176,7 @@
                                td.h + title_area_h, 0, 0, 0, 255);
        }
 
+
        if (opt.display) {
                winwid = winwidget_create_from_image(td.im_main, 
WIN_TYPE_THUMBNAIL);
                winwidget_rename(winwid, PACKAGE " [thumbnail mode]");
@@ -418,6 +418,7 @@
                }
        }
 
+
        return;
 }
 
@@ -783,7 +784,6 @@
        if (!l) {
                eprintf("Cannot find %s in filelist, wtf", thumbfile->filename);
        }
-
        thumbwin = 
winwidget_get_first_window_of_type(WIN_TYPE_THUMBNAIL_VIEWER);
        if (!thumbwin) {
                thumbwin = winwidget_create_from_file(
@@ -793,7 +793,13 @@
                        winwidget_show(thumbwin);
        } else if (FEH_FILE(thumbwin->file->data) != thumbfile) {
                thumbwin->file = l;
-               feh_reload_image(thumbwin, 1, 1);
+#ifdef HAVE_INOTIFY
+        winwidget_inotify_remove(thumbwin);
+#endif
+               feh_reload_image(thumbwin, 1, 0);
+#ifdef HAVE_INOTIFY
+        winwidget_inotify_add(thumbwin, thumbfile);
+#endif
        }
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/wallpaper.c 
new/feh-3.2.1/src/wallpaper.c
--- old/feh-3.1.3/src/wallpaper.c       2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/wallpaper.c       2019-07-22 20:26:34.000000000 +0200
@@ -452,6 +452,7 @@
                        home = getenv("HOME");
                        if (home) {
                                FILE *fp;
+                               int fd;
                                char *path;
                                char *absolute_path;
                                struct stat s;
@@ -462,7 +463,7 @@
                                } else {
                                        fputs("#!/bin/sh\n", fp);
                                        fputs(cmdargv[0], fp);
-                                       fputs(" --bg-", fp);
+                                       fputs(" --no-fehbg --bg-", fp);
                                        if (centered)
                                                fputs("center", fp);
                                        else if (scaled)
@@ -519,11 +520,11 @@
                                                free(absolute_path);
                                        }
                                        fputc('\n', fp);
-                                       fclose(fp);
-                                       stat(path, &s);
-                                       if (chmod(path, s.st_mode | S_IXUSR | 
S_IXGRP) != 0) {
+                                       fd = fileno(fp);
+                                       if (fstat(fd, &s) != 0 || fchmod(fd, 
s.st_mode | S_IXUSR | S_IXGRP) != 0) {
                                                weprintf("Can't set %s as 
executable", path);
                                        }
+                                       fclose(fp);
                                }
                                free(path);
                        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/winwidget.c 
new/feh-3.2.1/src/winwidget.c
--- old/feh-3.1.3/src/winwidget.c       2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/winwidget.c       2019-07-22 20:26:34.000000000 +0200
@@ -30,6 +30,10 @@
 #include "options.h"
 #include "events.h"
 
+#ifdef HAVE_INOTIFY
+#include <sys/inotify.h>
+#endif
+
 static void winwidget_unregister(winwidget win);
 static void winwidget_register(winwidget win);
 static winwidget winwidget_allocate(void);
@@ -78,6 +82,10 @@
        ret->click_offset_y = 0;
        ret->has_rotated = 0;
 
+#ifdef HAVE_INOTIFY
+    ret->inotify_wd = -1;
+#endif
+
        return(ret);
 }
 
@@ -662,6 +670,9 @@
 
 void winwidget_destroy(winwidget winwid)
 {
+#ifdef HAVE_INOTIFY
+    winwidget_inotify_remove(winwid);
+#endif
        winwidget_destroy_xwin(winwid);
        if (winwid->name)
                free(winwid->name);
@@ -673,6 +684,76 @@
        return;
 }
 
+#ifdef HAVE_INOTIFY
+void winwidget_inotify_remove(winwidget winwid)
+{
+    if (winwid->inotify_wd >= 0) {
+        D(("Removing inotify watch\n"));
+        if (inotify_rm_watch(opt.inotify_fd, winwid->inotify_wd))
+            weprintf("inotify_rm_watch failed:");
+        winwid->inotify_wd = -1;
+    }
+}
+#endif
+
+#ifdef HAVE_INOTIFY
+void winwidget_inotify_add(winwidget winwid, feh_file * file)
+{
+    if (opt.auto_reload) {
+        D(("Adding inotify watch for %s\n", file->filename));
+        char dir[PATH_MAX];
+        feh_file_dirname(dir, file, PATH_MAX);
+
+        /*
+         * Handle files without directory part, e.g. "feh somefile.jpg".
+         * These always reside in the current directory.
+         */
+        if (dir[0] == '\0') {
+            dir[0] = '.';
+            dir[1] = '\0';
+        }
+        winwid->inotify_wd = inotify_add_watch(opt.inotify_fd, dir, 
IN_CLOSE_WRITE | IN_MOVED_TO);
+        if (winwid->inotify_wd < 0)
+            weprintf("inotify_add_watch failed:");
+    }
+}
+#endif
+
+#ifdef HAVE_INOTIFY
+#define INOTIFY_BUFFER_LEN (1024 * (sizeof (struct inotify_event)) + 16)
+void feh_event_handle_inotify(void)
+{
+    D(("Received inotify events\n"));
+    char buf[INOTIFY_BUFFER_LEN];
+    int i = 0;
+    int len = read (opt.inotify_fd, buf, INOTIFY_BUFFER_LEN);
+    if (len < 0) {
+        if (errno != EINTR)
+            eprintf("inotify event read failed");
+    } else if (!len)
+        eprintf("inotify event read failed");
+    while (i < len) {
+        struct inotify_event *event;
+        event = (struct inotify_event *) &buf[i];
+        for (int j = 0; j < window_num; j++) {
+            if(windows[j]->inotify_wd == event->wd) {
+                if (event->mask & IN_IGNORED) {
+                    D(("inotify watch was implicitely removed\n"));
+                    windows[j]->inotify_wd = -1;
+                } else if (event->mask & (IN_CLOSE_WRITE | IN_MOVED_TO)) {
+                    if (strcmp(event->name, 
FEH_FILE(windows[j]->file->data)->name) == 0) {
+                        D(("inotify says file changed\n"));
+                        feh_reload_image(windows[j], 0, 0);
+                    }
+                }
+                break;
+            }
+        }
+        i += sizeof(struct inotify_event) + event->len;
+    }
+}
+#endif
+
 void winwidget_destroy_all(void)
 {
        int i;
@@ -706,7 +787,16 @@
 int winwidget_loadimage(winwidget winwid, feh_file * file)
 {
        D(("filename %s\n", file->filename));
-       return(feh_load_image(&(winwid->im), file));
+#ifdef HAVE_INOTIFY
+    winwidget_inotify_remove(winwid);
+#endif
+    int res = feh_load_image(&(winwid->im), file);
+#ifdef HAVE_INOTIFY
+    if (res) {
+        winwidget_inotify_add(winwid, file);
+    }
+#endif
+       return(res);
 }
 
 void winwidget_show(winwidget winwid)
@@ -721,6 +811,8 @@
                /* wait for the window to map */
                D(("Waiting for window to map\n"));
                XMaskEvent(disp, StructureNotifyMask, &ev);
+               winwidget_get_geometry(winwid, NULL);
+
                /* Unfortunately, StructureNotifyMask does not only mask
                 * the events of type MapNotify (which we want to mask here)
                 * but also such of type ConfigureNotify (and others, see
@@ -820,6 +912,8 @@
                winwid->had_resize = 1;
                XFlush(disp);
 
+               winwidget_get_geometry(winwid, NULL);
+
                if (force_resize && (opt.geom_flags & (WidthValue | 
HeightValue))
                                && (winwid->type != WIN_TYPE_THUMBNAIL)) {
                        opt.geom_w = winwid->w;
@@ -1059,8 +1153,11 @@
 {
        unsigned int bw, bp;
        Window child;
+
+       int inner_rect[4];
+
        if (!rect)
-               return;
+               rect = inner_rect;
 
        XGetGeometry(disp, winwid->win, &root, &(rect[0]), &(rect[1]), (unsigned
                                int *)&(rect[2]), (unsigned int *)&(rect[3]), 
&bw, &bp);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/feh-3.1.3/src/winwidget.h 
new/feh-3.2.1/src/winwidget.h
--- old/feh-3.1.3/src/winwidget.h       2019-02-17 08:47:27.000000000 +0100
+++ new/feh-3.2.1/src/winwidget.h       2019-07-22 20:26:34.000000000 +0200
@@ -116,8 +116,17 @@
        time_t click_start_time;
 
        unsigned char has_rotated;
+
+#ifdef HAVE_INOTIFY
+       int inotify_wd;
+#endif
 };
 
+#ifdef HAVE_INOTIFY
+void winwidget_inotify_remove(winwidget winwid);
+void winwidget_inotify_add(winwidget winwid, feh_file * file);
+#endif
+
 int winwidget_loadimage(winwidget winwid, feh_file * filename);
 void winwidget_show(winwidget winwid);
 void winwidget_show_menu(winwidget winwid);


Reply via email to