]> git.saurik.com Git - wxWidgets.git/blame - src/motif/gsockmot.cpp
undid change of r44565: not taking hyphens into account entirely is a bad idea as...
[wxWidgets.git] / src / motif / gsockmot.cpp
CommitLineData
2804f77d
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: motif/gsockmot.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///////////////////////////////////////////////////////////////////////////////
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()
793ba541 18#include "wx/gsocket.h"
2804f77d 19#include "wx/apptrait.h"
793ba541 20
2804f77d 21extern "C" {
793ba541 22
355b4d3d
WS
23static void _GSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid),
24 XtInputId *WXUNUSED(id))
793ba541 25{
355b4d3d 26 GSocket *socket = (GSocket *)data;
793ba541 27
355b4d3d 28 socket->Detected_Read();
793ba541
DE
29}
30
355b4d3d
WS
31static void _GSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
32 XtInputId *WXUNUSED(id))
793ba541 33{
355b4d3d 34 GSocket *socket = (GSocket *)data;
793ba541 35
355b4d3d 36 socket->Detected_Write();
793ba541
DE
37}
38
793ba541
DE
39}
40
2804f77d 41class MotifSocketManager : public GSocketInputBasedManager
793ba541 42{
2804f77d
VZ
43public:
44 virtual int AddInput(GSocket *socket, SocketDir d)
355b4d3d 45 {
2804f77d
VZ
46 return XtAppAddInput
47 (
48 wxGetAppContext(),
49 socket->m_fd,
50 (XtPointer)(d == FD_OUTPUT ? XtInputWriteMask
51 : XtInputReadMask),
52 d == FD_OUTPUT ? _GSocket_Motif_Output
53 : _GSocket_Motif_Input,
54 socket
55 );
355b4d3d
WS
56 }
57
2804f77d 58 virtual void RemoveInput(int fd)
355b4d3d 59 {
2804f77d 60 XtRemoveInput(fd);
355b4d3d 61 }
2804f77d 62};
793ba541 63
2804f77d 64GSocketManager *wxGUIAppTraits::GetSocketManager()
793ba541 65{
2804f77d
VZ
66 static MotifSocketManager s_manager;
67 return &s_manager;
793ba541
DE
68}
69
2804f77d 70#endif // wxUSE_SOCKETS