[comp.windows.x] displaying on multiple servers

kmeek@cti1.UUCP (Kevin Meek) (06/07/91)

I am learning X programming and am trying to figure out 
how to have an application open a widget on two different
display servers.   

I only have the basic MIT distribution -- no motif or open look.

I am using an example from the Nutshell sources  that I have been 
hacking on.  I get a bus error/ core dump when I run this.

Any suggestions/ tips / working examples of multi display programs,
would be greatly appreiciated.

BTW:  Is this the proper place to post this type of questions?
      It seemed like the most apropriate to me.

Kevin Meek
kmeek@cti.com

---- source that causes core dump.  -- I am running on an AT&T 3B2/600G 
---- System V 3.2.2 if that helps.

/*
 * xtwodisp.c
 */

/*
 * Include files required for all Toolkit programs
 */
#include <X11/Intrinsic.h>	/* Intrinsics Definitions */
#include <X11/StringDefs.h>	/* Standard Name-String definitions */

#include <X11/Shell.h>		/* Needed for applicationShellWidgetClass */

/*
 * Public include file for widgets we actually use in this file.
 */
#include <X11/Xaw/Label.h>		/* Athena Label Widget */

main(argc, argv)
int argc;
char **argv;
{
	XtAppContext app_con;
	Widget topLevel1, topLevel2, hello, goodbye;
	Display *display1, *display2;

	XtToolkitInitialize();

	app_con = XtCreateApplicationContext();

 	display1 = XtOpenDisplay(app_con, NULL, NULL, "XHello", NULL, 0, &argc, argv); 

	display2 = XtOpenDisplay(app_con, "kmeek.cti:0", NULL, "XGoodbye", NULL, 0, &argc, argv);

 	topLevel1 = XtAppCreateShell(app_con, "XHello", applicationShellWidgetClass, display1, NULL, 0); 

	topLevel2 = XtAppCreateShell(app_con, "XGoodbye", applicationShellWidgetClass, display2, NULL, 0);

	hello = XtCreateManagedWidget(
		"hello",		/* arbitrary widget name */
		labelWidgetClass,	/* widget class from Label.h */
		topLevel1,	/* parent widget*/
		NULL,		/* argument list */
		0		/* arg list size */
		);

	goodbye = XtCreateManagedWidget(
		"goodbye",		/* arbitrary widget name */
		labelWidgetClass,	/* widget class from Label.h */
		topLevel2,	/* parent widget*/
		NULL,		/* argument list */
		0		/* arg list size */
		);
	/*
	 *  Create windows for widgets and map them.
	 */
 	XtRealizeWidget(topLevel1); 
	XtRealizeWidget(topLevel2);

	/*
	 *  Loop for events.
	 */
	XtAppMainLoop(app_con);
}


-- 
Kevin Meek 
kmeek@cti.com

adrian@ora.com (Adrian Nye) (06/12/91)

< I am using an example from the Nutshell sources  that I have been 
< hacking on.  I get a bus error/ core dump when I run this.

The example was tested and worked on our systems.  I now work at home
so I don't have two servers to test your program (although it looks fine
to me).  Have you made sure
the system you are running the program on has permission to display on
both servers?

harkcom@spinach.pa.yokogawa.co.jp (Alton Harkcom) (06/12/91)

In article <1991Jun11.170626.20715@ora.com> adrian@ora.com (Adrian Nye) writes:

 =}< I am using an example from the Nutshell sources  that I have been 
 =}< hacking on.  I get a bus error/ core dump when I run this.
 =}
 =}The example was tested and worked on our systems.  I now work at home
 =}so I don't have two servers to test your program (although it looks fine
 =}to me).  Have you made sure
 =}the system you are running the program on has permission to display on
 =}both servers?

   The calls to XtAppCreateShell in the example posted are:

XtAppCreateShell(app_con, app_class, applicationShellWidgetClass, dpy, NULL, 0)
                 ^^^^^^^
They should be:

XtAppCreateShell("name", app_class, applicationShellWidgetClass, dpy, NULL, 0)

But other than that, the source was correct.


   I compiled and ran the same example on a Sun, HP, and Sony. The Sun
and Sony handled it, but the HP chokes on the second XtRealizeWidget...
(HP9000/400: HP_UX 7.03, Server=X11R4, libraries=X11R4)

   Anybody got any ideas as to why?

Al