Skip to content

Commit

Permalink
use separate eof_stdin bool instead of lumping it with run_display
Browse files Browse the repository at this point in the history
  • Loading branch information
youbitchoc committed Oct 28, 2022
1 parent ce7234b commit 30b2658
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dtao.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ static bool unified;
static int exclusive_zone = -1;
static enum align titlealign, subalign;
static bool expand;
static int run_display = true;
static bool run_display = true;
static bool eof_stdin = false;

static struct fcft_font *font;
static char line[MAX_LINE_LEN];
Expand Down Expand Up @@ -375,7 +376,7 @@ read_stdin(void)
if (b < 0)
EBARF("read");
if (b == 0) {
run_display = 2;
eof_stdin = true;
return;
}
linerem += b;
Expand Down Expand Up @@ -422,7 +423,7 @@ event_loop(void)
int ret;
int wlfd = wl_display_get_fd(display);

while (run_display == 1) {
while (run_display && eof_stdin) {
fd_set rfds;
FD_ZERO(&rfds);
FD_SET(STDIN_FILENO, &rfds);
Expand All @@ -440,10 +441,10 @@ event_loop(void)

if (FD_ISSET(wlfd, &rfds))
if (wl_display_dispatch(display) == -1)
run_display = 0;
run_display = false;
}

if (run_display == 2) {
if (run_display) {
if (persist == -1)
while (wl_display_roundtrip(display) != -1);
else {
Expand Down

0 comments on commit 30b2658

Please sign in to comment.