11ab64890Smrg 21ab64890Smrg/*********************************************************** 31ab64890Smrg 41ab64890SmrgCopyright 1987, 1998 The Open Group 51ab64890Smrg 61ab64890SmrgPermission to use, copy, modify, distribute, and sell this software and its 71ab64890Smrgdocumentation for any purpose is hereby granted without fee, provided that 81ab64890Smrgthe above copyright notice appear in all copies and that both that 91ab64890Smrgcopyright notice and this permission notice appear in supporting 101ab64890Smrgdocumentation. 111ab64890Smrg 121ab64890SmrgThe above copyright notice and this permission notice shall be included in 131ab64890Smrgall copies or substantial portions of the Software. 141ab64890Smrg 151ab64890SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 161ab64890SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 171ab64890SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 181ab64890SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 191ab64890SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 201ab64890SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 211ab64890Smrg 221ab64890SmrgExcept as contained in this notice, the name of The Open Group shall not be 231ab64890Smrgused in advertising or otherwise to promote the sale, use or other dealings 241ab64890Smrgin this Software without prior written authorization from The Open Group. 251ab64890Smrg 261ab64890Smrg 271ab64890SmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 281ab64890Smrg 291ab64890Smrg All Rights Reserved 301ab64890Smrg 3161b2299dSmrgPermission to use, copy, modify, and distribute this software and its 3261b2299dSmrgdocumentation for any purpose and without fee is hereby granted, 331ab64890Smrgprovided that the above copyright notice appear in all copies and that 3461b2299dSmrgboth that copyright notice and this permission notice appear in 351ab64890Smrgsupporting documentation, and that the name of Digital not be 361ab64890Smrgused in advertising or publicity pertaining to distribution of the 3761b2299dSmrgsoftware without specific, written prior permission. 381ab64890Smrg 391ab64890SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 401ab64890SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 411ab64890SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 421ab64890SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 431ab64890SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 441ab64890SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 451ab64890SmrgSOFTWARE. 461ab64890Smrg 471ab64890Smrg******************************************************************/ 481ab64890Smrg 491ab64890Smrg#ifdef HAVE_CONFIG_H 501ab64890Smrg#include <config.h> 511ab64890Smrg#endif 521ab64890Smrg#include "Xlibint.h" 531ab64890Smrg#include <X11/Xatom.h> 541ab64890Smrg#include <stdio.h> 551ab64890Smrg 561ab64890SmrgStatus XGetWMColormapWindows ( 571ab64890Smrg Display *dpy, 581ab64890Smrg Window w, 591ab64890Smrg Window **colormapWindows, 601ab64890Smrg int *countReturn) 611ab64890Smrg{ 621ab64890Smrg Atom *data = NULL; 631ab64890Smrg Atom actual_type; 641ab64890Smrg Atom prop; 651ab64890Smrg int actual_format; 661ab64890Smrg unsigned long leftover, nitems; 671ab64890Smrg 681ab64890Smrg prop = XInternAtom(dpy, "WM_COLORMAP_WINDOWS", False); 691ab64890Smrg if (prop == None) return False; 701ab64890Smrg 711ab64890Smrg /* get the property */ 721ab64890Smrg if (XGetWindowProperty (dpy, w, prop, 731ab64890Smrg 0L, 1000000L, False, 741ab64890Smrg XA_WINDOW, &actual_type, &actual_format, 751ab64890Smrg &nitems, &leftover, (unsigned char **) &data) 761ab64890Smrg != Success) 771ab64890Smrg return False; 781ab64890Smrg 791ab64890Smrg if (actual_type != XA_WINDOW || actual_format != 32) { 800f8248bfSmrg Xfree (data); 811ab64890Smrg return False; 821ab64890Smrg } 831ab64890Smrg 841ab64890Smrg *colormapWindows = (Window *) data; 851ab64890Smrg *countReturn = (int) nitems; 861ab64890Smrg return True; 871ab64890Smrg} 88