]> git.saurik.com Git - wxWidgets.git/blame - src/motif/sockmot.cpp
no real change: just rename "near" into "onNearPart" (MSVC doesn't like 'near' as...
[wxWidgets.git] / src / motif / sockmot.cpp
CommitLineData
2804f77d 1///////////////////////////////////////////////////////////////////////////////
a9d859df 2// Name: motif/sockmot.cpp
2804f77d
VZ
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///////////////////////////////////////////////////////////////////////////////
793ba541 10
355b4d3d
WS
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
793ba541
DE
13
14#if wxUSE_SOCKETS
15
2804f77d
VZ
16#include <X11/Intrinsic.h> // XtAppAdd/RemoveInput()
17#include "wx/motif/private.h" // wxGetAppContext()
6bcc1145 18#include "wx/private/fdiomanager.h"
2804f77d 19#include "wx/apptrait.h"
793ba541 20
2804f77d 21extern "C" {
793ba541 22
51fe4b60 23static void wxSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid),
355b4d3d 24 XtInputId *WXUNUSED(id))
793ba541 25{
6bcc1145 26 wxFDIOHandler * const handler = static_cast<wxFDIOHandler *>(data);
793ba541 27
a9d859df 28 handler->OnReadWaiting();
793ba541
DE
29}
30
51fe4b60 31static void wxSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
355b4d3d 32 XtInputId *WXUNUSED(id))
793ba541 33{
6bcc1145 34 wxFDIOHandler * const handler = static_cast<wxFDIOHandler *>(data);
793ba541 35
a9d859df 36 handler->OnWriteWaiting();
793ba541
DE
37}
38
793ba541
DE
39}
40
6bcc1145 41class MotifFDIOManager : public wxFDIOManager
793ba541 42{
2804f77d 43public:
6bcc1145 44 virtual int AddInput(wxFDIOHandler *handler, int fd, Direction d)
355b4d3d 45 {
2804f77d
VZ
46 return XtAppAddInput
47 (
48 wxGetAppContext(),
a9d859df 49 fd,
6bcc1145
VZ
50 (XtPointer)(d == OUTPUT ? XtInputWriteMask
51 : XtInputReadMask),
52 d == OUTPUT ? wxSocket_Motif_Output
53 : wxSocket_Motif_Input,
a9d859df 54 handler
2804f77d 55 );
355b4d3d
WS
56 }
57
6bcc1145
VZ
58 virtual void
59 RemoveInput(wxFDIOHandler* WXUNUSED(handler), int fd, Direction WXUNUSED(d))
355b4d3d 60 {
2804f77d 61 XtRemoveInput(fd);
355b4d3d 62 }
2804f77d 63};
793ba541 64
6bcc1145 65wxFDIOManager *wxGUIAppTraits::GetFDIOManager()
793ba541 66{
6bcc1145 67 static MotifFDIOManager s_manager;
2804f77d 68 return &s_manager;
793ba541
DE
69}
70
2804f77d 71#endif // wxUSE_SOCKETS