2003-11-14 15:54:30 +00:00
'\" 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.
2019-07-29 18:27:12 +02:00
. \" It is provided "as is" without express or implied warranty.
2019-07-30 04:52:25 -04:00
. \"
2004-04-23 18:42:09 +00:00
. \"
2003-11-14 15:54:30 +00:00
.ds xT X Toolkit Intrinsics \- C Language Interface
.ds xW Athena X Widgets \- C Language X Toolkit Interface
.ds xL Xlib \- C Language X Interface
.ds xC Inter-Client Communication Conventions Manual
'\" t
2006-10-10 22:11:05 -04:00
.TH XCreateWindow __libmansuffix__ __xorgversion__ "XLIB FUNCTIONS"
2003-11-14 15:54:30 +00:00
.SH NAME
XCreateWindow, XCreateSimpleWindow, XSetWindowAttributes \- create windows and window attributes structure
.SH SYNTAX
2004-04-23 18:42:09 +00:00
.HP
2019-07-30 04:52:25 -04:00
Window XCreateWindow\^ (\^ Display *\fI display\fP \^ , Window \fI parent\fP \^ , int \fI x\fP \^ , int \fI y\fP \^ , unsigned int \fI width\fP \^ , unsigned int \fI height\fP \^ , unsigned int \fI border_width\fP \^ , int \fI depth\fP \^ , unsigned int \fI class\fP \^ , Visual *\fI visual\fP \^ , unsigned long \fI valuemask\fP \^ , XSetWindowAttributes *\fI attributes\fP \^ );
2004-04-23 18:42:09 +00:00
.HP
2019-07-30 04:52:25 -04:00
Window XCreateSimpleWindow\^ (\^ Display *\fI display\fP \^ , Window \fI parent\fP \^ , int \fI x\fP \^ , int \fI y\fP \^ , unsigned int \fI width\fP \^ , unsigned int \fI height\fP \^ , unsigned int \fI border_width\fP \^ , unsigned long \fI border\fP \^ , unsigned long \fI background\fP \^ );
2003-11-14 15:54:30 +00:00
.SH ARGUMENTS
.IP \fI attributes\fP 1 i
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.
.IP \fI background\fP 1 i
Specifies the background pixel value of the window.
.IP \fI border\fP 1 i
Specifies the border pixel value of the window.
.IP \fI border_width\fP 1 i
Specifies the width of the created window's border in pixels.
.IP \fI class\fP 1 i
Specifies the created window's class.
You can pass
2019-07-03 18:18:09 +02:00
.BR InputOutput ,
.BR InputOnly ,
2019-07-30 04:52:25 -04:00
or
2019-07-03 18:18:09 +02:00
.BR CopyFromParent .
2019-07-30 04:52:25 -04:00
A class of
2019-07-03 18:18:09 +02:00
.B CopyFromParent
2003-11-14 15:54:30 +00:00
means the class
is taken from the parent.
.IP \fI depth\fP 1 i
Specifies the window's depth.
2019-07-30 04:52:25 -04:00
A depth of
2019-07-03 18:18:09 +02:00
.B CopyFromParent
2003-11-14 15:54:30 +00:00
means the depth is taken from the parent.
.IP \fI display\fP 1 i
Specifies the connection to the X server.
.IP \fI parent\fP 1 i
Specifies the parent window.
.IP \fI valuemask\fP 1 i
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.
.IP \fI visual\fP 1 i
Specifies the visual type.
2019-07-30 04:52:25 -04:00
A visual of
2019-07-03 18:18:09 +02:00
.B CopyFromParent
2019-07-30 04:52:25 -04:00
means the visual type is taken from the
2003-11-14 15:54:30 +00:00
parent.
.IP \fI width\fP 1 i
.br
.ns
.IP \fI height\fP 1 i
2019-07-30 04:52:25 -04:00
Specify the width and height, which are the created window's inside dimensions
2019-06-22 18:33:48 +02:00
and do not include the created window's borders.
2003-11-14 15:54:30 +00:00
.IP \fI x\fP 1 i
.br
.ns
.IP \fI y\fP 1 i
2019-07-30 04:52:25 -04:00
Specify the x and y coordinates, which are the top-left outside
corner of the window's
2019-06-22 18:33:48 +02:00
borders and are relative to the inside of the parent window's borders.
2003-11-14 15:54:30 +00:00
.SH DESCRIPTION
The
2019-07-03 18:18:09 +02:00
.B XCreateWindow
2019-07-30 04:52:25 -04:00
function creates an unmapped subwindow for a specified parent window,
returns the window ID of the created window,
2003-11-14 15:54:30 +00:00
and causes the X server to generate a
2019-07-03 18:18:09 +02:00
.B CreateNotify
2003-11-14 15:54:30 +00:00
event.
2019-07-30 04:52:25 -04:00
The created window is placed on top in the stacking order
2003-11-14 15:54:30 +00:00
with respect to siblings.
.LP
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.
2019-07-30 04:52:25 -04:00
For a window,
2003-11-14 15:54:30 +00:00
the origin is inside the border at the inside, upper-left corner.
.LP
The border_width for an
2019-07-03 18:18:09 +02:00
.B InputOnly
2003-11-14 15:54:30 +00:00
window must be zero, or a
2019-07-03 18:18:09 +02:00
.B BadMatch
2003-11-14 15:54:30 +00:00
error results.
For class
2019-07-03 18:18:09 +02:00
.BR InputOutput ,
2003-11-14 15:54:30 +00:00
the visual type and depth must be a combination supported for the screen,
or a
2019-07-03 18:18:09 +02:00
.B BadMatch
2003-11-14 15:54:30 +00:00
error results.
The depth need not be the same as the parent,
2019-07-30 04:52:25 -04:00
but the parent must not be a window of class
2019-07-03 18:18:09 +02:00
.BR InputOnly ,
2003-11-14 15:54:30 +00:00
or a
2019-07-03 18:18:09 +02:00
.B BadMatch
2003-11-14 15:54:30 +00:00
error results.
For an
2019-07-03 18:18:09 +02:00
.B InputOnly
2003-11-14 15:54:30 +00:00
window,
the depth must be zero, and the visual must be one supported by the screen.
If either condition is not met,
a
2019-07-03 18:18:09 +02:00
.B BadMatch
2003-11-14 15:54:30 +00:00
error results.
The parent window, however, may have any depth and class.
If you specify any invalid window attribute for a window, a
2019-07-03 18:18:09 +02:00
.B BadMatch
2003-11-14 15:54:30 +00:00
error results.
.LP
The created window is not yet displayed (mapped) on the user's display.
To display the window, call
2019-07-03 18:18:09 +02:00
.BR XMapWindow .
2003-11-14 15:54:30 +00:00
The new window initially uses the same cursor as
2019-07-30 04:52:25 -04:00
its parent.
2003-11-14 15:54:30 +00:00
A new cursor can be defined for the new window by calling
2019-07-03 18:18:09 +02:00
.BR XDefineCursor .
2003-11-14 15:54:30 +00:00
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.
.LP
2019-07-03 18:18:09 +02:00
.B XCreateWindow
2003-11-14 15:54:30 +00:00
can generate
2019-07-03 18:18:09 +02:00
.B BadAlloc
.BR BadColor ,
.BR BadCursor ,
.BR BadMatch ,
.BR BadPixmap ,
.BR BadValue ,
2003-11-14 15:54:30 +00:00
and
2019-07-03 18:18:09 +02:00
.B BadWindow
2003-11-14 15:54:30 +00:00
errors.
.LP
The
2019-07-03 18:18:09 +02:00
.B XCreateSimpleWindow
2003-11-14 15:54:30 +00:00
function creates an unmapped
2019-07-03 18:18:09 +02:00
.B InputOutput
2003-11-14 15:54:30 +00:00
subwindow for a specified parent window, returns the
window ID of the created window, and causes the X server to generate a
2019-07-03 18:18:09 +02:00
.B CreateNotify
2003-11-14 15:54:30 +00:00
event.
2019-07-30 04:52:25 -04:00
The created window is placed on top in the stacking order with respect to
2003-11-14 15:54:30 +00:00
siblings.
Any part of the window that extends outside its parent window is clipped.
The border_width for an
2019-07-03 18:18:09 +02:00
.B InputOnly
2003-11-14 15:54:30 +00:00
window must be zero, or a
2019-07-03 18:18:09 +02:00
.B BadMatch
2003-11-14 15:54:30 +00:00
error results.
2019-07-03 18:18:09 +02:00
.B XCreateSimpleWindow
2003-11-14 15:54:30 +00:00
inherits its depth, class, and visual from its parent.
2019-07-30 04:52:25 -04:00
All other window attributes, except background and border,
2003-11-14 15:54:30 +00:00
have their default values.
.LP
2019-07-03 18:18:09 +02:00
.B XCreateSimpleWindow
2003-11-14 15:54:30 +00:00
can generate
2019-07-03 18:18:09 +02:00
.BR BadAlloc ,
.BR BadMatch ,
.BR BadValue ,
2003-11-14 15:54:30 +00:00
and
2019-07-03 18:18:09 +02:00
.B BadWindow
2003-11-14 15:54:30 +00:00
errors.
.SH STRUCTURES
The
2019-07-03 18:18:09 +02:00
.BR XSetWindow Attributes
2003-11-14 15:54:30 +00:00
structure contains:
.LP
2007-11-21 16:50:04 -08:00
/\& * Window attribute value mask bits */
2003-11-14 15:54:30 +00:00
.TS
lw(.5i) lw(2.5i) lw(.8i).
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWBackPixmap
2003-11-14 15:54:30 +00:00
T} T{
(1L<<0)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWBackPixel
2003-11-14 15:54:30 +00:00
T} T{
(1L<<1)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWBorderPixmap
2003-11-14 15:54:30 +00:00
T} T{
(1L<<2)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWBorderPixel
2003-11-14 15:54:30 +00:00
T} T{
(1L<<3)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWBitGravity
2003-11-14 15:54:30 +00:00
T} T{
(1L<<4)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWWinGravity
2003-11-14 15:54:30 +00:00
T} T{
(1L<<5)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWBackingStore
2003-11-14 15:54:30 +00:00
T} T{
(1L<<6)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWBackingPlanes
2003-11-14 15:54:30 +00:00
T} T{
(1L<<7)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWBackingPixel
2003-11-14 15:54:30 +00:00
T} T{
(1L<<8)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWOverrideRedirect
2003-11-14 15:54:30 +00:00
T} T{
(1L<<9)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWSaveUnder
2003-11-14 15:54:30 +00:00
T} T{
(1L<<10)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWEventMask
2003-11-14 15:54:30 +00:00
T} T{
(1L<<11)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWDontPropagate
2003-11-14 15:54:30 +00:00
T} T{
(1L<<12)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWColormap
2003-11-14 15:54:30 +00:00
T} T{
(1L<<13)
T}
T{
2004-04-23 18:42:09 +00:00
\& #define
2003-11-14 15:54:30 +00:00
T} T{
2019-07-03 18:18:09 +02:00
.B CWCursor
2003-11-14 15:54:30 +00:00
T} T{
(1L<<14)
T}
.TE
2019-07-29 17:47:35 +02:00
.EX
2007-11-21 16:50:04 -08:00
/\& * Values */
2003-11-14 15:54:30 +00:00
typedef struct {
2012-08-23 08:24:17 -04:00
Pixmap background_pixmap; /\& * background, None, or ParentRelative */
unsigned long background_pixel; /\& * background pixel */
Pixmap border_pixmap; /\& * border of the window or CopyFromParent */
unsigned long border_pixel; /\& * border pixel value */
int bit_gravity; /\& * one of bit gravity values */
int win_gravity; /\& * one of the window gravity values */
int backing_store; /\& * NotUseful, WhenMapped, Always */
unsigned long backing_planes; /\& * planes to be preserved if possible */
unsigned long backing_pixel; /\& * value to use in restoring planes */
Bool save_under; /\& * should bits under be saved? (popups) */
long event_mask; /\& * set of events that should be saved */
long do_not_propagate_mask; /\& * set of events that should not propagate */
Bool override_redirect; /\& * boolean value for override_redirect */
Colormap colormap; /\& * color map to be associated with window */
Cursor cursor; /\& * cursor to be displayed (or None) */
2003-11-14 15:54:30 +00:00
} XSetWindowAttributes;
2019-07-29 17:47:35 +02:00
.EE
2003-11-14 15:54:30 +00:00
.LP
For a detailed explanation of the members of this structure,
see \fI \* (xL\fP \^ .
.SH DIAGNOSTICS
.TP 1 i
2019-07-03 18:18:09 +02:00
.B BadAlloc
2003-11-14 15:54:30 +00:00
The server failed to allocate the requested resource or server memory.
.TP 1 i
2019-07-03 18:18:09 +02:00
.B BadColor
2003-11-14 15:54:30 +00:00
A value for a Colormap argument does not name a defined Colormap.
.TP 1 i
2019-07-03 18:18:09 +02:00
.B BadCursor
2003-11-14 15:54:30 +00:00
A value for a Cursor argument does not name a defined Cursor.
.TP 1 i
2019-07-03 18:18:09 +02:00
.B BadMatch
2003-11-14 15:54:30 +00:00
The values do not exist for an
2019-07-03 18:18:09 +02:00
.B InputOnly
2003-11-14 15:54:30 +00:00
window.
.TP 1 i
2019-07-03 18:18:09 +02:00
.B BadMatch
2003-11-14 15:54:30 +00:00
Some argument or pair of arguments has the correct type and range but fails
to match in some other way required by the request.
.TP 1 i
2019-07-03 18:18:09 +02:00
.B BadPixmap
2003-11-14 15:54:30 +00:00
A value for a Pixmap argument does not name a defined Pixmap.
.TP 1 i
2019-07-03 18:18:09 +02:00
.B BadValue
2003-11-14 15:54:30 +00:00
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
2019-07-30 05:07:40 -04:00
by the argument's type is accepted.
Any argument defined as a set of
2003-11-14 15:54:30 +00:00
alternatives can generate this error.
.TP 1 i
2019-07-03 18:18:09 +02:00
.B BadWindow
2003-11-14 15:54:30 +00:00
A value for a Window argument does not name a defined Window.
.SH "SEE ALSO"
2025-07-13 10:57:31 -07:00
.BR XChangeWindowAttributes (__libmansuffix__),
.BR XConfigureWindow (__libmansuffix__),
.BR XDefineCursor (__libmansuffix__),
.BR XDestroyWindow (__libmansuffix__),
.BR XMapWindow (__libmansuffix__),
.BR XRaiseWindow (__libmansuffix__),
.BR XUnmapWindow (__libmansuffix__)
2003-11-14 15:54:30 +00:00
.br
\fI \* (xL\fP