[comp.windows.x] DECwindows DisplayString

kobuchi%hoover.DECnet@win1.ims.abb.COM ("HOOVER::KOBUCHI") (01/23/91)

OK, hope this message gets through OK--this is my first attempt at sending a
message to any Internet address...

I've just encountered a problem with obtaining the display name, using
DisplayString.  We just upgraded our VAXes to VMS 5.4.  In this upgrade, DEC
changed DECwindows so that DisplayString returns a VAX/VMS device name instead
of a string like "nodename::0.0".  This change caused my code to fail and the
only way I can think of to fix my code seems to be extremely un-X.

Basically, my DECwindows code is designed to use two CRTs (when available). 
I'm currently using a VAXstation 3100 with a color monitor and a black and
white monitor.

The first thing my code does is to open a temporary connection and determine
how many monitors are on the workstation:

            display = XOpenDisplay("");
            num_screens = ScreenCount(display);

It then gets and stores the display name so I can use the name to open up
connections to each screen (monitor) on the workstation:

            display_name = DisplayString(display);

I then close this temporary connection:

            XCloseDisplay(display);

Then I start doing the DECwindows initialization stuff:

            XtToolkitInitialize();
            app_context = XtCreateApplicationContext();

Finally, I enter a loop for each screen (monitor) on the workstation and I open
a connection for each screen using XtOpenDisplay.

Now this is where I use the display name I got beforehand: every time I call
XtOpenDisplay, I give it the display name with the last character modified to
be the screen number.

For example, if the workstation's node name is NODE1, and it has two screens, I
call XtOpenDisplay twice, the first time giving it the display name of
"NODE1::0.0" and the second time giving it the display name of "NODE1::0.1".

This used to work on VMS 5.3: DisplayString would return the string
"NODE1::0.0".

Now, on VMS 5.4, DisplayString returns a string containing a VAX/VMS device
name like "WSA1:".  Well, ok, I've found out that I can use this device name by
appending the server number and screen number to it (e.g., "WSA1:0.0"), but it
doesn't look like X anymore.  Also, I don't think I can determine the actual
node name anymore (so I could include it in messages to the user).


Did DEC screw up?  Did I screw up?  Is this the "correct" way to handle
multiple monitors on a single workstation?


Kent Kobuchi
ABB Engineering Automation
Internet: kobuchi%pasceg.decnet@win1.ims.abb.com
Voice:    (415) 748-4791

klee@wsl.dec.com (Ken Lee) (01/24/91)

In article <9101222319.AA10945@uc.msc.edu>, kobuchi%hoover.DECnet@win1.ims.abb.COM ("HOOVER::KOBUCHI") writes:
|> I've just encountered a problem with obtaining the display name, using
|> DisplayString.  We just upgraded our VAXes to VMS 5.4.  In this upgrade, DEC
|> changed DECwindows so that DisplayString returns a VAX/VMS device name instead
|> of a string like "nodename::0.0".
|>
|> 
|>             display = XOpenDisplay("");


I think you're asking 2 different questions here:

1.  does the VMS implementation violate the X11R4 specification?  X11R4
only specifies what happens when you XOpenDisplay(NULL) on a POSIX
system, but I think the current VMS implementation more closely matches
the spirit of the spec than does the old implementation of creating a
pseudo-string.

2.  can you assume that valid display specifiers will contain the node
name?  The specification never says this and, in fact, many high level
network interfaces, such as OSI, try hard to hide node names from you.
I recommend that you avoid writing code that requires node names.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee

kobuchi%hoover.DECnet@win1.ims.abb.COM ("HOOVER::KOBUCHI") (01/24/91)

-------------------------------------------------------------------------------
|In article <9101222319.AA10945@uc.msc.edu>, 
|kobuchi%hoover.DECnet@win1.ims.abb.COM ("HOOVER::KOBUCHI") writes:
||> I've just encountered a problem with obtaining the display name, using
||> DisplayString.  We just upgraded our VAXes to VMS 5.4.  In this upgrade, DEC
||> changed DECwindows so that DisplayString returns a VAX/VMS device name 
|instead
||> of a string like "nodename::0.0".
||>
||> 
||>             display = XOpenDisplay("");
|
|
|I think you're asking 2 different questions here:
|
|1.  does the VMS implementation violate the X11R4 specification?  X11R4
|only specifies what happens when you XOpenDisplay(NULL) on a POSIX
|system, but I think the current VMS implementation more closely matches
|the spirit of the spec than does the old implementation of creating a
|pseudo-string.
|
|2.  can you assume that valid display specifiers will contain the node
|name?  The specification never says this and, in fact, many high level
|network interfaces, such as OSI, try hard to hide node names from you.
|I recommend that you avoid writing code that requires node names.
|
|-- 
|Ken Lee
-------------------------------------------------------------------------------


	Alright, let's see if I've got this straight.

	When I do XOpenDisplay(""), X does not guarantee me what DisplayString
	will return, i.e, the string might be in the format
	"nodename::servernum.screennum" or it might be in different format.

	If that's true, then there seems to be no machine-independent way to
	open connections to each screen of a dual-monitor X workstation.

	I had assumed the way to open up the two connections was to call
	XtOpenDisplay twice:

		display_screen0 = XtOpenDisplay( app_con, "nodename::0.0",...

		display_screen1 = XtOpenDisplay( app_con, "nodename::0.1",...

	Am I missing something here?  Has my brain turned into mush?

Kent Kobuchi
ABB Engineering Automation
Internet: kobuchi%pasceg.decnet@win1.ims.abb.com
Voice:    (415) 748-4791

mouse@lightning.mcrcim.mcgill.EDU (01/24/91)

> Basically, my DECwindows code is designed to use two CRTs (when
> available).  I'm currently using a VAXstation 3100 with a color
> monitor and a black and white monitor.

> The first thing my code does is to open a temporary connection and
> determine how many monitors are on the workstation:

>             display = XOpenDisplay("");
>             num_screens = ScreenCount(display);
[...]
> Now this is where I use the display name I got beforehand: every time
> I call XtOpenDisplay, I give it the display name with the last
> character modified to be the screen number.

> For example, if the workstation's node name is NODE1, and it has two
> screens, I call XtOpenDisplay twice, the first time giving it the
> display name of "NODE1::0.0" and the second time giving it the
> display name of "NODE1::0.1".

(In passing, note that modifying the last character will break as soon
as you have more than nine screens.)

Why not just XOpenDisplay() once, then use different screens on that
connection?  Once you've connected to a given display, you can
manipulate windows on all the screens on that display.  All the
trailing number indicates is which screen is the default - but you are
not restricted to working with the default screen.

Um.  I just noticed you said XtOpenDisplay.  I don't know what Xt does
for this.  You may have to give up until Xt catches up with displays
with multiple screens...or go to writing in Xlib instead, if you feel
it worth the pain of learning an entirely new (and probably weaker) set
of tools.

Perhaps some Xt wizard can explain how to take the result of
XOpenDisplay and use all of the screens it provides....

					der Mouse

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

mouse@lightning.mcrcim.mcgill.EDU (01/25/91)

> Alright, let's see if I've got this straight.
[...]
> If that's true, then there seems to be no machine-independent way to
> open connections to each screen of a dual-monitor X workstation.

Right.  But then, you haven't lost anything; even

> 		display_screen0 = XtOpenDisplay( app_con, "nodename::0.0",...
> 		display_screen1 = XtOpenDisplay( app_con, "nodename::0.1",...

is DECnet-specific.

But really, you don't need to.  Given a connection, you can access all
screens of that display from that one connection.  (I don't know
whether Xt makes life difficult for you or not; if so, at least
complain about Xt instead!)

					der Mouse

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