<?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='xgetwattrman'>
<!-- '\" 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/XGetWAttr.man,v 1.4 2003/11/23 05:40:33 dawes Exp $ -->

<!-- .na -->
<!-- FD listing suppressed (not used) -->
<!-- FN listing suppressed (not used) -->
<!-- IN 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>XGetWindowAttributes</refentrytitle>
<manvolnum>3X11</manvolnum>
<refmiscinfo class='date'>__xorgversion__</refmiscinfo>
<refmiscinfo class='source'>XLIB FUNCTIONS</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>XGetWindowAttributes</refname>
<refname>XGetGeometry</refname>
<refname>XWindowAttributes</refname>
<refpurpose>get current window attribute or geometry and current window attributes structure</refpurpose>
</refnamediv>
<!-- body begins here -->

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

<para>Status XGetWindowAttributes&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>&hairsp;, Window <emphasis remap='I'>w</emphasis>&hairsp;,
XWindowAttributes *<emphasis remap='I'>window_attributes_return</emphasis>&hairsp;);</para> 

<para>Status XGetGeometry&hairsp;(&hairsp;Display *<emphasis remap='I'>display</emphasis>&hairsp;, Drawable <emphasis remap='I'>d</emphasis>&hairsp;, Window
*<emphasis remap='I'>root_return</emphasis>&hairsp;, int *<emphasis remap='I'>x_return</emphasis>&hairsp;, int *<emphasis remap='I'>y_return</emphasis>&hairsp;, unsigned
int *<emphasis remap='I'>width_return</emphasis>&hairsp;, unsigned int *<emphasis remap='I'>height_return</emphasis>&hairsp;, unsigned int
*<emphasis remap='I'>border_width_return</emphasis>&hairsp;, unsigned int *<emphasis remap='I'>depth_return</emphasis>&hairsp;);</para> 
</refsect1>

<refsect1 id='arguments'><title>ARGUMENTS</title>
<variablelist remap='IP'>
  <varlistentry>
  <term><emphasis remap='I'>border_width_return</emphasis></term>
  <listitem>
<para>Returns the border width in pixels.</para> 
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>d</emphasis></term>
  <listitem>
<para>Specifies the drawable, which can be a window or a pixmap.</para> 
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>depth_return</emphasis></term>
  <listitem>
<para>Returns the depth of the drawable (bits per pixel for the object).</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'>root_return</emphasis></term>
  <listitem>
<para>Returns the root window.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>w</emphasis></term>
  <listitem>
<para>Specifies the window whose current attributes you want to obtain.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>width_return</emphasis></term>
<!-- .br -->
<!-- .ns -->
  <term><emphasis remap='I'>height_return</emphasis></term>
  <listitem>
<para>Return the drawable's dimensions (width and height).</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>window_attributes_return</emphasis></term>
  <listitem>
<para>Returns the specified window's attributes in the
<emphasis remap='I'>&hairsp;XWindowAttributes&hairsp;</emphasis>
structure.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>x_return</emphasis></term>
<!-- .br -->
<!-- .ns -->
  <term><emphasis remap='I'>y_return</emphasis></term>
  <listitem>
<para>Return the x and y coordinates that define the location of the drawable.
For a window, 
these coordinates specify the upper-left outer corner relative to
its parent's origin.
For pixmaps, these coordinates are always zero.</para>
  </listitem>
  </varlistentry>
</variablelist>
</refsect1>

<refsect1 id='description'><title>DESCRIPTION</title>
<para>The
<emphasis remap='I'>&hairsp;XGetWindowAttributes&hairsp;</emphasis>
function returns the current attributes for the specified window to an
<emphasis remap='I'>&hairsp;XWindowAttributes&hairsp;</emphasis>
structure.</para>

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

<para>The
<emphasis remap='I'>&hairsp;XGetGeometry&hairsp;</emphasis>
function returns the root window and the current geometry of the drawable.
The geometry of the drawable includes the x and y coordinates, width and height,
border width, and depth.
These are described in the argument list.
It is legal to pass to this function a window whose class is
<emphasis remap='I'>&hairsp;InputOnly&hairsp;</emphasis>.</para>
</refsect1>

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

