diff options
author | emersion <contact@emersion.fr> | 2018-11-11 21:11:15 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-11-11 21:14:15 +0100 |
commit | 180151ed0995954d50648a30382217e471e77242 (patch) | |
tree | 2d28083772e0931316039b3848a69a4d1a12034a /backend | |
parent | aaff4b8c0066833caaf029180d2e972cd826810a (diff) |
backend/wayland: handle WL_EVENT_WRITABLE for Wayland socket
We need to flush when the connection is writable again. This is important in
case the write buffer becomes full. This is also what Weston does [1].
[1]: https://gitlab.freedesktop.org/wayland/weston/blob/master/libweston/compositor-wayland.c#L2593
Diffstat (limited to 'backend')
-rw-r--r-- | backend/wayland/backend.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index cb4f190d..df1bf431 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -27,7 +27,6 @@ struct wlr_wl_backend *get_wl_backend_from_backend(struct wlr_backend *backend) static int dispatch_events(int fd, uint32_t mask, void *data) { struct wlr_wl_backend *wl = data; - int count = 0; if ((mask & WL_EVENT_HANGUP) || (mask & WL_EVENT_ERROR)) { wl_display_terminate(wl->local_display); @@ -35,13 +34,19 @@ static int dispatch_events(int fd, uint32_t mask, void *data) { } if (mask & WL_EVENT_READABLE) { - count = wl_display_dispatch(wl->remote_display); + return wl_display_dispatch(wl->remote_display); + } + if (mask & WL_EVENT_WRITABLE) { + wl_display_flush(wl->remote_display); + return 0; } if (mask == 0) { - count = wl_display_dispatch_pending(wl->remote_display); + int count = wl_display_dispatch_pending(wl->remote_display); wl_display_flush(wl->remote_display); + return count; } - return count; + + return 0; } static void xdg_shell_handle_ping(void *data, struct zxdg_shell_v6 *shell, |