[comp.windows.x] Sending a string to another Window using DECWindows

samuels@phoenix.Princeton.EDU (Mark E Samuels) (06/30/89)

Is it possible in X or Decwindows to send a string to the window of
another client and have that client read the string as if it had been
typed from the keyboard?  For example, if a command line based program
that knows nothing about X  windows is running in a terminal emulator
window(call this client #1) and client #2 is a program that wishes to
send client #1 a command, could client #2 send a string to client #1 and
have client #1 read it as if it had been typed into it's command window?
The goal is to put a graphical interface on top of an existing command
based application.  I am working in a VMS environment but am searching
for a solution which is not dependent on the operating system. Thanks
very much for your ideas in advance.

		- Gregg Reno (posting on samuels account) 

karlton@fudge.sgi.com (Phil Karlton) (07/06/89)

In article <9228@phoenix.Princeton.EDU> samuels@phoenix.Princeton.EDU (Mark E Samuels) writes:
>Is it possible in X or Decwindows to send a string to the window of
>another client and have that client read the string as if it had been
>typed from the keyboard?

Well, anything is possible. Some things are just easier or more effecient
than others.

>For example, if a command line based program
>that knows nothing about X  windows is running in a terminal emulator
>window(call this client #1) and client #2 is a program that wishes to
>send client #1 a command, could client #2 send a string to client #1 and
>have client #1 read it as if it had been typed into it's command window?

One way that will probably work is to cons up some KeyPress events and
SendEvent them to the terminal emulator window. Unless you are careful
(or have some a priori knowledege about the encodings supported by the
terminal emualator) this tack will not be very portable to an international
environment. There may also be a performance penalty of having to fake
passing an string as a sequence of keyboard events. The terminal emulator
will have to have been configured to not strip out events with the
"SendEvent" bit turned on.

Another choice would be to SendEvent a ClientMessage event that specifically
meant to "insert string". The current ICCCM does not define such a
ClientMessage. (In fact there is no section on peer-to-peer communication
using ClientMessages.) When that does happen, no doubt versions of
ClientMessages will be defined that include the "string" internal to the
message as well as ones that indirect through a property.

If it is possible that the user will be directing the transfer of information,
then it should be fairly straightforward to use the standard Selection
mechanism and have the terminal emulator "pull" the value from client #2
rather than "pushing" it when the emulator least expects it.

PK

klee@gilroy.pa.dec.com (Ken Lee) (07/06/89)

In article <9228@phoenix.Princeton.EDU>, samuels@phoenix.Princeton.EDU (Mark E Samuels) writes:
> Is it possible in X or Decwindows to send a string to the window of
> another client and have that client read the string as if it had been
> typed from the keyboard? 

Try forking off the non-X program from an X client, then communicate
with it with pipes or sockets.  Most of the public domain X-based mail,
dbx, etc. front ends do this.

Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@decwrl.dec.com
Uucp: uunet!decwrl!klee