Re: Question on Externals

Jim Cardinal (starnet!apple!chetan.eng.ohio-state.edu!cardinal)
Sat, 14 Jan 1995 20:32:29 -0500

>> i have gone through the tutorials and see how XtTemplate.c and External.c
>> basically work. thus, i am trying to use an external C program to launch
>> metacard, etc. much like the XT demo. however, the twist I have is that i
>> want metacard to make a couple function calls back to the C program, like
>> the external.c demo. i guess i want the functionality of both. is there an
>> easy way to modify the two sets of files to do this.
>
>To be honest, I don't know if you can do this or not. The interface
>certainly wasn't designed to support this, but since the protocols are
>the same for the Xt communcation and the external communication, it
>should be possible to have both kinds work with an Xt application.
>Some low level hacking of the XtGlue.c file would be required,
>however.
>
>
thanks for your reply. i was able to hack the code from the XCmdGlue.c and
XtGlue.c files together to provide the bi-directional functionality. FYI,
having the code commented a little would have eased my frustrations with
figuring it out and saved a lot of time.

>PS: I'll put support for bidirectional communcation with the Xt
>application on the feature request list for the 2.0 release.
>
the aspect that made the communication difficult was that metacard will
watch for property changes on the window specified by the "-w" switch, but
it will only "post" property changes for metacard function/command calls to
its own window (which is used in the external.c demo). thus my hacked code
has to watch for property events on two windows. the first is the window
which is specified by the X/external Application through the "-w" command
option. the second is the metacard window itself. to get the metacard
window,
1. start up X in my app and pass the first window via the "-w" option
2. start metacard - - which will watch the "-w" specified window
3. get the windowid property from metacard (either by passing a global or
evalexpr)
4. set the external app to watch the metacard window also (using XSelectInput)
- - for external function/command calls.

thus, on the request list, it should be put that the "-w" option specifies
the place that all X-window properties are modified and watched for by
metacard.

-jim

*******************************************************************
* James M. Cardinal *
* Graduate Research Associate *
* Life-Cycle Design Lab & ERC/NSM, The Ohio-State University *
* Phone: (614) 292 - 2849 *
*******************************************************************