1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
4 * Purpose: GSocket: PM part
5 * Licence: The wxWindows licence
7 * ------------------------------------------------------------------------- */
9 // For compilers that support precompilation, includes "wx.h".
10 #include "wx/wxprec.h"
15 #include "wx/gsocket.h"
17 #include "wx/apptrait.h"
19 #define wxSockReadMask 0x01
20 #define wxSockWriteMask 0x02
22 static void _GSocket_PM_Input(void *data
)
24 GSocket
*socket
= (GSocket
*) data
;
25 socket
->Detected_Read();
28 static void _GSocket_PM_Output(void *data
)
30 GSocket
*socket
= (GSocket
*) data
;
31 socket
->Detected_Write();
34 class PMSocketManager
: public GSocketInputBasedManager
37 virtual int AddInput(GSocket
*socket
, SocketDir d
)
41 return wxTheApp
->AddSocketHandler(socket
->m_fd
, wxSockWriteMask
,
42 _GSocket_PM_Output
, (void *)socket
);
44 return wxTheApp
->AddSocketHandler(socket
->m_fd
, wxSockReadMask
,
45 _GSocket_PM_Input
, (void *)socket
);
48 virtual void RemoveInput(int fd
)
50 wxTheApp
->RemoveSocketHandler(fd
);
54 GSocketManager
*wxGUIAppTraits::GetSocketManager()
56 static PMSocketManager s_manager
;
61 #else /* !wxUSE_SOCKETS */
63 /* some compilers don't like having empty source files */
64 static int wxDummyGsockVar
= 0;
66 #endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */