]> git.saurik.com Git - wxWidgets.git/blob - src/motif/sockmot.cpp
fix building with WXWIN_COMPATIBILITY_2_8 == 0
[wxWidgets.git] / src / motif / sockmot.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/motif/sockmot.cpp
3 // Purpose: implementation of wxMotif-specific socket event handling
4 // Author: Guilhem Lavaux, Vadim Zeitlin
5 // Created: 1999
6 // Copyright: (c) 1999, 2007 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 <X11/Intrinsic.h> // XtAppAdd/RemoveInput()
16 #include "wx/motif/private.h" // wxGetAppContext()
17 #include "wx/private/fdiomanager.h"
18 #include "wx/apptrait.h"
19
20 extern "C" {
21
22 static void wxSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid),
23 XtInputId *WXUNUSED(id))
24 {
25 wxFDIOHandler * const handler = static_cast<wxFDIOHandler *>(data);
26
27 handler->OnReadWaiting();
28 }
29
30 static void wxSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
31 XtInputId *WXUNUSED(id))
32 {
33 wxFDIOHandler * const handler = static_cast<wxFDIOHandler *>(data);
34
35 handler->OnWriteWaiting();
36 }
37
38 }
39
40 class MotifFDIOManager : public wxFDIOManager
41 {
42 public:
43 virtual int AddInput(wxFDIOHandler *handler, int fd, Direction d)
44 {
45 return XtAppAddInput
46 (
47 wxGetAppContext(),
48 fd,
49 (XtPointer)(d == OUTPUT ? XtInputWriteMask
50 : XtInputReadMask),
51 d == OUTPUT ? wxSocket_Motif_Output
52 : wxSocket_Motif_Input,
53 handler
54 );
55 }
56
57 virtual void
58 RemoveInput(wxFDIOHandler* WXUNUSED(handler), int fd, Direction WXUNUSED(d))
59 {
60 XtRemoveInput(fd);
61 }
62 };
63
64 wxFDIOManager *wxGUIAppTraits::GetFDIOManager()
65 {
66 static MotifFDIOManager s_manager;
67 return &s_manager;
68 }
69
70 #endif // wxUSE_SOCKETS