]> git.saurik.com Git - wxWidgets.git/blame - src/motif/sockmot.cpp
no changes, just remove trailing whitespace
[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()
60913641 18#include "wx/private/socket.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{
a9d859df 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{
a9d859df 34 wxFDIOHandler * const handler = static_cast<wxFDIOHandler *>(data);
793ba541 35
a9d859df 36 handler->OnWriteWaiting();
793ba541
DE
37}
38
793ba541
DE
39}
40
51fe4b60 41class MotifSocketManager : public wxSocketInputBasedManager
793ba541 42{
2804f77d 43public:
a9d859df 44 virtual int AddInput(wxFDIOHandler *handler, int fd, SocketDir d)
355b4d3d 45 {
2804f77d
VZ
46 return XtAppAddInput
47 (
48 wxGetAppContext(),
a9d859df 49 fd,
2804f77d
VZ
50 (XtPointer)(d == FD_OUTPUT ? XtInputWriteMask
51 : XtInputReadMask),
51fe4b60
VZ
52 d == FD_OUTPUT ? wxSocket_Motif_Output
53 : wxSocket_Motif_Input,
a9d859df 54 handler
2804f77d 55 );
355b4d3d
WS
56 }
57
2804f77d 58 virtual void RemoveInput(int fd)
355b4d3d 59 {
2804f77d 60 XtRemoveInput(fd);
355b4d3d 61 }
2804f77d 62};
793ba541 63
51fe4b60 64wxSocketManager *wxGUIAppTraits::GetSocketManager()
793ba541 65{
2804f77d
VZ
66 static MotifSocketManager s_manager;
67 return &s_manager;
793ba541
DE
68}
69
2804f77d 70#endif // wxUSE_SOCKETS