]> gitweb.factorcode.org Git - factor.git/blob - basis/x11/constants/constants.factor
Remove ENUM: f and replace uses with CONSTANTs.
[factor.git] / basis / x11 / constants / constants.factor
1 ! Copyright (C) 2005, 2006 Eduardo Cavazos and Alex Chapman
2 ! See http://factorcode.org/license.txt for BSD license.
3
4 ! Based on X.h
5
6 USING: alien alien.c-types alien.syntax math x11.xlib ;
7 IN: x11.constants
8
9 TYPEDEF: ulong Mask
10
11 TYPEDEF: uchar KeyCode
12
13 ! Reserved Resource and Constant Definitions
14
15 CONSTANT: ParentRelative 1
16 CONSTANT: CopyFromParent 0
17 CONSTANT: PointerWindow 0
18 CONSTANT: InputFocus 1
19 CONSTANT: PointerRoot 1
20 CONSTANT: AnyPropertyType 0
21 CONSTANT: AnyKey 0
22 CONSTANT: AnyButton 0
23 CONSTANT: AllTemporary 0
24 CONSTANT: CurrentTime 0
25 CONSTANT: NoSymbol 0
26
27 ! Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
28 !   state in various key-, mouse-, and button-related events.
29
30
31 ! modifier names.  Used to build a SetModifierMapping request or
32 ! to read a GetModifierMapping request.  These correspond to the
33 ! masks defined above.
34 CONSTANT: ShiftMapIndex 0
35 CONSTANT: LockMapIndex 1
36 CONSTANT: ControlMapIndex 2
37 CONSTANT: Mod1MapIndex 3
38 CONSTANT: Mod2MapIndex 4
39 CONSTANT: Mod3MapIndex 5
40 CONSTANT: Mod4MapIndex 6
41 CONSTANT: Mod5MapIndex 7
42
43
44 ! button masks.  Used in same manner as Key masks above. Not to be confused
45 ! with button names below.
46
47
48 : AnyModifier          ( -- n ) 15 2^ ; ! used in GrabButton, GrabKey
49
50 ! button names. Used as arguments to GrabButton and as detail in ButtonPress
51 ! and ButtonRelease events.  Not to be confused with button masks above.
52 ! Note that 0 is already defined above as "AnyButton".
53
54 ! Notify modes
55
56 CONSTANT: NotifyNormal 0
57 CONSTANT: NotifyGrab 1
58 CONSTANT: NotifyUngrab 2
59 CONSTANT: NotifyWhileGrabbed 3
60
61 CONSTANT: NotifyHint 1 ! for MotionNotify events
62                        
63 ! Notify detail
64
65 CONSTANT: NotifyAncestor 0
66 CONSTANT: NotifyVirtual 1
67 CONSTANT: NotifyInferior 2
68 CONSTANT: NotifyNonlinear 3
69 CONSTANT: NotifyNonlinearVirtual 4
70 CONSTANT: NotifyPointer 5
71 CONSTANT: NotifyPointerRoot 6
72 CONSTANT: NotifyDetailNone 7
73
74 ! Visibility notify
75
76 CONSTANT: VisibilityUnobscured 0
77 CONSTANT: VisibilityPartiallyObscured 1
78 CONSTANT: VisibilityFullyObscured 2
79
80 ! Circulation request
81
82 CONSTANT: PlaceOnTop 0
83 CONSTANT: PlaceOnBottom 1
84
85 ! protocol families
86
87 CONSTANT: FamilyInternet 0     ! IPv4
88 CONSTANT: FamilyDECnet 1
89 CONSTANT: FamilyChaos 2
90 CONSTANT: FamilyInternet6 6     ! IPv6
91
92 ! authentication families not tied to a specific protocol
93 CONSTANT: FamilyServerInterpreted 5
94
95 ! Property notification
96
97 CONSTANT: PropertyNewValue 0
98 CONSTANT: PropertyDelete 1
99
100 ! Color Map notification
101
102 CONSTANT: ColormapUninstalled 0
103 CONSTANT: ColormapInstalled 1
104
105 ! GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes
106
107 CONSTANT: GrabModeSync 0
108 CONSTANT: GrabModeAsync 1
109
110 ! GrabPointer, GrabKeyboard reply status
111
112 CONSTANT: GrabSuccess 0
113 CONSTANT: AlreadyGrabbed 1
114 CONSTANT: GrabInvalidTime 2
115 CONSTANT: GrabNotViewable 3
116 CONSTANT: GrabFrozen 4
117
118 ! AllowEvents modes
119
120 CONSTANT: AsyncPointer 0
121 CONSTANT: SyncPointer 1
122 CONSTANT: ReplayPointer 2
123 CONSTANT: AsyncKeyboard 3
124 CONSTANT: SyncKeyboard 4
125 CONSTANT: ReplayKeyboard 5
126 CONSTANT: AsyncBoth 6
127 CONSTANT: SyncBoth 7
128
129 ! Used in SetInputFocus, GetInputFocus
130
131 : RevertToNone         ( -- n ) None ;
132 : RevertToPointerRoot  ( -- n ) PointerRoot ;
133 CONSTANT: RevertToParent 2
134
135 ! *****************************************************************
136 ! * ERROR CODES 
137 ! *****************************************************************
138
139 CONSTANT: Success 0 ! everything's okay
140 CONSTANT: BadRequest 1 ! bad request code
141 CONSTANT: BadValue 2 ! int parameter out of range
142 CONSTANT: BadWindow 3 ! parameter not a Window
143 CONSTANT: BadPixmap 4 ! parameter not a Pixmap
144 CONSTANT: BadAtom 5 ! parameter not an Atom
145 CONSTANT: BadCursor 6 ! parameter not a Cursor
146 CONSTANT: BadFont 7 ! parameter not a Font
147 CONSTANT: BadMatch 8 ! parameter mismatch
148 CONSTANT: BadDrawable 9 ! parameter not a Pixmap or Window
149 CONSTANT: BadAccess 10 ! depending on context:
150                        !         - key/button already grabbed
151                        !         - attempt to free an illegal 
152                        !           cmap entry 
153                        !        - attempt to store into a read-only 
154                        !           color map entry.
155                        !        - attempt to modify the access control
156                        !           list from other than the local host.
157 CONSTANT: BadAlloc 11 ! insufficient resources
158 CONSTANT: BadColor 12 ! no such colormap
159 CONSTANT: BadGC 13 ! parameter not a GC
160 CONSTANT: BadIDChoice 14 ! choice not in range or already used
161 CONSTANT: BadName 15 ! font or color name doesn't exist
162 CONSTANT: BadLength 16 ! Request length incorrect
163 CONSTANT: BadImplementation 17 ! server is defective
164
165 CONSTANT: FirstExtensionError 128
166 CONSTANT: LastExtensionError 255
167
168 ! *****************************************************************
169 ! * WINDOW DEFINITIONS 
170 ! *****************************************************************
171
172 ! Window classes used by CreateWindow
173 ! Note that CopyFromParent is already defined as 0 above
174
175 CONSTANT: InputOutput 1
176 CONSTANT: InputOnly 2
177
178 ! Used in CreateWindow for backing-store hint
179
180 CONSTANT: NotUseful 0
181 CONSTANT: WhenMapped 1
182 CONSTANT: Always 2
183
184 ! Used in ChangeSaveSet
185
186 CONSTANT: SetModeInsert 0
187 CONSTANT: SetModeDelete 1
188
189 ! Used in ChangeCloseDownMode
190
191 CONSTANT: DestroyAll 0
192 CONSTANT: RetainPermanent 1
193 CONSTANT: RetainTemporary 2
194
195 ! Window stacking method (in configureWindow)
196
197 CONSTANT: Above 0
198 CONSTANT: Below 1
199 CONSTANT: TopIf 2
200 CONSTANT: BottomIf 3
201 CONSTANT: Opposite 4
202
203 ! Circulation direction
204
205 CONSTANT: RaiseLowest 0
206 CONSTANT: LowerHighest 1
207
208 ! Property modes
209
210 CONSTANT: PropModeReplace 0
211 CONSTANT: PropModePrepend 1
212 CONSTANT: PropModeAppend 2
213
214 ! *****************************************************************
215 ! * GRAPHICS DEFINITIONS
216 ! *****************************************************************
217
218 ! LineStyle
219
220 CONSTANT: LineSolid 0
221 CONSTANT: LineOnOffDash 1
222 CONSTANT: LineDoubleDash 2
223
224 ! capStyle
225
226 CONSTANT: CapNotLast 0
227 CONSTANT: CapButt 1
228 CONSTANT: CapRound 2
229 CONSTANT: CapProjecting 3
230
231 ! joinStyle
232
233 CONSTANT: JoinMiter 0
234 CONSTANT: JoinRound 1
235 CONSTANT: JoinBevel 2
236
237 ! fillStyle
238
239 CONSTANT: FillSolid 0
240 CONSTANT: FillTiled 1
241 CONSTANT: FillStippled 2
242 CONSTANT: FillOpaqueStippled 3
243
244 ! fillRule
245
246 CONSTANT: EvenOddRule 0
247 CONSTANT: WindingRule 1
248
249 ! subwindow mode
250
251 CONSTANT: ClipByChildren 0
252 CONSTANT: IncludeInferiors 1
253
254 ! SetClipRectangles ordering
255
256 CONSTANT: Unsorted 0
257 CONSTANT: YSorted 1
258 CONSTANT: YXSorted 2
259 CONSTANT: YXBanded 3
260
261 ! CoordinateMode for drawing routines
262
263 CONSTANT: CoordModeOrigin 0 ! relative to the origin
264 CONSTANT: CoordModePrevious 1 ! relative to previous point
265
266 ! Polygon shapes
267
268 CONSTANT: Complex 0 ! paths may intersect
269 CONSTANT: Nonconvex 1 ! no paths intersect, but not convex
270 CONSTANT: Convex 2 ! wholly convex
271
272 ! Arc modes for PolyFillArc
273
274 CONSTANT: ArcChord 0 ! join endpoints of arc
275 CONSTANT: ArcPieSlice 1 ! join endpoints to center of arc
276
277 ! *****************************************************************
278 ! * FONTS 
279 ! *****************************************************************
280
281 ! used in QueryFont -- draw direction
282
283 CONSTANT: FontLeftToRight 0
284 CONSTANT: FontRightToLeft 1
285
286 CONSTANT: FontChange 255
287
288 ! *****************************************************************
289 ! *  IMAGING 
290 ! *****************************************************************
291
292 ! ImageFormat -- PutImage, GetImage
293
294 CONSTANT: XYBitmap 0 ! depth 1, XYFormat
295 CONSTANT: XYPixmap 1 ! depth == drawable depth
296 CONSTANT: ZPixmap 2 ! depth == drawable depth
297
298 ! *****************************************************************
299 ! *  COLOR MAP STUFF 
300 ! *****************************************************************
301
302 ! For CreateColormap
303
304 CONSTANT: AllocNone 0 ! create map with no entries
305 CONSTANT: AllocAll 1 ! allocate entire map writeable
306
307
308 ! Flags used in StoreNamedColor, StoreColors
309
310 : DoRed        ( -- n ) 0 2^ ;
311 : DoGreen      ( -- n ) 1 2^ ;
312 : DoBlue       ( -- n ) 2 2^ ;
313
314 ! *****************************************************************
315 ! * CURSOR STUFF
316 ! *****************************************************************
317
318 ! QueryBestSize Class
319
320 CONSTANT: CursorShape 0 ! largest size that can be displayed
321 CONSTANT: TileShape 1 ! size tiled fastest
322 CONSTANT: StippleShape 2 ! size stippled fastest
323
324 ! ***************************************************************** 
325 ! * KEYBOARD/POINTER STUFF
326 ! *****************************************************************
327
328 CONSTANT: AutoRepeatModeOff 0
329 CONSTANT: AutoRepeatModeOn 1
330 CONSTANT: AutoRepeatModeDefault 2
331
332 CONSTANT: LedModeOff 0
333 CONSTANT: LedModeOn 1
334
335 ! masks for ChangeKeyboardControl
336
337 : KBKeyClickPercent    ( -- n ) 0 2^ ;
338 : KBBellPercent        ( -- n ) 1 2^ ;
339 : KBBellPitch          ( -- n ) 2 2^ ;
340 : KBBellDuration       ( -- n ) 3 2^ ;
341 : KBLed                ( -- n ) 4 2^ ;
342 : KBLedMode            ( -- n ) 5 2^ ;
343 : KBKey                ( -- n ) 6 2^ ;
344 : KBAutoRepeatMode     ( -- n ) 7 2^ ;
345
346 CONSTANT: MappingSuccess 0
347 CONSTANT: MappingBusy 1
348 CONSTANT: MappingFailed 2
349
350 CONSTANT: MappingModifier 0
351 CONSTANT: MappingKeyboard 1
352 CONSTANT: MappingPointer 2
353
354 ! *****************************************************************
355 ! * SCREEN SAVER STUFF 
356 ! *****************************************************************
357
358 CONSTANT: DontPreferBlanking 0
359 CONSTANT: PreferBlanking 1
360 CONSTANT: DefaultBlanking 2
361
362 CONSTANT: DisableScreenSaver 0
363 CONSTANT: DisableScreenInterval 0
364
365 CONSTANT: DontAllowExposures 0
366 CONSTANT: AllowExposures 1
367 CONSTANT: DefaultExposures 2
368
369 ! for ForceScreenSaver
370
371 CONSTANT: ScreenSaverReset 0
372 CONSTANT: ScreenSaverActive 1
373
374 ! *****************************************************************
375 ! * HOSTS AND CONNECTIONS
376 ! *****************************************************************
377
378 ! for ChangeHosts
379
380 CONSTANT: HostInsert 0
381 CONSTANT: HostDelete 1
382
383 ! for ChangeAccessControl
384
385 CONSTANT: EnableAccess 1
386 CONSTANT: DisableAccess 0
387
388 ! Display classes  used in opening the connection 
389 ! Note that the statically allocated ones are even numbered and the
390 ! dynamically changeable ones are odd numbered
391
392 CONSTANT: StaticGray 0
393 CONSTANT: GrayScale 1
394 CONSTANT: StaticColor 2
395 CONSTANT: PseudoColor 3
396 CONSTANT: TrueColor 4
397 CONSTANT: DirectColor 5
398
399
400 ! Byte order  used in imageByteOrder and bitmapBitOrder
401
402 CONSTANT: LSBFirst 0
403 CONSTANT: MSBFirst 1
404
405 ! *****************************************************************
406 ! * EXTENDED WINDOW MANAGER HINTS
407 ! *****************************************************************
408
409 CONSTANT: _NET_WM_STATE_REMOVE 0
410 CONSTANT: _NET_WM_STATE_ADD 1
411 CONSTANT: _NET_WM_STATE_TOGGLE 2