summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index f1fca24..1a76e2d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
/* main event loop */
while (feh_main_iteration(1));
- return(0);
+ return(sig_exit);
}
/* Return 0 to stop iterating, 1 if ok to continue. */
@@ -104,7 +104,7 @@ int feh_main_iteration(int block)
double t1 = 0.0, t2 = 0.0;
fehtimer ft;
- if (window_num == 0)
+ if (window_num == 0 || sig_exit != 0)
return(0);
if (first) {
@@ -137,7 +137,7 @@ int feh_main_iteration(int block)
if (ev_handler[ev.type])
(*(ev_handler[ev.type])) (&ev);
- if (window_num == 0)
+ if (window_num == 0 || sig_exit != 0)
return(0);
}
XFlush(disp);
@@ -191,7 +191,7 @@ int feh_main_iteration(int block)
in that */
feh_handle_timer();
}
- else if (count && (FD_ISSET(0, &fdset)))
+ else if ((count > 0) && (FD_ISSET(0, &fdset)))
feh_event_handle_stdin();
}
} else {
@@ -204,11 +204,11 @@ int feh_main_iteration(int block)
&& ((errno == ENOMEM) || (errno == EINVAL)
|| (errno == EBADF)))
eprintf("Connection to X display lost");
- else if (count && (FD_ISSET(0, &fdset)))
+ else if ((count > 0) && (FD_ISSET(0, &fdset)))
feh_event_handle_stdin();
}
}
- if (window_num == 0)
+ if (window_num == 0 || sig_exit != 0)
return(0);
return(1);