Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!earth.cray.COM!jlf From: jlf@earth.cray.COM (John Freeman) Newsgroups: comp.windows.x Subject: Re: Question on XtAddInput Message-ID: <8902211641.AA21529@thelake.cray.com> Date: 21 Feb 89 16:41:22 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 49 > The documentation that I have concerning XtAddInput is not particularly > clear. > > XtInputId XtAddInput (source,condition,proc,client_data) > int source; > caddr_t condition; > XtInputCallbackProc proc; > caddr_t client_data; > > What is the condition? My documentation says "Specifies the mask > that indicates either a read, write, or exception condition or an operating > system dependent condition" Does this mean that it can be of type > XEventMask (e.g., KeyPressMask)? > No, it can't be an XEventMask, use XtAddEventHandler for that. According to Intrinsic.h, condition can be one of the following: typedef unsigned long XtInputMask; #define XtInputNoneMask 0L #define XtInputReadMask (1L<<0) #define XtInputWriteMask (1L<<1) #define XtInputExceptMask (1L<<2) > Secondly, can the source be of type FILE, e.g., stdin? If not, what is passed. > My documentation says that source "specifies the source file descriptor on a > dependent-device specification?" Source is an ordinary file descriptor, as returned from open() or pipe(). > > Thirdly, is there some example code that demonstrates the use of XtAddInput? int out_fd[2]; int read_dbx_pipe() {} main() { blah; blah; pipe(out_fd); /* * source is out_fd, condition is XtInputReadMask, proc is read_dbx_pipe */ XtAddInput(out_fd[0], XtInputReadMask, read_dbx_pipe, NULL); more blah; }