diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/wlclock.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/wlclock.c b/src/wlclock.c index bc88ca4..670f9f5 100644 --- a/src/wlclock.c +++ b/src/wlclock.c @@ -592,18 +592,21 @@ static void clock_run () while (context.loop) { - /* Flush Wayland events. */ - errno = 0; - do { - if ( wl_display_flush(context.display) == 1 && errno != EAGAIN ) - { - clocklog(0, "ERROR: wl_display_flush: %s\n", - strerror(errno)); - break; - } - } while ( errno == EAGAIN ); + /* Flush pending Wayland events/requests. */ + int ret = 1; + while ( ret > 0 ) + { + ret = wl_display_dispatch_pending(context.display); + wl_display_flush(context.display); + } + if ( ret < 0 ) + { + clocklog(0, "ERROR: wl_display_dispatch_pending: %s\n", strerror(errno)); + context.ret = EXIT_FAILURE; + goto exit; + } - int ret = poll(fds, 1, get_timeout()); + ret = poll(fds, 1, get_timeout()); if ( ret == 0 ) /* Timeout -> update clock hands. */ { |