]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/sockgtk.cpp
Disable handling of wxEVT_MOUSEWHEEL in wxVarScrollHelperEvtHandler in wxGTK.
[wxWidgets.git] / src / gtk1 / sockgtk.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk1/sockgtk.cpp
3 // Purpose: implementation of wxGTK-specific socket event handling
4 // Author: Guilhem Lavaux, Vadim Zeitlin
5 // Created: 1999
6 // Copyright: (c) 1999, 2007 wxWidgets dev team
7 // (c) 2009 Vadim Zeitlin
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12
13 #if defined( __VMS ) && defined( __ia64 )
14 // Work around for a bug in the C++ compiler on OpenVMS IA64
15 # include <time.h>
16 #endif
17
18 #include "wx/wxprec.h"
19
20 #if wxUSE_SOCKETS
21
22 #include <gdk/gdk.h>
23 #include <glib.h>
24
25 #include "wx/apptrait.h"
26 #include "wx/private/fdiomanager.h"
27
28 extern "C" {
29 static
30 void wxSocket_GDK_Input(gpointer data,
31 gint WXUNUSED(source),
32 GdkInputCondition condition)
33 {
34 wxFDIOHandler * const handler = static_cast<wxFDIOHandler *>(data);
35
36 if ( condition & GDK_INPUT_READ )
37 {
38 handler->OnReadWaiting();
39
40 // we could have lost connection while reading in which case we
41 // shouldn't call OnWriteWaiting() as the socket is now closed and it
42 // would assert
43 if ( !handler->IsOk() )
44 return;
45 }
46
47 if ( condition & GDK_INPUT_WRITE )
48 handler->OnWriteWaiting();
49 }
50 }
51
52 class GTKFDIOManager : public wxFDIOManager
53 {
54 public:
55 virtual int AddInput(wxFDIOHandler *handler, int fd, Direction d)
56 {
57 return gdk_input_add
58 (
59 fd,
60 d == OUTPUT ? GDK_INPUT_WRITE : GDK_INPUT_READ,
61 wxSocket_GDK_Input,
62 handler
63 );
64 }
65
66 virtual void
67 RemoveInput(wxFDIOHandler* WXUNUSED(handler), int fd, Direction WXUNUSED(d))
68 {
69 gdk_input_remove(fd);
70 }
71 };
72
73 wxFDIOManager *wxGUIAppTraits::GetFDIOManager()
74 {
75 static GTKFDIOManager s_manager;
76 return &s_manager;
77 }
78
79 #endif // wxUSE_SOCKETS