From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 27-JUN-1990 20:22:52.50
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	Re: DECW$WINMGR Weirdness

Received:  by crdgw1.ge.com (5.57/GE 1.70)
	 id AA22129; Wed, 27 Jun 90 20:06:34 EDT
Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Wed, 27 JUN 90 15:33:29 PDT
Received: by ucbvax.Berkeley.EDU (5.63/1.41)
	id AA07050; Wed, 27 Jun 90 15:28:44 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 27 Jun 90 21:40:48 GMT
From: stan!ninja!toml@boulder.colorado.edu  (Tom LaStrange)
Organization: Solbourne Computer, Inc.
Subject: Re: DECW$WINMGR Weirdness
Message-Id: <1990Jun27.214048.15453@Solbourne.COM>
References: <1376@shodha.dec.com>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com


|> -The problem is that the DEC window manager places a full-screen,
|> -pseudo-root window over the real root window.  This pseudo-root window
|> -has background set to ParentRelative, but it doesn't automatically
|> -change when xsetroot changes the real root window's background.
|> 
|>   There is another solution.  You could check for the existence of the DEC
|> window manager psuedo-root and then use it in your programs.  What follows
|> is an Ada procedure that will 'look' for this window.
|> 

This problem also exists for swm users when the Virtual Desktop is enabled.
With our next release (very soon now), you will find a C fragment in
/usr/lib/X11/swm/vdt.c that will return the actual root window or the
Virtual Desktop window if swm is running and the vdt is enabled.  For you
swm users out there now, I'm including that code fragment here.  It's
easy to just plug this into xphoon, xsetroot, or any other root window
display program and have it do the right thing.

--
Tom LaStrange

Solbourne Computer Inc.    ARPA: toml@Solbourne.COM
1900 Pike Rd.              UUCP: ...!{boulder,sun}!stan!toml
Longmont, CO  80501

--------------------- vdt.c ---------------------------
/***********************************************************************
 *
 * Solbourne Computer, Inc.
 * Copyright (c) 1990, Solbourne Computer, Inc.  USA
 * All rights reserved.
 *
 * vdt.c
 *
 * Find the Virtual Desktop window
 *
 * 08-Feb-90 Thomas E. LaStrange        File created
 *
 ***********************************************************************/

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>

/***********************************************************************
 *
 *  Procedure:
 *	FindVirtualDesktop
 *
 *  Arguments:
 *	dpy	- Display pointer
 *
 *  Returns:
 *	Window	- the Virtual Desktop window or the actual root window
 *
 *  Function:
 *	This routine will look for the swm Virtual Desktop window.  If
 *	it is not there, the actual root window is returned.
 *
 ***********************************************************************
 */

#ifndef NULL
#define NULL 0
#endif

Window
FindVirtualDesktop(dpy)
Display *dpy;
{
    Window root;	/* the returned root window */
    Window rootReturn;
    Window parentReturn;
    Window *children;
    unsigned int numChildren;
    int i;
    Atom __SWM_VROOT;

    /* get the default root window */
    root = RootWindow(dpy, DefaultScreen(dpy));

    /* go look for a virtual desktop */
    __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);

    children = NULL;
    XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren);

    for (i = 0; i < numChildren; i++)
    {
	Atom actual_type;
	int actual_format;
	long nitems, bytesafter;
	Window *newRoot = NULL;

	if (XGetWindowProperty (dpy, children[i], __SWM_VROOT,0,1,
	    False, XA_WINDOW, &actual_type, &actual_format, &nitems, &bytesafter,
				(unsigned char **) &newRoot) == Success && newRoot)
	{
	    root = *newRoot;
	    break;
	}
    }
    if (children)
	XFree(children);

    return (root);
}

