]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/os2/sockpm.cpp
Swap client data pointers in wxRearrangeList too.
[wxWidgets.git] / src / os2 / sockpm.cpp
... / ...
CommitLineData
1///////////////////////////////////////////////////////////////////////////////
2// Name: os2/sockpm.cpp
3// Purpose: implementation of OS-2-specific handler event handling
4// Author: Guilhem Lavaux, Vadim Zeitlin
5// Created: 1999
6// RCS-ID: $Id$
7// Copyright: (c) 1999-2008 wxWidgets dev team
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#if wxUSE_SOCKETS
15
16#include <stdlib.h>
17#include "wx/private/socket.h"
18#include "wx/app.h"
19#include "wx/apptrait.h"
20
21#define wxSockReadMask 0x01
22#define wxSockWriteMask 0x02
23
24static void wxSocket_PM_Input(void *data)
25{
26 wxFDIOHandler *handler = static_cast<wxSocketImplUnix *>(data);
27
28 handler->OnReadWaiting();
29}
30
31static void wxSocket_PM_Output(void *data)
32{
33 wxFDIOHandler *handler = static_cast<wxSocketImplUnix *>(data);
34
35 handler->OnWriteWaiting();
36}
37
38class PMFDIOManager : public wxFDIOManager
39{
40public:
41 virtual int AddInput(wxFDIOHandler *handler,
42 int fd,
43 wxFDIOManager::Direction d)
44 {
45 if (d == FD_OUTPUT)
46 return wxTheApp->AddSocketHandler(fd, wxSockWriteMask,
47 wxSocket_PM_Output, handler);
48 else
49 return wxTheApp->AddSocketHandler(fd, wxSockReadMask,
50 wxSocket_PM_Input, handler);
51 }
52
53 virtual void
54 RemoveInput(wxFDIOHandler * WXUNUSED(handler),
55 int fd,
56 wxFDIOManager::Direction WXUNUSED(dir))
57 {
58 wxTheApp->RemoveSocketHandler(fd);
59 }
60};
61
62wxFDIOManager *wxGUIAppTraits::GetFDIOManager()
63{
64 static PMFDIOManager s_manager;
65 return &s_manager;
66}
67
68
69#else /* !wxUSE_SOCKETS */
70
71/* some compilers don't like having empty source files */
72static int wxDummyGsockVar = 0;
73
74#endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */