1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
155
  
156
  
157
  
158
  
159
  
160
  
161
  
162
  
163
  
164
  
165
  
166
  
167
  
168
  
169
  
170
  
171
  
172
  
173
  
174
  
175
  
176
  
177
  
178
  
179
  
180
  
181
  
182
  
183
  
184
  
185
  
186
  
187
  
188
  
189
  
190
  
191
  
192
  
193
  
194
  
195
  
196
  
197
  
198
  
199
  
200
  
201
  
202
  
203
  
204
  
205
  
206
  
207
  
208
  
209
  
210
  
211
  
212
  
213
  
214
  
215
  
216
  
217
  
218
  
219
  
220
  
221
  
222
  
223
  
224
  
225
  
226
  
227
  
228
  
229
  
230
  
231
  
232
  
233
  
234
  
235
  
236
  
237
  
238
  
239
  
240
  
241
  
242
  
243
  
244
  
245
  
246
  
247
  
248
  
249
  
250
  
251
  
252
  
253
  
254
  
255
  
256
  
257
  
258
  
259
  
260
  
261
  
262
  
263
  
264
  
265
  
266
  
267
  
268
  
269
  
270
  
271
  
272
  
273
  
274
  
275
  
276
  
277
  
278
  
279
  
280
  
281
  
282
  
283
  
284
  
285
  
286
  
287
  
/* _Xlib.pmod 
 * 
 * Kluge, should be in Xlib.pmod 
 */ 
 
/* 
 *    Protocols.X, a Pike interface to the X Window System 
 * 
 *    See COPYRIGHT for copyright information. 
 * 
 *    This program is free software; you can redistribute it and/or modify 
 *    it under the terms of the GNU General Public License as published by 
 *    the Free Software Foundation; either version 2 of the License, or 
 *    (at your option) any later version. 
 * 
 *    This program is distributed in the hope that it will be useful, 
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *    GNU General Public License for more details. 
 * 
 *    You should have received a copy of the GNU General Public License 
 *    along with this program; if not, write to the Free Software 
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 */ 
 
#pike __REAL_VERSION__ 
 
object display_re = Regexp("^([^:]*):([0-9]+)(.[0-9]+|)$"); 
 
string pad(string s) 
{ 
  return s + ({ "", "\0\0\0", "\0\0", "\0" })[sizeof(s) % 4]; 
} 
 
array(string) window_attributes = 
({ "BackPixmap", 
   "BackPixel", 
   "BorderPixmap", 
   "BorderPixel", 
   "BitGravity", 
   "WinGravity", 
   "BackingStore", 
   "BackingPlanes", 
   "BackingPixel", 
   "OverrideRedirect", 
   "SaveUnder", 
   "EventMask", 
   "DontPropagate", 
   "Colormap", 
   "Cursor" }); 
 
array(string) window_configure_attributes = 
({ 
  "X", 
  "Y", 
  "Width", 
  "Height", 
  "BorderWidth", 
  "Sibling", 
  "StackMode" 
}); 
 
array(string) gc_attributes = 
({ 
  "Function", 
  "PlaneMask", 
  "Foreground", 
  "Background", 
  "LineWidth", 
  "LineStyle", 
  "CapStyle", 
  "JoinStyle", 
  "FillStyle", 
  "FillRule", 
  "Tile", 
  "Stipple", 
  "TileStipXOrigin", 
  "TileStipYOrigin", 
  "Font", 
  "SubwindowMode", 
  "GraphicsExposures", 
  "ClipXOrigin", 
  "ClipYOrigin", 
  "ClipMask", 
  "DashOffset", 
  "DashList", 
  "ArcMode" 
}); 
 
mapping(string:int) event_masks = 
([ 
  "KeyPress" : 1<<0, 
  "KeyRelease" : 1<<1, 
  "ButtonPress" : 1<<2, 
  "ButtonRelease" : 1<<3, 
  "EnterWindow" : 1<<4, 
  "LeaveWindow" : 1<<5, 
  "PointerMotion" : 1<<6, 
  "PointerMotionHint" : 1<<7, 
  "Button1Motion" : 1<<8, 
  "Button2Motion" : 1<<9, 
  "Button3Motion" : 1<<10, 
  "Button4Motion" : 1<<11, 
  "Button5Motion" : 1<<12, 
  "ButtonMotion" : 1<<13, 
  "KeymapState" : 1<<14, 
  "Exposure" : 1<<15, 
  "VisibilityChange" : 1<<16, 
  "StructureNotify" : 1<<17, 
  "ResizeRedirect" : 1<<18, 
  "SubstructureNotify" : 1<<19, 
  "SubstructureRedirect" : 1<<20, 
  "FocusChange" : 1<<21, 
  "PropertyChange" : 1<<22, 
  "ColormapChange" : 1<<23, 
  "OwnerGrabButton" : 1<<24 
 ]); 
 
