1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: os2/sockpm.cpp
3 // Purpose: implementation of OS-2-specific handler event handling
4 // Author: Guilhem Lavaux, Vadim Zeitlin
7 // Copyright: (c) 1999-2008 wxWidgets dev team
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
17 #include "wx/private/socket.h"
19 #include "wx/apptrait.h"
21 #define wxSockReadMask 0x01
22 #define wxSockWriteMask 0x02
24 static void wxSocket_PM_Input(void *data
)
26 wxSocketImplUnix
*handler
= static_cast<wxSocketImplUnix
*>(data
);
28 handler
->OnReadWaiting();
31 static void wxSocket_PM_Output(void *data
)
33 wxSocketImplUnix
*handler
= static_cast<wxSocketImplUnix
*>(data
);
35 handler
->OnWriteWaiting();
38 class PMSocketManager
: public wxSocketInputBasedManager
41 virtual int AddInput(wxSocketImplUnix
*handler
, int fd
, SocketDir d
)
44 return wxTheApp
->AddSocketHandler(fd
, wxSockWriteMask
,
45 wxSocket_PM_Output
, handler
);
47 return wxTheApp
->AddSocketHandler(fd
, wxSockReadMask
,
48 wxSocket_PM_Input
, handler
);
51 virtual void RemoveInput(int fd
)
53 wxTheApp
->RemoveSocketHandler(fd
);
57 wxSocketManager
*wxGUIAppTraits::GetSocketManager()
59 static PMSocketManager s_manager
;
64 #else /* !wxUSE_SOCKETS */
66 /* some compilers don't like having empty source files */
67 static int wxDummyGsockVar
= 0;
69 #endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */