[comp.sys.hp] starbase under X11

gordon@maxwell.waterloo.edu (Gordon R. Strachan) (01/30/91)

Okay here is a question that has stumped me for a long time.  I am using
starbase in an X11 window on an HP 9000 series 300 workstation with the motif
window manager.  When I create the X window, I set the XSetCloseDownMode
to RetainTemporary so that the window isn't destroyed when the program
terminates.  When I open starbase (with either the 300h or sox11 device driver)
I specify INIT so that the starbase colour map gets installed into the window.

Now, everything works fine, the colour map is used and is installed by the
window manager when the graphics window has the input focus.  But when the
program terminates and I call gclose, the starbase colour map disappears and
the default X colour map is reloaded.  So, even though my window has been
retained after the program ends, the colour map I was using disappears.  Who is
doing this?  Is gclose re-installing the original colour map for some reason?
More importantly, is there anyway I can get it to stop doing that?

Gordon
Newsgroups: comp.sys.hp
Subject: starbase in an X11 window
Expires: 
References: 
Sender: 
Reply-To: gordon@maxwell.waterloo.edu (Gordon R. Strachan)
Followup-To: 
Distribution: 
Organization: University of Waterloo, Waterloo Ont.
Keywords: 

Okay here is a question that has stumped me for a long time.  I am using
starbase in an X11 window on an HP 9000 series 300 workstation with the motif
window manager.  When I create the X window, I set the XSetCloseDownMode
to RetainTemporary so that the window isn't destroyed when the program
terminates.  When I open starbase (with either the 300h or sox11 device driver)
I specify INIT so that the starbase colour map gets installed into the window.

Now, everything works fine, the colour map is used and is installed by the
window manager when the graphics window has the input focus.  But when the
program terminates and I call gclose, the starbase colour map disappears and
the default X colour map is reloaded.  So, even though my window has been
retained after the program ends, the colour map I was using disappears.  Who is
doing this?  Is gclose re-installing the original colour map for some reason?
More importantly, is there anyway I can get it to stop doing that?

Gordon

stroyan@hpfcso.HP.COM (Mike Stroyan) (01/31/91)

>Okay here is a question that has stumped me for a long time.  I am using
>starbase in an X11 window on an HP 9000 series 300 workstation with the motif
>window manager.  When I create the X window, I set the XSetCloseDownMode
>to RetainTemporary so that the window isn't destroyed when the program
>terminates.  When I open starbase (with either the 300h or sox11 device driver)
>I specify INIT so that the starbase colour map gets installed into the window.
>
>Now, everything works fine, the colour map is used and is installed by the
>window manager when the graphics window has the input focus.  But when the
>program terminates and I call gclose, the starbase colour map disappears and
>the default X colour map is reloaded.  So, even though my window has been
>retained after the program ends, the colour map I was using disappears.  Who is
>doing this?  Is gclose re-installing the original colour map for some reason?
>More importantly, is there anyway I can get it to stop doing that?

The Sox11 driver both sets the window colormap to the default colormap
and free's its private colormap during gclose.  The hp300h driver just
closes it's connection, which has basically the same effect.  The
Starbase library is doing its own XOpenDisplay, so a call to
XSetCloseDownMode on your connection does not affect the resources of
Starbase's connection.

It should be possible to keep displaying the colors you want beyond
program termination.  Copy the window's colormap just before calling
gclose, then set the window's colormap to the copy after gclose.  Use
XGetWindowAttributes to find the colormap and visual, XQueryColors to
read the colormap values, XCreateColormap and XSetWindowColormap to
change the window's colormap.  Then XSetCloseDownMode will apply to your
copy of the colormap, allowing it to remain after exit.

Unlike the sox11 driver, the hp300h driver and other Direct Hardware
Access drivers can set display modes beyond normal X colormap controls.
This control is used to select different banks for double buffering and
to set the hardware display_enable control.  If your program has been
changing these settings, then your copy of the colormap will not be able
to duplicate these effects.

Mike Stroyan, mike_stroyan@fc.hp.com

harry@hpcvlx.cv.hp.com (Harry Phinney) (02/01/91)

Gordon R. Strachan writes:
> When I create the X window, I set the XSetCloseDownMode
> to RetainTemporary so that the window isn't destroyed when the program
> terminates.  

> Now, everything works fine, the colour map is used and is installed by the
> window manager when the graphics window has the input focus.  But when the
> program terminates and I call gclose, the starbase colour map disappears and
> the default X colour map is reloaded.

The window is "owned" by a different client (one which set its
closeDownMode to RetainTemporary) than the colormap.  For various
reasons the Starbase library opens its own connection to the server.
This means that the server considers the Starbase library to be a
different client than the rest of the program.  Even if you create the
window within your program, the server will not retain the resources
created by the Starbase library.

Harry Phinney   harry@hp-pcd.cv.hp.com