X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/691aba016bccb44aa30cb7fdd9c232a85d56c4b2..461fe6e2559a3096d4985a50ba106f26ed890a1d:/src/msw/gsockmsw.c?ds=sidebyside diff --git a/src/msw/gsockmsw.c b/src/msw/gsockmsw.c index c966cfffc1..38dd6bd523 100644 --- a/src/msw/gsockmsw.c +++ b/src/msw/gsockmsw.c @@ -7,6 +7,14 @@ * ------------------------------------------------------------------------- */ +/* + * TODO: for WinCE we need to replace WSAAsyncSelect + * (Windows message-based notification of network events for a socket) + * with another mechanism. + * We may need to have a separate thread that polls for socket events + * using select() and sends a message to the main thread. + */ + /* * PLEASE don't put C++ comments here - this is a C source file. */ @@ -19,6 +27,14 @@ # pragma warning(disable:4115) /* named type definition in parentheses */ #endif +/* This needs to be before the wx/defs/h inclusion + * for some reason + */ + +#ifdef __WXWINCE__ +#include +#endif + #ifndef __GSOCKET_STANDALONE__ #include "wx/defs.h" #include "wx/setup.h" @@ -46,7 +62,14 @@ #endif /* __GSOCKET_STANDALONE__ */ +#ifndef __WXWINCE__ #include +#else +#define assert(x) +#include +#include "wx/msw/wince/net.h" +#endif + #include #include #include @@ -83,9 +106,8 @@ static int firstAvailable; /* Global initializers */ -int GSocket_Init(void) +int _GSocket_GUI_Init(void) { - WSADATA wsaData; WNDCLASS winClass; int i; @@ -118,11 +140,10 @@ int GSocket_Init(void) } firstAvailable = 0; - /* Initialize WinSocket */ - return (WSAStartup((1 << 8) | 1, &wsaData) == 0); + return 1; } -void GSocket_Cleanup(void) +void _GSocket_GUI_Cleanup(void) { /* Destroy internal window */ DestroyWindow(hWin); @@ -130,14 +151,11 @@ void GSocket_Cleanup(void) /* Delete critical section */ DeleteCriticalSection(&critical); - - /* Cleanup WinSocket */ - WSACleanup(); } /* Per-socket GUI initialization / cleanup */ -int _GSocket_GUI_Init(GSocket *socket) +int _GSocket_GUI_Init_Socket(GSocket *socket) { int i; @@ -164,7 +182,7 @@ int _GSocket_GUI_Init(GSocket *socket) return TRUE; } -void _GSocket_GUI_Destroy(GSocket *socket) +void _GSocket_GUI_Destroy_Socket(GSocket *socket) { /* Remove the socket from the list */ EnterCriticalSection(&critical); @@ -188,7 +206,7 @@ LRESULT CALLBACK _GSocket_Internal_WinProc(HWND hWnd, { EnterCriticalSection(&critical); socket = socketList[(uMsg - WM_USER)]; - event = -1; + event = (GSocketEvent) -1; cback = NULL; data = NULL;