From 85be70efa516bccb375bd7c011a2882a064c24da Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 3 Jun 2025 08:23:04 +0200 Subject: Restore use of build option FLTK_USE_POLL --- src/drivers/Unix/Fl_Unix_Screen_Driver.H | 5 +++-- src/drivers/Unix/Fl_Unix_Screen_Driver.cxx | 4 +++- src/drivers/Unix/Fl_Unix_System_Driver.cxx | 18 +++++++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/drivers/Unix/Fl_Unix_Screen_Driver.H b/src/drivers/Unix/Fl_Unix_Screen_Driver.H index 36eb943f8..dd3f6e5c7 100644 --- a/src/drivers/Unix/Fl_Unix_Screen_Driver.H +++ b/src/drivers/Unix/Fl_Unix_Screen_Driver.H @@ -24,7 +24,6 @@ # if USE_POLL # include -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; diff --git a/src/drivers/Unix/Fl_Unix_Screen_Driver.cxx b/src/drivers/Unix/Fl_Unix_Screen_Driver.cxx index 4988474cb..97b11b840 100644 --- a/src/drivers/Unix/Fl_Unix_Screen_Driver.cxx +++ b/src/drivers/Unix/Fl_Unix_Screen_Driver.cxx @@ -18,7 +18,9 @@ #include #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; diff --git a/src/drivers/Unix/Fl_Unix_System_Driver.cxx b/src/drivers/Unix/Fl_Unix_System_Driver.cxx index 2b15882a1..443838c5d 100644 --- a/src/drivers/Unix/Fl_Unix_System_Driver.cxx +++ b/src/drivers/Unix/Fl_Unix_System_Driver.cxx @@ -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