1 /* -------------------------------------------------------------------------
2 * Project: wxSocketImpl (Generic Socket) for WX
4 * Purpose: wxSocketImpl: 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/private/gsocket.h"
17 #include "wx/apptrait.h"
19 #define wxSockReadMask 0x01
20 #define wxSockWriteMask 0x02
22 static void wxSocket_PM_Input(void *data
)
24 wxSocketImpl
*socket
= static_cast<wxSocketImpl
*>(data
);
26 socket
->Detected_Read();
29 static void wxSocket_PM_Output(void *data
)
31 wxSocketImpl
*socket
= static_cast<wxSocketImpl
*>(data
);
33 socket
->Detected_Write();
36 class PMSocketManager
: public wxSocketInputBasedManager
39 virtual int AddInput(wxSocketImpl
*socket
, SocketDir d
)
43 return wxTheApp
->AddSocketHandler(socket
->m_fd
, wxSockWriteMask
,
44 wxSocket_PM_Output
, (void *)socket
);
46 return wxTheApp
->AddSocketHandler(socket
->m_fd
, wxSockReadMask
,
47 wxSocket_PM_Input
, (void *)socket
);
50 virtual void RemoveInput(int fd
)
52 wxTheApp
->RemoveSocketHandler(fd
);
56 wxSocketManager
*wxGUIAppTraits::GetSocketManager()
58 static PMSocketManager s_manager
;
63 #else /* !wxUSE_SOCKETS */
65 /* some compilers don't like having empty source files */
66 static int wxDummyGsockVar
= 0;
68 #endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */