Restore use of build option FLTK_USE_POLL
Build and Test / build-linux (push) Has been cancelled
Build and Test / build-wayland (push) Has been cancelled
Build and Test / build-macos (push) Has been cancelled
Build and Test / build-windows (push) Has been cancelled

This commit is contained in:
ManoloFLTK
2025-06-03 08:23:04 +02:00
parent 9a5e3b95b8
commit 85be70efa5
3 changed files with 15 additions and 12 deletions
+3 -2
View File
@@ -24,7 +24,6 @@
# if USE_POLL
# include <poll.h>
static pollfd *pollfds = 0;
# else
# if HAVE_SYS_SELECT_H
@@ -52,7 +51,9 @@ static pollfd *pollfds = 0;
class Fl_Unix_Screen_Driver : public Fl_Screen_Driver {
public:
# if !USE_POLL
# if USE_POLL
static pollfd *pollfds;
# else
static fd_set fdsets[3];
# endif
static int maxfd;
+3 -1
View File
@@ -18,7 +18,9 @@
#include <sys/time.h>
#include "Fl_Unix_Screen_Driver.H"
#if !USE_POLL
#if USE_POLL
pollfd *Fl_Unix_Screen_Driver::pollfds = NULL;
#else
fd_set Fl_Unix_Screen_Driver::fdsets[3];
#endif
int Fl_Unix_Screen_Driver::maxfd = 0;
+9 -9
View File
@@ -723,18 +723,18 @@ void Fl_Unix_System_Driver::add_fd(int n, int events, void (*cb)(int, void*), vo
# if USE_POLL
pollfd *tpoll;
if (!pollfds) tpoll = (pollfd*)malloc(fd_array_size*sizeof(pollfd));
else tpoll = (pollfd*)realloc(pollfds, fd_array_size*sizeof(pollfd));
if (!Fl_Unix_Screen_Driver::pollfds) tpoll = (pollfd*)malloc(fd_array_size*sizeof(pollfd));
else tpoll = (pollfd*)realloc(Fl_Unix_Screen_Driver::pollfds, fd_array_size*sizeof(pollfd));
if (!tpoll) return;
pollfds = tpoll;
Fl_Unix_Screen_Driver::pollfds = tpoll;
# endif
}
Fl_Unix_Screen_Driver::fd[i].cb = cb;
Fl_Unix_Screen_Driver::fd[i].arg = v;
# if USE_POLL
pollfds[i].fd = n;
pollfds[i].events = events;
Fl_Unix_Screen_Driver::pollfds[i].fd = n;
Fl_Unix_Screen_Driver::pollfds[i].events = events;
# else
Fl_Unix_Screen_Driver::fd[i].fd = n;
Fl_Unix_Screen_Driver::fd[i].events = events;
@@ -756,10 +756,10 @@ void Fl_Unix_System_Driver::remove_fd(int n, int events) {
# endif
for (i=j=0; i<Fl_Unix_Screen_Driver::nfds; i++) {
# if USE_POLL
if (pollfds[i].fd == n) {
int e = pollfds[i].events & ~events;
if (Fl_Unix_Screen_Driver::pollfds[i].fd == n) {
int e = Fl_Unix_Screen_Driver::pollfds[i].events & ~events;
if (!e) continue; // if no events left, delete this fd
pollfds[j].events = e;
Fl_Unix_Screen_Driver::pollfds[j].events = e;
}
# else
if (Fl_Unix_Screen_Driver::fd[i].fd == n) {
@@ -773,7 +773,7 @@ void Fl_Unix_System_Driver::remove_fd(int n, int events) {
if (j<i) {
Fl_Unix_Screen_Driver::fd[j] = Fl_Unix_Screen_Driver::fd[i];
# if USE_POLL
pollfds[j] = pollfds[i];
Fl_Unix_Screen_Driver::pollfds[j] = Fl_Unix_Screen_Driver::pollfds[i];
# endif
}
j++;