]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/gsockmot.cpp
1 // -------------------------------------------------------------------------
2 // Project: GSocket (Generic Socket) for WX
4 // Purpose: GSocket: Motif part
6 // -------------------------------------------------------------------------
13 #include <X11/Intrinsic.h>
14 #include <wx/gsocket.h>
16 #include <wx/unix/gsockunx.h>
18 #define wxAPP_CONTEXT ((XtAppContext)wxTheApp->GetAppContext())
20 static void _GSocket_Motif_Input(XtPointer data
, int *fid
,
23 GSocket
*socket
= (GSocket
*)data
;
25 _GSocket_Detected_Read(socket
);
28 static void _GSocket_Motif_Output(XtPointer data
, int *fid
,
31 GSocket
*socket
= (GSocket
*)data
;
33 _GSocket_Detected_Write(socket
);
36 void _GSocket_GUI_Init(GSocket
*socket
)
41 socket
->m_gui_dependent
= (char *)malloc(sizeof(int)*3);
42 m_id
= (int *)(socket
->m_gui_dependent
);
48 void _GSocket_GUI_Destroy(GSocket
*socket
)
53 m_id
= (int *)(socket
->m_gui_dependent
);
57 XtRemoveInput(m_id
[i
]);
59 free(socket
->m_gui_dependent
);
62 void _GSocket_Install_Callback(GSocket
*socket
, GSocketEvent event
)
66 m_id
= (int *)(socket
->m_gui_dependent
);
69 case GSOCK_CONNECTION
:
73 XtRemoveInput(m_id
[0]);
74 m_id
[0] = XtAppAddInput(wxAPP_CONTEXT
, socket
->m_fd
,
75 (XtPointer
*)XtInputReadMask
,
76 (XtInputCallbackProc
) _GSocket_Motif_Input
,
81 XtRemoveInput(m_id
[1]);
82 m_id
[1] = XtAppAddInput(wxAPP_CONTEXT
, socket
->m_fd
,
83 (XtPointer
*)XtInputWriteMask
,
84 (XtInputCallbackProc
) _GSocket_Motif_Output
,
91 void _GSocket_Uninstall_Callback(GSocket
*socket
, GSocketEvent event
)
96 m_id
= (int *)(socket
->m_gui_dependent
);
99 case GSOCK_CONNECTION
:
101 case GSOCK_INPUT
: c
= 0; break;
102 case GSOCK_OUTPUT
: c
= 1; break;
108 XtRemoveInput(m_id
[c
]);
113 unsigned long GSocket_GetEventID(GSocket
*socket
)
118 void GSocket_DoEvent(unsigned long evt_id
)
122 #endif // wxUSE_SOCKETS