home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!news.ans.net!cmcl2!adm!news
- From: leec@leland.stanford.edu (Christopher Lee)
- Newsgroups: comp.sys.sgi
- Subject: how to send KeyEvents to xwsh on SGI?
- Message-ID: <34592@adm.brl.mil>
- Date: 12 Dec 92 13:17:31 GMT
- Sender: news@adm.brl.mil
- Lines: 35
-
- I want to use the Xlib SendEvent() call to send text to an xwsh, such
- that xwsh interprets this just as if a user had typed the text in the xwsh.
- I have tried the obvious... and it indeed works sending text to my own
- X applications, but not to xwsh! Here is the basic idea of what I've
- tried:
-
- XKeyEvent xpress={KeyPress},xrel={KeyRelease};
- dpy=XOpenDisplay(0);
- if (!dpy) {
- fprintf(stderr, "No connection to X server, check setting of environment's \\$DISPLAY.\n");
- exit(-1);
- }
-
- xpress.display=xrel.display=dpy;
- xpress.window=xrel.window=xpress.root=xrel.root=
- xpress.subwindow=xrel.subwindow=target;
-
- while (EOF!=(i=getchar())) {
- xpress.keycode=xrel.keycode=XKeysymToKeycode(dpy,(KeySym)i);
- XSendEvent(dpy,target,False,0,&xpress); /* PRESS THE KEY */
- XSendEvent(dpy,target,False,0,&xrel); /* RELEASE IT*/
- XFlush(dpy);
- }
-
- Do I need to do some fancy setting of the XKeyEvent member data to convince
- xwsh that the event should really be paid attention to? Do the .x .y fields
- matter? etc.
-
- What I am *really* trying to do is be able to pipe input to drive a terminal
- just as if a user had typed some commands. Any advice on this would be
- appreciated!
-
- Thanks!
-
- Chris Lee
-