diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-04-27 14:39:27 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-04-27 14:39:27 +0000 |
| commit | ff3295f0365fcb3262129047311072138e208fcd (patch) | |
| tree | 6b64d7cec6c67cdd487b5997fafbe5718342576b /src/Fl_x.cxx | |
| parent | 36b469928ed6833c792dc1a7451e6b65b08dc266 (diff) | |
Handle WM_ACTIVATEAPP message under WIN32, using GetAsyncKeyState() for
all of the key and button states in FLTK.
SunOS 4.x changes (check for <sys/stdtypes.h> and don't rely on
realloc(NULL, size) working - this doesn't work on a lot of platforms!)
Fix nesting of #ifdefs in vsnprintf.c - the C++ wrapper stuff wasn't
being included outside the checks for the individual functions...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1444 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_x.cxx')
| -rw-r--r-- | src/Fl_x.cxx | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 2b83932db..8905e0f40 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_x.cxx,v 1.24.2.23 2001/01/22 15:13:40 easysw Exp $" +// "$Id: Fl_x.cxx,v 1.24.2.24 2001/04/27 14:39:27 easysw Exp $" // // X specific code for the Fast Light Tool Kit (FLTK). // @@ -69,23 +69,38 @@ static int maxfd; static int nfds = 0; static int fd_array_size = 0; -static struct FD { +struct FD { #if !USE_POLL int fd; short events; #endif void (*cb)(int, void*); void* arg; -} *fd = 0; +}; + +static FD *fd = 0; void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) { remove_fd(n,events); int i = nfds++; if (i >= fd_array_size) { + FD *temp; fd_array_size = 2*fd_array_size+1; - fd = (FD*)realloc(fd, fd_array_size*sizeof(FD)); + + if (!fd) temp = (FD*)malloc(fd_array_size*sizeof(FD)); + else temp = (FD*)realloc(fd, fd_array_size*sizeof(FD)); + + if (!temp) return; + fd = temp; + #if USE_POLL - pollfds = (pollfd*)realloc(pollfds, fd_array_size*sizeof(pollfd)); + pollfd *tpoll; + + if (!pollfds) tpoll = (pollfd*)malloc(fd_array_size*sizeof(pollfd)); + else tpoll = (pollfd*)realloc(pollfds, fd_array_size*sizeof(pollfd)); + + if (!tpoll) return; + pollfds = tpoll; #endif } fd[i].cb = cb; @@ -903,5 +918,5 @@ void Fl_Window::make_current() { #endif // -// End of "$Id: Fl_x.cxx,v 1.24.2.23 2001/01/22 15:13:40 easysw Exp $". +// End of "$Id: Fl_x.cxx,v 1.24.2.24 2001/04/27 14:39:27 easysw Exp $". // |
