core: Convert SDL_IOReady()'s 2nd parameter to flags

This commit is contained in:
Cameron Gutman
2021-10-30 15:56:54 -05:00
committed by Sam Lantinga
parent 81fe2ccb9c
commit c97c46877f
9 changed files with 30 additions and 21 deletions

View File

@@ -50,7 +50,7 @@ write_pipe(int fd, const void* buffer, size_t total_length, size_t *pos)
sigset_t old_sig_set;
struct timespec zerotime = {0};
ready = SDL_IOReady(fd, SDL_TRUE, PIPE_MS_TIMEOUT);
ready = SDL_IOReady(fd, SDL_IOR_WRITE, PIPE_MS_TIMEOUT);
sigemptyset(&sig_set);
sigaddset(&sig_set, SIGPIPE);
@@ -96,7 +96,7 @@ read_pipe(int fd, void** buffer, size_t* total_length, SDL_bool null_terminate)
ssize_t bytes_read = 0;
size_t pos = 0;
ready = SDL_IOReady(fd, SDL_FALSE, PIPE_MS_TIMEOUT);
ready = SDL_IOReady(fd, SDL_IOR_READ, PIPE_MS_TIMEOUT);
if (ready == 0) {
bytes_read = SDL_SetError("Pipe timeout");

View File

@@ -259,7 +259,7 @@ Wayland_WaitEventTimeout(_THIS, int timeout)
/* wl_display_prepare_read() will return -1 if the default queue is not empty.
* If the default queue is empty, it will prepare us for our SDL_IOReady() call. */
if (WAYLAND_wl_display_prepare_read(d->display) == 0) {
if (SDL_IOReady(WAYLAND_wl_display_get_fd(d->display), SDL_FALSE, timeout) > 0) {
if (SDL_IOReady(WAYLAND_wl_display_get_fd(d->display), SDL_IOR_READ, timeout) > 0) {
/* There are new events available to read */
WAYLAND_wl_display_read_events(d->display);
WAYLAND_wl_display_dispatch_pending(d->display);
@@ -308,7 +308,7 @@ Wayland_PumpEvents(_THIS)
/* wl_display_prepare_read() will return -1 if the default queue is not empty.
* If the default queue is empty, it will prepare us for our SDL_IOReady() call. */
if (WAYLAND_wl_display_prepare_read(d->display) == 0) {
if (SDL_IOReady(WAYLAND_wl_display_get_fd(d->display), SDL_FALSE, 0) > 0) {
if (SDL_IOReady(WAYLAND_wl_display_get_fd(d->display), SDL_IOR_READ, 0) > 0) {
WAYLAND_wl_display_read_events(d->display);
} else {
WAYLAND_wl_display_cancel_read(d->display);

View File

@@ -155,7 +155,7 @@ Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
break;
}
if (SDL_IOReady(WAYLAND_wl_display_get_fd(display), SDL_FALSE, max_wait - now) <= 0) {
if (SDL_IOReady(WAYLAND_wl_display_get_fd(display), SDL_IOR_READ, max_wait - now) <= 0) {
/* Error or timeout expired without any events for us. Cancel the read. */
WAYLAND_wl_display_cancel_read(display);
break;

View File

@@ -1536,7 +1536,7 @@ X11_Pending(Display * display)
}
/* More drastic measures are required -- see if X is ready to talk */
if (SDL_IOReady(ConnectionNumber(display), SDL_FALSE, 0)) {
if (SDL_IOReady(ConnectionNumber(display), SDL_IOR_READ, 0)) {
return (X11_XPending(display));
}
@@ -1586,7 +1586,7 @@ X11_WaitEventTimeout(_THIS, int timeout)
return 0;
}
} else if (timeout > 0) {
if (SDL_IOReady(ConnectionNumber(display), SDL_FALSE, timeout) > 0) {
if (SDL_IOReady(ConnectionNumber(display), SDL_IOR_READ, timeout) > 0) {
X11_XNextEvent(display, &xevent);
} else {
return 0;