home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / Xmu / ScrOfWin.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-22  |  1.8 KB  |  51 lines

  1. /*
  2.  * $XConsortium: ScrOfWin.c,v 1.2 89/09/22 12:10:01 jim Exp $
  3.  *
  4.  * Copyright 1989 Massachusetts Institute of Technology
  5.  *
  6.  * Permission to use, copy, modify, distribute, and sell this software and its
  7.  * documentation for any purpose is hereby granted without fee, provided that
  8.  * the above copyright notice appear in all copies and that both that
  9.  * copyright notice and this permission notice appear in supporting
  10.  * documentation, and that the name of M.I.T. not be used in advertising or
  11.  * publicity pertaining to distribution of the software without specific,
  12.  * written prior permission.  M.I.T. makes no representations about the
  13.  * suitability of this software for any purpose.  It is provided "as is"
  14.  * without express or implied warranty.
  15.  *
  16.  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  17.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  18.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  19.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  20.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  21.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  22.  *
  23.  * Author:  Jim Fulton, MIT X Consortium
  24.  */
  25.  
  26. #include <stdio.h>
  27. #include <X11/Xlib.h>
  28.  
  29.  
  30. Screen *XmuScreenOfWindow (dpy, w)
  31.     Display *dpy;
  32.     Window w;
  33. {
  34.     register int i;
  35.     Window root;
  36.     int x, y;                    /* dummy variables */
  37.     unsigned int width, height, bw, depth;    /* dummy variables */
  38.  
  39.     if (!XGetGeometry (dpy, w, &root, &x, &y, &width, &height,
  40.                &bw, &depth)) {
  41.     return NULL;
  42.     }
  43.     for (i = 0; i < ScreenCount (dpy); i++) {    /* find root from list */
  44.     if (root == RootWindow (dpy, i)) {
  45.         return ScreenOfDisplay (dpy, i);
  46.     }
  47.     }
  48.     return NULL;
  49. }
  50.  
  51.