1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
4 * Purpose: GSocket: GTK part
6 * -------------------------------------------------------------------------
15 #include "wx/gsocket.h"
16 #include "../unix/gsockunx.h"
18 void _GSocket_GDK_Input(gpointer data
, gint source
, GdkInputCondition condition
)
20 GSocket
*socket
= (GSocket
*)data
;
24 _GSocket_Detected_Read(socket
);
27 _GSocket_Detected_Write(socket
);
34 void _GSocket_GUI_Init(GSocket
*socket
)
39 socket
->m_gui_dependent
= (char *)malloc(sizeof(gint
)*3);
40 m_id
= (gint
*)(socket
->m_gui_dependent
);
46 void _GSocket_GUI_Destroy(GSocket
*socket
)
51 m_id
= (gint
*)(socket
->m_gui_dependent
);
55 gdk_input_remove(m_id
[i
]);
57 free(socket
->m_gui_dependent
);
60 void _GSocket_Install_Callback(GSocket
*socket
, GSocketEvent event
)
62 GdkInputCondition flag
;
66 m_id
= (gint
*)(socket
->m_gui_dependent
);
69 case GSOCK_CONNECTION
:
71 case GSOCK_INPUT
: c
= 0; flag
= GDK_INPUT_READ
; break;
72 case GSOCK_OUTPUT
: c
= 1;flag
= GDK_INPUT_WRITE
; break;
77 gdk_input_remove(m_id
[c
]);
79 m_id
[c
] = gdk_input_add(socket
->m_fd
, flag
,
80 _GSocket_GDK_Input
, (gpointer
)socket
);
83 void _GSocket_Uninstall_Callback(GSocket
*socket
, GSocketEvent event
)
88 m_id
= (gint
*)(socket
->m_gui_dependent
);
91 case GSOCK_CONNECTION
:
93 case GSOCK_INPUT
: c
= 0; break;
94 case GSOCK_OUTPUT
: c
= 1; break;
99 gdk_input_remove(m_id
[c
]);
104 unsigned long GSocket_GetEventID(GSocket
*socket
)
109 void GSocket_DoEvent(unsigned long evt_id
)
113 #endif /* wxUSE_SOCKETS */