]> git.saurik.com Git - wxWidgets.git/blame - src/os2/gsockpm.cpp
explicitly check that we're being run from the correct directory
[wxWidgets.git] / src / os2 / gsockpm.cpp
CommitLineData
05a019a2
DE
1/* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
3 * Name: gsockpm.c
4 * Purpose: GSocket: PM part
65571936 5 * Licence: The wxWindows licence
05a019a2
DE
6 * CVSID: $Id$
7 * ------------------------------------------------------------------------- */
8
6670f564
WS
9// For compilers that support precompilation, includes "wx.h".
10#include "wx/wxprec.h"
11
05a019a2
DE
12#if wxUSE_SOCKETS
13
14#include <stdlib.h>
05a019a2 15#include "wx/gsocket.h"
621b4574 16#include "wx/app.h"
cb1e81d4 17#include "wx/apptrait.h"
05a019a2
DE
18
19#define wxSockReadMask 0x01
20#define wxSockWriteMask 0x02
21
22static void _GSocket_PM_Input(void *data)
23{
24 GSocket *socket = (GSocket *) data;
a1ad0f6b 25 socket->Detected_Read();
05a019a2
DE
26}
27
28static void _GSocket_PM_Output(void *data)
29{
30 GSocket *socket = (GSocket *) data;
a1ad0f6b 31 socket->Detected_Write();
05a019a2
DE
32}
33
f90913e2 34class PMSocketManager : public GSocketInputBasedManager
05a019a2 35{
f90913e2
SN
36public:
37 virtual int AddInput(GSocket *socket, SocketDir d)
05a019a2 38 {
05a019a2 39
f90913e2
SN
40 if (d == FD_OUTPUT)
41 return wxTheApp->AddSocketHandler(socket->m_fd, wxSockWriteMask,
42 _GSocket_PM_Output, (void *)socket);
43 else
44 return wxTheApp->AddSocketHandler(socket->m_fd, wxSockReadMask,
45 _GSocket_PM_Input, (void *)socket);
05a019a2 46 }
05a019a2 47
f90913e2 48 virtual void RemoveInput(int fd)
05a019a2 49 {
f90913e2 50 wxTheApp->RemoveSocketHandler(fd);
05a019a2 51 }
f90913e2 52};
05a019a2 53
f90913e2 54GSocketManager *wxGUIAppTraits::GetSocketManager()
05a019a2 55{
cb1e81d4 56 static PMSocketManager s_manager;
f90913e2 57 return &s_manager;
05a019a2
DE
58}
59
05a019a2
DE
60
61#else /* !wxUSE_SOCKETS */
62
63/* some compilers don't like having empty source files */
64static int wxDummyGsockVar = 0;
65
66#endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */