diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2009-12-24 11:40:26 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2009-12-24 11:40:26 +0000 |
| commit | 9a505ef44c8433c8f58c68b79888c6f52c7739db (patch) | |
| tree | fc255632d19676e08cfa3db13d6f78123a945723 /src | |
| parent | 954fba25c88e532f77fb1c74b1e912e7a84ac452 (diff) | |
Fixed a name conflict with new (VC 2008 Express) winsock2.h versions
(POLLIN, POLLOUT, POLLERR) and another conflict (FORCE_POSITION flag) that
produced compile errors with VC 2008 (STR #2301).
Removed remaining code of the obsolete WSAAsyncSelect call from Fl_win32.cxx.
Removed some obsolete html tags from FL/Fl_Window.H and fixed some typos.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6980 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_win32.cxx | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 136b3ee0f..8db05169d 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -101,11 +101,10 @@ #endif typedef int (WINAPI* fl_wsk_select_f)(int, fd_set*, fd_set*, fd_set*, const struct timeval*); typedef int (WINAPI* fl_wsk_fd_is_set_f)(SOCKET, fd_set *); -typedef int (WINAPI* fl_wsk_async_select_f)(SOCKET,HWND,u_int,long); + static HMODULE s_wsock_mod = 0; static fl_wsk_select_f s_wsock_select=0; static fl_wsk_fd_is_set_f fl_wsk_fd_is_set=0; -static fl_wsk_async_select_f fl_wsk_async_select=0; static HMODULE get_wsock_mod() { if (!s_wsock_mod) { @@ -114,7 +113,6 @@ static HMODULE get_wsock_mod() { Fl::fatal("FLTK Lib Error: %s file not found! Please check your winsock dll accessibility.\n",WSCK_DLL_NAME); s_wsock_select = (fl_wsk_select_f) GetProcAddress(s_wsock_mod, "select"); fl_wsk_fd_is_set = (fl_wsk_fd_is_set_f) GetProcAddress(s_wsock_mod, "__WSAFDIsSet"); - fl_wsk_async_select = (fl_wsk_async_select_f) GetProcAddress(s_wsock_mod, "WSAAsyncSelect"); } return s_wsock_mod; } @@ -229,14 +227,18 @@ static Fl_Window *track_mouse_win=0; // current TrackMouseEvent() window // // Microsoft provides the Berkeley select() call and an asynchronous // select function that sends a WIN32 message when the select condition -// exists... +// exists. However, we don't try to use the asynchronous WSAAsyncSelect() +// any more for good reasons (see above). +// +// A.S. Dec 2009: We got reports that current winsock2.h files define +// POLLIN, POLLOUT, and POLLERR with conflicting values WRT what we +// used before (STR #2301). Therefore we must not use these values +// for our internal purposes, but use FL_READ, FL_WRITE, and +// FL_EXCEPT, as defined for use in Fl::add_fd(). +// static int maxfd = 0; static fd_set fdsets[3]; -# define POLLIN 1 -# define POLLOUT 4 -# define POLLERR 8 - #if !defined(__GNUC__) || __GNUC__ >= 3 extern IDropTarget *flIDropTarget; #endif // !__GNUC__ || __GNUC__ >= 3 @@ -292,14 +294,14 @@ void Fl::add_fd(int n, int events, void (*cb)(int, void*), void *v) { fd[i].cb = cb; fd[i].arg = v; - if (events & POLLIN) FD_SET((unsigned)n, &fdsets[0]); - if (events & POLLOUT) FD_SET((unsigned)n, &fdsets[1]); - if (events & POLLERR) FD_SET((unsigned)n, &fdsets[2]); + if (events & FL_READ) FD_SET((unsigned)n, &fdsets[0]); + if (events & FL_WRITE) FD_SET((unsigned)n, &fdsets[1]); + if (events & FL_EXCEPT) FD_SET((unsigned)n, &fdsets[2]); if (n > maxfd) maxfd = n; } void Fl::add_fd(int fd, void (*cb)(int, void*), void* v) { - Fl::add_fd(fd, POLLIN, cb, v); + Fl::add_fd(fd, FL_READ, cb, v); } void Fl::remove_fd(int n, int events) { @@ -318,9 +320,9 @@ void Fl::remove_fd(int n, int events) { } nfds = j; - if (events & POLLIN) FD_CLR(unsigned(n), &fdsets[0]); - if (events & POLLOUT) FD_CLR(unsigned(n), &fdsets[1]); - if (events & POLLERR) FD_CLR(unsigned(n), &fdsets[2]); + if (events & FL_READ) FD_CLR(unsigned(n), &fdsets[0]); + if (events & FL_WRITE) FD_CLR(unsigned(n), &fdsets[1]); + if (events & FL_EXCEPT) FD_CLR(unsigned(n), &fdsets[2]); } void Fl::remove_fd(int n) { @@ -374,9 +376,9 @@ int fl_wait(double time_to_wait) { for (int i = 0; i < nfds; i ++) { SOCKET f = fd[i].fd; short revents = 0; - if (fl_wsk_fd_is_set(f, &fdt[0])) revents |= POLLIN; - if (fl_wsk_fd_is_set(f, &fdt[1])) revents |= POLLOUT; - if (fl_wsk_fd_is_set(f, &fdt[2])) revents |= POLLERR; + if (fl_wsk_fd_is_set(f, &fdt[0])) revents |= FL_READ; + if (fl_wsk_fd_is_set(f, &fdt[1])) revents |= FL_WRITE; + if (fl_wsk_fd_is_set(f, &fdt[2])) revents |= FL_EXCEPT; if (fd[i].events & revents) fd[i].cb(f, fd[i].arg); } time_to_wait = 0.0; // just peek for any messages @@ -1292,7 +1294,7 @@ void Fl_Window::resize(int X,int Y,int W,int H) { int resize_from_program = (this != resize_bug_fix); if (!resize_from_program) resize_bug_fix = 0; if (X != x() || Y != y()) { - set_flag(FORCE_POSITION); + force_position(1); } else { if (!is_a_resize) return; flags |= SWP_NOMOVE; @@ -1474,7 +1476,7 @@ Fl_X* Fl_X::make(Fl_Window* w) { wp += 2*bx; hp += 2*by+bt; } - if (!(w->flags() & Fl_Widget::FORCE_POSITION)) { + if (!w->force_position()) { xp = yp = CW_USEDEFAULT; } else { if (!Fl::grab()) { |
