]> git.saurik.com Git - wxWidgets.git/blob - src/motif/sockmot.cpp
Open debugger at the location of failing assert, if possible.
[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 // RCS-ID: $Id$
7 // Copyright: (c) 1999, 2007 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 <X11/Intrinsic.h> // XtAppAdd/RemoveInput()
17 #include "wx/motif/private.h" // wxGetAppContext()
18 #include "wx/private/fdiomanager.h"
19 #include "wx/apptrait.h"
20
21 extern "C" {
22
23 static void wxSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid),
24 XtInputId *WXUNUSED(id))
25 {
26 wxFDIOHandler * const handler = static_cast<wxFDIOHandler *>(data);
27
28 handler->OnReadWaiting();
29 }
30
31 static void wxSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
32 XtInputId *WXUNUSED(id))
33 {
34 wxFDIOHandler * const handler = static_cast<wxFDIOHandler *>(data);
35
36 handler->OnWriteWaiting();
37 }
38
39 }
40
41 class MotifFDIOManager : public wxFDIOManager
42 {
43 public:
44 virtual int AddInput(wxFDIOHandler *handler, int fd, Direction d)
45 {
46 return XtAppAddInput
47 (
48 wxGetAppContext(),
49 fd,
50 (XtPointer)(d == OUTPUT ? XtInputWriteMask
51 : XtInputReadMask),
52 d == OUTPUT ? wxSocket_Motif_Output
53 : wxSocket_Motif_Input,
54 handler
55 );
56 }
57
58 virtual void
59 RemoveInput(wxFDIOHandler* WXUNUSED(handler), int fd, Direction WXUNUSED(d))
60 {
61 XtRemoveInput(fd);
62 }
63 };
64
65 wxFDIOManager *wxGUIAppTraits::GetFDIOManager()
66 {
67 static MotifFDIOManager s_manager;
68 return &s_manager;
69 }
70
71 #endif // wxUSE_SOCKETS