|
#include <stdio.h> /* For printf and so on. */
#ifdef VMS
#include <decw$include/DwtAppl.h> /* DECwindows Toolkit */
#else
#include <X11/DwtAppl.h> /* DECwindows Toolkit */
#endif
/*
* Forward declarations
*/
void create_proc();
void push_proc();
void expose_proc();
/* The names and addresses of things that DRM has to bind. The names do
* not have to be in alphabetical order. */
DRMHierarchy s_DRMHierarchy; /* DRM database hierarchy ID */
DRMType *dummy_class; /* and class variable. */
char *db_filename_vec[] = /* DRM heirachy file list. */
{"test.uid" /* There is only one UID file for */
}; /* this application. */
int db_filename_num =
(sizeof db_filename_vec / sizeof db_filename_vec [0]);
static DRMRegisterArg reglist[] = {
{"expose_proc", (caddr_t) expose_proc},
{"create_proc", (caddr_t) create_proc},
{"push_proc", (caddr_t) push_proc},
};
static int reglist_num = (sizeof reglist / sizeof reglist [0]);
static char *className = {"Bitahon"};
static char *applName = {"����� ���"};
static XtAppContext context;
static Display *dpy[8];
static Widget top[8],
main_widget[8],
wa[8][8];
static int displays = 0;
/* Utilites */
static int find_display(wid)
Widget wid;
{
register i;
for (i = 0; i < displays; i++)
if (XtDisplay(wid) == dpy[i])
return i;
return (-1);
}
static void s_error (message)
char *message;
{
printf("%s\n",message);
exit(1);
}
unsigned int main(argc, argv)
unsigned int argc; /* Command line argument count. */
char *argv[]; /* Pointers to command line args. */
{
int i,sync;
DwtInitializeDRM(); /* Initialize DRM before initializing
/* the X Toolkit. */
XtToolkitInitialize();
context = XtCreateApplicationContext();
if (argc < 2)
s_error("Absent parameters");
sync = atoi(argv[1]);
if (argc < 3)
s_error("Displays are not specified");
for (i = 2; i < argc; i++) {
if (!(dpy[displays] = XtOpenDisplay(
context,
argv[i],
applName,
className,
NULL,0, &argc, argv)))
s_error(strcat("Can't Open Display ",argv[i]));
XSynchronize(dpy[displays],sync);
top[displays] = XtAppCreateShell(
applName,
className,
applicationShellWidgetClass,
dpy[displays],
NULL,0);
displays++;
}
/* Open the UID files (the output of the UIL compiler) in the hierarchy*/
if (DwtOpenHierarchy(db_filename_num,
db_filename_vec,
NULL,
&s_DRMHierarchy) != DRMSuccess)
s_error("can't open hierarchy");
/* Register the items DRM needs to bind for us. */
DwtRegisterDRMNames(reglist, reglist_num);
/* Go get the main part of the application */
for ( i = 0; i < displays; i++) {
if (DwtFetchWidget(s_DRMHierarchy,
"MainWindow",
top[i],
&main_widget[i],
&dummy_class) != DRMSuccess)
s_error("can't fetch main window");
}
/* Show all */
for ( i = 0; i < displays; i++) {
XtManageChild(main_widget[i]);
XtRealizeWidget(top[i]);
}
/* Wait for events to be processed */
XtAppMainLoop(context);
/* UNREACHABLE */
exit(0);
}
/***************************************************************************
*
* This section contains callback routines.
*
***************************************************************************
*/
/*
* All push buttons in this application call back to this routine. We
* use the tag to tell us what widget it is, then react accordingly.
*/
void expose_proc(w, tag, Cb)
Widget w;
int *tag;
DwtWindowCallbackStruct *Cb;
{
printf("Expose procedure on display %d\n",find_display(w));
}
void push_proc(w, tag, reason)
Widget w;
int *tag;
unsigned long *reason;
{
switch (*tag) {
case 1:
exit(1);
default:
break;
}
}
void create_proc(w, tag, reason)
Widget w;
int *tag;
DwtAnyCallbackStruct *reason;
{
wa[*tag][find_display(w)] = w;
}
|
| Is the toolkit known to understand multiple displays? I'm suspicious that
someone might be using a resource id created for one server on the other server.
If the algorithm for allocating client numbers differs between the two servers,
you might see this.
When you do VMS,VMS,Ultrix, are both the VMS machines in the same state? For
example, do they both have the same number of clients connected to them? If
so, try starting an extra client on one before running your program. For
example, run DECW$CLOCK. If you see this failure on the second VMS system
now, that would tend to confirm my guess.
Burns
|