1 /***********************************************************
2 Copyright 1988 by Wyse Technology, Inc., San Jose, Ca,
3 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
7 Permission to use, copy, modify, and distribute this software and its
8 documentation for any purpose and without fee is hereby granted,
9 provided that the above copyright notice appear in all copies and that
10 both that copyright notice and this permission notice appear in
11 supporting documentation, and that the name Digital not be
12 used in advertising or publicity pertaining to distribution of the
13 software without specific, written prior permission.
15 DIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 EVENT SHALL DIGITAL OR WYSE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
19 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 PERFORMANCE OF THIS SOFTWARE.
23 ******************************************************************/
27 Copyright 1987, 1988, 1998 The Open Group
29 Permission to use, copy, modify, distribute, and sell this software and its
30 documentation for any purpose is hereby granted without fee, provided that
31 the above copyright notice appear in all copies and that both that
32 copyright notice and this permission notice appear in supporting
35 The above copyright notice and this permission notice shall be included
36 in all copies or substantial portions of the Software.
38 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
39 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
40 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
41 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
42 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
43 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
44 OTHER DEALINGS IN THE SOFTWARE.
46 Except as contained in this notice, the name of The Open Group shall
47 not be used in advertising or otherwise to promote the sale, use or
48 other dealings in this Software without prior written authorization
57 #include <X11/Xlibint.h>
58 #include <X11/Xatom.h>
59 #include "Xatomtype.h"
60 #include <X11/Xutil.h>
63 Status XGetWMSizeHints (
70 xPropSizeHints *prop = NULL;
73 unsigned long leftover;
76 if (XGetWindowProperty (dpy, w, property, 0L,
77 (long)NumPropSizeElements,
78 False, XA_WM_SIZE_HINTS, &actual_type,
79 &actual_format, &nitems, &leftover,
80 (unsigned char **)&prop)
84 if ((actual_type != XA_WM_SIZE_HINTS) ||
85 (nitems < OldNumPropSizeElements) || (actual_format != 32)) {
86 if (prop != NULL) Xfree ((char *)prop);
90 hints->flags = prop->flags;
91 /* XSizeHints misdeclares these as int instead of long */
92 hints->x = cvtINT32toInt (prop->x);
93 hints->y = cvtINT32toInt (prop->y);
94 hints->width = cvtINT32toInt (prop->width);
95 hints->height = cvtINT32toInt (prop->height);
96 hints->min_width = cvtINT32toInt (prop->minWidth);
97 hints->min_height = cvtINT32toInt (prop->minHeight);
98 hints->max_width = cvtINT32toInt (prop->maxWidth);
99 hints->max_height = cvtINT32toInt (prop->maxHeight);
100 hints->width_inc = cvtINT32toInt (prop->widthInc);
101 hints->height_inc = cvtINT32toInt (prop->heightInc);
102 hints->min_aspect.x = cvtINT32toInt (prop->minAspectX);
103 hints->min_aspect.y = cvtINT32toInt (prop->minAspectY);
104 hints->max_aspect.x = cvtINT32toInt (prop->maxAspectX);
105 hints->max_aspect.y = cvtINT32toInt (prop->maxAspectY);
107 *supplied = (USPosition | USSize | PAllHints);
108 if (nitems >= NumPropSizeElements) {
109 hints->base_width= cvtINT32toInt (prop->baseWidth);
110 hints->base_height= cvtINT32toInt (prop->baseHeight);
111 hints->win_gravity= cvtINT32toInt (prop->winGravity);
112 *supplied |= (PBaseSize | PWinGravity);
114 hints->flags &= (*supplied); /* get rid of unwanted bits */
120 Status XGetWMNormalHints (
126 return (XGetWMSizeHints (dpy, w, hints, supplied, XA_WM_NORMAL_HINTS));