<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<!-- lifted from troff+man by doclifter -->
<refentry id='xashintsman'>
<!-- '\" t -->
<!--  Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium -->

<!--  Permission is hereby granted, free of charge, to any person obtaining -->
<!--  a copy of this software and associated documentation files (the -->
<!--  "Software"), to deal in the Software without restriction, including -->
<!--  without limitation the rights to use, copy, modify, merge, publish, -->
<!--  distribute, sublicense, and/or sell copies of the Software, and to -->
<!--  permit persons to whom the Software is furnished to do so, subject to -->
<!--  the following conditions: -->

<!--  The above copyright notice and this permission notice shall be included -->
<!--  in all copies or substantial portions of the Software. -->

<!--  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -->
<!--  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
<!--  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -->
<!--  IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR -->
<!--  OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -->
<!--  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -->
<!--  OTHER DEALINGS IN THE SOFTWARE. -->

<!--  Except as contained in this notice, the name of the X Consortium shall -->
<!--  not be used in advertising or otherwise to promote the sale, use or -->
<!--  other dealings in this Software without prior written authorization -->
<!--  from the X Consortium. -->

<!--  Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by -->
<!--  Digital Equipment Corporation -->

<!--  Portions Copyright \(co 1990, 1991 by -->
<!--  Tektronix, Inc. -->

<!--  Permission to use, copy, modify and distribute this documentation for -->
<!--  any purpose and without fee is hereby granted, provided that the above -->
<!--  copyright notice appears in all copies and that both that copyright notice -->
<!--  and this permission notice appear in all copies, and that the names of -->
<!--  Digital and Tektronix not be used in in advertising or publicity pertaining -->
<!--  to this documentation without specific, written prior permission. -->
<!--  Digital and Tektronix makes no representations about the suitability -->
<!--  of this documentation for any purpose. -->
<!--  It is provided ``as is'' without express or implied warranty. -->
<!--   -->
<!--  $XFree86: xc/doc/man/X11/XASHints.man,v 1.6 2003/11/23 05:40:33 dawes Exp $ -->

<!-- .na -->
<!-- FD listing suppressed (not used) -->
<!-- FN listing suppressed (not used) -->
<!-- C{ listing suppressed (not used) -->
<!-- C} listing suppressed (not used) -->
<!-- Pn listing suppressed (not used) -->
<!-- hN listing suppressed (not used) -->
<!-- NT listing suppressed (not used) -->
<!-- .		\" Note End \-\- doug kraft 3/85 -->
<!-- NE listing suppressed (not used) -->
<!-- .ny0 -->
<!-- '\" t -->
<refmeta>
<refentrytitle>XAllocSizeHints</refentrytitle>
<manvolnum>3X11</manvolnum>
<refmiscinfo class='date'>__xorgversion__</refmiscinfo>
<refmiscinfo class='source'>XLIB FUNCTIONS</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>XAllocSizeHints</refname>
<refname>XSetWMNormalHints</refname>
<refname>XGetWMNormalHints</refname>
<refname>XSetWMSizeHints</refname>
<refname>XGetWMSizeHints</refname>
<refname>XSizeHints</refname>
<refpurpose>allocate size hints structure and set or read a window's WM_NORMAL_HINTS property</refpurpose>
</refnamediv>
<!-- body begins here -->

<refsect1 id='syntax'><title>SYNTAX</title>

<para>XSizeHints *XAllocSizeHints&hairsp;(void&hairsp;);</para>

<para>void XSetWMNormalHints&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>, Window <emphasis remap='I'>w</emphasis>, XSizeHints *<emphasis remap='I'>hints</emphasis>&hairsp;);</para>

<para>Status XGetWMNormalHints&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>, Window <emphasis remap='I'>w</emphasis>,
XSizeHints *<emphasis remap='I'>hints_return</emphasis>, long *<emphasis remap='I'>supplied_return</emphasis>&hairsp;);</para>

<para>void XSetWMSizeHints&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>, Window <emphasis remap='I'>w</emphasis>, XSizeHints
*<emphasis remap='I'>hints</emphasis>, Atom <emphasis remap='I'>property</emphasis>&hairsp;);</para>

<para>Status XGetWMSizeHints&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>, Window <emphasis remap='I'>w</emphasis>, XSizeHints
*<emphasis remap='I'>hints_return</emphasis>, long *<emphasis remap='I'>supplied_return</emphasis>, Atom <emphasis remap='I'>property</emphasis>&hairsp;);</para>
</refsect1>

<refsect1 id='arguments'><title>ARGUMENTS</title>
<variablelist remap='IP'>
  <varlistentry>
  <term><emphasis remap='I'>display</emphasis></term>
  <listitem>
