<?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='xcrewinman'>
<!-- '\" 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/XCreWin.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>XCreateWindow</refentrytitle>
<manvolnum>3X11</manvolnum>
<refmiscinfo class='date'>__xorgversion__</refmiscinfo>
<refmiscinfo class='source'>XLIB FUNCTIONS</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>XCreateWindow</refname>
<refname>XCreateSimpleWindow</refname>
<refname>XSetWindowAttributes</refname>
<refpurpose>create windows and window attributes structure</refpurpose>
</refnamediv>
<!-- body begins here -->

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

<para>Window XCreateWindow&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>&hairsp;, Window <emphasis remap='I'>parent</emphasis>&hairsp;, int <emphasis remap='I'>x</emphasis>&hairsp;, int <emphasis remap='I'>y</emphasis>&hairsp;, unsigned int <emphasis remap='I'>width</emphasis>&hairsp;, unsigned int <emphasis remap='I'>height</emphasis>&hairsp;, unsigned int <emphasis remap='I'>border_width</emphasis>&hairsp;, int <emphasis remap='I'>depth</emphasis>&hairsp;, unsigned int <emphasis remap='I'>class</emphasis>&hairsp;, Visual *<emphasis remap='I'>visual</emphasis>&hairsp;, unsigned long <emphasis remap='I'>valuemask</emphasis>&hairsp;, XSetWindowAttributes *<emphasis remap='I'>attributes</emphasis>&hairsp;);</para> 

<para>Window XCreateSimpleWindow&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>&hairsp;, Window <emphasis remap='I'>parent</emphasis>&hairsp;, int <emphasis remap='I'>x</emphasis>&hairsp;, int <emphasis remap='I'>y</emphasis>&hairsp;, unsigned int <emphasis remap='I'>width</emphasis>&hairsp;, unsigned int <emphasis remap='I'>height</emphasis>&hairsp;, unsigned int <emphasis remap='I'>border_width</emphasis>&hairsp;, unsigned long <emphasis remap='I'>border</emphasis>&hairsp;, unsigned long <emphasis remap='I'>background</emphasis>&hairsp;);</para> 
</refsect1>

<refsect1 id='arguments'><title>ARGUMENTS</title>
<variablelist remap='IP'>
  <varlistentry>
  <term><emphasis remap='I'>attributes</emphasis></term>
  <listitem>
<para>Specifies the structure from which the values (as specified by the value mask)
are to be taken.
The value mask should have the appropriate bits
set to indicate which attributes have been set in the structure.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>background</emphasis></term>
  <listitem>
<para>Specifies the background pixel value of the window.</para>

  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>border</emphasis></term>
  <listitem>
<para>Specifies the border pixel value of the window.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>border_width</emphasis></term>
  <listitem>
<para>Specifies the width of the created window's border in pixels.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>class</emphasis></term>
  <listitem>
<para>Specifies the created window's class.
You can pass
<emphasis remap='I'>&hairsp;InputOutput&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;InputOnly&hairsp;</emphasis>,
or 
<emphasis remap='I'>&hairsp;CopyFromParent&hairsp;</emphasis>.
A class of 
<emphasis remap='I'>&hairsp;CopyFromParent&hairsp;</emphasis>
means the class
is taken from the parent.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>depth</emphasis></term>
  <listitem>
<para>Specifies the window's depth.
A depth of 
<emphasis remap='I'>&hairsp;CopyFromParent&hairsp;</emphasis>
means the depth is taken from the parent.</para>
  </listitem>
  </varlistentry>
  <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'>parent</emphasis></term>
  <listitem>
<para>Specifies the parent window.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>valuemask</emphasis></term>
  <listitem>
<para>Specifies which window attributes are defined in the attributes
argument.
This mask is the bitwise inclusive OR of the valid attribute mask bits.
If valuemask is zero,
the attributes are ignored and are not referenced.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>visual</emphasis></term>
  <listitem>
<para>Specifies the visual type.
A visual of 
<emphasis remap='I'>&hairsp;CopyFromParent&hairsp;</emphasis>
means the visual type is taken from the 
parent.
and do not include the created window's borders</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>width</emphasis></term>
<!-- .br -->
<!-- .ns -->
  <term><emphasis remap='I'>height</emphasis></term>
  <listitem>
<para>Specify the width and height, which are the created window's inside dimensions.
borders and are relative to the inside of the parent window's borders</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>x</emphasis></term>
<!-- .br -->
<!-- .ns -->
  <term><emphasis remap='I'>y</emphasis></term>
  <listitem>
<para>Specify the x and y coordinates, which are the top-left outside corner of the window's.</para>
  </listitem>
  </varlistentry>
</variablelist>
</refsect1>

<refsect1 id='description'><title>DESCRIPTION</title>
<para>The
<emphasis remap='I'>&hairsp;XCreateWindow&hairsp;</emphasis>
function creates an unmapped subwindow for a specified parent window, 
returns the window ID of the created window, 
and causes the X server to generate a
<emphasis remap='I'>&hairsp;CreateNotify&hairsp;</emphasis>
event.
The created window is placed on top in the stacking order 
with respect to siblings.</para>

<para>The coordinate system has the X axis horizontal and the Y axis vertical
with the origin [0, 0] at the upper-left corner.
Coordinates are integral,
in terms of pixels,
and coincide with pixel centers.
Each window and pixmap has its own coordinate system.
For a window, 
the origin is inside the border at the inside, upper-left corner.</para>

<para>The border_width for an
<emphasis remap='I'>&hairsp;InputOnly&hairsp;</emphasis>
window must be zero, or a
<emphasis remap='I'>&hairsp;BadMatch&hairsp;</emphasis>
error results.
For class
<emphasis remap='I'>&hairsp;InputOutput&hairsp;</emphasis>,
the visual type and depth must be a combination supported for the screen,
or a
<emphasis remap='I'>&hairsp;BadMatch&hairsp;</emphasis>
error results.
The depth need not be the same as the parent,
but the parent must not be a window of class 
<emphasis remap='I'>&hairsp;InputOnly&hairsp;</emphasis>,
or a
<emphasis remap='I'>&hairsp;BadMatch&hairsp;</emphasis>
error results.
For an
<emphasis remap='I'>&hairsp;InputOnly&hairsp;</emphasis>
window,
the depth must be zero, and the visual must be one supported by the screen.
If either condition is not met,
a
<emphasis remap='I'>&hairsp;BadMatch&hairsp;</emphasis>
error results.
The parent window, however, may have any depth and class.
If you specify any invalid window attribute for a window, a
<emphasis remap='I'>&hairsp;BadMatch&hairsp;</emphasis>
error results.</para>

<para>The created window is not yet displayed (mapped) on the user's display.
To display the window, call
<emphasis remap='I'>&hairsp;XMapWindow&hairsp;</emphasis>.
The new window initially uses the same cursor as
its parent. 
A new cursor can be defined for the new window by calling
<emphasis remap='I'>&hairsp;XDefineCursor&hairsp;</emphasis>.
The window will not be visible on the screen unless it and all of its
ancestors are mapped and it is not obscured by any of its ancestors.</para>

<para><emphasis remap='I'>&hairsp;XCreateWindow&hairsp;</emphasis>
can generate
<emphasis remap='I'>&hairsp;BadAlloc&hairsp;</emphasis>
<emphasis remap='I'>&hairsp;BadColor&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;BadCursor&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;BadMatch&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;BadPixmap&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;BadValue&hairsp;</emphasis>,
and
<emphasis remap='I'>&hairsp;BadWindow&hairsp;</emphasis>
errors.</para>

<para>The
<emphasis remap='I'>&hairsp;XCreateSimpleWindow&hairsp;</emphasis>
function creates an unmapped
<emphasis remap='I'>&hairsp;InputOutput&hairsp;</emphasis>
subwindow for a specified parent window, returns the
window ID of the created window, and causes the X server to generate a
<emphasis remap='I'>&hairsp;CreateNotify&hairsp;</emphasis>
event.
The created window is placed on top in the stacking order with respect to 
siblings.
Any part of the window that extends outside its parent window is clipped.
The border_width for an
<emphasis remap='I'>&hairsp;InputOnly&hairsp;</emphasis>
window must be zero, or a
<emphasis remap='I'>&hairsp;BadMatch&hairsp;</emphasis>
error results.
<emphasis remap='I'>&hairsp;XCreateSimpleWindow&hairsp;</emphasis>
inherits its depth, class, and visual from its parent.
All other window attributes, except background and border, 
have their default values.</para>

<para><emphasis remap='I'>&hairsp;XCreateSimpleWindow&hairsp;</emphasis>
can generate
<emphasis remap='I'>&hairsp;BadAlloc&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;BadMatch&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;BadValue&hairsp;</emphasis>,
and
<emphasis remap='I'>&hairsp;BadWindow&hairsp;</emphasis>
errors.</para>
</refsect1>

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


<para>/&lowast; Window attribute value mask bits */</para>


