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