<para>Specifies the connection to the X server.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>hints</emphasis></term>
  <listitem>
<para>Specifies the size hints for the window in its normal state.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>hints</emphasis></term>
  <listitem>
<para>Specifies the
<emphasis remap='I'>&hairsp;XSizeHints&hairsp;</emphasis>
structure to be used.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>hints_return</emphasis></term>
  <listitem>
<para>Returns the size hints for the window in its normal state.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>property</emphasis></term>
  <listitem>
<para>Specifies the property name.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>supplied_return</emphasis></term>
  <listitem>
<para>Returns the hints that were supplied by the user.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>w</emphasis></term>
  <listitem>
<para>Specifies the window.</para>
  </listitem>
  </varlistentry>
</variablelist>
</refsect1>

<refsect1 id='description'><title>DESCRIPTION</title>
<para>The
<emphasis remap='I'>&hairsp;XAllocSizeHints&hairsp;</emphasis>
function allocates and returns a pointer to a
<emphasis remap='I'>&hairsp;XSizeHints&hairsp;</emphasis>
structure.
Note that all fields in the
<emphasis remap='I'>&hairsp;XSizeHints&hairsp;</emphasis>
structure are initially set to zero.
If insufficient memory is available, 
<emphasis remap='I'>&hairsp;XAllocSizeHints&hairsp;</emphasis>
returns NULL.
To free the memory allocated to this structure,
use
<emphasis remap='I'>&hairsp;XFree&hairsp;</emphasis>.</para>

<para>The 
<emphasis remap='I'>&hairsp;XSetWMNormalHints&hairsp;</emphasis>
function replaces the size hints for the WM_NORMAL_HINTS property 
on the specified window.
If the property does not already exist,
<emphasis remap='I'>&hairsp;XSetWMNormalHints&hairsp;</emphasis>
sets the size hints for the WM_NORMAL_HINTS property on the specified window.
The property is stored with a type of WM_SIZE_HINTS and a format of 32.</para>

<para><emphasis remap='I'>&hairsp;XSetWMNormalHints&hairsp;</emphasis>
can generate
<emphasis remap='I'>&hairsp;BadAlloc&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;BadWindow&hairsp;</emphasis>
errors.</para>

<para>The 
<emphasis remap='I'>&hairsp;XGetWMNormalHints&hairsp;</emphasis>
function returns the size hints stored in the WM_NORMAL_HINTS property 
on the specified window.
If the property is of type WM_SIZE_HINTS, is of format 32,
and is long enough to contain either an old (pre-ICCCM) 
or new size hints structure, 
<emphasis remap='I'>&hairsp;XGetWMNormalHints&hairsp;</emphasis>
sets the various fields of the 
<emphasis remap='I'>&hairsp;XSizeHints&hairsp;</emphasis>
structure, sets the supplied_return argument to the list of fields 
that were supplied by the user (whether or not they contained defined values),
and returns a nonzero status.
Otherwise, it returns a zero status.</para>

<para>If 
<emphasis remap='I'>&hairsp;XGetWMNormalHints&hairsp;</emphasis>
returns successfully and a pre-ICCCM size hints property is read, 
the supplied_return argument will contain the following bits:</para>

<literallayout remap='.nf'>
<!-- .D   -->

