summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Willner <sven.willner@gmail.com>2017-10-27 17:42:02 +0200
committerSven Willner <sven.willner@gmail.com>2017-10-27 17:42:02 +0200
commitc50d376d615e966cbb55ceeef57a204586f1e802 (patch)
treea6eab5ea901fe5adac858a7a29b06992dd6cc8f4
parentf5ce98d3f379a810103e37fa36baf241668387f1 (diff)
fixed inotify for overwritten files
-rw-r--r--src/winwidget.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/winwidget.c b/src/winwidget.c
index b2c340e..9270d69 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -821,9 +821,16 @@ void feh_event_handle_inotify(void)
while (i < len) {
struct inotify_event *event;
event = (struct inotify_event *) &buf[i];
- for (int i = 0; i < window_num; i++) {
- if(windows[i]->inotify_wd == event->wd) {
- feh_reload_image(windows[i], 0, 1);
+ 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"));
+ feh_reload_image(windows[j], 0, 1);
+ winwidget_inotify_add(windows[j], FEH_FILE(windows[j]->file->data)->filename);
+ } else if (event->mask & IN_CLOSE_WRITE) {
+ D(("Inotify says file changed\n"));
+ feh_reload_image(windows[j], 0, 1);
+ }
break;
}
}