[comp.windows.x] Multiple Displays in Xt

hagerman@ece.cmu.edu (John Hagerman) (11/02/90)

I can't seem to open multiple displays in my X Toolkit application.  I
initialize the toolkit, create an application context, and then do an
XtOpenDisplay for each display.  I can open the same display multiple
times, but not different displays.  The error I get is:

X Protocol error detected by server:  BadCursor - parameter not a Cursor
  Failed request major op code 1 (X_CreateWindow)
  Failed request minor op code 0 (if applicable)
  ResourceID 0x100083 in failed request (if applicable)
  Serial number of failed request 318
  Current serial number in output stream 428

Any hints?  I'm running X11R3 under Ultrix 3.1 on a DECstation 3100.

Thanks - John

P.S. Should I make unique copies of all the elements of argv for each
XtOpenDisplay, or can I use the same strings in the different argv's?
--
hagerman@ece.cmu.edu

mouse@LARRY.MCRCIM.MCGILL.EDU (11/05/90)

> I can't seem to open multiple displays in my X Toolkit application.
[...]
> I'm running X11R3 under Ultrix 3.1 on a DECstation 3100.

I am fairly sure R3 Xt simply does not work right when you try to open
multiple displays.  (Some of the Xt-private state information is not
correctly tagged according to which display it belongs to, so Xt tries
to use some things on displays they didn't come from.  From your quoted
error message, it seems it does this with a Cursor in your case.)

I have a vague memory of hearing that R4 was supposed to be better, but
I also seem to recall hearing that the R4 Xt still doesn't work right.
Since I don't use Xt, I really can't say.  (I can say that at the Xlib
level this is entirely a non-problem, even back in R3.)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

hagerman@ece.cmu.edu (John Hagerman) (11/06/90)

I said:

> I can't seem to open multiple displays in my X Toolkit application.  I
> initialize the toolkit, create an application context, and then do an
> XtOpenDisplay for each display.  I can open the same display multiple
> times, but not different displays.
> [...]

Der Mouse said:

> I am fairly sure R3 Xt simply does not work right when you try to open
> multiple displays.  (Some of the Xt-private state information is not
> correctly tagged according to which display it belongs to, so Xt tries
> to use some things on displays they didn't come from.  From your quoted
> error message, it seems it does this with a Cursor in your case.)
> [...]

So I tried to work around the problem with a gross hack: I initialize
the toolkit, and then for each display I create an application context
and do an XtOpenDisplay.  Then instead of XtAppMainLoop I use my own
routine that checks for and dispatches events for each application
context in a round-robin fashion (no use of select, so the loop uses
all available cycles).  I had hoped that the bad state information
would be in the application context, but apparently not; I still get
the same error when I try to open multiple displays.

Does anyone know of a successful work-around?

Thanks - John
--
hagerman@ece.cmu.edu

klute@heike.informatik.uni-dortmund.de (Rainer Klute) (11/06/90)

In article <9011050309.AA08155@Larry.McRCIM.McGill.EDU>,
mouse@LARRY.MCRCIM.MCGILL.EDU writes:
|> > I can't seem to open multiple displays in my X Toolkit application.
|> [...]
|> > I'm running X11R3 under Ultrix 3.1 on a DECstation 3100.
|> 
|> I am fairly sure R3 Xt simply does not work right when you try to open
|> multiple displays.  (Some of the Xt-private state information is not
|> correctly tagged according to which display it belongs to, so Xt tries
|> to use some things on displays they didn't come from.  From your quoted
|> error message, it seems it does this with a Cursor in your case.)
|> 
|> I have a vague memory of hearing that R4 was supposed to be better, but
|> I also seem to recall hearing that the R4 Xt still doesn't work right.

I am opening multiple displays with the R4 version of the X Toolkit all the
time - and it works.

-- 
  Dipl.-Inform. Rainer Klute      klute@irb.informatik.uni-dortmund.de
  Univ. Dortmund, IRB             klute@unido.uucp, klute@unido.bitnet
  Postfach 500500         |)|/    Tel.: +49 231 755-4663
D-4600 Dortmund 50        |\|\    Fax : +49 231 755-2386

clive@x.co.uk (Clive Feather) (11/08/90)

John Hagerman <hagerman@ece.cmu.edu> writes:
> I can't seem to open multiple displays in my X Toolkit application.  I
> initialize the toolkit, create an application context, and then do an
> XtOpenDisplay for each display.  I can open the same display multiple
> times, but not different displays.
[and gives details]

Der Mouse replied:

> I am fairly sure R3 Xt simply does not work right when you try to open
> multiple displays.  (Some of the Xt-private state information is not
> correctly tagged according to which display it belongs to, so Xt tries
> to use some things on displays they didn't come from.  From your quoted
> error message, it seems it does this with a Cursor in your case.)
> [...]

Der Mouse is correct. The state information that is not correctly tagged is in
the String to Cursor converter (CvtStringToCursor in Converters.c). The R3
code stored the results of conversion internally, rather than letting the
Intrinsics cache the result. This means that when the same cursor is converted
for a different display, the stored value was used instead of reconverting.

Fixes:
  1: Try setting the resources so that a different named cursor is used for
     each display.
  2: Patch CvtStringToCursor to stop it storing the value.
  3: Fixed in R4 (from a quick glance at the code).
-- 
Clive D.W. Feather     | IXI Limited         | If you lie to the compiler,
clive@x.co.uk          | 62-74 Burleigh St.  | it will get its revenge.
Phone: +44 223 462 131 | Cambridge   CB1 1OJ |   - Henry Spencer
(USA: 1 800 XDESK 57)  | United Kingdom      |