<!-- .ps \n(PS -->
<!-- .if \n(VS&gt;=40 .vs \n(VSu -->
<!-- .if \n(VS&lt;=39 .vs \n(VSp -->
(USPosition|USSize|PPosition|PSize|PMinSize|
 PMaxSize|PResizeInc|PAspect)
<!-- .ce 0  IGNORED -->
<!-- .in \n(OIu  IGNORED -->

</literallayout> <!-- .fi -->

<para>If the property is large enough to contain the base size 
and window gravity fields as well, 
the supplied_return argument will also contain the following bits:</para>

<literallayout remap='.nf'>
<!-- .D   -->

<!-- .ps \n(PS -->
<!-- .if \n(VS&gt;=40 .vs \n(VSu -->
<!-- .if \n(VS&lt;=39 .vs \n(VSp -->
PBaseSize|PWinGravity
<!-- .ce 0  IGNORED -->
<!-- .in \n(OIu  IGNORED -->

</literallayout> <!-- .fi -->

<para><emphasis remap='I'>&hairsp;XGetWMNormalHints&hairsp;</emphasis>
can generate a
PN BadWindow
error.</para>

<para>The 
<emphasis remap='I'>&hairsp;XSetWMSizeHints&hairsp;</emphasis>
function replaces the size hints for the specified property 
on the named window.
If the specified property does not already exist,
<emphasis remap='I'>&hairsp;XSetWMSizeHints&hairsp;</emphasis>
sets the size hints for the specified property
on the named window.
The property is stored with a type of WM_SIZE_HINTS and a format of 32.
To set a window's normal size hints, 
you can use the 
<emphasis remap='I'>&hairsp;XSetWMNormalHints&hairsp;</emphasis>
function.</para>

<para><emphasis remap='I'>&hairsp;XSetWMSizeHints&hairsp;</emphasis>
can generate
<emphasis remap='I'>&hairsp;BadAlloc&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;BadAtom&hairsp;</emphasis>,
and
<emphasis remap='I'>&hairsp;BadWindow&hairsp;</emphasis>
errors.</para>

<para>The 
<emphasis remap='I'>&hairsp;XGetWMSizeHints&hairsp;</emphasis>
function returns the size hints stored in the specified property 
on the named window.
If the property is of type WM_SIZE_HINTS, is of format 32, 
and is long enough to contain either an old (pre-ICCCM) 
or new size hints structure, 
<emphasis remap='I'>&hairsp;XGetWMSizeHints&hairsp;</emphasis>
sets the various fields of the 
<emphasis remap='I'>&hairsp;XSizeHints&hairsp;</emphasis>
structure, sets the supplied_return argument to the
list of fields that were supplied by the user 
(whether or not they contained defined values), 
and returns a nonzero status.
Otherwise, it returns a zero status.
To get a window's normal size hints, 
you can use the 
<emphasis remap='I'>&hairsp;XGetWMNormalHints&hairsp;</emphasis>
function.</para>

<para>If 
<emphasis remap='I'>&hairsp;XGetWMSizeHints&hairsp;</emphasis>
returns successfully and a pre-ICCCM size hints property is read, 
the supplied_return argument will contain the following bits:</para>

<literallayout remap='.nf'>
<!-- .D   -->

<!-- .ps \n(PS -->
<!-- .if \n(VS&gt;=40 .vs \n(VSu -->
<!-- .if \n(VS&lt;=39 .vs \n(VSp -->
(USPosition|USSize|PPosition|PSize|PMinSize|
 PMaxSize|PResizeInc|PAspect);
<!-- .ce 0  IGNORED -->
<!-- .in \n(OIu  IGNORED -->

</literallayout> <!-- .fi -->

<para>If the property is large enough to contain the base size 
and window gravity fields as well, 
the supplied_return argument will also contain the following bits:</para>

<literallayout remap='.nf'>
<!-- .D   -->

<!-- .ps \n(PS -->
<!-- .if \n(VS&gt;=40 .vs \n(VSu -->
<!-- .if \n(VS&lt;=39 .vs \n(VSp -->
PBaseSize|PWinGravity
<!-- .ce 0  IGNORED -->
<!-- .in \n(OIu  IGNORED -->

</literallayout> <!-- .fi -->

<para><emphasis remap='I'>&hairsp;XGetWMSizeHints&hairsp;</emphasis>
can generate
<emphasis remap='I'>&hairsp;BadAtom&hairsp;</emphasis>
and
<emphasis remap='I'>&hairsp;BadWindow&hairsp;</emphasis>
errors.</para>
</refsect1>

<refsect1 id='properties'><title>PROPERTIES</title>
<variablelist remap='TP'>
  <varlistentry>
  <term>WM_NORMAL_HINTS</term>
  <listitem>
<para>Size hints for a window in its normal state.
The C type of this property is
<emphasis remap='I'>&hairsp;XSizeHints&hairsp;</emphasis>.</para>
  </listitem>
  </varlistentry>
</variablelist>
</refsect1>

<refsect1 id='structures'><title>STRUCTURES</title>
<para>The
<emphasis remap='I'>&hairsp;XSizeHints&hairsp;</emphasis>
structure contains:</para>

<para>/&lowast; Size hints mask bits */</para>


<informaltable pgwide='0' frame='none'>
  <tgroup cols='4' align='center'>
    <colspec colname='c1'/>
    <colspec colname='c2'/>
    <colspec colname='c3'/>
    <colspec colname='c4'/>
    <tbody>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN USPosition</entry>
        <entry align='left'>(1L &lt;&lt; 0)</entry>
        <entry align='left'>/&lowast; user specified x, y */</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN USSize</entry>
        <entry align='left'>(1L &lt;&lt; 1)</entry>
        <entry align='left'>/&lowast; user specified width, height */</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN PPosition</entry>
        <entry align='left'>(1L &lt;&lt; 2)</entry>
        <entry align='left'>/&lowast; program specified position */</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN PSize</entry>
        <entry align='left'>(1L &lt;&lt; 3)</entry>
        <entry align='left'>/&lowast; program specified size */</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN PMinSize</entry>
        <entry align='left'>(1L &lt;&lt; 4)</entry>
        <entry align='left'>/&lowast; program specified minimum size */</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN PMaxSize</entry>
        <entry align='left'>(1L &lt;&lt; 5)</entry>
        <entry align='left'>/&lowast; program specified maximum size */</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN PResizeInc</entry>
        <entry align='left'>(1L &lt;&lt; 6)</entry>
        <entry align='left'>/&lowast; program specified resize increments */</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN PAspect</entry>
        <entry align='left'>(1L &lt;&lt; 7)</entry>
        <entry align='left'>/&lowast; program specified min and max aspect ratios */</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN PBaseSize</entry>
        <entry align='left'>(1L &lt;&lt; 8)</entry>
        <entry align='left'></entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN PWinGravity</entry>
        <entry align='left'>(1L &lt;&lt; 9)</entry>
        <entry align='left'></entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN PAllHints</entry>
        <entry align='left'>(PPosition|PSize|
.br
PMinSize|PMaxSize|
.br
PResizeInc|PAspect)</entry>
        <entry align='left'>T}</entry>
      </row>
    </tbody>
  </tgroup>
</informaltable>


<literallayout remap='.nf'>
<!-- .0D  0 -->

<!-- .ps \n(PS -->
<!-- .if \n(VS&gt;=40 .vs \n(VSu -->
<!-- .if \n(VS&lt;=39 .vs \n(VSp -->
<!-- .TA .5i 2.5i -->
<!-- .ta .5i 2.5i -->
/&lowast; Values */

typedef struct {
	long flags;	/&lowast; marks which fields in this structure are defined */
	int x, y;	/&lowast; Obsolete */
	int width, height;	/&lowast; Obsolete */
	int min_width, min_height;
	int max_width, max_height;
	int width_inc, height_inc;
	struct {
	       int x;	/&lowast; numerator */
	       int y;	/&lowast; denominator */
	} min_aspect, max_aspect;
	int base_width, base_height;
	int win_gravity;
	/&lowast; this structure may be extended in the future */
} XSizeHints;
<!-- .ce 0  IGNORED -->
<!-- .in \n(OIu  IGNORED -->

</literallayout> <!-- .fi -->

<para>The x, y, width, and height members are now obsolete
and are left solely for compatibility reasons.
The min_width and min_height members specify the
minimum window size that still allows the application to be useful.
The max_width and max_height members specify the maximum window size.
The width_inc and height_inc members define an arithmetic progression of
sizes (minimum to maximum) into which the window prefers to be resized.
The min_aspect and max_aspect members are expressed
as ratios of x and y, 
and they allow an application to specify the range of aspect
ratios it prefers.
The base_width and base_height members define the desired size of the window.
The window manager will interpret the position of the window 
and its border width to position the point of the outer rectangle 
of the overall window specified by the win_gravity member.
The outer rectangle of the window includes any borders or decorations
supplied by the window manager.
In other words,
if the window manager decides to place the window where the client asked,
the position on the parent window's border named by the win_gravity 
will be placed where the client window would have been placed 
in the absence of a window manager.</para>

<para>Note that use of the
<emphasis remap='I'>&hairsp;PAllHints&hairsp;</emphasis>
macro is highly discouraged.</para>
</refsect1>

<refsect1 id='diagnostics'><title>DIAGNOSTICS</title>
<variablelist remap='TP'>
  <varlistentry>
  <term><emphasis remap='I'>&hairsp;BadAlloc&hairsp;</emphasis></term>
  <listitem>
<para>The server failed to allocate the requested resource or server memory.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>&hairsp;BadAtom&hairsp;</emphasis></term>
  <listitem>
<para>A value for an Atom argument does not name a defined Atom.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>&hairsp;BadWindow&hairsp;</emphasis></term>
  <listitem>
<para>A value for a Window argument does not name a defined Window.</para>
  </listitem>
  </varlistentry>
</variablelist>
</refsect1>

<refsect1 id='see_also'><title>SEE ALSO</title>
<para>XAllocClassHint(3X11),
XAllocIconSize(3X11),
XAllocWMHints(3X11),
XFree(3X11),
XSetCommand(3X11),
XSetTransientForHint(3X11),
XSetTextProperty(3X11),
XSetWMClientMachine(3X11),
XSetWMColormapWindows(3X11),
XSetWMIconName(3X11),
XSetWMName(3X11),
XSetWMProperties(3X11),
XSetWMProtocols(3X11),
XStringListToTextProperty(3X11)
<!-- .br -->
<userinput>Xlib - C Language X Interface, </userinput>O'Reilly and Associates,<emphasis remap='P->I'></emphasis></para>
</refsect1>
</refentry>

