|
@@ -178,15 +178,23 @@ void
|
|
|
Wayland_PumpEvents(_THIS)
|
|
|
{
|
|
|
SDL_VideoData *d = _this->driverdata;
|
|
|
+ int err;
|
|
|
|
|
|
WAYLAND_wl_display_flush(d->display);
|
|
|
|
|
|
if (SDL_IOReady(WAYLAND_wl_display_get_fd(d->display), SDL_FALSE, 0)) {
|
|
|
- WAYLAND_wl_display_dispatch(d->display);
|
|
|
+ err = WAYLAND_wl_display_dispatch(d->display);
|
|
|
+ } else {
|
|
|
+ err = WAYLAND_wl_display_dispatch_pending(d->display);
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- WAYLAND_wl_display_dispatch_pending(d->display);
|
|
|
+ if (err == -1 && !d->display_disconnected) {
|
|
|
+ /* Something has failed with the Wayland connection -- for example,
|
|
|
+ * the compositor may have shut down and closed its end of the socket,
|
|
|
+ * or there is a library-specific error. No recovery is possible. */
|
|
|
+ d->display_disconnected = 1;
|
|
|
+ /* Only send a single quit message, as application shutdown might call
|
|
|
+ * SDL_PumpEvents */
|
|
|
+ SDL_SendQuit();
|
|
|
}
|
|
|
}
|
|
|
|