[comp.windows.x] text widget on multiple displays?

keith@lakes.cray.COM (Keith A. Fredericks) (02/24/89)

I am trying to realize text widgets on multiple displays.  When I run my
program, I get:

X Protocol error:  BadCursor, invalid Cursor parameter

I can realize list, command, and label widgets with this method, but not text
or dialog widgets.  Is there a work-around or a fix or another method to get
two text widgets on two displays controlled by the same application?

Here is the program:
-----------
/* program to put a text widget on two displays */

#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/AsciiText.h>
#include <stdio.h>

main(argc, argv)
unsigned int argc;
char **argv;
{
    Display *dpy1, *dpy2;
    Widget toplevel1, toplevel2, text1, text2;

    XtToolkitInitialize();

    dpy1 = XtOpenDisplay(NULL, "mirror:0.0", NULL, "test", NULL,
                                0, &argc, argv);

    if (dpy1 == NULL) { printf("XtOpenDisplay #1 failed\n"); return; }

    dpy2 = XtOpenDisplay(NULL, "nokomis:0.0", NULL, "test", NULL,
                                0, &argc, argv);

    if (dpy2 == NULL) { printf("XtOpenDisplay #2 failed\n"); return; }

    toplevel1 = XtAppCreateShell("XShell","xshell",
                        applicationShellWidgetClass,dpy1,NULL,0);

    toplevel2 = XtAppCreateShell("XShell","xshell",
                        applicationShellWidgetClass,dpy2,NULL,0);

    text1 = XtCreateManagedWidget( "text1", asciiStringWidgetClass,
                            toplevel1, NULL, 0 );

    text2 = XtCreateManagedWidget( "text2", asciiStringWidgetClass,
                            toplevel2, NULL, 0 );

    XtRealizeWidget(toplevel1);
    XtRealizeWidget(toplevel2);

XtMainLoop();

}
---------

BTW, this program works fine when the two display strings are the same.

-keith