Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!agate!ucbvax!KITCHEN.BELLCORE.COM!aw From: aw@KITCHEN.BELLCORE.COM (Andrew Wason, aw@cellar.bae.bellcore.com) Newsgroups: comp.windows.x.motif Subject: Re: Multiple Displays in Xt (again) and panedWindowWidget Message-ID: <9012111657.AA29254@bellcore.bellcore.com> Date: 11 Dec 90 16:51:16 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 178 [ repost, sorry if you've seen this before ] I am also having problems using XmPanedWindow on multiple displays with X11R4(fix18) and Motif 1.1. The program below opens 2 displays and creates an XmPanedWindow on each. This results in a BadCursor error: X Error of failed request: BadCursor (invalid Cursor parameter) Major opcode of failed request: 1 (X_CreateWindow) Minor opcode of failed request: 0 Resource id in failed request: 0x1000010 Serial number of failed request: 50 Current serial number in output stream: 59 I traced all the calls to XCreateWindow, and 4 of them specified CWCursor in their valuemask. For these 4, attributes->cursor was 0x1000010. I guess the XmSash widget creates 2 windows each one with a cursor specified. It seems like someone is caching the cursor for all 4 windows, even though 2 of those windows are in a different server (where those cursor IDs are invalid). If you run the program below and specify the same display for both displays, and also specify the -sync option, it works fine. e.g. try -sync -display jello:0 jello:0 I guess this is because the first 2 XCreateWindows cache the cursor, and the next 2 XCreateWindows are for the same server and that cached cursor exists and is valid (since we are synchronous, the cursor is definitely in the server from the previous XCreateWindow). Does anyone know who is caching the cursor (if that is what is happening)? The Intrinsics CvtStringToCursor converter uses XtCacheByDisplay, so I don't think it is the problem (I don't know if XmSash even uses CvtStringToCursor, also I might be misunderstanding the meaning of XtCacheByDisplay). Are there any workarounds? I think someone had suggested using resources to specify a different cursor for each XmSash, but I don't see a cursor resource. Is this only a problem for XmSash, or do any other widgets have this problem too? Thanks for any help, Andrew [ Sun Sparc1+, SunOS 4.1, MIT X11R4, Quest Motif 1.1 ] -------------------------------------------------------------------------------- Andrew Wason Bell Communications Research aw@cellar.bae.bellcore.com Piscataway, NJ bellcore!cellar!aw -------------------------------------------------------------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'try.c' <<'END_OF_FILE' X#include X#include X#include X X/* X * cc -D_NO_PROTO -o try try.c -lXm -lXt -lX11 X */ X Xmain(argc, argv) XCardinal argc; Xchar *argv[]; X{ X XtAppContext app; X Widget toplevel1, toplevel2, pop1, pop2; X Widget paned; X Display *dpy1, *dpy2; X String *saved_argv; X Cardinal saved_argc; X String server; X X /* X * save argc/argv since XtOpenDisplay messes with them and we need X * them for XtAppCreateShell X */ X saved_argv = (String *)XtMalloc(argc * sizeof(String)); X saved_argc = argc; X memcpy(saved_argv, argv, argc * sizeof(String)); X X XtToolkitInitialize(); X app = XtCreateApplicationContext(); X X if ((dpy1 = XtOpenDisplay(app, NULL, NULL, "Try", X NULL, 0, &saved_argc, saved_argv)) == NULL) X XtAppError(app, "Failed to open local display."); X X if (saved_argc == 2) { X server = saved_argv[1]; X saved_argc = argc; X memcpy(saved_argv, argv, argc * sizeof(String)); X if ((dpy2 = XtOpenDisplay(app, server, NULL, "Try", X NULL, 0, &saved_argc, saved_argv)) == NULL) X XtAppError(app, "Failed to open remote display."); X } X else { X fprintf(stderr, "Usage: %s other-display [toolkitoptions]\n", argv[0]); X exit(1); X } X X /* X * now we are done with it X */ X XtFree(saved_argv); X X /* X * create dummy toplevels which will never be realized X */ X toplevel1 = XtVaAppCreateShell(NULL, "Try", X applicationShellWidgetClass, dpy1, X XmNargc, argc, X XmNargv, argv, X NULL); X toplevel2 = XtVaAppCreateShell(NULL, "Try", X applicationShellWidgetClass, dpy2, X XmNargc, argc, X XmNargv, argv, X NULL); X X pop1 = XtCreatePopupShell("pop1", X topLevelShellWidgetClass, toplevel1, X NULL, 0); X paned = XtCreateManagedWidget("paned1", X xmPanedWindowWidgetClass, pop1, X NULL, 0); X XtCreateManagedWidget("label1", X xmLabelWidgetClass, paned, X NULL, 0); X XtCreateManagedWidget("label1", X xmLabelWidgetClass, paned, X NULL, 0); X X pop2 = XtCreatePopupShell("pop2", X topLevelShellWidgetClass, toplevel2, X NULL, 0); X paned = XtCreateManagedWidget("paned2", X xmPanedWindowWidgetClass, pop2, X NULL, 0); X XtCreateManagedWidget("label2", X xmLabelWidgetClass, paned, X NULL, 0); X XtCreateManagedWidget("label2", X xmLabelWidgetClass, paned, X NULL, 0); X X XtPopup(pop1, XtGrabNone); X XtPopup(pop2, XtGrabNone); X X XtAppMainLoop(app); X} END_OF_FILE if test 2254 -ne `wc -c <'try.c'`; then echo shar: \"'try.c'\" unpacked with wrong size! fi # end of 'try.c' fi echo shar: End of shell archive. exit 0