11ab64890Smrg 21ab64890Smrg/*********************************************************** 31ab64890SmrgCopyright 1988 by Wyse Technology, Inc., San Jose, Ca, 41ab64890SmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, 51ab64890Smrg 61ab64890Smrg All Rights Reserved 71ab64890Smrg 81ab64890SmrgPermission to use, copy, modify, and distribute this software and its 91ab64890Smrgdocumentation for any purpose and without fee is hereby granted, 101ab64890Smrgprovided that the above copyright notice appear in all copies and that 111ab64890Smrgboth that copyright notice and this permission notice appear in 121ab64890Smrgsupporting documentation, and that the name Digital not be 131ab64890Smrgused in advertising or publicity pertaining to distribution of the 141ab64890Smrgsoftware without specific, written prior permission. 151ab64890Smrg 161ab64890SmrgDIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 171ab64890SmrgINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 181ab64890SmrgEVENT SHALL DIGITAL OR WYSE BE LIABLE FOR ANY SPECIAL, INDIRECT OR 191ab64890SmrgCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 201ab64890SmrgUSE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 211ab64890SmrgOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 221ab64890SmrgPERFORMANCE OF THIS SOFTWARE. 231ab64890Smrg 241ab64890Smrg******************************************************************/ 251ab64890Smrg/* 261ab64890Smrg 271ab64890SmrgCopyright 1987, 1988, 1998 The Open Group 281ab64890Smrg 291ab64890SmrgPermission to use, copy, modify, distribute, and sell this software and its 301ab64890Smrgdocumentation for any purpose is hereby granted without fee, provided that 311ab64890Smrgthe above copyright notice appear in all copies and that both that 321ab64890Smrgcopyright notice and this permission notice appear in supporting 331ab64890Smrgdocumentation. 341ab64890Smrg 351ab64890SmrgThe above copyright notice and this permission notice shall be included 361ab64890Smrgin all copies or substantial portions of the Software. 371ab64890Smrg 381ab64890SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 391ab64890SmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 401ab64890SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 411ab64890SmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 421ab64890SmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 431ab64890SmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 441ab64890SmrgOTHER DEALINGS IN THE SOFTWARE. 451ab64890Smrg 461ab64890SmrgExcept as contained in this notice, the name of The Open Group shall 471ab64890Smrgnot be used in advertising or otherwise to promote the sale, use or 481ab64890Smrgother dealings in this Software without prior written authorization 491ab64890Smrgfrom The Open Group. 501ab64890Smrg 511ab64890Smrg*/ 521ab64890Smrg 531ab64890Smrg#ifdef HAVE_CONFIG_H 541ab64890Smrg#include <config.h> 551ab64890Smrg#endif 561ab64890Smrg#include <X11/Xlibint.h> 571ab64890Smrg#include <X11/Xutil.h> 581ab64890Smrg#include "Xatomtype.h" 591ab64890Smrg#include <X11/Xatom.h> 601ab64890Smrg#include <X11/Xos.h> 611ab64890Smrg 621ab64890Smrgvoid XSetWMSizeHints ( 631ab64890Smrg Display *dpy, 641ab64890Smrg Window w, 651ab64890Smrg XSizeHints *hints, 661ab64890Smrg Atom prop) 671ab64890Smrg{ 681ab64890Smrg xPropSizeHints data; 691ab64890Smrg 701ab64890Smrg memset(&data, 0, sizeof(data)); 7161b2299dSmrg data.flags = (hints->flags & 721ab64890Smrg (USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize| 731ab64890Smrg PResizeInc|PAspect|PBaseSize|PWinGravity)); 741ab64890Smrg 751ab64890Smrg /* 761ab64890Smrg * The x, y, width, and height fields are obsolete; but, applications 771ab64890Smrg * that want to work with old window managers might set them. 781ab64890Smrg */ 791ab64890Smrg if (hints->flags & (USPosition|PPosition)) { 801ab64890Smrg data.x = hints->x; 811ab64890Smrg data.y = hints->y; 821ab64890Smrg } 831ab64890Smrg if (hints->flags & (USSize|PSize)) { 841ab64890Smrg data.width = hints->width; 851ab64890Smrg data.height = hints->height; 861ab64890Smrg } 871ab64890Smrg 881ab64890Smrg if (hints->flags & PMinSize) { 891ab64890Smrg data.minWidth = hints->min_width; 901ab64890Smrg data.minHeight = hints->min_height; 911ab64890Smrg } 921ab64890Smrg if (hints->flags & PMaxSize) { 931ab64890Smrg data.maxWidth = hints->max_width; 941ab64890Smrg data.maxHeight = hints->max_height; 951ab64890Smrg } 961ab64890Smrg if (hints->flags & PResizeInc) { 971ab64890Smrg data.widthInc = hints->width_inc; 981ab64890Smrg data.heightInc = hints->height_inc; 991ab64890Smrg } 1001ab64890Smrg if (hints->flags & PAspect) { 1011ab64890Smrg data.minAspectX = hints->min_aspect.x; 1021ab64890Smrg data.minAspectY = hints->min_aspect.y; 1031ab64890Smrg data.maxAspectX = hints->max_aspect.x; 1041ab64890Smrg data.maxAspectY = hints->max_aspect.y; 1051ab64890Smrg } 1061ab64890Smrg if (hints->flags & PBaseSize) { 1071ab64890Smrg data.baseWidth = hints->base_width; 1081ab64890Smrg data.baseHeight = hints->base_height; 1091ab64890Smrg } 1101ab64890Smrg if (hints->flags & PWinGravity) { 1111ab64890Smrg data.winGravity = hints->win_gravity; 1121ab64890Smrg } 11361b2299dSmrg 1141ab64890Smrg XChangeProperty (dpy, w, prop, XA_WM_SIZE_HINTS, 32, 1151ab64890Smrg PropModeReplace, (unsigned char *) &data, 1161ab64890Smrg NumPropSizeElements); 1171ab64890Smrg} 1181ab64890Smrg 1191ab64890Smrg 1201ab64890Smrgvoid XSetWMNormalHints ( 1211ab64890Smrg Display *dpy, 1221ab64890Smrg Window w, 1231ab64890Smrg XSizeHints *hints) 1241ab64890Smrg{ 1251ab64890Smrg XSetWMSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); 1261ab64890Smrg} 1271ab64890Smrg 128