1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
4 * Purpose: GSocket: GTK part
6 * -------------------------------------------------------------------------
11 #include <wx/gsocket.h>
12 #include "../unix/gsockunx.h"
14 void _GSocket_GDK_Input(gpointer data
, gint source
, GdkInputCondition condition
)
16 GSocket
*socket
= (GSocket
*)data
;
20 _GSocket_Detected_Read(socket
);
23 _GSocket_Detected_Write(socket
);
30 void _GSocket_GUI_Init(GSocket
*socket
)
35 socket
->m_gui_dependent
= (char *)malloc(sizeof(gint
)*3);
36 m_id
= (gint
*)(socket
->m_gui_dependent
);
42 void _GSocket_GUI_Destroy(GSocket
*socket
)
47 m_id
= (gint
*)(socket
->m_gui_dependent
);
51 gdk_input_remove(m_id
[i
]);
53 free(socket
->m_gui_dependent
);
56 void _GSocket_Install_Fallback(GSocket
*socket
, GSocketEvent event
)
58 GdkInputCondition flag
;
62 m_id
= (gint
*)(socket
->m_gui_dependent
);
65 case GSOCK_CONNECTION
:
67 case GSOCK_INPUT
: c
= 0; flag
= GDK_INPUT_READ
; break;
68 case GSOCK_OUTPUT
: c
= 1;flag
= GDK_INPUT_WRITE
; break;
73 gdk_input_remove(m_id
[c
]);
75 m_id
[c
] = gdk_input_add(socket
->m_fd
, flag
,
76 _GSocket_GDK_Input
, (gpointer
)socket
);
79 void _GSocket_Uninstall_Fallback(GSocket
*socket
, GSocketEvent event
)
84 m_id
= (gint
*)(socket
->m_gui_dependent
);
87 case GSOCK_CONNECTION
:
89 case GSOCK_INPUT
: c
= 0; break;
90 case GSOCK_OUTPUT
: c
= 1; break;
95 gdk_input_remove(m_id
[c
]);
100 unsigned long GSocket_GetEventID(GSocket
*socket
)
105 void GSocket_DoEvent(unsigned long evt_id
)