wayland: only call wl_display_prepare_read() if we read any events

That is, only call it if we have POLLIN. If not, then we never read
any events and we still hold the read lock and thus we shouldn't try
to acquire it again.
This commit is contained in:
Daniel Eklöf 2020-01-04 23:32:00 +01:00
parent 4cbd894803
commit d243a836ce
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -569,11 +569,12 @@ fdm_wayl(struct fdm *fdm, int fd, int events, void *data)
struct wayland *wayl = data;
int event_count = 0;
if (events & EPOLLIN)
if (events & EPOLLIN) {
wl_display_read_events(wayl->display);
while (wl_display_prepare_read(wayl->display) != 0)
wl_display_dispatch_pending(wayl->display);
while (wl_display_prepare_read(wayl->display) != 0)
wl_display_dispatch_pending(wayl->display);
}
if (events & EPOLLHUP) {
LOG_WARN("disconnected from Wayland");