1MODULE oocXutil (*[INTERFACE "C"]*);
2
3IMPORT
4  C := oocC, X := oocX11, SYSTEM;
5
6
7(*
8 * Bitmask returned by XParseGeometry().  Each bit tells if the corresponding
9 * value (x, y, width, height) was found in the parsed string.
10 *)
11CONST
12  NoValue* = 00000H;
13  XValue* = 00001H;
14  YValue* = 00002H;
15  WidthValue* = 00004H;
16  HeightValue* = 00008H;
17  AllValues* = 0000FH;
18  XNegative* = 00010H;
19  YNegative* = 00020H;
20
21(*
22 * new version containing basewidth, baseheight, and wingravity fields;
23 * used with WMNORMALHINTS.
24 *)
25TYPE
26  XSizeHintsPtr* = POINTER TO XSizeHints;
27  XSizeHints* = RECORD
28    flags*: X.ulongmask;        (* marks which fields in this structure are defined *)
29    x*, y*: C.int;              (* obsolete for new window mgrs, but clients *)
30    width*, height*: C.int;     (* should set so old wm's don't mess up *)
31    minwidth*, minheight*: C.int;
32    maxwidth*, maxheight*: C.int;
33    widthinc*, heightinc*: C.int;
34    minaspect*, maxaspect*: RECORD
35      x*: C.int;                (* numerator *)
36      y*: C.int;                (* denominator *)
37    END;
38    basewidth*, baseheight*: C.int;(* added by ICCCM version 1 *)
39    wingravity*: C.int;        (* added by ICCCM version 1 *)
40  END;
41
42(*
43 * The next block of definitions are for window manager properties that
44 * clients and applications use for communication.
45 *)
46CONST
47(* flags argument in size hints *)
48  USPosition* = {0};            (* user specified x, y *)
49  USSize* = {1};                (* user specified width, height *)
50  PPosition* = {2};             (* program specified position *)
51  PSize* = {3};                 (* program specified size *)
52  PMinSize* = {4};              (* program specified minimum size *)
53  PMaxSize* = {5};              (* program specified maximum size *)
54  PResizeInc* = {6};            (* program specified resize increments *)
55  PAspect* = {7};               (* program specified min and max aspect ratios *)
56  PBaseSize* = {8};             (* program specified base for incrementing *)
57  PWinGravity* = {9};           (* program specified window gravity *)
58(* obsolete *)
59  PAllHints* = PPosition+PSize+PMinSize+PMaxSize+PResizeInc+PAspect;
60
61TYPE
62  XWMHintsPtr* = POINTER TO XWMHints;
63  XWMHints* = RECORD
64    flags*: X.ulongmask;(* marks which fields in this structure are defined *)
65    input*: X.Bool;   (* does this application rely on the window manager to
66			get keyboard input? *)
67    initialstate*: C.int;        (* see below *)
68    iconpixmap*: X.Pixmap;       (* pixmap to be used as icon *)
69    iconwindow*: X.Window;       (* window to be used as icon *)
70    iconx*, icony*: C.int;      (* initial position of icon *)
71    iconmask*: X.Pixmap;         (* icon mask bitmap *)
72    windowgroup*: X.XID;         (* id of related window group *)
73  END;
74
75CONST
76(* definition for flags of XWMHints *)
77  InputHint* = {0};
78  StateHint* = {1};
79  IconPixmapHint* = {2};
80  IconWindowHint* = {3};
81  IconPositionHint* = {4};
82  IconMaskHint* = {5};
83  WindowGroupHint* = {6};
84  AllHints* = InputHint+StateHint+IconPixmapHint+IconWindowHint+IconPositionHint+IconMaskHint+WindowGroupHint;
85  XUrgencyHint* = {8};
86(* definitions for initial window state *)
87  WithdrawnState* = 0;          (* for windows that are not mapped *)
88  NormalState* = 1;             (* most applications want to start this way *)
89  IconicState* = 3;             (* application wants to start as an icon *)
90
91(*
92 * Obsolete states no longer defined by ICCCM
93 *)
94CONST
95  DontCareState* = 0;           (* don't know or care *)
96  ZoomState* = 2;               (* application wants to start zoomed *)
97  InactiveState* = 4;           (* application believes it is seldom used; *)
98                                (* some wm's may put it on inactive menu *)
99(*
100 * new structure for manipulating TEXT properties; used with WMNAME,
101 * WMICONNAME, WMCLIENTMACHINE, and WMCOMMAND.
102 *)
103TYPE
104  XTextPropertyPtr* = POINTER TO XTextProperty;
105  XTextProperty* = RECORD
106    value*: C.charPtr1d;        (* same as Property routines *)
107    encoding*: X.Atom;          (* prop type *)
108    format*: C.int;             (* prop data format: 8, 16, or 32 *)
109    nitems*: C.longint;         (* number of data items in value *)
110  END;
111
112CONST
113  XNoMemory* = 1;
114  XLocaleNotSupported* = 2;
115  XConverterNotFound* = 3;
116
117CONST  (* enum XICCEncodingStyle *)
118  XStringStyle* = 0;
119  XCompoundTextStyle* = 1;
120  XTextStyle* = 2;
121  XStdICCTextStyle* = 3;
122
123TYPE
124  XICCEncodingStyle* = C.enum1;
125  XIconSizePtr* = POINTER TO XIconSize;
126  XIconSize* = RECORD
127    minwidth*, minheight*: C.int;
128    maxwidth*, maxheight*: C.int;
129    widthinc*, heightinc*: C.int;
130  END;
131  XClassHintPtr* = POINTER TO XClassHint;
132  XClassHint* = RECORD
133    resname*: C.charPtr1d;
134    resclass*: C.charPtr1d;
135  END;
136
137(*
138 * These macros are used to give some sugar to the image routines so that
139 * naive people are more comfortable with them.
140 *)
141(* can't define any macros here *)
142
143(*
144 * Compose sequence status structure, used in calling XLookupString.
145 *)
146TYPE
147  XComposeStatusPtr* = POINTER TO XComposeStatus;
148  XComposeStatus* = RECORD
149    composeptr*: X.XPointer;     (* state table pointer *)
150    charsmatched*: C.int;      (* match state *)
151  END;
152
153(*
154 * Keysym macros, used on Keysyms to test for classes of symbols
155 *)
156(* can't define any macros here *)
157
158(*
159 * opaque reference to Region data type
160 *)
161TYPE
162  XRegion* = RECORD END;
163  Region* = POINTER TO XRegion;
164
165(* Return values from XRectInRegion() *)
166CONST
167  RectangleOut* = 0;
168  RectangleIn* = 1;
169  RectanglePart* = 2;
170
171(*
172 * Information used by the visual utility routines to find desired visual
173 * type from the many visuals a display may support.
174 *)
175TYPE
176  XVisualInfoPtr* = POINTER TO XVisualInfo;
177  XVisualInfo* = RECORD
178    visual*: X.VisualPtr;
179    visualid*: X.VisualID;
180    screen*: C.int;
181    depth*: C.int;
182    class*: C.int;
183    redmask*: X.ulongmask;
184    greenmask*: X.ulongmask;
185    bluemask*: X.ulongmask;
186    colormapsize*: C.int;
187    bitsperrgb*: C.int;
188  END;
189
190CONST
191  VisualNoMask* = 00H;
192  VisualIDMask* = 01H;
193  VisualScreenMask* = 02H;
194  VisualDepthMask* = 04H;
195  VisualClassMask* = 08H;
196  VisualRedMaskMask* = 010H;
197  VisualGreenMaskMask* = 020H;
198  VisualBlueMaskMask* = 040H;
199  VisualColormapSizeMask* = 080H;
200  VisualBitsPerRGBMask* = 0100H;
201  VisualAllMask* = 01FFH;
202
203(*
204 * This defines a window manager property that clients may use to
205 * share standard color maps of type RGBCOLORMAP:
206 *)
207TYPE
208  XStandardColormapPtr* = POINTER TO XStandardColormap;
209  XStandardColormap* = RECORD
210    colormap*: X.Colormap;
211    redmax*: C.longint;
212    redmult*: C.longint;
213    greenmax*: C.longint;
214    greenmult*: C.longint;
215    bluemax*: C.longint;
216    bluemult*: C.longint;
217    basepixel*: C.longint;
218    visualid*: X.VisualID;        (* added by ICCCM version 1 *)
219    killid*: X.XID;               (* added by ICCCM version 1 *)
220  END;
221
222CONST
223  ReleaseByFreeingColormap* = 1;(* for killid field above *)
224
225(*
226 * return codes for XReadBitmapFile and XWriteBitmapFile
227 *)
228CONST
229  BitmapSuccess* = 0;
230  BitmapOpenFailed* = 1;
231  BitmapFileInvalid* = 2;
232  BitmapNoMemory* = 3;
233
234
235(****************************************************************
236 *
237 * Context Management
238 *
239 ****************************************************************)
240(* Associative lookup table return codes *)
241CONST
242  XCSUCCESS* = 0;               (* No error. *)
243  XCNOMEM* = 1;                 (* Out of memory *)
244  XCNOENT* = 2;                 (* No entry in table *)
245
246TYPE
247  XContext* = C.int;
248
249
250(* The following declarations are alphabetized. *)
251(*
252PROCEDURE XAllocClassHint* (): XClassHintPtr;
253PROCEDURE XAllocIconSize* (): XIconSizePtr;
254PROCEDURE XAllocSizeHints* (): XSizeHintsPtr;
255PROCEDURE XAllocStandardColormap* (): XStandardColormapPtr;
256PROCEDURE XAllocWMHints* (): XWMHintsPtr;
257PROCEDURE XClipBox* (
258    r: Region;
259    VAR rectreturn: X.XRectangle);
260PROCEDURE XCreateRegion* (): Region;
261PROCEDURE XDefaultString* (): C.charPtr1d;
262PROCEDURE XDeleteContext* (
263    display: X.DisplayPtr;
264    rid: X.XID;
265    context: XContext): C.int;
266PROCEDURE XDestroyRegion* (
267    r: Region);
268PROCEDURE XEmptyRegion* (
269    r: Region);
270PROCEDURE XEqualRegion* (
271    r1: Region;
272    r2: Region);
273PROCEDURE XFindContext* (
274    display: X.DisplayPtr;
275    rid: X.XID;
276    context: XContext;
277    VAR datareturn: X.XPointer): C.int;
278PROCEDURE XGetClassHint* (
279    display: X.DisplayPtr;
280    w: X.Window;
281    VAR classhintsreturn: XClassHint): X.Status;
282PROCEDURE XGetIconSizes* (
283    display: X.DisplayPtr;
284    w: X.Window;
285    VAR sizelistreturn: XIconSize;
286    VAR countreturn: C.int): X.Status;
287PROCEDURE XGetNormalHints* (
288    display: X.DisplayPtr;
289    w: X.Window;
290    VAR hintsreturn: XSizeHints): X.Status;
291PROCEDURE XGetRGBColormaps* (
292    display: X.DisplayPtr;
293    w: X.Window;
294    VAR stdcmapreturn: XStandardColormap;
295    VAR countreturn: C.int;
296    property: X.Atom): X.Status;
297PROCEDURE XGetSizeHints* (
298    display: X.DisplayPtr;
299    w: X.Window;
300    VAR hintsreturn: XSizeHints;
301    property: X.Atom): X.Status;
302PROCEDURE XGetStandardColormap* (
303    display: X.DisplayPtr;
304    w: X.Window;
305    VAR colormapreturn: XStandardColormap;
306    property: X.Atom): X.Status;
307PROCEDURE XGetTextProperty* (
308    display: X.DisplayPtr;
309    window: X.Window;
310    VAR textpropreturn: XTextProperty;
311    property: X.Atom): X.Status;
312PROCEDURE XGetVisualInfo* (
313    display: X.DisplayPtr;
314    vinfomask: X.ulongmask;
315    vinfotemplate: XVisualInfoPtr;
316    VAR nitemsreturn: C.int): XVisualInfoPtr;
317PROCEDURE XGetWMClientMachine* (
318    display: X.DisplayPtr;
319    w: X.Window;
320    VAR textpropreturn: XTextProperty): X.Status;
321PROCEDURE XGetWMHints* (
322    display: X.DisplayPtr;
323    w: X.Window): XWMHintsPtr;
324PROCEDURE XGetWMIconName* (
325    display: X.DisplayPtr;
326    w: X.Window;
327    VAR textpropreturn: XTextProperty): X.Status;
328PROCEDURE XGetWMName* (
329    display: X.DisplayPtr;
330    w: X.Window;
331    VAR textpropreturn: XTextProperty): X.Status;
332PROCEDURE XGetWMNormalHints* (
333    display: X.DisplayPtr;
334    w: X.Window;
335    VAR hintsreturn: XSizeHints;
336    VAR suppliedreturn: C.longint): X.Status;
337PROCEDURE XGetWMSizeHints* (
338    display: X.DisplayPtr;
339    w: X.Window;
340    VAR hintsreturn: XSizeHints;
341    VAR suppliedreturn: C.longint;
342    property: X.Atom): X.Status;
343PROCEDURE XGetZoomHints* (
344    display: X.DisplayPtr;
345    w: X.Window;
346    VAR zhintsreturn: XSizeHints): X.Status;
347PROCEDURE XIntersectRegion* (
348    sra, srb, drreturn: Region);  (* ??? *)
349PROCEDURE XConvertCase* (
350    sym: X.KeySym;
351    VAR lower: X.KeySym;
352    VAR upper: X.KeySym);
353*)
354PROCEDURE -XLookupString* (
355    (*VAR eventStruct: X.XKeyEvent;*)
356    VAR eventStruct: X.XEvent;
357    VAR bufferReturn: ARRAY OF C.char;
358    bytesBuffer: C.int;
359    VAR keysymReturn: X.KeySym;
360    (*VAR statusInOut(*[NILCOMPAT]*): XComposeStatus): C.int*)
361    VAR statusInOut(*[NILCOMPAT]*): C.longint): C.int
362    "(int)XLookupString((XKeyEvent*)eventStruct, bufferReturn, bytesBuffer, (KeySym*)keysymReturn, (XComposeStatus*)statusInOut)";
363(*
364PROCEDURE XMatchVisualInfo* (
365    display: X.DisplayPtr;
366    screen: C.int;
367    depth: C.int;
368    class: C.int;
369    VAR vinforeturn: XVisualInfo): X.Status;
370PROCEDURE XOffsetRegion* (
371    r: Region;
372    dx: C.int;
373    dy: C.int);
374PROCEDURE XPointInRegion* (
375    r: Region;
376    x: C.int;
377    y: C.int): X.Bool;
378PROCEDURE XPolygonRegion* (
379    points: ARRAY OF X.XPoint;
380    n: C.int;
381    fillrule: C.int): Region;
382PROCEDURE XRectInRegion* (
383    r: Region;
384    x: C.int;
385    y: C.int;
386    width: C.int;
387    height: C.int): C.int;
388PROCEDURE XSaveContext* (
389    display: X.DisplayPtr;
390    rid: X.XID;
391    context: XContext;
392    data: ARRAY OF C.char): C.int;
393PROCEDURE XSetClassHint* (
394    display: X.DisplayPtr;
395    w: X.Window;
396    classhints: XClassHintPtr);
397PROCEDURE XSetIconSizes* (
398    display: X.DisplayPtr;
399    w: X.Window;
400    sizelist: XIconSizePtr;
401    count: C.int);
402PROCEDURE XSetNormalHints* (
403    display: X.DisplayPtr;
404    w: X.Window;
405    hints: XSizeHintsPtr);
406PROCEDURE XSetRGBColormaps* (
407    display: X.DisplayPtr;
408    w: X.Window;
409    stdcmaps: XStandardColormapPtr;
410    count: C.int;
411    property: X.Atom);
412PROCEDURE XSetSizeHints* (
413    display: X.DisplayPtr;
414    w: X.Window;
415    hints: XSizeHintsPtr;
416    property: X.Atom);
417PROCEDURE XSetStandardProperties* (
418    display: X.DisplayPtr;
419    w: X.Window;
420    windowname: ARRAY OF C.char;
421    iconname: ARRAY OF C.char;
422    iconpixmap: X.Pixmap;
423    argv: C.charPtr2d;
424    argc: C.int;
425    hints: XSizeHintsPtr);
426PROCEDURE XSetTextProperty* (
427    display: X.DisplayPtr;
428    w: X.Window;
429    textprop: XTextPropertyPtr;
430    property: X.Atom);
431PROCEDURE XSetWMClientMachine* (
432    display: X.DisplayPtr;
433    w: X.Window;
434    textprop: XTextPropertyPtr);
435PROCEDURE XSetWMHints* (
436    display: X.DisplayPtr;
437    w: X.Window;
438    wmhints: XWMHintsPtr);
439PROCEDURE XSetWMIconName* (
440    display: X.DisplayPtr;
441    w: X.Window;
442    textprop: XTextPropertyPtr);
443PROCEDURE XSetWMName* (
444    display: X.DisplayPtr;
445    w: X.Window;
446    textprop: XTextPropertyPtr);
447PROCEDURE XSetWMNormalHints* (
448    display: X.DisplayPtr;
449    w: X.Window;
450    hints: XSizeHintsPtr);
451PROCEDURE XSetWMProperties* (
452    display: X.DisplayPtr;
453    w: X.Window;
454    windowname: XTextPropertyPtr;
455    iconname: XTextPropertyPtr;
456    argv: C.charPtr2d;
457    argc: C.int;
458    normalhints: XSizeHintsPtr;
459    wmhints: XWMHintsPtr;
460    classhints: XClassHintPtr);
461PROCEDURE XmbSetWMProperties* (
462    display: X.DisplayPtr;
463    w: X.Window;
464    windowname: ARRAY OF C.char;
465    iconname: ARRAY OF C.char;
466    argv: C.charPtr2d;
467    argc: C.int;
468    normalhints: XSizeHintsPtr;
469    wmhints: XWMHintsPtr;
470    classhints: XClassHintPtr);
471PROCEDURE XSetWMSizeHints* (
472    display: X.DisplayPtr;
473    w: X.Window;
474    hints: XSizeHintsPtr;
475    property: X.Atom);
476PROCEDURE XSetRegion* (
477    display: X.DisplayPtr;
478    gc: X.GC;
479    r: Region);
480PROCEDURE XSetStandardColormap* (
481    display: X.DisplayPtr;
482    w: X.Window;
483    colormap: XStandardColormapPtr;
484    property: X.Atom);
485PROCEDURE XSetZoomHints* (
486    display: X.DisplayPtr;
487    w: X.Window;
488    zhints: XSizeHintsPtr);
489PROCEDURE XShrinkRegion* (
490    r: Region;
491    dx: C.int;
492    dy: C.int);
493PROCEDURE XStringListToTextProperty* (
494    list: C.charPtr2d;
495    count: C.int;
496    VAR textpropreturn: XTextProperty): X.Status;
497PROCEDURE XSubtractRegion* (
498    sra, srb, drreturn: Region);  (* ??? *)
499PROCEDURE XmbTextListToTextProperty* (
500    display: X.DisplayPtr;
501    list: C.charPtr2d;
502    count: C.int;
503    style: XICCEncodingStyle;
504    VAR textpropreturn: XTextProperty): C.int;
505PROCEDURE XwcTextListToTextProperty* (
506    display: X.DisplayPtr;
507    list: ARRAY OF X.wchart;
508    count: C.int;
509    style: XICCEncodingStyle;
510    VAR textpropreturn: XTextProperty): C.int;
511PROCEDURE XwcFreeStringList* (
512    list: X.wcharPtr2d);
513PROCEDURE XTextPropertyToStringList* (
514    textprop: XTextPropertyPtr;
515    VAR listreturn: C.charPtr2d;
516    VAR countreturn: C.int): X.Status;
517PROCEDURE XTextPropertyToTextList* (
518    display: X.DisplayPtr;
519    textprop: XTextPropertyPtr;
520    VAR listreturn: C.charPtr2d;
521    VAR countreturn: C.int): X.Status;
522PROCEDURE XwcTextPropertyToTextList* (
523    display: X.DisplayPtr;
524    textprop: XTextPropertyPtr;
525    VAR listreturn: X.wcharPtr2d;
526    VAR countreturn: C.int): X.Status;
527PROCEDURE XUnionRectWithRegion* (
528    rectangle: X.XRectanglePtr;
529    srcregion: Region;
530    destregionreturn: Region);  (* ??? *)
531PROCEDURE XUnionRegion* (
532    sra, srb, drreturn: Region);  (* ??? *)
533PROCEDURE XWMGeometry* (
534    display: X.DisplayPtr;
535    screennumber: C.int;
536    usergeometry: ARRAY OF C.char;
537    defaultgeometry: ARRAY OF C.char;
538    borderwidth: C.int;
539    hints: XSizeHintsPtr;
540    VAR xreturn: C.int;
541    VAR yreturn: C.int;
542    VAR widthreturn: C.int;
543    VAR heightreturn: C.int;
544    VAR gravityreturn: C.int): C.int;
545PROCEDURE XXorRegion* (
546    sra, srb, drreturn: Region);  (* ??? *)
547*)
548END oocXutil.
549