/* 
 * -- $Header: /cec/src/nestor/servers/R3/shXlib/XSelInput.c,v 1.1.1.1 90/04/23 10:05:28 spanachi Exp $ 
 */

#include "copyright.h"

/* $XConsortium: XSelInput.c,v 11.8 88/09/06 16:10:22 jim Exp $ */
/* Copyright    Massachusetts Institute of Technology    1986	*/

/* -- MULTIPLEX Extension -- */

#include "Xlibint.h"

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

XSelectInput (dpy, w, mask)
    register Display *dpy;
    Window w;
    long mask;
{
    register xChangeWindowAttributesReq *req;
    /* -- additional variables -- */
    Bool mux_add_events ;

    mux_add_events = XmuXMustAddEvents( dpy , w , XmuXUpdate ) ;

    LockDisplay(dpy);
    GetReqExtra (ChangeWindowAttributes, 4, req);
    req->window = w;
    req->valueMask = CWEventMask;
    /* 
     * -- if w is a top-level window (indicated by mux_add_events), add
     * -- XmuXMask to the new event mask and store the change in the top-level
     * -- list
     */
    if( mux_add_events )
    {   long mux_specific_mask ;
	
	mux_specific_mask  = ~mask & XmuXMask ;
	mask              |= XmuXMask ;
	XmuXChangeToplevelInfo( dpy , w , mux_specific_mask ) ;
    }
    OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), mask);
    UnlockDisplay(dpy);
    SyncHandle();
}

