wayland: Simplify dispatch_pending error handling
wl_display_dispatch_pending does not return EAGAIN, and always sets an error when it fails. This allows us to handle errors in a simpler manner.
This commit is contained in:
parent
bc24716476
commit
083b294659
10
glfw/wl_window.c
vendored
10
glfw/wl_window.c
vendored
@ -762,16 +762,10 @@ handleEvents(monotonic_t timeout)
|
|||||||
EVDBG("starting handleEvents(%.2f)", monotonic_t_to_s_double(timeout));
|
EVDBG("starting handleEvents(%.2f)", monotonic_t_to_s_double(timeout));
|
||||||
|
|
||||||
while (wl_display_prepare_read(display) != 0) {
|
while (wl_display_prepare_read(display) != 0) {
|
||||||
while(1) {
|
if (wl_display_dispatch_pending(display) == -1) {
|
||||||
int num_dispatched = wl_display_dispatch_pending(display);
|
abortOnFatalError(wl_display_get_error(display));
|
||||||
if (num_dispatched < 0) {
|
|
||||||
if (errno == EAGAIN) continue;
|
|
||||||
int last_error = wl_display_get_error(display);
|
|
||||||
if (last_error) abortOnFatalError(last_error);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If an error different from EAGAIN happens, we have likely been
|
// If an error different from EAGAIN happens, we have likely been
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user