[comp.os.vms] DECW$WINMGR Weirdness

mikey@eukanuba.wpd.sgi.com (Mike Yang) (06/27/90)

In article <JYM.90Jun25204254@eris.berkeley.edu>, jym@eris.berkeley.edu
(Jym Dyer) writes:
|> |T|here's a different problem, which may not be related, but
|> `-' again, it happens only with DECW$WINMGR, not with HPWM.
|>     I compiled xsetroot and the Xmu stuff.  Then I ran xsetroot
|>     to put a bitmap in my background.  Under HPWM it shows up
|>     right away; but under DECW$WINMGR it only shows up after I
|>     lift a window off of the background.  Does *that* one sound
|>     familiar to anyone?

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.

The solution is to use xrefresh after using xsetroot.

----------------------------------------------------------------------
   Mike Yang        Silicon Graphics, Inc.        mikey@wpd.sgi.com
		    415/335-1786		  decwrl!sgi!wpd!mikey

west@gsrc.dec.com (Jim West (Stealth Contractor)) (06/27/90)

In article <9518@odin.corp.sgi.com>, mikey@eukanuba.wpd.sgi.com (Mike Yang) writes...

-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.
- 
-The solution is to use xrefresh after using xsetroot.
- 

  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.


  function get_wm_root (
    display	: in x.display_type) return x.window_id_type is

    screen	    : x.screen_id_type;
    root	    : x.window_id_type;
    wm_root	    : x.window_id_type;
    rootatt	    : x.window_attributes_type;
    childatt	    : x.window_attributes_type;
    children_addr   : address;
    children	    : child_array_type;
    num_children    : integer;

  begin

    x.default_screen (
      result	=> screen,
      display	=> display);

    x.root_window (
      result	    => root,
      display	    => display,
      screen_number => screen);

    x.get_window_attributes (
      status			=> status,
      display			=> display,
      window_id			=> root,
      window_attributes_return	=> rootatt);

    x.query_tree (
      status		    => status,
      display		    => display,
      window_id		    => root,
      children_return	    => children_addr,
      num_children_return   => num_children);

    if num_children > 0 then

      children := addr_to_array (a => children_addr);
      x.free (buff_ptr => children_addr);

      for i in 0 .. num_children - 1 loop

        x.get_window_attributes (
	  status		    => status,
	  display		    => display,
	  window_id		    => children(i),
	  window_attributes_return  => childatt);

	if rootatt.wdat_width = childatt.wdat_width and
	   rootatt.wdat_height = childatt.wdat_height then

	  x.query_tree (
	    status		=> status,
	    display		=> display,
	    window_id		=> children(i),
	    children_return	=> children_addr,
	    num_children_return	=> num_children);

	  if num_children > 0 then -- It had better be !!
	    children := addr_to_array (a => children_addr);
	    x.free (buff_ptr => children_addr);
	    return children(0);
	  end if;

	end if;

      end loop;

      return zero; -- No window manager (DEC's)

    end if;

  end get_wm_root;


----------------------------------------------------------------------
 Jim West                      |  The Schainker Converse
 west@gsrc.dec.com             |  to Hoare's Law :
                               |
 These are my opinions.        |   Inside every small problem
 Digital has no idea           |     is a larger problem struggling
 what I'm  saying.             |       to get out.
----------------------------------------------------------------------

terence@hkov04.dec.com (Terence Lee @HKO, Digital Equipment Corporation) (06/28/90)

In article <1376@shodha.dec.com>, west@gsrc.dec.com (Jim West (Stealth Contractor)) writes...
#
#In article <9518@odin.corp.sgi.com>, mikey@eukanuba.wpd.sgi.com (Mike Yang) writes...
#
#  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.
#

How about a VAXC routine?

Window find_root(pwin)
Window  pwin;
{
        XWindowAttributes pxwa,cxwa;
        Window  root,parent,*child;
        int     i,nchild;

        if (!XGetWindowAttributes(dpy,pwin,&pxwa))
            pfail("find_root: fail to get window attributes\n");
        if (XQueryTree(dpy,pwin,&root,&parent,&child,&nchild)) {
            for (i = 0; i < nchild; i++) {
                if (!XGetWindowAttributes(dpy,child[i],&cxwa))
                    pfail("find_root: fail to get window attributes\n");
                if (pxwa.width == cxwa.width && pxwa.height == cxwa.height)
                    return(find_root(child[i]));
            }
            return(pwin);
        }
        else pfail("find_root: fail to get root window\n");
}

================================================================================
Terence Lee     terence%hkov04.dec@decwrl.dec.com
                root%hkvs04.dec@decwrl.dec.com
From Middlesex, UWO
================================================================================