1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk1/sockgtk.cpp
3 // Purpose: implementation of wxGTK-specific socket event handling
4 // Author: Guilhem Lavaux, Vadim Zeitlin
7 // Copyright: (c) 1999, 2007 wxWidgets dev team
8 // (c) 2009 Vadim Zeitlin
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
14 #if defined( __VMS ) && defined( __ia64 )
15 // Work around for a bug in the C++ compiler on OpenVMS IA64
19 #include "wx/wxprec.h"
26 #include "wx/apptrait.h"
27 #include "wx/private/fdiomanager.h"
31 void wxSocket_GDK_Input(gpointer data
,
32 gint
WXUNUSED(source
),
33 GdkInputCondition condition
)
35 wxFDIOHandler
* const handler
= static_cast<wxFDIOHandler
*>(data
);
37 if ( condition
& GDK_INPUT_READ
)
39 handler
->OnReadWaiting();
41 // we could have lost connection while reading in which case we
42 // shouldn't call OnWriteWaiting() as the socket is now closed and it
44 if ( !handler
->IsOk() )
48 if ( condition
& GDK_INPUT_WRITE
)
49 handler
->OnWriteWaiting();
53 class GTKFDIOManager
: public wxFDIOManager
56 virtual int AddInput(wxFDIOHandler
*handler
, int fd
, Direction d
)
61 d
== OUTPUT
? GDK_INPUT_WRITE
: GDK_INPUT_READ
,
68 RemoveInput(wxFDIOHandler
* WXUNUSED(handler
), int fd
, Direction
WXUNUSED(d
))
74 wxFDIOManager
*wxGUIAppTraits::GetFDIOManager()
76 static GTKFDIOManager s_manager
;
80 #endif // wxUSE_SOCKETS