JONES@WHARTON.UPENN.EDU (02/21/89)
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)? 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?" Thirdly, is there some example code that demonstrates the use of XtAddInput? Finally, once one sets up put handler correctly, if one calls XtNextEvent, when an input event occurs, what type of event does XtNextEvent return? I am interested in this because I need to interleave standard input from the terminal (via xterm) with some widget events. I'm running X11 R2 on an IBM RT running AIX version 2.2.1. Thanks. Chris Jones The Wharton School The University of Pennsylvania Philadelphia, PA 19104 215-898-7290 JONES@WHARTON.UPENN.EDU
jlf@earth.cray.COM (John Freeman) (02/22/89)
> 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; }
asente@decwrl.dec.com (Paul Asente) (02/22/89)
In article <8902211446.AA26070@remote.dccs.upenn.edu> JONES@WHARTON.UPENN.EDU writes: > [Many questions about XtAddInput] I suggest before you go too far you get yourself the latest documentation. The quotes you gave were from the R2 intrinsics spec. In brief, the source for XtAddInput, on Unix systems, is a file descriptor. -paul asente asente@decwrl.dec.com decwrl!asente