From f499168c2c1d2e4f09da691f81453e0a7b0b04b9 Mon Sep 17 00:00:00 2001
From: Cameron Gutman <[EMAIL REDACTED]>
Date: Sun, 24 Oct 2021 15:54:57 -0500
Subject: [PATCH] x11: Use SDL_IOReady() instead of calling select() directly
SDL_IOReady() properly handles EINTR and can use poll() if available.
---
src/video/x11/SDL_x11events.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index f070dccdf2..fd52092f2f 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -1586,14 +1586,7 @@ X11_WaitEventTimeout(_THIS, int timeout)
return 0;
}
} else if (timeout > 0) {
- int display_fd = ConnectionNumber(display);
- fd_set readset;
- struct timeval tv_timeout;
- FD_ZERO(&readset);
- FD_SET(display_fd, &readset);
- tv_timeout.tv_sec = (timeout / 1000);
- tv_timeout.tv_usec = (timeout % 1000) * 1000;
- if (select(display_fd + 1, &readset, NULL, NULL, &tv_timeout) > 0) {
+ if (SDL_IOReady(ConnectionNumber(display), SDL_FALSE, timeout) > 0) {
X11_XNextEvent(display, &xevent);
} else {
return 0;