aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-11-24 23:18:44 +0100
committeremersion <contact@emersion.fr>2018-11-24 23:18:44 +0100
commit41ffb5b4d5cb22b670a34ff441a7e069b7a4d175 (patch)
tree14670abb7b22f90aa5df466e67134c5fe7c35b74
parent6358de382793a5e28f445c87bb3baf138f4810af (diff)
swayidle: listen when display becomes writable
-rw-r--r--swayidle/main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/swayidle/main.c b/swayidle/main.c
index 2e202ce1..ab4b4596 100644
--- a/swayidle/main.c
+++ b/swayidle/main.c
@@ -373,7 +373,11 @@ static int display_event(int fd, uint32_t mask, void *data) {
int count = 0;
if (mask & WL_EVENT_READABLE) {
count = wl_display_dispatch(state.display);
- } else {
+ }
+ if (mask & WL_EVENT_WRITABLE) {
+ wl_display_flush(state.display);
+ }
+ if (mask == 0) {
count = wl_display_dispatch_pending(state.display);
wl_display_flush(state.display);
}
@@ -438,7 +442,7 @@ int main(int argc, char *argv[]) {
wl_display_roundtrip(state.display);
struct wl_event_source *source = wl_event_loop_add_fd(state.event_loop,
- wl_display_get_fd(state.display), WL_EVENT_READABLE,
+ wl_display_get_fd(state.display), WL_EVENT_READABLE | WL_EVENT_WRITABLE,
display_event, NULL);
wl_event_source_check(source);