[comp.sys.hp] MOTIF/Starbase/Turbo SRX Combined Mode

stroyan@hpfcso.HP.COM (Mike Stroyan) (06/28/90)

> I want to run Starbase inside a MOTIF drawingArea widget, with the X
> server running in COMBINED mode on an 835 Turbo SRX. After an appeal
> to the net I received from a guy at HP, a realize() routine which
> allowed me to use a different visual for a widgets window. I've
> appended this routine at the end of my message. This seemed to work
> ok, until I tried to run a Starbase program using double buffering in
> the Widget. Result: only one bank of planes ever seems to get
> displayed.

You need to set a WM_COLORMAP_WINDOWS property on the top level window.
The window manager explicitly installs colormaps for applications when
they recieve focus.  The default colormap to install is the top window's
colormap.  The window manager checks the property to learn about other
windows that the application wants to have colormaps installed for.
This is all according to the ICCCM draft standard.  The example code
below sets the property.  The code should go in the expose callback so
the windows are realized before this runs.

if (!property_set) {
	Atom WM_COLORMAP_WINDOWS, WINDOW;
	Window windows[2];

	property_set = 1;

	WM_COLORMAP_WINDOWS = XInternAtom(XtDisplay(widget),
		"WM_COLORMAP_WINDOWS", False);
	WINDOW = XInternAtom(XtDisplay(widget), "WINDOW", False);
	windows[0] = XtWindow(widget);
	windows[1] = XtWindow(toplevel);
	XChangeProperty(XtDisplay(widget), XtWindow(toplevel),
		WM_COLORMAP_WINDOWS, WINDOW, 32, PropModeReplace,
		(char *) windows, 2);
}

By putting the DrawingArea window before the top level window in the
window list, the window manager is told that the DrawingArea window is
more important than the top level window.  This is important because
most servers can only install one colormap at one time, so window
managers only install the most important one.

There is a problem with the current, (OSF 1.0, HP-UX 7.0), release of
mwm.  It gets confused about whether it has installed a colormap for a
window id when the window id has been reused.  If your mwm is not
installing the colormap for repeated use of a program, you can use the
mwm f.restart function to reset the window manager and fix the behavior.
There are a variety of other problems with handling colormap
installation and the WM_COLORMAP_WINDOWS property in many other current
window managers.  We can only hope that they all will quickly improve.

Mike Stroyan, stroyan@hpstryn

neil@yc.estec.nl (Neil Dixon) (06/29/90)

In article <7370162@hpfcso.HP.COM>, stroyan@hpfcso.HP.COM (Mike Stroyan)
writes:

|>if (!property_set) {
|>	Atom WM_COLORMAP_WINDOWS, WINDOW;
|>	Window windows[2];
|>
|>	property_set = 1;
|>
|>	WM_COLORMAP_WINDOWS = XInternAtom(XtDisplay(widget),
|>		"WM_COLORMAP_WINDOWS", False);
|>	WINDOW = XInternAtom(XtDisplay(widget), "WINDOW", False);
|>	windows[0] = XtWindow(widget);
|>	windows[1] = XtWindow(toplevel);
|>	XChangeProperty(XtDisplay(widget), XtWindow(toplevel),
|>		WM_COLORMAP_WINDOWS, WINDOW, 32, PropModeReplace,
|>		(char *) windows, 2);
|>}

I'd made the mistake of using the XA_WINDOW atom, rather than interning an atom
for the widget.

|>
|>There is a problem with the current, (OSF 1.0, HP-UX 7.0), release of
|>mwm.  It gets confused about whether it has installed a colormap for a
|>window id when the window id has been reused.  If your mwm is not
|>installing the colormap for repeated use of a program, you can use the
|>mwm f.restart function to reset the window manager and fix the behavior.

f.restart doesn't seem to work every time. Quiting mwm and restarting seems to.

|>There are a variety of other problems with handling colormap
|>installation and the WM_COLORMAP_WINDOWS property in many other current
|>window managers.  We can only hope that they all will quickly improve.
|>

I made a quick test with twm, and that never seems to install the
colormap at all.
Anyone know of similar problems with other (supposedly ICCCM) compliant
window managers.

P.S. Thanks for the help (once again!!!).                               
Neil Dixon <neil@yc.estec.nl> UUCP:...!mcvax!esatst!neil, BITNET: NDIXON@ESTEC
Thermal Control & Life Support Division (YC) 
European Space Research and Technology Centre (ESTEC),
Noordwijk, The Netherlands.