diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-06-03 08:23:04 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-06-03 08:23:04 +0200 |
| commit | 85be70efa516bccb375bd7c011a2882a064c24da (patch) | |
| tree | d8dd4c770edf71ddda23b2851745aba5b3bdbb8f /src/drivers/Unix | |
| parent | 9a5e3b95b8abe132c36eb58a55f0e5188c726e20 (diff) | |
Restore use of build option FLTK_USE_POLL
Diffstat (limited to 'src/drivers/Unix')
| -rw-r--r-- | src/drivers/Unix/Fl_Unix_Screen_Driver.H | 5 | ||||
| -rw-r--r-- | src/drivers/Unix/Fl_Unix_Screen_Driver.cxx | 4 | ||||
| -rw-r--r-- | 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 <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; 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 <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; 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<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++; |
