3 Copyright 1986, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
32 void _XProcessWindowAttributes (
33 register Display *dpy,
34 xChangeWindowAttributesReq *req,
35 register unsigned long valuemask,
36 register XSetWindowAttributes *attributes)
38 unsigned long values[32];
39 register unsigned long *value = values;
42 if (valuemask & CWBackPixmap)
43 *value++ = attributes->background_pixmap;
45 if (valuemask & CWBackPixel)
46 *value++ = attributes->background_pixel;
48 if (valuemask & CWBorderPixmap)
49 *value++ = attributes->border_pixmap;
51 if (valuemask & CWBorderPixel)
52 *value++ = attributes->border_pixel;
54 if (valuemask & CWBitGravity)
55 *value++ = attributes->bit_gravity;
57 if (valuemask & CWWinGravity)
58 *value++ = attributes->win_gravity;
60 if (valuemask & CWBackingStore)
61 *value++ = attributes->backing_store;
63 if (valuemask & CWBackingPlanes)
64 *value++ = attributes->backing_planes;
66 if (valuemask & CWBackingPixel)
67 *value++ = attributes->backing_pixel;
69 if (valuemask & CWOverrideRedirect)
70 *value++ = attributes->override_redirect;
72 if (valuemask & CWSaveUnder)
73 *value++ = attributes->save_under;
75 if (valuemask & CWEventMask)
76 *value++ = attributes->event_mask;
78 if (valuemask & CWDontPropagate)
79 *value++ = attributes->do_not_propagate_mask;
81 if (valuemask & CWColormap)
82 *value++ = attributes->colormap;
84 if (valuemask & CWCursor)
85 *value++ = attributes->cursor;
87 req->length += (nvalues = value - values);
89 nvalues <<= 2; /* watch out for macros... */
90 Data32 (dpy, (long *) values, (long)nvalues);
94 #define AllMaskBits (CWBackPixmap|CWBackPixel|CWBorderPixmap|\
95 CWBorderPixel|CWBitGravity|CWWinGravity|\
96 CWBackingStore|CWBackingPlanes|CWBackingPixel|\
97 CWOverrideRedirect|CWSaveUnder|CWEventMask|\
98 CWDontPropagate|CWColormap|CWCursor)
100 Window XCreateWindow(
101 register Display *dpy,
107 unsigned int borderWidth,
111 unsigned long valuemask,
112 XSetWindowAttributes *attributes)
115 register xCreateWindowReq *req;
118 GetReq(CreateWindow, req);
119 req->parent = parent;
123 req->height = height;
124 req->borderWidth = borderWidth;
127 if (visual == CopyFromParent)
128 req->visual = CopyFromParent;
130 req->visual = visual->visualid;
131 wid = req->wid = XAllocID(dpy);
132 valuemask &= AllMaskBits;
133 if ((req->mask = valuemask))
134 _XProcessWindowAttributes (dpy, (xChangeWindowAttributesReq *)req,
135 valuemask, attributes);