]>
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 // -------------------------------------------------------------------------
8 #include <X11/Intrinsic.h>
9 #include <wx/gsocket.h>
11 #include "../unix/gsockunx.h"
13 #define wxAPP_CONTEXT ((XtAppContext)wxTheApp->GetAppContext())
15 static void _GSocket_Motif_Input(XtPointer data
, int *fid
,
18 GSocket
*socket
= (GSocket
*)data
;
20 _GSocket_Detected_Read(socket
);
23 static void _GSocket_Motif_Output(XtPointer data
, int *fid
,
26 GSocket
*socket
= (GSocket
*)data
;
28 _GSocket_Detected_Write(socket
);
31 void _GSocket_GUI_Init(GSocket
*socket
)
36 socket
->m_gui_dependent
= (char *)malloc(sizeof(int)*3);
37 m_id
= (int *)(socket
->m_gui_dependent
);
43 void _GSocket_GUI_Destroy(GSocket
*socket
)
48 m_id
= (int *)(socket
->m_gui_dependent
);
52 XtRemoveInput(m_id
[i
]);
54 free(socket
->m_gui_dependent
);
57 void _GSocket_Install_Fallback(GSocket
*socket
, GSocketEvent event
)
61 m_id
= (int *)(socket
->m_gui_dependent
);
64 case GSOCK_CONNECTION
:
68 XtRemoveInput(m_id
[0]);
69 m_id
[0] = XtAppAddInput(wxAPP_CONTEXT
, socket
->m_fd
,
70 (XtPointer
*)XtInputReadMask
,
71 (XtInputCallbackProc
) _GSocket_Motif_Input
,
76 XtRemoveInput(m_id
[1]);
77 m_id
[1] = XtAppAddInput(wxAPP_CONTEXT
, socket
->m_fd
,
78 (XtPointer
*)XtInputWriteMask
,
79 (XtInputCallbackProc
) _GSocket_Motif_Output
,
86 void _GSocket_Uninstall_Fallback(GSocket
*socket
, GSocketEvent event
)
91 m_id
= (int *)(socket
->m_gui_dependent
);
94 case GSOCK_CONNECTION
:
96 case GSOCK_INPUT
: c
= 0; break;
97 case GSOCK_OUTPUT
: c
= 1; break;
103 XtRemoveInput(m_id
[c
]);
108 unsigned long GSocket_GetEventID(GSocket
*socket
)
113 void GSocket_DoEvent(unsigned long evt_id
)