]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/sockgtk.cpp
fix wxGTK1 compilation after wxTextEntry DoGetValue() change
[wxWidgets.git] / src / gtk1 / sockgtk.cpp
CommitLineData
2804f77d
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: gtk/gsockgtk.cpp
3// Purpose: implementation of wxGTK-specific socket event handling
4// Author: Guilhem Lavaux, Vadim Zeitlin
5// Created: 1999
6// RCS-ID: $Id$
7// Copyright: (c) 1999, 2007 wxWidgets dev team
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
9b5f1895
WS
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
180f9714
DE
13
14#if wxUSE_SOCKETS
15
180f9714
DE
16#include <stdlib.h>
17#include <stdio.h>
18
19#include <gdk/gdk.h>
20#include <glib.h>
21
60913641 22#include "wx/private/socket.h"
2804f77d 23#include "wx/apptrait.h"
180f9714 24
865bb325
VZ
25extern "C" {
26static
51fe4b60 27void wxSocket_GDK_Input(gpointer data,
89954433 28 gint WXUNUSED(source),
180f9714
DE
29 GdkInputCondition condition)
30{
a9d859df 31 wxFDIOHandler * const handler = static_cast<wxFDIOHandler *>(data);
180f9714 32
a9d859df
VZ
33 if ( condition & GDK_INPUT_READ )
34 handler->OnReadWaiting();
35 if ( condition & GDK_INPUT_WRITE )
36 handler->OnWriteWaiting();
180f9714 37}
865bb325 38}
180f9714 39
51fe4b60 40class GTKSocketManager : public wxSocketInputBasedManager
180f9714 41{
2804f77d 42public:
a9d859df 43 virtual int AddInput(wxFDIOHandler *handler, int fd, SocketDir d)
2804f77d
VZ
44 {
45 return gdk_input_add
46 (
a9d859df 47 fd,
2804f77d 48 d == FD_OUTPUT ? GDK_INPUT_WRITE : GDK_INPUT_READ,
51fe4b60 49 wxSocket_GDK_Input,
a9d859df 50 handler
2804f77d
VZ
51 );
52 }
53
54 virtual void RemoveInput(int fd)
55 {
56 gdk_input_remove(fd);
57 }
58};
59
51fe4b60 60wxSocketManager *wxGUIAppTraits::GetSocketManager()
180f9714 61{
2804f77d
VZ
62 static GTKSocketManager s_manager;
63 return &s_manager;
180f9714
DE
64}
65
2804f77d 66#endif // wxUSE_SOCKETS