]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/gsockgtk.cpp
remove old thread debugging code
[wxWidgets.git] / src / gtk / gsockgtk.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
22#include "wx/gsocket.h"
2804f77d 23#include "wx/apptrait.h"
180f9714 24
865bb325
VZ
25extern "C" {
26static
180f9714 27void _GSocket_GDK_Input(gpointer data,
e4161a2a 28 gint WXUNUSED(source),
180f9714
DE
29 GdkInputCondition condition)
30{
31 GSocket *socket = (GSocket *)data;
32
33 if (condition & GDK_INPUT_READ)
0a647691 34 socket->Detected_Read();
180f9714 35 if (condition & GDK_INPUT_WRITE)
0a647691 36 socket->Detected_Write();
180f9714 37}
865bb325 38}
180f9714 39
2804f77d 40class GTKSocketManager : public GSocketInputBasedManager
180f9714 41{
2804f77d
VZ
42public:
43 virtual int AddInput(GSocket *socket, SocketDir d)
44 {
45 return gdk_input_add
46 (
47 socket->m_fd,
48 d == FD_OUTPUT ? GDK_INPUT_WRITE : GDK_INPUT_READ,
49 _GSocket_GDK_Input,
50 socket
51 );
52 }
53
54 virtual void RemoveInput(int fd)
55 {
56 gdk_input_remove(fd);
57 }
58};
59
60GSocketManager *wxGUIAppTraits::GetSocketManager()
180f9714 61{
2804f77d
VZ
62 static GTKSocketManager s_manager;
63 return &s_manager;
180f9714
DE
64}
65
a59bbda1 66#endif // wxUSE_SOCKETS