mirror of
https://github.com/fltk/fltk.git
synced 2026-06-01 06:14:28 +08:00
Add Teun's CygWin patch for select()...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1902 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
CHANGES IN FLTK 1.1.0b9
|
CHANGES IN FLTK 1.1.0b9
|
||||||
|
|
||||||
|
- Update CygWin support for Fl::add_fd().
|
||||||
- Update the plastic scheme to not override the default
|
- Update the plastic scheme to not override the default
|
||||||
colors - move the color code to the MacOS-specific
|
colors - move the color code to the MacOS-specific
|
||||||
code. Also updates the tile image colormap to match
|
code. Also updates the tile image colormap to match
|
||||||
|
|||||||
+14
-6
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_win32.cxx,v 1.33.2.37.2.10 2001/12/06 22:16:49 easysw Exp $"
|
// "$Id: Fl_win32.cxx,v 1.33.2.37.2.11 2002/01/01 14:14:34 easysw Exp $"
|
||||||
//
|
//
|
||||||
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
|
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#if defined(__CYGWIN__)
|
#ifdef __CYGWIN__
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#else
|
#else
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// USE_ASYNC_SELECT - define it if you have WSAAsyncSelect()...
|
// USE_ASYNC_SELECT - define it if you have WSAAsyncSelect()...
|
||||||
//
|
//
|
||||||
@@ -55,6 +56,7 @@
|
|||||||
// WM_SYNCPAINT is an "undocumented" message, which is finally defined in
|
// WM_SYNCPAINT is an "undocumented" message, which is finally defined in
|
||||||
// VC++ 6.0.
|
// VC++ 6.0.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef WM_SYNCPAINT
|
#ifndef WM_SYNCPAINT
|
||||||
# define WM_SYNCPAINT 0x0088
|
# define WM_SYNCPAINT 0x0088
|
||||||
#endif /* !WM_SYNCPAINT */
|
#endif /* !WM_SYNCPAINT */
|
||||||
@@ -71,6 +73,7 @@
|
|||||||
# define WHEEL_DELTA 120 // according to MSDN.
|
# define WHEEL_DELTA 120 // according to MSDN.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// WM_FLSELECT is the user-defined message that we get when one of
|
// WM_FLSELECT is the user-defined message that we get when one of
|
||||||
// the sockets has pending data, etc.
|
// the sockets has pending data, etc.
|
||||||
@@ -78,6 +81,7 @@
|
|||||||
|
|
||||||
#define WM_FLSELECT (WM_USER+0x0400)
|
#define WM_FLSELECT (WM_USER+0x0400)
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
// interface to poll/select call:
|
// interface to poll/select call:
|
||||||
|
|
||||||
@@ -88,7 +92,7 @@
|
|||||||
// Microsoft provides the Berkeley select() call and an asynchronous
|
// Microsoft provides the Berkeley select() call and an asynchronous
|
||||||
// select function that sends a WIN32 message when the select condition
|
// select function that sends a WIN32 message when the select condition
|
||||||
// exists...
|
// exists...
|
||||||
|
static int maxfd = 0;
|
||||||
#ifndef USE_ASYNC_SELECT
|
#ifndef USE_ASYNC_SELECT
|
||||||
static fd_set fdsets[3];
|
static fd_set fdsets[3];
|
||||||
#endif // !USE_ASYNC_SELECT
|
#endif // !USE_ASYNC_SELECT
|
||||||
@@ -128,6 +132,7 @@ void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) {
|
|||||||
if (events & POLLIN) FD_SET(n, &fdsets[0]);
|
if (events & POLLIN) FD_SET(n, &fdsets[0]);
|
||||||
if (events & POLLOUT) FD_SET(n, &fdsets[1]);
|
if (events & POLLOUT) FD_SET(n, &fdsets[1]);
|
||||||
if (events & POLLERR) FD_SET(n, &fdsets[2]);
|
if (events & POLLERR) FD_SET(n, &fdsets[2]);
|
||||||
|
if (n > maxfd) maxfd = n;
|
||||||
#endif // USE_ASYNC_SELECT
|
#endif // USE_ASYNC_SELECT
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,8 +204,7 @@ int fl_wait(double time_to_wait) {
|
|||||||
fdt[0] = fdsets[0];
|
fdt[0] = fdsets[0];
|
||||||
fdt[1] = fdsets[1];
|
fdt[1] = fdsets[1];
|
||||||
fdt[2] = fdsets[2];
|
fdt[2] = fdsets[2];
|
||||||
|
if (::select(maxfd+1,&fdt[0],&fdt[1],&fdt[2],&t)) {
|
||||||
if (::select(0,&fdt[0],&fdt[1],&fdt[2],&t)) {
|
|
||||||
// We got something - do the callback!
|
// We got something - do the callback!
|
||||||
for (int i = 0; i < nfds; i ++) {
|
for (int i = 0; i < nfds; i ++) {
|
||||||
int f = fd[i].fd;
|
int f = fd[i].fd;
|
||||||
@@ -211,10 +215,14 @@ int fl_wait(double time_to_wait) {
|
|||||||
if (fd[i].events & revents) fd[i].cb(f, fd[i].arg);
|
if (fd[i].events & revents) fd[i].cb(f, fd[i].arg);
|
||||||
}
|
}
|
||||||
time_to_wait = 0.0; // just peek for any messages
|
time_to_wait = 0.0; // just peek for any messages
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
}
|
||||||
|
#else
|
||||||
} else {
|
} else {
|
||||||
// we need to check them periodically, so set a short timeout:
|
// we need to check them periodically, so set a short timeout:
|
||||||
if (time_to_wait > .001) time_to_wait = .001;
|
if (time_to_wait > .001) time_to_wait = .001;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif // USE_ASYNC_SELECT
|
#endif // USE_ASYNC_SELECT
|
||||||
|
|
||||||
@@ -1020,5 +1028,5 @@ void Fl_Window::make_current() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.10 2001/12/06 22:16:49 easysw Exp $".
|
// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.11 2002/01/01 14:14:34 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user