<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 -->
typedef struct {
	int x, y;	/&lowast; location of window */
	int width, height;	/&lowast; width and height of window */
	int border_width;	/&lowast; border width of window */
	int depth;	/&lowast; depth of window */
	Visual *visual;	/&lowast; the associated visual structure */
	Window root;	/&lowast; root of screen containing window */
	int class;	/&lowast; InputOutput, InputOnly*/
	int bit_gravity;	/&lowast; one of the 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 be used when restoring planes */
	Bool save_under;	/&lowast; boolean, should bits under be saved? */
	Colormap colormap;	/&lowast; color map to be associated with window */
	Bool map_installed;	/&lowast; boolean, is color map currently installed*/
	int map_state;	/&lowast; IsUnmapped, IsUnviewable, IsViewable */
	long all_event_masks;	/&lowast; set of events all people have interest in*/
	long your_event_mask;	/&lowast; my event mask */
	long do_not_propagate_mask;	/&lowast; set of events that should not propagate */
	Bool override_redirect;	/&lowast; boolean value for override-redirect */
	Screen *screen;	/&lowast; back pointer to correct screen */
} XWindowAttributes;
<!-- .ce 0  IGNORED -->
<!-- .in \n(OIu  IGNORED -->

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

<para>The x and y members are set to the upper-left outer
corner relative to the parent window's origin.
The width and height members are set to the inside size of the window, 
not including the border.
The border_width member is set to the window's border width in pixels.
The depth member is set to the depth of the window 
(that is, bits per pixel for the object).
The visual member is a pointer to the screen's associated
<emphasis remap='I'>&hairsp;Visual&hairsp;</emphasis>
structure.
The root member is set to the root window of the screen containing the window.
The class member is set to the window's class and can be either
<emphasis remap='I'>&hairsp;InputOutput&hairsp;</emphasis>
or
<emphasis remap='I'>&hairsp;InputOnly&hairsp;</emphasis>.</para>

<para>The bit_gravity member is set to the window's bit gravity
and can be one of the following:</para>



<informaltable pgwide='0' frame='none'>
  <tgroup cols='2' align='center'>
    <colspec colname='c1'/>
    <colspec colname='c2'/>
    <tbody>
      <row>
        <entry align='left'>T{
.ZN ForgetGravity</entry>
        <entry align='left'>.ZN EastGravity</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN NorthWestGravity</entry>
        <entry align='left'>.ZN SouthWestGravity</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN NorthGravity</entry>
        <entry align='left'>.ZN SouthGravity</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN NorthEastGravity</entry>
        <entry align='left'>.ZN SouthEastGravity</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN WestGravity</entry>
        <entry align='left'>.ZN StaticGravity</entry>
      </row>
      <row>
        <entry align='left'>.ZN CenterGravity</entry>
        <entry align='left'></entry>
      </row>
    </tbody>
  </tgroup>
</informaltable>



<para>The win_gravity member is set to the window's window gravity
and can be one of the following:</para>



<informaltable pgwide='0' frame='none'>
  <tgroup cols='2' align='center'>
    <colspec colname='c1'/>
    <colspec colname='c2'/>
    <tbody>
      <row>
        <entry align='left'>T{
.ZN UnmapGravity</entry>
        <entry align='left'>.ZN EastGravity</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN NorthWestGravity</entry>
        <entry align='left'>.ZN SouthWestGravity</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN NorthGravity</entry>
        <entry align='left'>.ZN SouthGravity</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN NorthEastGravity</entry>
        <entry align='left'>.ZN SouthEastGravity</entry>
      </row>
      <row>
        <entry align='left'>T{
.ZN WestGravity</entry>
        <entry align='left'>.ZN StaticGravity</entry>
      </row>
      <row>
        <entry align='left'>.ZN CenterGravity</entry>
        <entry align='left'></entry>
      </row>
    </tbody>
  </tgroup>
</informaltable>



<para>For additional information on gravity,
see section 3.3.</para>

<para>The backing_store member is set to indicate how the X server should maintain
the contents of a window 
and can be 
<emphasis remap='I'>&hairsp;WhenMapped&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;Always&hairsp;</emphasis>,
or
<emphasis remap='I'>&hairsp;NotUseful&hairsp;</emphasis>.
The backing_planes member is set to indicate (with bits set to 1) which bit 
planes of the window hold dynamic data that must be preserved in backing_stores 
and during save_unders.
The backing_pixel member is set to indicate what values to use 
for planes not set in backing_planes.</para>

<para>The save_under member is set to 
<emphasis remap='I'>&hairsp;True&hairsp;</emphasis>
or
<emphasis remap='I'>&hairsp;False&hairsp;</emphasis>.
The colormap member is set to the colormap for the specified window and can be
a colormap ID or 
<emphasis remap='I'>&hairsp;None&hairsp;</emphasis>.
The map_installed member is set to indicate whether the colormap is 
currently installed and can be 
<emphasis remap='I'>&hairsp;True&hairsp;</emphasis>
or
<emphasis remap='I'>&hairsp;False&hairsp;</emphasis>.
The map_state member is set to indicate the state of the window and can be
<emphasis remap='I'>&hairsp;IsUnmapped&hairsp;</emphasis>,
<emphasis remap='I'>&hairsp;IsUnviewable&hairsp;</emphasis>,
or
<emphasis remap='I'>&hairsp;IsViewable&hairsp;</emphasis>.
<emphasis remap='I'>&hairsp;IsUnviewable&hairsp;</emphasis>
is used if the window is mapped but some ancestor is unmapped.</para>

<para>The all_event_masks member is set to the bitwise inclusive OR of all event 
masks selected on the window by all clients.
The your_event_mask member is set to the bitwise inclusive OR of all event 
masks selected by the querying client.
The do_not_propagate_mask member is set to the bitwise inclusive OR of the 
set of events that should not propagate.</para>

<para>The override_redirect member is set to indicate whether this window overrides
structure control facilities and can be 
<emphasis remap='I'>&hairsp;True&hairsp;</emphasis>
or
<emphasis remap='I'>&hairsp;False&hairsp;</emphasis>.
Window manager clients should ignore the window if this member is
<emphasis remap='I'>&hairsp;True&hairsp;</emphasis>.</para>

<para>The screen member is set to a screen pointer that gives you a back pointer 
to the correct screen.
This makes it easier to obtain the screen information without
having to loop over the root window fields to see which field matches.</para>
</refsect1>

<refsect1 id='diagnostics'><title>DIAGNOSTICS</title>
<variablelist remap='TP'>
  <varlistentry>
  <term><emphasis remap='I'>&hairsp;BadDrawable&hairsp;</emphasis></term>
  <listitem>
<para>A value for a Drawable argument does not name a defined Window or Pixmap.</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>XQueryPointer(3X11),
XQueryTree(3X11)
<!-- .br -->
<userinput>Xlib - C Language X Interface</userinput></para>
</refsect1>
</refentry>

