diff options
author | Sven Willner <sven.willner@gmail.com> | 2017-10-27 17:42:02 +0200 |
---|---|---|
committer | Sven Willner <sven.willner@gmail.com> | 2017-10-27 17:42:02 +0200 |
commit | c50d376d615e966cbb55ceeef57a204586f1e802 (patch) | |
tree | a6eab5ea901fe5adac858a7a29b06992dd6cc8f4 /src | |
parent | f5ce98d3f379a810103e37fa36baf241668387f1 (diff) |
fixed inotify for overwritten files
Diffstat (limited to 'src')
-rw-r--r-- | src/winwidget.c | 13 |
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; } } |