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