array(string) event_types = 
({ 
  "Error", 
  "Reply", 
  "KeyPress", 
  "KeyRelease", 
  "ButtonPress", 
  "ButtonRelease", 
  "MotionNotify", 
  "EnterNotify", 
  "LeaveNotify", 
  "FocusIn", 
  "FocusOut", 
  "KeymapNotify", 
  "Expose", 
  "GraphicsExpose", 
  "NoExpose", 
  "VisibilityNotify", 
  "CreateNotify", 
  "DestroyNotify", 
  "UnmapNotify", 
  "MapNotify", 
  "MapRequest", 
  "ReparentNotify", 
  "ConfigureNotify", 
  "ConfigureRequest", 
  "GravityNotify", 
  "ResizeRequest", 
  "CirculateNotify", 
  "CirculateRequest", 
  "PropertyNotify", 
  "SelectionClear", 
  "SelectionRequest", 
  "SelectionNotify", 
  "ColormapNotify", 
  "ClientMessage", 
  "MappingNotify" 
}); 
 
array(string) error_codes = 
({ 
  "Success",                /* everything's okay */ 
  "Request",                /* bad request code */ 
  "Value",          /* int parameter out of range */ 
  "Window",         /* parameter not a Window */ 
  "Pixmap",         /* parameter not a Pixmap */ 
  "Atom",           /* parameter not an Atom */ 
  "Cursor",         /* parameter not a Cursor */ 
  "Font",           /* parameter not a Font */ 
  "Match",          /* parameter mismatch */ 
  "Drawable",               /* parameter not a Pixmap or Window */ 
  "Access",         /* depending on context: 
                           - key/button already grabbed 
                           - attempt to free an illegal 
                             cmap entry 
                           - attempt to store into a read-only 
                             color map entry. 
                           - attempt to modify the access control 
                             list from other than the local host. 
                             */ 
  "Alloc",          /* insufficient resources */ 
  "Color",          /* no such colormap */ 
  "GC",                     /* parameter not a GC */ 
  "IDChoice",               /* choice not in range or already used */ 
  "Name",           /* font or color name doesn't exist */ 
  "Length",         /* Request length incorrect */ 
  "Implementation"  /* server is defective */ 
}); 
 
array(string) predefined_atoms = 
({ "Foo", // ignored 
   "PRIMARY", 
   "SECONDARY", 
   "ARC", 
   "ATOM", 
   "BITMAP", 
   "CARDINAL", 
   "COLORMAP", 
   "CURSOR", 
   "CUT_BUFFER0", 
   "CUT_BUFFER1", 
   "CUT_BUFFER2", 
   "CUT_BUFFER3", 
   "CUT_BUFFER4", 
   "CUT_BUFFER5", 
   "CUT_BUFFER6", 
   "CUT_BUFFER7", 
   "DRAWABLE", 
   "FONT", 
   "INTEGER", 
   "PIXMAP", 
   "POINT", 
   "RECTANGLE", 
   "RESOURCE_MANAGER", 
   "RGB_COLOR_MAP", 
   "RGB_BEST_MAP", 
   "RGB_BLUE_MAP", 
   "RGB_DEFAULT_MAP", 
   "RGB_GRAY_MAP", 
   "RGB_GREEN_MAP", 
   "RGB_RED_MAP", 
   "STRING", 
   "VISUALID", 
   "WINDOW", 
   "WM_COMMAND", 
   "WM_HINTS", 
   "WM_CLIENT_MACHINE", 
   "WM_ICON_NAME", 
   "WM_ICON_SIZE", 
   "WM_NAME", 
   "WM_NORMAL_HINTS", 
   "WM_SIZE_HINTS", 
   "WM_ZOOM_HINTS", 
   "MIN_SPACE", 
   "NORM_SPACE", 
   "MAX_SPACE", 
   "END_SPACE", 
   "SUPERSCRIPT_X", 
   "SUPERSCRIPT_Y", 
   "SUBSCRIPT_X", 
   "SUBSCRIPT_Y", 
   "UNDERLINE_POSITION", 
   "UNDERLINE_THICKNESS", 
   "STRIKEOUT_ASCENT", 
   "STRIKEOUT_DESCENT", 
   "ITALIC_ANGLE", 
   "X_HEIGHT", 
   "QUAD_WIDTH", 
   "WEIGHT", 
   "POINT_SIZE", 
   "RESOLUTION", 
   "COPYRIGHT", 
   "NOTICE", 
   "FONT_NAME", 
   "FAMILY_NAME", 
   "FULL_NAME", 
   "CAP_HEIGHT", 
   "WM_CLASS", 
   "WM_TRANSIENT_FOR" 
}); 
 
array(string) visual_classes = 
({ 
  "StaticGray", 
  "GrayScale", 
  "StaticColor", 
  "PseudoColor", 
  "TrueColor", 
  "DirectColor", 
}); 
 
array(string) amiwm_pens = 
({ 
  "detail",             /* compatible Intuition rendering pens */ 
  "block",              /* compatible Intuition rendering pens */ 
  "text",               /* text on background                  */ 
  "shine",              /* bright edge on 3D objects           */ 
  "shadow",             /* dark edge on 3D objects             */ 
  "fill",               /* active-window/selected-gadget fill  */ 
  "filltext",           /* text over FILLPEN                   */ 
  "background",         /* always color 0                      */ 
  "highlighttext",      /* special color text, on background   */ 
  /* New for V39, only present if DRI_VERSION >= 2: */ 
  "bardetail",          /* text/detail in screen-bar/menus */ 
  "barblock",           /* screen-bar/menus fill */ 
  "bartrim",            /* trim under screen-bar */ 
});