1(*
2    Copyright (c) 2000
3        Cambridge University Technical Services Limited
4
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18*)
19(******************************************************************************
20 ******************************************************************************
21 ***                                                                        ***
22 *** Copyright (c) Abstract Hardware Limited 1988 - 1994                    ***
23 ***                                                                        ***
24 *** Copyright (c) 1987 Digital Equipment Corporation                       ***
25 *** Copyright (c) 1987 Massachusetts Institute of Technology               ***
26 ***                                                                        ***
27 ***                    All Rights Reserved                                 ***
28 ***                                                                        ***
29 *** Permission to use, copy, modify, and distribute this signature and     ***
30 *** its documentation for any purpose and without fee is hereby granted,   ***
31 *** provided that the above copyright notices appear in all copies and     ***
32 *** that both the copyright notices and this permission notice appear in   ***
33 *** supporting documentation, and that the names of Digital, MIT and AHL   ***
34 *** not be used in advertising or publicity pertaining to distribution of  ***
35 *** the signature without specific, written prior permission.  Digital,    ***
36 *** MIT and AHL disclaim all warranties with regard to this signature,     ***
37 *** including all implied warranties of merchantability and fitness, in    ***
38 *** no event shall Digital, MIT or AHL be liable for any special,          ***
39 *** indirect or consequential damages or any damages whatsoever resulting  ***
40 *** from loss of use, data or profits, whether in an action of contract,   ***
41 *** negligence or other tortious action, arising out of or in connection   ***
42 *** with the use or performance of this signature.                         ***
43 ***                                                                        ***
44 ******************************************************************************
45 ******************************************************************************)
46
47signature XWINDOWS_SIG =
48sig
49  structure XAtoms   : XATOMS_SIG;
50  structure XCursors : XCURSORS_SIG;
51  structure XKeySyms : XKEYSYMS_SIG;
52
53  exception XWindows of string ;
54
55  include XEVENT_SIG ;
56
57  (* Geometry *)
58
59  val Left:   XRectangle -> int ;
60  val Right:  XRectangle -> int ;
61  val Top:    XRectangle -> int ;
62  val Bottom: XRectangle -> int ;
63  val Width:  XRectangle -> int ; (* width and height are non-negative *)
64  val Height: XRectangle -> int ;
65
66  val TopLeft:     XRectangle -> XPoint ;
67  val TopRight:    XRectangle -> XPoint ;
68  val BottomLeft:  XRectangle -> XPoint ;
69  val BottomRight: XRectangle -> XPoint ;
70
71  exception XRectangle of { top:int,left:int,bottom:int,right:int } ;
72
73  val Rect: { left:int,right:int,top:int,bottom:int } -> XRectangle ;
74  val Area: { x:int,y:int,w:int,h:int }               -> XRectangle ;
75
76  val DestructRect: XRectangle -> { left:int,right:int,top:int,bottom:int } ;
77  val DestructArea: XRectangle -> { x:int,y:int,w:int,h:int } ;
78
79  val SplitRect: XRectangle  -> (XPoint * XPoint) ;
80  val MakeRect:  XPoint -> XPoint -> XRectangle ;
81
82  val Reflect:       XRectangle -> XRectangle ;
83  val NegativePoint: XPoint     -> XPoint ;
84
85  datatype Section = Nothing | Section of XRectangle ;
86
87  val Intersection: XRectangle -> XRectangle  -> Section ;
88  val Union:        XRectangle -> XRectangle  -> XRectangle ;
89  val OutsetRect:   int -> XRectangle -> XRectangle ;
90  val OffsetRect:   XRectangle -> XPoint -> XRectangle ;
91  val IncludePoint: XPoint -> XRectangle -> XRectangle ;
92
93  (* meant to be used as infix operators *)
94
95  val AddPoint:       (XPoint * XPoint) -> XPoint ;
96  val SubtractPoint:  (XPoint * XPoint) -> XPoint ;
97
98  (* meant to be used as infix predicates *)
99
100  val Inside:               (XRectangle * XRectangle) -> bool ;
101  val Overlap:              (XRectangle * XRectangle) -> bool ;
102  val Within:               (XPoint     * XRectangle) -> bool ;
103  val LeftOf:               (XPoint     * XRectangle) -> bool ;
104  val RightOf:              (XPoint     * XRectangle) -> bool ;
105  val AboveOf:              (XPoint     * XRectangle) -> bool ;
106  val BelowOf:              (XPoint     * XRectangle) -> bool ;
107  val HorizontallyAbutting: (XRectangle * XRectangle) -> bool ;
108  val VerticallyAbutting:   (XRectangle * XRectangle) -> bool ;
109
110  val origin: XPoint ;
111  val empty:  XRectangle ;
112
113  (* Colorcells *)
114
115  datatype XColor = XColor of { doRed:   bool,
116                                doGreen: bool,
117                                doBlue:  bool,
118                                red:     int,
119                                green:   int,
120                                blue:    int,
121                                pixel:   int } ;
122
123  val Pixel: XColor -> int ;
124  val RGB:   XColor -> (int * int * int) ;
125
126  val Not: int -> int ;       (* infix, for not-ing  pixel values *)
127  val And: int * int -> int ; (* infix, for and-ing  pixel values *)
128  val Or:  int * int -> int ; (* infix, for or-ing   pixel values *)
129  val Xor: int * int -> int ; (* infix, for xor-ing  pixel values *)
130  val >> : int * int -> int ; (* infix, for shifting pixel values *)
131  val << : int * int -> int ; (* infix, for shifting pixel values *)
132
133  val XAllocColor:       Colormap -> XColor -> XColor ;
134  val XAllocColorCells:  Colormap -> bool -> int -> int -> (int list * int list) ;
135  val XAllocColorPlanes: Colormap -> bool -> int -> int -> int -> int -> (int list * int * int * int) ;
136  val XAllocNamedColor:  Colormap -> string -> (XColor * XColor) ;
137  val XFreeColors:       Colormap -> int list -> int -> unit ;
138  val XLookupColor:      Colormap -> string -> (XColor * XColor) ;
139  val XParseColor:       Colormap -> string -> XColor ;
140  val XQueryColor:       Colormap -> int -> XColor ;
141  val XQueryColors:      Colormap -> int list -> XColor list ;
142  val XStoreColor:       Colormap -> XColor -> unit ;
143  val XStoreColors:      Colormap -> XColor list -> unit ;
144  val XStoreNamedColor:  Colormap -> string -> int -> (bool * bool * bool) -> unit ;
145
146  val BlackPixel: Display -> int ;
147  val WhitePixel: Display -> int ;
148
149  (* Colormaps *)
150
151  datatype AllocType = AllocNone | AllocAll ;
152
153  val XCopyColormapAndFree:    Colormap -> Colormap ;
154  val XCreateColormap:         Drawable -> Visual -> AllocType -> Colormap ;
155  val XFreeColormap:           Colormap -> unit ;
156  val XInstallColormap:        Colormap -> unit ;
157  val XListInstalledColormaps: Drawable -> Colormap list ;
158  val XSetWindowColormap:      Drawable -> Colormap -> unit ;
159  val XUninstallColormap:      Colormap -> unit ;
160
161  val DefaultColormap: Display -> Colormap ;
162  val DefaultVisual:   Display -> Visual ;
163  val DisplayCells:    Display -> int ;
164
165  datatype VisualClass = StaticGray | GrayScale | StaticColor | PseudoColor | TrueColor | DirectColor ;
166
167  val VisualClass:     Visual -> VisualClass ;
168  val VisualRedMask:   Visual -> int ;
169  val VisualGreenMask: Visual -> int ;
170  val VisualBlueMask:  Visual -> int ;
171
172  (* Cursors *)
173
174  val XCreateFontCursor:   Display -> int -> Cursor ;
175  val XCreateGlyphCursor:  Font -> Font -> int -> int -> XColor -> XColor -> Cursor ;
176  val XCreatePixmapCursor: Drawable -> Drawable -> XColor -> XColor -> XPoint -> Cursor ;
177  val XDefineCursor:       Drawable -> Cursor -> unit ;
178  val XFreeCursor:         Cursor   -> unit ;
179  val XQueryBestCursor:    Drawable -> XRectangle -> XRectangle ;
180  val XRecolorCursor:      Cursor -> XColor -> XColor -> unit ;
181  val XUndefineCursor:     Drawable -> unit ;
182
183  (* Display Specifications *)
184
185  datatype ShapeClass = CursorShape | TileShape | StippleShape ;
186
187  val XQueryBestSize: ShapeClass -> Drawable -> XRectangle -> XRectangle ;
188
189  datatype BackingStore = NotUseful | WhenMapped | Always ;
190
191  val XOpenDisplay: string -> Display ;
192
193  val XStartDisplayHandler: Display -> unit ;
194
195  val AllPlanes:         int ;
196  val CellsOfScreen:     Display -> int ;
197  val DefaultDepth:      Display -> int ;
198  val DisplayHeight:     Display -> int ;
199  val DisplayHeightMM:   Display -> int ;
200  val DisplayPlanes:     Display -> int ;
201  val DisplayString:     Display -> string ;
202  val DisplayWidth:      Display -> int ;
203  val DisplayWidthMM:    Display -> int ;
204  val DoesBackingStore:  Display -> BackingStore ;
205  val DoesSaveUnders:    Display -> bool ;
206  val EventMaskOfScreen: Display -> EventMask list ;
207  val MaxCmapsOfScreen:  Display -> int ;
208  val MinCmapsOfScreen:  Display -> int ;
209  val ProtocolRevision:  Display -> int ;
210  val ProtocolVersion:   Display -> int ;
211  val ServerVendor:      Display -> string ;
212  val VendorRelease:     Display -> int ;
213
214  (* Drawing Primitives *)
215
216  datatype XArc = XArc of XRectangle * int * int ;
217
218  datatype XTextItem   = XTextItem   of string   * int * Font ;
219  datatype XTextItem16 = XTextItem16 of int list * int * Font ;
220
221  datatype CoordMode = CoordModeOrigin | CoordModePrevious ;
222
223  datatype PolyShape = Complex | Nonconvex | Convex ;
224
225  val XClearArea:         Drawable -> XRectangle -> bool -> unit ;
226  val XClearWindow:       Drawable -> unit ;
227  val XCopyArea:          Drawable -> Drawable -> GC -> XPoint -> XRectangle -> unit ;
228  val XCopyPlane:         Drawable -> Drawable -> GC -> XPoint -> XRectangle -> int -> unit ;
229  val XDrawArc:           Drawable -> GC -> XArc -> unit ;
230  val XDrawArcs:          Drawable -> GC -> XArc list -> unit ;
231  val XDrawImageString:   Drawable -> GC -> XPoint -> string   -> unit ;
232  val XDrawImageString16: Drawable -> GC -> XPoint -> int list -> unit ;
233  val XDrawLine:          Drawable -> GC -> XPoint -> XPoint -> unit ;
234  val XDrawLines:         Drawable -> GC -> XPoint list -> CoordMode -> unit ;
235  val XDrawPoint:         Drawable -> GC -> XPoint -> unit ;
236  val XDrawPoints:        Drawable -> GC -> XPoint list -> CoordMode -> unit ;
237  val XDrawRectangle:     Drawable -> GC -> XRectangle -> unit ;
238  val XDrawRectangles:    Drawable -> GC -> XRectangle list -> unit ;
239  val XDrawSegments:      Drawable -> GC -> (XPoint * XPoint) list -> unit ;
240  val XDrawString:        Drawable -> GC -> XPoint -> string   -> unit ;
241  val XDrawString16:      Drawable -> GC -> XPoint -> int list -> unit ;
242  val XDrawText:          Drawable -> GC -> XPoint -> XTextItem list -> unit ;
243  val XDrawText16:        Drawable -> GC -> XPoint -> XTextItem16 list -> unit ;
244  val XFillArc:           Drawable -> GC -> XArc -> unit ;
245  val XFillArcs:          Drawable -> GC -> XArc list -> unit ;
246  val XFillPolygon:       Drawable -> GC -> XPoint list -> PolyShape -> CoordMode -> unit ;
247  val XFillRectangle:     Drawable -> GC -> XRectangle -> unit ;
248  val XFillRectangles:    Drawable -> GC -> XRectangle list -> unit ;
249
250  (* Events *)
251
252  val XSelectInput: Drawable -> EventMask list -> unit ;
253
254  val XSynchronize: Display -> int -> unit ;
255
256  val XSetHandler: Drawable -> ('a XEvent * 'b -> 'b) -> 'b -> (int -> 'a -> unit) ;
257
258  val NullHandler: 'a XEvent * 'b -> 'b ;
259
260  val CurrentTime: int ;
261
262  datatype RevertCode = RevertToParent | RevertToPointerRoot | RevertToNone ;
263
264  val XSetInputFocus: Display -> Drawable -> RevertCode -> int -> unit ;
265  val XGetInputFocus: Display -> (Drawable * RevertCode) ;
266
267  val XSetSelectionOwner: Display -> int -> Drawable -> int -> unit ;
268  val XGetSelectionOwner: Display -> int -> Drawable ;
269
270  val XConvertSelection:    { selection:int, target:int, property:int, requestor:Drawable, time:int } -> unit ;
271  val XSendSelectionNotify: { selection:int, target:int, property:int, requestor:Drawable, time:int } -> unit ;
272
273  val XDeleteProperty: Drawable -> int -> unit ;
274
275  val XInternAtom:  Display -> string -> bool -> int ;
276  val XGetAtomName: Display -> int -> string ;
277
278  (* Fonts *)
279
280  datatype FontDirection = FontLeftToRight | FontRightToLeft ;
281
282  datatype XCharStruct = XCharStruct of { lbearing:   int,
283                                          rbearing:   int,
284                                          width:      int,
285                                          ascent:     int,
286                                          descent:    int,
287                                          attributes: int } ;
288
289  datatype XFontStruct = XFontStruct of { font:          Font,
290                                          direction:     FontDirection,
291                                          minChar:       int,
292                                          maxChar:       int,
293                                          minByte1:      int,
294                                          maxByte1:      int,
295                                          allCharsExist: bool,
296                                          defaultChar:   int,
297                                          minBounds:     XCharStruct,
298                                          maxBounds:     XCharStruct,
299                                          perChar:       XCharStruct list,
300                                          ascent:        int,
301                                          descent:       int } ;
302
303  val XFreeFont:          XFontStruct -> unit ;
304  val XGetFontPath:       Display -> string list ;
305  val XListFonts:         Display -> string -> int -> string list ;
306  val XListFontsWithInfo: Display -> string -> int -> (string list * XFontStruct list) ;
307  val XLoadFont:          Display -> string -> Font ;
308  val XLoadQueryFont:     Display -> string -> XFontStruct ;
309  val XQueryFont:         Font -> XFontStruct ;
310  val XSetFontPath:       Display -> string list -> unit ;
311  val XUnloadFont:        Font -> unit ;
312
313  (* Graphics Context *)
314
315  datatype GCArcMode = ArcChord | ArcPieSlice ;
316
317  datatype GCOrder = Unsorted | YSorted | YXSorted | YXBanded ;
318
319  datatype GCFillRule = EvenOddRule | WindingRule ;
320
321  datatype GCFillStyle = FillSolid | FillTiled | FillStippled | FillOpaqueStippled ;
322
323  datatype GCFunction = GXclear        | GXand        | GXandReverse | GXcopy
324                      | GXandInverted  | GXnoop       | GXxor        | GXor
325                      | GXnor          | GXequiv      | GXinvert     | GXorReverse
326                      | GXcopyInverted | GXorInverted | GXnand       | GXset ;
327
328  datatype GCLineStyle = LineSolid | LineOnOffDash | LineDoubleDash ;
329
330  datatype GCCapStyle = CapNotLast | CapButt | CapRound | CapProjecting ;
331
332  datatype GCJoinStyle = JoinMiter | JoinRound | JoinBevel ;
333
334  datatype GCSubwindowMode = ClipByChildren | IncludeInferiors ;
335
336  val DefaultGC: Display -> GC ;
337
338  datatype XGCValue = GCFunction          of GCFunction
339                    | GCPlaneMask         of int
340                    | GCForeground        of int
341                    | GCBackground        of int
342                    | GCLineWidth         of int
343                    | GCLineStyle         of GCLineStyle
344                    | GCCapStyle          of GCCapStyle
345                    | GCJoinStyle         of GCJoinStyle
346                    | GCFillStyle         of GCFillStyle
347                    | GCFillRule          of GCFillRule
348                    | GCTile              of Drawable
349                    | GCStipple           of Drawable
350                    | GCTSOrigin          of XPoint
351                    | GCFont              of Font
352                    | GCSubwindowMode     of GCSubwindowMode
353                    | GCGraphicsExposures of bool
354                    | GCClipOrigin        of XPoint
355                    | GCClipMask          of Drawable
356                    | GCDashOffset        of int
357                    | GCDashList          of int
358                    | GCArcMode           of GCArcMode ;
359
360  val XChangeGC:             GC -> XGCValue list -> unit ;
361  val XCreateGC:             Drawable -> XGCValue list -> GC ;
362  val XFreeGC:               GC -> unit ;
363  val XSetArcMode:           GC -> GCArcMode -> unit ;
364  val XSetBackground:        GC -> int -> unit ;
365  val XSetClipMask:          GC -> Drawable -> unit ;
366  val XSetClipOrigin:        GC -> XPoint -> unit ;
367  val XSetClipRectangles:    GC -> XPoint -> XRectangle list -> GCOrder -> unit ;
368  val XSetDashes:            GC -> int -> int list -> unit ;
369  val XSetFillRule:          GC -> GCFillRule -> unit ;
370  val XSetFillStyle:         GC -> GCFillStyle -> unit ;
371  val XSetFont:              GC -> Font -> unit ;
372  val XSetForeground:        GC -> int -> unit ;
373  val XSetFunction:          GC -> GCFunction  -> unit ;
374  val XSetGraphicsExposures: GC -> bool -> unit ;
375  val XSetLineAttributes:    GC -> int -> GCLineStyle -> GCCapStyle -> GCJoinStyle -> unit ;
376  val XSetPlaneMask:         GC -> int -> unit ;
377  val XSetState:             GC -> int -> int -> GCFunction -> int -> unit ;
378  val XSetStipple:           GC -> Drawable -> unit ;
379  val XSetSubwindowMode:     GC -> GCSubwindowMode -> unit ;
380  val XSetTile:              GC -> Drawable -> unit ;
381  val XSetTSOrigin:          GC -> XPoint -> unit ;
382
383  (* Images *)
384
385  datatype ImageFormat = XYBitmap | XYPixmap | ZPixmap ;
386
387  datatype ImageOrder = LSBFirst | MSBFirst ;
388
389  type ImageData ;
390
391  val Data: string -> ImageData ;
392
393  datatype XImage = XImage of { data:            ImageData,
394                                size:            XRectangle,
395                                depth:           int,
396                                format:          ImageFormat,
397                                xoffset:         int,
398                                bitmapPad:       int,
399                                byteOrder:       ImageOrder,
400                                bitmapUnit:      int,
401                                bitsPerPixel:    int,
402                                bytesPerLine:    int,
403                                visualRedMask:   int,
404                                bitmapBitOrder:  ImageOrder,
405                                visualBlueMask:  int,
406                                visualGreenMask: int } ;
407
408  val XAddPixel:     Display  -> XImage -> int -> unit ;
409  val XCreateImage:  Visual   -> int -> ImageFormat -> int -> string -> XRectangle -> int -> int -> XImage ;
410  val XGetImage:     Drawable -> XRectangle -> int -> ImageFormat -> XImage ;
411  val XGetPixel:     Display  -> XImage -> XPoint -> int ;
412  val XGetSubImage:  Drawable -> XRectangle -> int -> ImageFormat -> XImage -> XPoint -> unit ;
413  val XPutImage:     Drawable -> GC -> XImage -> XPoint -> XRectangle -> unit ;
414  val XPutPixel:     Display  -> XImage -> XPoint -> int -> unit ;
415  val XSubImage:     Display  -> XImage -> XRectangle -> XImage ;
416
417  val BitmapBitOrder: Display -> ImageOrder ;
418  val BitmapPad:      Display -> int ;
419  val BitmapUnit:     Display -> int ;
420  val ByteOrder:      Display -> ImageOrder ;
421
422  val ImageByteOrder: XImage -> ImageOrder ;
423  val ImageSize:      XImage -> XRectangle ;
424  val ImageDepth:     XImage -> int ;
425
426  (* Keyboard *)
427
428  (* keysym values are integers, and are defined in other signatures *)
429
430  val XLookupString: Drawable -> int -> Modifier list -> (string * int) ;
431
432  val XQueryKeymap: Display -> bool list ; (* 256 bools *)
433
434  val IsCursorKey:       int -> bool ;
435  val IsFunctionKey:     int -> bool ;
436  val IsKeypadKey:       int -> bool ;
437  val IsMiscFunctionKey: int -> bool ;
438  val IsModifierKey:     int -> bool ;
439  val IsPFKey:           int -> bool ;
440
441  (* Output Buffer *)
442
443  val XFlush: Display -> unit ;
444  val XSync:  Display -> bool -> unit ;
445
446  (* Pointers *)
447
448  val XQueryPointer: Drawable -> (bool * Drawable * Drawable * XPoint * XPoint * Modifier list) ;
449
450  (* Screen Saver *)
451
452  datatype SaveMode = ScreenSaverReset | ScreenSaverActive ;
453
454  datatype Blanking = DontPreferBlanking | PreferBlanking | DefaultBlanking ;
455
456  datatype Exposures = DontAllowExposures | AllowExposures | DefaultExposures ;
457
458  val XActivateScreenSaver: Display -> unit ;
459  val XForceScreenSaver:    Display -> SaveMode -> unit ;
460  val XGetScreenSaver:      Display -> (int * int * Blanking * Exposures) ;
461  val XResetScreenSaver:    Display -> unit ;
462  val XSetScreenSaver:      Display -> int -> int -> Blanking -> Exposures -> unit ;
463
464  (* Standard Geometry *)
465
466  val XTranslateCoordinates: Drawable -> Drawable -> XPoint -> XPoint * Drawable ;
467
468  (* Text *)
469
470  val XTextExtents:   XFontStruct -> string   -> (FontDirection * int * int * XCharStruct) ;
471  val XTextExtents16: XFontStruct -> int list -> (FontDirection * int * int * XCharStruct) ;
472  val XTextWidth:     XFontStruct -> string   -> int ;
473  val XTextWidth16:   XFontStruct -> int list -> int ;
474
475  (* Tiles, Pixmaps, Stipples and Bitmaps *)
476
477  datatype BitmapStatus = BitmapOpenFailed
478                        | BitmapFileInvalid
479                        | BitmapNoMemory
480                        | BitmapSuccess of Drawable * XRectangle * XPoint ;
481
482  val XCreateBitmapFromData:       Drawable -> string -> XRectangle -> Drawable ;
483  val XCreatePixmap:               Drawable -> XRectangle -> int -> Drawable ;
484  val XCreatePixmapFromBitmapData: Drawable -> string -> XRectangle -> int -> int -> int -> Drawable ;
485  val XFreePixmap:                 Drawable -> unit ;
486  val XQueryBestStipple:           Drawable -> XRectangle -> XRectangle ;
487  val XQueryBestTile:              Drawable -> XRectangle -> XRectangle ;
488  val XReadBitmapFile:             Drawable -> string -> BitmapStatus ;
489  val XWriteBitmapFile:            string -> Drawable -> XRectangle -> XPoint -> BitmapStatus ;
490
491  (* User Preferences *)
492
493  val XAutoRepeatOff: Display -> unit ;
494  val XAutoRepeatOn:  Display -> unit ;
495  val XBell:          Display -> int -> unit ;
496  val XGetDefault:    Display -> string -> string -> string ;
497
498  (* Window Attributes *)
499
500  datatype Gravity = ForgetGravity | NorthWestGravity | NorthGravity | NorthEastGravity | WestGravity | CenterGravity
501                   | EastGravity   | SouthWestGravity | SouthGravity | SouthEastGravity | StaticGravity ;
502
503  val UnmapGravity: Gravity ;    (* same as ForgetGravity *)
504
505  datatype XSetWindowAttributes = CWBackPixmap       of Drawable
506                                | CWBackPixel        of int
507                                | CWBorderPixmap     of Drawable
508                                | CWBorderPixel      of int
509                                | CWBitGravity       of Gravity
510                                | CWWinGravity       of Gravity
511                                | CWBackingStore     of BackingStore
512                                | CWBackingPlanes    of int
513                                | CWBackingPixel     of int
514                                | CWOverrideRedirect of bool
515                                | CWSaveUnder        of bool
516                                | CWEventMask        of EventMask list
517                                | CWDontPropagate    of EventMask list
518                                | CWColormap         of Colormap
519                                | CWCursor           of Cursor ;
520
521  datatype WindowClass = CopyFromParentClass | InputOutputClass | InputOnlyClass ;
522
523  datatype MapState = IsUnmapped | IsUnviewable | IsViewable ;
524
525  datatype XWindowAttributes = XWindowAttributes of
526                               {
527                                 position:           XPoint,
528                                 size:               XRectangle,
529                                 borderWidth:        int,
530                                 depth:              int,
531                                 visual:             Visual,
532                                 root:               Drawable,
533                                 class:              WindowClass,
534                                 bitGravity:         Gravity,
535                                 winGravity:         Gravity,
536                                 backingStore:       BackingStore,
537                                 backingPlanes:      int,
538                                 backingPixel:       int,
539                                 saveUnder:          bool,
540                                 colormap:           Colormap,
541                                 mapInstalled:       bool,
542                                 mapState:           MapState,
543                                 allEventMasks:      EventMask list,
544                                 yourEventMask:      EventMask list,
545                                 doNotPropagateMask: EventMask list,
546                                 overrideRedirect:   bool
547                               } ;
548
549  val XChangeWindowAttributes:    Drawable -> XSetWindowAttributes list -> unit ;
550  val XGetGeometry:               Drawable -> (Drawable * XPoint * XRectangle * int * int) ;
551  val XGetWindowAttributes:       Drawable -> XWindowAttributes ;
552  val XSetWindowBackground:       Drawable -> int      -> unit ;
553  val XSetWindowBackgroundPixmap: Drawable -> Drawable -> unit ;
554  val XSetWindowBorder:           Drawable -> int      -> unit ;
555  val XSetWindowBorderPixmap:     Drawable -> Drawable -> unit ;
556  val XSetWindowBorderWidth:      Drawable -> int      -> unit ;
557
558  (* Window Configuration *)
559
560  datatype CirculateDirection = RaiseLowest | LowerHighest ;
561
562  datatype XWindowChanges = CWPosition    of XPoint
563                          | CWSize        of XRectangle
564                          | CWBorderWidth of int
565                          | CWStackMode   of StackMode
566                          | CWSibling     of Drawable ;
567
568  val XCirculateSubwindows:     Drawable -> CirculateDirection -> unit ;
569  val XCirculateSubwindowsDown: Drawable -> unit ;
570  val XCirculateSubwindowsUp:   Drawable -> unit ;
571  val XConfigureWindow:         Drawable -> XWindowChanges list -> unit ;
572  val XLowerWindow:             Drawable -> unit ;
573  val XMapRaised:               Drawable -> unit ;
574  val XMapSubwindows:           Drawable -> unit ;
575  val XMapWindow:               Drawable -> unit ;
576  val XMoveResizeWindow:        Drawable -> XPoint -> XRectangle -> unit ;
577  val XMoveWindow:              Drawable -> XPoint -> unit ;
578  val XQueryTree:               Drawable -> (Drawable * Drawable * Drawable list) ;
579  val XRaiseWindow:             Drawable -> unit ;
580  val XReparentWindow:          Drawable -> Drawable -> XPoint -> unit ;
581  val XResizeWindow:            Drawable -> XRectangle -> unit ;
582  val XRestackWindows:          Drawable list -> unit ;
583  val XUnmapSubwindows:         Drawable -> unit ;
584  val XUnmapWindow:             Drawable -> unit ;
585
586  (* Window Existence *)
587
588  val NoDrawable:             Drawable ;
589  val NoCursor:               Cursor ;
590  val NoFont:                 Font ;
591  val NoColormap:             Colormap ;
592  val NoVisual:               Visual ;
593  val ParentRelative:         Drawable ;
594  val CopyFromParentDrawable: Drawable ;
595  val CopyFromParentVisual:   Visual ;
596  val PointerWindow:          Drawable ;
597  val InputFocus:             Drawable ;
598  val PointerRoot:            Drawable ;
599  val NoSymbol:               int ;
600  val AnyKey:                 int ;
601
602  val RootWindow:         Display  -> Drawable ;
603  val XDestroyWindow:     Drawable -> unit ;
604  val XDestroySubwindows: Drawable -> unit ;
605
606  val XCreateSimpleWindow: Drawable -> XPoint -> XRectangle -> int -> int -> int -> Drawable ;
607
608  val XCreateWindow: Drawable -> XPoint -> XRectangle -> int -> int -> WindowClass -> Visual -> XSetWindowAttributes list -> Drawable ;
609
610  (* Window Manager *)
611
612  datatype XWMStateHint = DontCareState | NormalState | ZoomState | IconicState | InactiveState ;
613
614  datatype XWMHint = InputHint        of bool
615                   | StateHint        of XWMStateHint
616                   | IconPixmapHint   of Drawable
617                   | IconWindowHint   of Drawable
618                   | IconPositionHint of XPoint
619                   | IconMaskHint     of Drawable ;
620
621  datatype XWMSizeHint = PPosition   of XPoint
622                       | PSize       of XRectangle
623                       | PMinSize    of XRectangle
624                       | PMaxSize    of XRectangle
625                       | PResizeInc  of XRectangle
626                       | PAspect     of XPoint * XPoint
627                       | PBaseSize   of XRectangle
628                       | PWinGravity of Gravity ;
629
630  datatype XStandardColormap = XStandardColormap of { colormap:  Colormap,
631                                                      redMax:    int,
632                                                      redMult:   int,
633                                                      greenMax:  int,
634                                                      greenMult: int,
635                                                      blueMax:   int,
636                                                      blueMult:  int,
637                                                      basePixel: int,
638                                                      visual:    Visual } ;
639
640  datatype PropertyValue = PropertyArc         of XArc list
641                         | PropertyAtom        of int list
642                         | PropertyBitmap      of Drawable list
643                         | PropertyColormap    of Colormap list
644                         | PropertyCursor      of Cursor list
645                         | PropertyDrawable    of Drawable list
646                         | PropertyFont        of Font list
647                         | PropertyInteger     of int list
648                         | PropertyPixmap      of Drawable list
649                         | PropertyPoint       of XPoint list
650                         | PropertyRectangle   of XRectangle list
651                         | PropertyRGBColormap of XStandardColormap list
652                         | PropertyString      of string
653                         | PropertyVisual      of Visual list
654                         | PropertyWindow      of Drawable list
655                         | PropertyWMHints     of XWMHint list
656                         | PropertyWMSizeHints of XWMSizeHint list
657                         | PropertyWMIconSizes of (XRectangle * XRectangle * XRectangle) list ;
658
659  val XSetProperty: Drawable -> int -> PropertyValue -> int -> unit ;
660
661  val XGetTextProperty: Drawable -> int -> (string * int * int * int) ;
662
663  val XGetWMName:          Drawable -> string ;
664  val XGetWMIconName:      Drawable -> string ;
665  val XGetWMClientMachine: Drawable -> string ;
666  val XSetWMName:          Drawable -> string -> unit ;
667  val XSetWMIconName:      Drawable -> string -> unit ;
668  val XSetWMClientMachine: Drawable -> string -> unit ;
669
670  val XGetWMCommand: Drawable -> string list ;
671  val XGetWMClass:   Drawable -> string list ;
672  val XSetWMCommand: Drawable -> string list -> unit ;
673  val XSetWMClass:   Drawable -> string list -> unit ;
674
675  val XSetWMHints: Drawable -> XWMHint list -> unit ;
676  val XGetWMHints: Drawable -> XWMHint list ;
677
678  val XSetWMSizeHints: Drawable -> int -> XWMSizeHint list -> unit ;
679  val XGetWMSizeHints: Drawable -> int -> XWMSizeHint list ;
680
681  val XSetWMNormalHints: Drawable -> XWMSizeHint list -> unit ;
682  val XGetWMNormalHints: Drawable -> XWMSizeHint list ;
683
684  val XWMGeometry: Display -> string -> string -> int -> XWMSizeHint list -> XPoint * XRectangle * Gravity ;
685
686  val XSetWMProperties: Drawable -> string -> string -> string list -> XWMSizeHint list -> XWMHint list -> string list -> unit ;
687
688  val XSetIconSizes: Drawable -> (XRectangle * XRectangle * XRectangle) list -> unit ;
689  val XGetIconSizes: Drawable -> (XRectangle * XRectangle * XRectangle) list ;
690
691  val XSetTransientForHint: Drawable -> Drawable -> unit ;
692  val XGetTransientForHint: Drawable -> Drawable ;
693
694  val XSetWMColormapWindows: Drawable -> Drawable list -> unit ;
695  val XGetWMColormapWindows: Drawable -> Drawable list ;
696
697  val XSetRGBColormaps: Drawable -> int -> XStandardColormap list -> unit ;
698  val XGetRGBColormaps: Drawable -> int -> XStandardColormap list ;
699
700  (* Miscellaneous and Convenience functions *)
701
702  val ColormapID: Colormap -> int ;                      (* id numbers for X resources *)
703  val CursorID:   Cursor   -> int ;                      (* two X resources with the same id are the same resource *)
704  val DrawableID: Drawable -> int ;
705  val FontID:     Font     -> int ;
706  val GCID:       GC       -> int ;
707  val VisualID:   Visual   -> int ;
708
709  val SameDrawable: Drawable -> Drawable -> bool ;
710
711  val ColormapDisplay: Colormap -> Display ;             (* Display associated with X resource *)
712  val CursorDisplay:   Cursor   -> Display ;
713  val DrawableDisplay: Drawable -> Display ;
714  val FontDisplay:     Font     -> Display ;
715  val GCDisplay:       GC       -> Display ;
716  val VisualDisplay:   Visual   -> Display ;
717
718  val ColormapExists: Colormap -> bool ;                 (* value brought across from previous session *)
719  val CursorExists:   Cursor   -> bool ;
720  val DrawableExists: Drawable -> bool ;
721  val FontExists:     Font     -> bool ;
722  val GCExists:       GC       -> bool ;
723  val VisualExists:   Visual   -> bool ;
724  val DisplayExists:  Display  -> bool ;
725
726  val XSetColors: GC -> int -> int -> unit ;             (* set foreground and background *)
727
728  val XGetWindowRoot:        Drawable -> Drawable ;      (* root         from XGetGeometry *)
729  val XGetWindowPosition:    Drawable -> XPoint ;        (* position     from XGetGeometry *)
730  val XGetWindowSize:        Drawable -> XRectangle ;    (* size         from XGetGeometry *)
731  val XGetWindowBorderWidth: Drawable -> int ;           (* border width from XGetGeometry *)
732  val XGetWindowDepth:       Drawable -> int ;           (* depth        from XGetGeometry *)
733  val XGetWindowParent:      Drawable -> Drawable ;      (* parent       from XQueryTree *)
734  val XGetWindowChildren:    Drawable -> Drawable list ; (* children     from XQueryTree *)
735
736  val GetTimeOfDay: unit -> int * int ;
737
738  val FSFont:          XFontStruct -> Font ;
739  val FSDirection:     XFontStruct -> FontDirection ;
740  val FSMinChar:       XFontStruct -> int ;
741  val FSMaxChar:       XFontStruct -> int ;
742  val FSMinByte1:      XFontStruct -> int ;
743  val FSMaxByte1:      XFontStruct -> int ;
744  val FSAllCharsExist: XFontStruct -> bool ;
745  val FSDefaultChar:   XFontStruct -> int ;
746  val FSMinBounds:     XFontStruct -> XCharStruct ;
747  val FSMaxBounds:     XFontStruct -> XCharStruct ;
748  val FSPerChar:       XFontStruct -> XCharStruct list ;
749  val FSAscent:        XFontStruct -> int ;
750  val FSDescent:       XFontStruct -> int ;
751
752  val CharLBearing:   XCharStruct -> int ;
753  val CharRBearing:   XCharStruct -> int ;
754  val CharWidth:      XCharStruct -> int ;
755  val CharAscent:     XCharStruct -> int ;
756  val CharDescent:    XCharStruct -> int ;
757  val CharAttributes: XCharStruct -> int ;
758
759  val FSMinWidth:  XFontStruct -> int ;
760  val FSMaxWidth:  XFontStruct -> int ;
761  val FSMinHeight: XFontStruct -> int ;
762  val FSMaxHeight: XFontStruct -> int ;
763
764  val ShiftDown:   Modifier list -> bool ;
765  val ControlDown: Modifier list -> bool ;
766
767end (* XWINDOWS_SIG *) ;
768