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".
13 #include "wx/wxprec.h"
20 #include "wx/apptrait.h"
21 #include "wx/private/fdiomanager.h"
25 void wxSocket_GDK_Input(gpointer data
,
26 gint
WXUNUSED(source
),
27 GdkInputCondition condition
)
29 wxFDIOHandler
* const handler
= static_cast<wxFDIOHandler
*>(data
);
31 if ( condition
& GDK_INPUT_READ
)
33 handler
->OnReadWaiting();
35 // we could have lost connection while reading in which case we
36 // shouldn't call OnWriteWaiting() as the socket is now closed and it
38 if ( !handler
->IsOk() )
42 if ( condition
& GDK_INPUT_WRITE
)
43 handler
->OnWriteWaiting();
47 class GTKFDIOManager
: public wxFDIOManager
50 virtual int AddInput(wxFDIOHandler
*handler
, int fd
, Direction d
)
55 d
== OUTPUT
? GDK_INPUT_WRITE
: GDK_INPUT_READ
,
62 RemoveInput(wxFDIOHandler
* WXUNUSED(handler
), int fd
, Direction
WXUNUSED(d
))
68 wxFDIOManager
*wxGUIAppTraits::GetFDIOManager()
70 static GTKFDIOManager s_manager
;
74 #endif // wxUSE_SOCKETS