1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: gtk/gsockgtk.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".
13 #include "wx/wxprec.h"
17 #include "wx/apptrait.h"
18 #include "wx/private/fdiomanager.h"
24 void wxSocket_GDK_Input(gpointer data
,
25 gint
WXUNUSED(source
),
26 GdkInputCondition condition
)
28 wxFDIOHandler
* const handler
= static_cast<wxFDIOHandler
*>(data
);
30 if ( condition
& GDK_INPUT_READ
)
32 handler
->OnReadWaiting();
34 // we could have lost connection while reading in which case we
35 // shouldn't call OnWriteWaiting() as the socket is now closed and it
37 if ( !handler
->IsOk() )
41 if ( condition
& GDK_INPUT_WRITE
)
42 handler
->OnWriteWaiting();
46 class GTKFDIOManager
: public wxFDIOManager
49 virtual int AddInput(wxFDIOHandler
*handler
, int fd
, Direction d
)
54 d
== OUTPUT
? GDK_INPUT_WRITE
: GDK_INPUT_READ
,
61 RemoveInput(wxFDIOHandler
* WXUNUSED(handler
), int fd
, Direction
WXUNUSED(d
))
67 wxFDIOManager
*wxGUIAppTraits::GetFDIOManager()
69 static GTKFDIOManager s_manager
;
73 #endif // wxUSE_SOCKETS