<informaltable pgwide='0' frame='none'>
  <tgroup cols='3' align='center'>
    <colspec colname='c1'/>
    <colspec colname='c2'/>
    <colspec colname='c3'/>
    <tbody>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWBackPixmap</entry>
        <entry align='left'>(1L&lt;&lt;0)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWBackPixel</entry>
        <entry align='left'>(1L&lt;&lt;1)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWBorderPixmap</entry>
        <entry align='left'>(1L&lt;&lt;2)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWBorderPixel</entry>
        <entry align='left'>(1L&lt;&lt;3)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWBitGravity</entry>
        <entry align='left'>(1L&lt;&lt;4)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWWinGravity</entry>
        <entry align='left'>(1L&lt;&lt;5)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWBackingStore</entry>
        <entry align='left'>(1L&lt;&lt;6)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWBackingPlanes</entry>
        <entry align='left'>(1L&lt;&lt;7)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWBackingPixel</entry>
        <entry align='left'>(1L&lt;&lt;8)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWOverrideRedirect</entry>
        <entry align='left'>(1L&lt;&lt;9)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWSaveUnder</entry>
        <entry align='left'>(1L&lt;&lt;10)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWEventMask</entry>
        <entry align='left'>(1L&lt;&lt;11)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWDontPropagate</entry>
        <entry align='left'>(1L&lt;&lt;12)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWColormap</entry>
        <entry align='left'>(1L&lt;&lt;13)</entry>
      </row>
      <row>
        <entry align='left'>T{
#define</entry>
        <entry align='left'>.ZN CWCursor</entry>
        <entry align='left'>(1L&lt;&lt;14)</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 3i -->
<!-- .ta .5i 3i -->
/&lowast; Values */

typedef struct {
	Pixmap background_pixmap;	/&lowast; background, None, or ParentRelative */
	unsigned long background_pixel;	/&lowast; background pixel */
	Pixmap border_pixmap;		/&lowast; border of the window or CopyFromParent */
	unsigned long border_pixel;	/&lowast; border pixel value */
	int bit_gravity;	/&lowast; one of bit gravity values */
	int win_gravity;	/&lowast; one of the window gravity values */
	int backing_store;	/&lowast; NotUseful, WhenMapped, Always */
	unsigned long backing_planes;	/&lowast; planes to be preserved if possible */
	unsigned long backing_pixel;	/&lowast; value to use in restoring planes */
	Bool save_under;	/&lowast; should bits under be saved? (popups) */
	long event_mask;	/&lowast; set of events that should be saved */
	long do_not_propagate_mask;	/&lowast; set of events that should not propagate */
	Bool override_redirect;	/&lowast; boolean value for override_redirect */
	Colormap colormap;	/&lowast; color map to be associated with window */
	Cursor cursor;		/&lowast; cursor to be displayed (or None) */
} XSetWindowAttributes;
<!-- .ce 0  IGNORED -->
<!-- .in \n(OIu  IGNORED -->

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

<para>For a detailed explanation of the members of this structure,
see <userinput>Xlib - C Language X Interface</userinput>&hairsp;.</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;BadColor&hairsp;</emphasis></term>
  <listitem>
<para>A value for a Colormap argument does not name a defined Colormap.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>&hairsp;BadCursor&hairsp;</emphasis></term>
  <listitem>
<para>A value for a Cursor argument does not name a defined Cursor.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>&hairsp;BadMatch&hairsp;</emphasis></term>
  <listitem>
<para>The values do not exist for an
<emphasis remap='I'>&hairsp;InputOnly&hairsp;</emphasis>
window.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>&hairsp;BadMatch&hairsp;</emphasis></term>
  <listitem>
<para>Some argument or pair of arguments has the correct type and range but fails
to match in some other way required by the request.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>&hairsp;BadPixmap&hairsp;</emphasis></term>
  <listitem>
<para>A value for a Pixmap argument does not name a defined Pixmap.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>&hairsp;BadValue&hairsp;</emphasis></term>
  <listitem>
<para>Some numeric value falls outside the range of values accepted by the request.
Unless a specific range is specified for an argument, the full range defined
by the argument's type is accepted.  Any argument defined as a set of
alternatives can generate this error.</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>XChangeWindowAttributes(3X11),
XConfigureWindow(3X11), 
XDefineCursor(3X11),
XDestroyWindow(3X11), 
XMapWindow(3X11), 
XRaiseWindow(3X11),
XUnmapWindow(3X11)
<!-- .br -->
<userinput>Xlib - C Language X Interface</userinput></para>
</refsect1>
</refentry>

