|
|
1.1 root 1: #include "copyright.h"
2:
3: /* $Header: XWindow.c,v 11.11 87/09/11 08:08:31 toddb Exp $ */
4: /* Copyright Massachusetts Institute of Technology 1986 */
5:
6: #include "Xlibint.h"
7:
8: Window XCreateWindow(dpy, parent, x, y, width, height,
9: borderWidth, depth, class, visual, valuemask, attributes)
10: register Display *dpy;
11: Window parent;
12: int x, y;
13: unsigned int width, height, borderWidth;
14: int depth;
15: unsigned int class;
16: Visual *visual;
17: unsigned long valuemask;
18: XSetWindowAttributes *attributes;
19: {
20: Window wid;
21: register xCreateWindowReq *req;
22:
23: LockDisplay(dpy);
24: GetReq(CreateWindow, req);
25: req->parent = parent;
26: req->x = x;
27: req->y = y;
28: req->width = width;
29: req->height = height;
30: req->borderWidth = borderWidth;
31: req->depth = depth;
32: req->class = class;
33: if (visual == CopyFromParent)
34: req->visual = CopyFromParent;
35: else
36: req->visual = visual->visualid;
37: wid = req->wid = XAllocID(dpy);
38: if (req->mask = valuemask)
39: _XProcessWindowAttributes (dpy, (xChangeWindowAttributesReq *)req,
40: valuemask, attributes);
41: UnlockDisplay(dpy);
42: SyncHandle();
43: return (wid);
44: }
45:
46: _XProcessWindowAttributes (dpy, req, valuemask, attributes)
47: register Display *dpy;
48: xChangeWindowAttributesReq *req;
49: register unsigned long valuemask;
50: register XSetWindowAttributes *attributes;
51: {
52:
53: /* Warning! This code assumes that "unsigned long" is 32-bits wide */
54:
55: unsigned long values[32];
56: register unsigned long *value = values;
57: unsigned int nvalues;
58:
59: if (valuemask & CWBackPixmap)
60: *value++ = attributes->background_pixmap;
61:
62: if (valuemask & CWBackPixel)
63: *value++ = attributes->background_pixel;
64:
65: if (valuemask & CWBorderPixmap)
66: *value++ = attributes->border_pixmap;
67:
68: if (valuemask & CWBorderPixel)
69: *value++ = attributes->border_pixel;
70:
71: if (valuemask & CWBitGravity)
72: *value++ = attributes->bit_gravity;
73:
74: if (valuemask & CWWinGravity)
75: *value++ = attributes->win_gravity;
76:
77: if (valuemask & CWBackingStore)
78: *value++ = attributes->backing_store;
79:
80: if (valuemask & CWBackingPlanes)
81: *value++ = attributes->backing_planes;
82:
83: if (valuemask & CWBackingPixel)
84: *value++ = attributes->backing_pixel;
85:
86: if (valuemask & CWOverrideRedirect)
87: *value++ = attributes->override_redirect;
88:
89: if (valuemask & CWSaveUnder)
90: *value++ = attributes->save_under;
91:
92: if (valuemask & CWEventMask)
93: *value++ = attributes->event_mask;
94:
95: if (valuemask & CWDontPropagate)
96: *value++ = attributes->do_not_propagate_mask;
97:
98: if (valuemask & CWColormap)
99: *value++ = attributes->colormap;
100:
101: if (valuemask & CWCursor)
102: *value++ = attributes->cursor;
103:
104: req->length += (nvalues = value - values);
105:
106: /* note: Data is a macro that uses its arguments multiple
107: times, so "nvalues" is changed in a separate assignment
108: statement */
109:
110: nvalues <<= 2;
111: Data (dpy, (char *) values, (long)nvalues);
112:
113: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.