/*
 * -- $Header: /cec/src/nestor/servers/R3/shXlib/XChWAttrs.c,v 1.2 90/05/14
 * 08:57:18 altenhof Exp $
 */
#include "copyright.h"

/* $XConsortium: XChWAttrs.c,v 11.8 88/09/06 16:04:36 jim Exp $ */
/* Copyright    Massachusetts Institute of Technology    1986	 */


/* -- MULTIPLEX Extension -- */
#include "Xlibint.h"

/* -- additional includes -- */
#include "resources.h"
#include "ApplCtx.h"

#define AllMaskBits (CWBackPixmap|CWBackPixel|CWBorderPixmap|\
		     CWBorderPixel|CWBitGravity|CWWinGravity|\
		     CWBackingStore|CWBackingPlanes|CWBackingPixel|\
		     CWOverrideRedirect|CWSaveUnder|CWEventMask|\
		     CWDontPropagate|CWColormap|CWCursor)

XChangeWindowAttributes (dpy, w, valuemask, attributes)
  register Display *dpy;
  Window w;
  unsigned long valuemask;
  XSetWindowAttributes *attributes;
{
  register xChangeWindowAttributesReq *req;
  /* -- additional variables -- */
  Bool mux_add_events;
  unsigned long mux_specific_mask;

  /* -- find out if we must alter the event mask -- */
  mux_add_events = XmuXMustAddEvents (dpy, w, XmuXUpdate);

  LockDisplay (dpy);
  GetReq (ChangeWindowAttributes, req);
  req->window = w;
  valuemask &= AllMaskBits;
  if (req->valueMask = valuemask) {
    /* -- two additional parameters !! -- */
    _XProcessWindowAttributes (dpy, req, valuemask, attributes,
			       mux_add_events, &mux_specific_mask);

    /*
     * -- These changes may affect window attributes that point to other --
     * resources. We must keep track of these changes, since they -- have a
     * strong impact on duplicating resources (see multiplex.c -- for further
     * information).
     */
    if (XmuXStoreResources (dpy))
      XmuXUpdateWindowInfo (dpy, w, req->valueMask, attributes);
    if (mux_add_events && (req->valueMask & CWEventMask))
      XmuXChangeToplevelInfo (dpy, w, mux_specific_mask);

  }
  UnlockDisplay (dpy);
  SyncHandle ();
}
