1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk1/sockgtk.cpp
3 // Purpose: implementation of wxGTK-specific socket event handling
4 // Author: Guilhem Lavaux, Vadim Zeitlin
6 // Copyright: (c) 1999, 2007 wxWidgets dev team
7 // (c) 2009 Vadim Zeitlin
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
13 #if defined( __VMS ) && defined( __ia64 )
14 // Work around for a bug in the C++ compiler on OpenVMS IA64
18 #include "wx/wxprec.h"
25 #include "wx/apptrait.h"
26 #include "wx/private/fdiomanager.h"
30 void wxSocket_GDK_Input(gpointer data
,
31 gint
WXUNUSED(source
),
32 GdkInputCondition condition
)
34 wxFDIOHandler
* const handler
= static_cast<wxFDIOHandler
*>(data
);
36 if ( condition
& GDK_INPUT_READ
)
38 handler
->OnReadWaiting();
40 // we could have lost connection while reading in which case we
41 // shouldn't call OnWriteWaiting() as the socket is now closed and it
43 if ( !handler
->IsOk() )
47 if ( condition
& GDK_INPUT_WRITE
)
48 handler
->OnWriteWaiting();
52 class GTKFDIOManager
: public wxFDIOManager
55 virtual int AddInput(wxFDIOHandler
*handler
, int fd
, Direction d
)
60 d
== OUTPUT
? GDK_INPUT_WRITE
: GDK_INPUT_READ
,
67 RemoveInput(wxFDIOHandler
* WXUNUSED(handler
), int fd
, Direction
WXUNUSED(d
))
73 wxFDIOManager
*wxGUIAppTraits::GetFDIOManager()
75 static GTKFDIOManager s_manager
;
79 #endif // wxUSE_SOCKETS