habibi@rainbow.ecn.purdue.edu (Shidan Habibi) (11/06/90)
I previously posted: > I have just moved from a networked SUN 3/50s > (Sun OS 4.0.3; running twm, X11R4 backward > compatible with R3)to networked DEC 3100s > (ultrix; running DecWindows, X11R3). > I am attempting to run an X application on > the DECS which I had developed on the SUNs. > > Does anyone out there know how I must set up my > environment in ultrix so that my X program > behaves the same as it did before on > the SUNs. I am using the Athena widget set. I wrote a small sample program (testcom.c) to illustrate my problem. testcom.c uses a single client server with multiple displays. In other words, testcom.c accesses other workstation displays. You can compile this program as is and see what it does. To get the program running, I compile it with this: cc -g testcom.c -lXaw -lXmu -lXt -lX11 I successfully ran testcom.c under X11R4 (backward compatible with R3) on SUN 3/50, 3/60 and SPARCstations. Note: The Athena text widgets in testcom.c are X11R3. I am now trying to run testcom.c on DEC 3100, Ultrix, X11R3. However, I have been having problems with it. When I just have label widgets, everything works great, just like it works on the SUNs, i.e. I can open different displays. When I add any other type of widget, I can open the same display multiple times, but not different displays. You can test this out by commenting out all the widgets except the label widget. Note: The host for the application is named mickey. The remote display is located on goofy. Also mickey has already been added to goofy's access host list. This is what happens when it tries to access the display: (mickey /usr/users/habibi/Gdss][5] a.out Enter number of participants: 1 Enter name of display 1 : goofy:0 X Protocol error detected by server: parameter not a Cursor Failed request major op code 1 X_CreateWindow Failed request minor op code 0 (if applicable) ResourceID 0x600007 in failed request (if applicable) Serial number of failed request 78 Current serial number in output stream 101 Just before the above error appears, the application appears for an extremely short period of time on goofy's display. I am desperate for help. I would appreciate any advice. Please send any responses to: habibi@ecn.purdue.edu If there is an interest, I will post a summary of the responses. Thanks in advance. Shidan Habibi __________________________________________________________ Shidan Habibi habibi@ecn.purdue.edu Graduate student home (317) 495-1183 Purdue University work (317) 494-0438 School of Industrial Eng. __________________________________________________________ %<----cut here-------------------------------------------------------- #define XAW_BC /* To make it R4 compatible */ #include <string.h> #include <ctype.h> #include <stdio.h> #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <mit/X11/AsciiText.h> #include <mit/X11/Box.h> #include <mit/X11/Command.h> #include <X11/Composite.h> #include <X11/Shell.h> #include <mit/X11/Dialog.h> #include <mit/X11/Form.h> #include <mit/X11/Label.h> #include <mit/X11/Text.h> /*_______________ Macros to describe commonly used procedures ______*/ #define DISPLAY XtDisplay( top_level_widget ) #define SCREEN DefaultScreen( DISPLAY ) #define WHITEPIX WhitePixel( DISPLAY, SCREEN ) #define BLACKPIX BlackPixel( DISPLAY, SCREEN ) #define ARGS( xtn, val ) ( XtSetArg( arglist[argcnt], xtn, val ), \ argcnt++ ) /*________________ Symbolic constants _________________________*/ #define MAXIMUM_NUMBER_OF_PARTICIPANTS 10 #define STRING_WIDGET_ARRAY_LENGTH 2000 void dummy_function(); /* Captures a button press and does nothing. */ /*____________________ Variable and Array declarations ___________*/ /* Address to the various displays */ Display *display[MAXIMUM_NUMBER_OF_PARTICIPANTS]; /* For screen set up */ int default_depth[MAXIMUM_NUMBER_OF_PARTICIPANTS]; /* For screen set up */ int default_screen[MAXIMUM_NUMBER_OF_PARTICIPANTS]; char question_string[STRING_WIDGET_ARRAY_LENGTH]; /* Length of entered question by facilitator */ /* Name of the display screens */ char display_name[MAXIMUM_NUMBER_OF_PARTICIPANTS][20]; /* Top widget */ Widget top_level_widget[MAXIMUM_NUMBER_OF_PARTICIPANTS]; /* One below the top */ Widget top_level_child_widget[MAXIMUM_NUMBER_OF_PARTICIPANTS]; /* Used to indicate parent widgets */ Widget parent; /* Name of widgets */ Widget w[MAXIMUM_NUMBER_OF_PARTICIPANTS][200]; /* Number of participants using the system */ int no_of_participants; int argcnt; Arg arglist[15]; main( argc, argv ) int argc; char *argv[15]; { int i; Widget topLevel, Label; printf("Enter number of participants: "); scanf("%d", &no_of_participants); /* get display names */ for(i=1; i<no_of_participants+1; i++) { printf("Enter name of display %d : ", i); scanf("%s", display_name[i]); } /* Creat the top level widget */ top_level_widget[0] = XtInitialize( "Test", "test", NULL, 0, &argc, argv ); parent = top_level_child_widget[0] = XtCreateManagedWidget( "top_level_child_widget", formWidgetClass, top_level_widget[0], arglist, argcnt ); /* Set the display to the corresponding toplevel */ display[0] = XtDisplay( top_level_widget[0] ); default_screen[0] = DefaultScreen( display[0] ); default_depth[0] = DefaultDepth( display[0], default_screen[0] ); /* The label for the group discussion monitor widget */ parent = top_level_child_widget[0]; argcnt = 0; ARGS( XtNborderWidth, 1 ); ARGS (XtNhorizDistance,10); ARGS (XtNwidth, 300); ARGS (XtNheight, 300); w[0][32] = XtCreateManagedWidget (" Main window ", labelWidgetClass, parent, arglist, argcnt); /* Get the pointers to all the display terminals */ /* And Creat the top level widget for that display */ /* And loop and create the same widgets for all the displays */ for(i=1; i<no_of_participants+1; i++) { display[i] = XtOpenDisplay( XtWidgetToApplicationContext(top_level_widget[0]), display_name[i], "GDSS", "gdss", NULL, 0, &argc, argv ); argcnt = 0; parent = top_level_widget[i] = XtAppCreateShell( "Test", "test", applicationShellWidgetClass, display[i], arglist, argcnt ); /* Set the display to the corresponding toplevel */ display[i] = XtDisplay( top_level_widget[i] ); default_screen[i] = DefaultScreen( display[i] ); default_depth[i] = DefaultDepth( display[i], default_screen[i] ); /* Create a child to the top level */ top_level_child_widget[i] = XtCreateManagedWidget( "top_level_child_widget", formWidgetClass, parent, arglist, argcnt ); /* Create the form widget to put the text widgets in the EBS tool. */ parent = top_level_child_widget[i]; argcnt = 0; ARGS( XtNdefaultDistance, 5 ); ARGS( XtNborderWidth, 0 ); w[i][1] = XtCreateManagedWidget( "address_form", formWidgetClass, parent, arglist, argcnt ); /* The label widget */ parent = w[i][1]; argcnt = 0; ARGS( XtNborderWidth, 3 ); ARGS (XtNwidth, 300); ARGS (XtNheight, 150); w[i][101] = XtCreateManagedWidget (" Hello World ", labelWidgetClass, parent, arglist, argcnt); /* Create the text widget asciiString */ argcnt = 0; ARGS( XtNborderWidth, 3 ); ARGS( XtNeditType, XttextEdit ); ARGS( XtNfromVert, w[i][101] ); ARGS (XtNhorizDistance,10); ARGS (XtNvertDistance,5); ARGS( XtNheight, 100 ); ARGS( XtNwidth, 300 ); ARGS( XtNstring, question_string ); ARGS( XtNlength, STRING_WIDGET_ARRAY_LENGTH ); ARGS( XtNtextOptions, editable | wordBreak | scrollOnOverflow ); w[i][8] = XtCreateManagedWidget( "", asciiStringWidgetClass, parent, arglist, argcnt ); /* Command widget */ argcnt = 0; ARGS( XtNborderWidth, 2 ); ARGS( XtNlabel, " Command Widget " ); ARGS (XtNfromVert, w[i][8]); ARGS (XtNhorizDistance,10); ARGS (XtNvertDistance,10); w[i][3] = XtCreateManagedWidget( "command widget", commandWidgetClass, parent, arglist, argcnt ); XtAddCallback ( w[i][3], XtNcallback, dummy_function, 3 ); } /* end for */ /* Realize (show) the widgets */ for (i=0; i<no_of_participants+1; i++) XtRealizeWidget(top_level_widget[i]); XtMainLoop (); } void dummy_function( wid, clientData, callData ) Widget wid; /* button widget getting the button press */ int clientData; /* Button number which was pressed */ caddr_t callData; /* unused */ { printf("clientData = %d\n ", clientData); } /* end dummy_function */ /******************************** * * * End of file testcom.c * * * ********************************/