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 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
22 #include "wx/private/socket.h"
23 #include "wx/apptrait.h"
27 void wxSocket_GDK_Input(gpointer data
,
28 gint
WXUNUSED(source
),
29 GdkInputCondition condition
)
31 wxSocketImplUnix
* const handler
= static_cast<wxSocketImplUnix
*>(data
);
33 if ( condition
& GDK_INPUT_READ
)
35 handler
->OnReadWaiting();
37 // we could have lost connection while reading in which case we
38 // shouldn't call OnWriteWaiting() as the socket is now closed and it
40 if ( handler
->m_fd
== INVALID_SOCKET
)
44 if ( condition
& GDK_INPUT_WRITE
)
45 handler
->OnWriteWaiting();
49 class GTKSocketManager
: public wxSocketInputBasedManager
52 virtual int AddInput(wxSocketImplUnix
*handler
, int fd
, SocketDir d
)
57 d
== FD_OUTPUT
? GDK_INPUT_WRITE
: GDK_INPUT_READ
,
63 virtual void RemoveInput(int fd
)
69 wxSocketManager
*wxGUIAppTraits::GetSocketManager()
71 static GTKSocketManager s_manager
;
75 #endif // wxUSE_SOCKETS