Module Xlib


module Xlib: sig .. end
OCaml bindings for the Xlib library.




Types



type event_mask =
| KeyPressMask
| KeyReleaseMask
| ButtonPressMask
| ButtonReleaseMask
| EnterWindowMask
| LeaveWindowMask
| PointerMotionMask
| PointerMotionHintMask
| Button1MotionMask
| Button2MotionMask
| Button3MotionMask
| Button4MotionMask
| Button5MotionMask
| ButtonMotionMask
| KeymapStateMask
| ExposureMask
| VisibilityChangeMask
| StructureNotifyMask
| ResizeRedirectMask
| SubstructureNotifyMask
| SubstructureRedirectMask
| FocusChangeMask
| PropertyChangeMask
| ColormapChangeMask
| OwnerGrabButtonMask
type uint = int 
type 'a drawable 
type _window 
type window = Xlib._window drawable 
type _pixmap 
type pixmap = Xlib._pixmap drawable 
both windows and pixmaps can be used as drawable
type gc 
type colormap 
type atom 
type time = int64 
type keysym = int 
type keycode = int 

Display



Display Functions
type display 
val xOpenDisplay : name:string -> display
man
val open_display : ?name:string -> unit -> display
val xCloseDisplay : dpy:display -> unit
man
val xFlush : dpy:display -> unit
man
val xBell : dpy:display -> percent:int -> unit
man
val xChangeKeyboardControl_bell_percent : dpy:display -> bell_percent:int -> unit
val xChangeKeyboardControl_bell_pitch : dpy:display -> bell_pitch:int -> unit
val xChangeKeyboardControl_bell_duration : dpy:display -> bell_duration:int -> unit
val xChangeKeyboardControl_bell : dpy:display ->
bell_percent:int -> bell_pitch:int -> bell_duration:int -> unit
bell_percent sets the base volume for the bell between 0 (off) and 100 (loud) inclusive, if possible. A setting of -1 restores the default. Other negative values generate a BadValue error.

bell_pitch member sets the pitch (specified in Hz) of the bell, if possible. A setting of -1 restores the default. Other negative values generate a BadValue error.

bell_duration member sets the duration of the bell specified in milliseconds, if possible. A setting of -1 restores the default. Other negative values generate a BadValue error.

val xChangeKeyboardControl_key_click_percent : dpy:display -> key_click_percent:int -> unit

type close_mode =
| DestroyAll
| RetainPermanent
| RetainTemporary
val xSetCloseDownMode : dpy:display -> close_mode:close_mode -> unit
man
val xSync : dpy:display -> discard:bool -> unit
man
val xConnectionNumber : dpy:display -> int
man
val xProtocolVersion : dpy:display -> int
man
val xProtocolRevision : dpy:display -> int
val xVendorRelease : dpy:display -> int
val xServerVendor : dpy:display -> string
val xlibSpecificationRelease : unit -> int

Server Grabbing
val xGrabServer : dpy:display -> unit
man
val xUngrabServer : dpy:display -> unit
man
val xUngrabPointer : dpy:display -> time:time -> unit
man
val xUngrabKeyboard : dpy:display -> time:time -> unit
man

Screen number


type screen_number = private int 
val xDefaultScreen : dpy:display -> screen_number
man
val xDisplayWidth : dpy:display -> scr:screen_number -> int
val xDisplayHeight : dpy:display -> scr:screen_number -> int
val xDefaultDepth : dpy:display -> scr:screen_number -> int
man
val xListDepths : dpy:display -> scr:screen_number -> int array
man
val xDisplayPlanes : dpy:display -> scr:screen_number -> int
man
val xScreenCount : dpy:display -> int
man
val xScreenNumbers : dpy:display -> screen_number array
returns an array of all the screen numbers

Pixel Colors


type pixel_color 
val xBlackPixel : dpy:display -> scr:screen_number -> pixel_color
man
val xWhitePixel : dpy:display -> scr:screen_number -> pixel_color
man

XColor



Color Management Functions
type xColor 
val new_xColor : unit -> xColor
this type is garbage collected
val xAllocNamedColor : dpy:display ->
colormap:colormap -> color_name:string -> xColor * xColor
the returned values are garbage collected, man
val xColor_set_red : xColor -> int -> unit
val xColor_set_green : xColor -> int -> unit
val xColor_set_blue : xColor -> int -> unit
val xColor_set_rgb : xColor -> r:int -> g:int -> b:int -> unit

type color_flags =
| DoRed
| DoGreen
| DoBlue
val xColor_set_flags : xColor -> color_flags list -> unit
val xAllocColor : dpy:display -> colormap:colormap -> xColor -> unit
man
val xAllocColorCells : dpy:display ->
colormap:colormap ->
contig:bool ->
nplanes:uint -> npixels:uint -> uint array * uint array
man, returns (plane_masks, pixels)
val xAllocColorCellsPixels : dpy:display ->
colormap:colormap -> contig:bool -> npixels:uint -> uint array
same than xAllocColorCells but only requests for the pixels
val xColor_pixel : xColor -> pixel_color
val xColor_set_pixel : xColor -> pixel_color -> unit
val xQueryColor : dpy:display -> colormap:colormap -> xColor -> unit
man
val xColor_get_red : xColor -> int
val xColor_get_green : xColor -> int
val xColor_get_blue : xColor -> int
val xColor_get_rgb : xColor -> int * int * int

Visual


type visual 
type visualID 
val xDefaultVisual : dpy:display -> scr:screen_number -> visual
man
val visual_red_mask : visual:visual -> int
val visual_green_mask : visual:visual -> int
val visual_blue_mask : visual:visual -> int
val visual_bits_per_rgb : visual:visual -> int
val visual_visualid : visual:visual -> visualID
val visual_map_entries : visual:visual -> int
color map entries

xVisualInfo



man
type xVisualInfo 

type xVisualInfo_contents = {
   visual : visual;
   visual_id : visualID;
   screen_number : screen_number;
   depth : int;
   red_mask : uint;
   green_mask : uint;
   blue_mask : uint;
   colormap_size : int;
   bits_per_rgb : int;
}
val xVisualInfo_datas : visual_info:xVisualInfo -> xVisualInfo_contents
val xFree_xVisualInfo : xVisualInfo -> unit

type color_class =
| StaticGray
| GrayScale
| StaticColor
| PseudoColor
| TrueColor
| DirectColor
val new_xVisualInfo : unit -> xVisualInfo
do not call Xlib.xFree_xVisualInfo with this xVisualInfo
val xVisualInfo_set_visual : visual -> unit
val xVisualInfo_set_visualid : visualID -> unit
val xVisualInfo_set_screen : screen_number -> unit
val xVisualInfo_set_depth : uint -> unit
val xVisualInfo_set_class : color_class -> unit
val xVisualInfo_set_red_mask : uint -> unit
val xVisualInfo_set_green_mask : uint -> unit
val xVisualInfo_set_blue_mask : uint -> unit
val xVisualInfo_set_colormap_size : int -> unit
val xVisualInfo_set_bits_per_rgb : int -> unit

type visual_info_mask =
| VisualNoMask
| VisualIDMask
| VisualScreenMask
| VisualDepthMask
| VisualClassMask
| VisualRedMaskMask
| VisualGreenMaskMask
| VisualBlueMaskMask
| VisualColormapSizeMask
| VisualBitsPerRGBMask
| VisualAllMask
val xGetVisualInfo : dpy:display ->
visual_info_mask list ->
template:xVisualInfo -> xVisualInfo array
man
val xMatchVisualInfo : dpy:display ->
scr:screen_number ->
depth:int -> color_class:color_class -> xVisualInfo
man no need to call Xlib.xFree_xVisualInfo on the returned value

Colormap


val xDefaultColormap : dpy:display -> scr:screen_number -> colormap
do not free the default colormap, man
val xDisplayCells : dpy:display -> scr:screen_number -> int
man

type colormap_alloc =
| AllocNone
| AllocAll
val xCreateColormap : dpy:display ->
win:window ->
visual:visual -> alloc:colormap_alloc -> colormap
man
val xFreeColormap : dpy:display -> colormap:colormap -> unit
man
val xCopyColormapAndFree : dpy:display -> colormap:colormap -> colormap
man
val xSetWindowColormap : dpy:display -> win:window -> colormap:colormap -> unit
man

Managing Installed Colormaps


val xInstallColormap : dpy:display -> colormap:colormap -> unit
man
val xUninstallColormap : dpy:display -> colormap:colormap -> unit
man
val xListInstalledColormaps : dpy:display -> win:window -> colormap array
man

xSetWindowAttributes


type xSetWindowAttributes 
val new_xSetWindowAttributes : unit -> xSetWindowAttributes
the returned xSetWindowAttributes is garbage collected
type event_mask_list = event_mask list 
type cursor 
val winAttr_set_background_pixmap : xSetWindowAttributes -> background_pixmap:pixmap -> unit
val winAttr_set_background_pixel : xSetWindowAttributes -> background_pixel:pixel_color -> unit
val winAttr_set_border_pixmap : xSetWindowAttributes -> border_pixmap:pixmap -> unit
val winAttr_set_border_pixel : xSetWindowAttributes -> border_pixel:pixel_color -> unit
val winAttr_set_bit_gravity : xSetWindowAttributes -> bit_gravity:int -> unit
val winAttr_set_win_gravity : xSetWindowAttributes -> win_gravity:int -> unit
val winAttr_set_backing_store : xSetWindowAttributes -> backing_store:int -> unit
val winAttr_set_backing_planes : xSetWindowAttributes -> backing_planes:uint -> unit
val winAttr_set_backing_pixel : xSetWindowAttributes -> backing_pixel:uint -> unit
val winAttr_set_save_under : xSetWindowAttributes -> save_under:bool -> unit
val winAttr_set_event_mask : xSetWindowAttributes -> event_mask:event_mask_list -> unit
val winAttr_set_do_not_propagate_mask : xSetWindowAttributes -> do_not_propagate_mask:int -> unit
val winAttr_set_override_redirect : xSetWindowAttributes -> override_redirect:bool -> unit
val winAttr_set_colormap : xSetWindowAttributes -> colormap:colormap -> unit
val winAttr_set_cursor : xSetWindowAttributes -> cursor:cursor -> unit

type set_win_attr = {
   attr : xSetWindowAttributes;
   set_background_pixmap : background_pixmap:pixmap -> unit;
   set_background_pixel : background_pixel:pixel_color -> unit;
   set_border_pixmap : border_pixmap:pixmap -> unit;
   set_border_pixel : border_pixel:pixel_color -> unit;
   set_bit_gravity : bit_gravity:int -> unit;
   set_win_gravity : win_gravity:int -> unit;
   set_backing_store : backing_store:int -> unit;
   set_backing_planes : backing_planes:uint -> unit;
   set_backing_pixel : backing_pixel:uint -> unit;
   set_save_under : save_under:bool -> unit;
   set_event_mask : event_mask:event_mask_list -> unit;
   set_do_not_propagate_mask : do_not_propagate_mask:int -> unit;
   set_override_redirect : override_redirect:bool -> unit;
   set_colormap : colormap:colormap -> unit;
   set_cursor : cursor:cursor -> unit;
}
a record to replace all the winAttr_set_* functions
val new_win_attr : unit -> set_win_attr
replaces new_xSetWindowAttributes, this one is supposed to produce more concise code

Windows


val xRootWindow : dpy:display -> scr:screen_number -> window
man
val xDefaultRootWindow : dpy:display -> window
man
val root_win : dpy:display -> ?scr:screen_number -> unit -> window
alternative for xRootWindow and xDefaultRootWindow
val xCreateSimpleWindow : dpy:display ->
parent:window ->
x:int ->
y:int ->
width:uint ->
height:uint ->
border_width:uint ->
border_color:pixel_color -> background:pixel_color -> window
man
val simple_window : dpy:display ->
?parent:window ->
?x:int ->
?y:int ->
?width:uint ->
?height:uint ->
?border_width:uint ->
?border_color:pixel_color ->
?background:pixel_color -> unit -> window
returns a window with eventually defaut parameters (wip)
val xDestroyWindow : dpy:display -> win:window -> unit
man
val xid : int -> 'a
some magic
val xStoreName : dpy:display -> win:window -> name:string -> unit
man
val xFetchName : dpy:display -> win:window -> string
man
val xSelectInput : dpy:display ->
win:window -> event_mask:event_mask list -> unit
val xMapWindow : dpy:display -> win:window -> unit
man
val xMapSubwindows : dpy:display -> win:window -> unit
man
val xMapRaised : dpy:display -> win:window -> unit
man
val xUnmapWindow : dpy:display -> win:window -> unit
man

type window_class =
| CopyFromParent
| InputOutput
| InputOnly

type winattr_valuemask =
| CWBackPixmap
| CWBackPixel
| CWBorderPixmap
| CWBorderPixel
| CWBitGravity
| CWWinGravity
| CWBackingStore
| CWBackingPlanes
| CWBackingPixel
| CWOverrideRedirect
| CWSaveUnder
| CWEventMask
| CWDontPropagate
| CWColormap
| CWCursor
val xCreateWindow : dpy:display ->
parent:window ->
x:int ->
y:int ->
width:uint ->
height:uint ->
border_width:uint ->
depth:int ->
win_class:window_class ->
visual:visual ->
valuemask:winattr_valuemask list ->
attributes:xSetWindowAttributes -> window
man

type winattr =
| BackPixmap of pixmap
| BackPixel of pixel_color
| BorderPixmap of pixmap
| BorderPixel of pixel_color
| BitGravity of int
| WinGravity of int
| BackingStore of int
| BackingPlanes of uint
| BackingPixel of uint
| OverrideRedirect of bool
| SaveUnder of bool
| EventMask of event_mask_list
| DontPropagate of int
| Colormap of colormap
| Cursor of cursor
val create_window : dpy:display ->
parent:window ->
x:int ->
y:int ->
width:uint ->
height:uint ->
border_width:uint ->
depth:int ->
win_class:window_class ->
visual:visual -> win_attrs:winattr list -> window
equivalent of xCreateWindow
val xResizeWindow : dpy:display ->
win:window -> width:uint -> height:uint -> unit
man
val xMoveWindow : dpy:display -> win:window -> x:int -> y:int -> unit
man
val xMoveResizeWindow : dpy:display ->
win:window ->
x:int -> y:int -> width:uint -> height:uint -> unit
man
val xLowerWindow : dpy:display -> win:window -> unit
man
val xRaiseWindow : dpy:display -> win:window -> unit
man
val xQueryTree : dpy:display ->
win:window -> window * window * window array
man, returns (root_window, parent_window, children_windows)
val xRestackWindows : dpy:display -> win:window array -> unit
man
val xCirculateSubwindowsDown : dpy:display -> win:window -> unit
val xCirculateSubwindowsUp : dpy:display -> win:window -> unit

type circulate_subwindows_direction =
| RaiseLowest
| LowerHighest
val xCirculateSubwindows : dpy:display ->
win:window -> dir:circulate_subwindows_direction -> unit

type req_type =
| Atom of atom
| AnyPropertyType
val xGetWindowProperty_string : dpy:display ->
win:window ->
property:atom ->
long_offset:int ->
long_length:int ->
delete:bool -> req_type:req_type -> atom * int * int * int * string
val xGetWindowProperty_window : dpy:display ->
win:window ->
property:atom ->
long_offset:int ->
long_length:int ->
delete:bool ->
req_type:req_type -> atom * int * int * int * window
man

XScreen


type xScreen 
this type wraps the scruture Screen from the Xlib, but is here renamed with an additionnal x as a way of disambiguation with the type screen_number
val xDefaultScreenOfDisplay : dpy:display -> xScreen
the result points to a member of the input structure
val xScreenOfDisplay : dpy:display -> scr:screen_number -> xScreen
val xDefaultVisualOfScreen : xScreen -> visual
the result points to a member of the input structure
val xRootWindowOfScreen : xScreen -> window
val xBlackPixelOfScreen : xScreen -> pixel_color
val xWhitePixelOfScreen : xScreen -> pixel_color
val xDefaultColormapOfScreen : xScreen -> colormap
val xDefaultDepthOfScreen : xScreen -> int
val xDefaultGCOfScreen : xScreen -> gc
val xDisplayOfScreen : xScreen -> display
val xWidthOfScreen : xScreen -> int
val xHeightOfScreen : xScreen -> int
val xScreenNumberOfScreen : xScreen -> screen_number

xWindowAttributes


type xWindowAttributes 
xWindowAttributes is garbage collected
val xGetWindowAttributes : dpy:display -> win:window -> xWindowAttributes
man
val xWindowAttributes_x : xWindowAttributes -> int
val xWindowAttributes_y : xWindowAttributes -> int
val xWindowAttributes_width : xWindowAttributes -> int
val xWindowAttributes_height : xWindowAttributes -> int
val xWindowAttributes_depth : xWindowAttributes -> int
val xWindowAttributes_screen : xWindowAttributes -> xScreen
val xWindowAttributes_border_width : xWindowAttributes -> int
val xWindowAttributes_colormap : xWindowAttributes -> colormap
val xWindowAttributes_map_installed : xWindowAttributes -> bool

type wattr = {
   wattr_x : int;
   wattr_y : int;
   wattr_width : int;
   wattr_height : int;
   wattr_depth : int;
}
a record to replace all the xWindowAttributes_* functions
val get_win_attrs : dpy:display -> win:window -> wattr
replaces xGetWindowAttributes, this one is supposed to produce more concise code

type wattrs = {
   winat_x : unit -> int;
   winat_y : unit -> int;
   winat_width : unit -> int;
   winat_height : unit -> int;
   winat_depth : unit -> int;
   winat_screen : unit -> xScreen;
   winat_border_width : unit -> int;
   winat_colormap : unit -> colormap;
   winat_map_installed : unit -> bool;
}
another record to replace all the xWindowAttributes_* functions
val win_attrs : dpy:display -> win:window -> wattrs
another replacement for xWindowAttributes functions

XSizeHints


type xSizeHints 
val new_xSizeHints : unit -> xSizeHints
this type is garbage collected
val xSizeHints_set_USPosition : xSizeHints -> x:int -> y:int -> unit
val xSizeHints_set_USSize : xSizeHints -> width:int -> height:int -> unit
val xSizeHints_set_PPosition : xSizeHints -> x:int -> y:int -> unit
val xSizeHints_set_PSize : xSizeHints -> width:int -> height:int -> unit
val xSizeHints_set_PMinSize : xSizeHints -> width:int -> height:int -> unit
val xSizeHints_set_PMaxSize : xSizeHints -> width:int -> height:int -> unit
val xSizeHints_set_PResizeInc : xSizeHints -> width_inc:int -> height_inc:int -> unit
val xSizeHints_set_PBaseSize : xSizeHints -> base_width:int -> base_height:int -> unit
val xSizeHints_set_PAspect : xSizeHints -> min_aspect:int * int -> max_aspect:int * int -> unit
val xSizeHints_set_PWinGravity : xSizeHints -> win_gravity:int -> unit
val xSetNormalHints : dpy:display -> win:window -> hints:xSizeHints -> unit
val xSetStandardProperties : dpy:display ->
win:window ->
window_name:string ->
icon_name:string ->
icon_pixmap:pixmap option ->
argv:string array -> hints:xSizeHints -> unit

type set_size_hints = {
   hints : xSizeHints;
   set_USPosition : x:int -> y:int -> unit;
   set_USSize : width:int -> height:int -> unit;
   set_PPosition : x:int -> y:int -> unit;
   set_PSize : width:int -> height:int -> unit;
   set_PMinSize : width:int -> height:int -> unit;
   set_PMaxSize : width:int -> height:int -> unit;
   set_PResizeInc : width_inc:int -> height_inc:int -> unit;
   set_PBaseSize : base_width:int -> base_height:int -> unit;
   set_PAspect : min_aspect:int * int -> max_aspect:int * int -> unit;
   set_PWinGravity : win_gravity:int -> unit;
}
a record to replace all the xSizeHints_set_* functions
val new_size_hints : unit -> set_size_hints
replaces new_xSizeHints

type size_hints =
| USPosition of int * int
| USSize of int * int (*(width, height)*)
| PPosition of int * int
| PSize of int * int
| PMinSize of int * int
| PMaxSize of int * int
| PResizeInc of int * int
| PBaseSize of int * int
| PAspect of (int * int) * (int * int)
| PWinGravity of int
a variant to replace all the xSizeHints_set_* functions
val set_normal_hints : dpy:display -> win:window -> hints:size_hints list -> unit
replaces xSetNormalHints
val set_standard_properties : dpy:display ->
win:window ->
window_name:string ->
icon_name:string ->
icon_pixmap:pixmap option ->
argv:string array -> hints:size_hints list -> unit
replaces xSetStandardProperties

XEvents


type 'a xEvent 

type event_type =
| 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
type any 
type xKeyEvent 
type xButtonEvent 
type xMotionEvent 
type xCrossingEvent 
type xFocusChangeEvent 
type xExposeEvent 
type xGraphicsExposeEvent 
type xNoExposeEvent 
type xVisibilityEvent 
type xCreateWindowEvent 
type xDestroyWindowEvent 
type xUnmapEvent 
type xMapEvent 
type xMapRequestEvent 
type xReparentEvent 
type xConfigureEvent 
type xGravityEvent 
type xResizeRequestEvent 
type xConfigureRequestEvent 
type xCirculateEvent 
type xCirculateRequestEvent 
type xPropertyEvent 
type xSelectionClearEvent 
type xSelectionRequestEvent 
type xSelectionEvent 
type xColormapEvent 
type xClientMessageEvent 
type xMappingEvent 
type xErrorEvent 
type xKeymapEvent 
type xKeyPressedEvent = xKeyEvent 
type xKeyReleasedEvent = xKeyEvent 
type xButtonPressedEvent = xButtonEvent 
type xButtonReleasedEvent = xButtonEvent 
type xEnterWindowEvent = xCrossingEvent 
type xLeaveWindowEvent = xCrossingEvent 
type xFocusInEvent = xFocusChangeEvent 
type xFocusOutEvent = xFocusChangeEvent 

type event_kind =
| XKeyPressedEvent of xKeyPressedEvent xEvent
| XKeyReleasedEvent of xKeyReleasedEvent xEvent
| XButtonPressedEvent of xButtonPressedEvent xEvent
| XButtonReleasedEvent of xButtonReleasedEvent xEvent
| XMotionEvent of xMotionEvent xEvent
| XCrossingEvent of xCrossingEvent xEvent
| XFocusChangeEvent of xFocusChangeEvent xEvent
| XExposeEvent of xExposeEvent xEvent
| XGraphicsExposeEvent of xGraphicsExposeEvent xEvent
| XNoExposeEvent of xNoExposeEvent xEvent
| XVisibilityEvent of xVisibilityEvent xEvent
| XCreateWindowEvent of xCreateWindowEvent xEvent
| XDestroyWindowEvent of xDestroyWindowEvent xEvent
| XUnmapEvent of xUnmapEvent xEvent
| XMapEvent of xMapEvent xEvent
| XMapRequestEvent of xMapRequestEvent xEvent
| XReparentEvent of xReparentEvent xEvent
| XConfigureEvent of xConfigureEvent xEvent
| XGravityEvent of xGravityEvent xEvent
| XResizeRequestEvent of xResizeRequestEvent xEvent
| XConfigureRequestEvent of xConfigureRequestEvent xEvent
| XCirculateEvent of xCirculateEvent xEvent
| XCirculateRequestEvent of xCirculateRequestEvent xEvent
| XPropertyEvent of xPropertyEvent xEvent
| XSelectionClearEvent of xSelectionClearEvent xEvent
| XSelectionRequestEvent of xSelectionRequestEvent xEvent
| XSelectionEvent of xSelectionEvent xEvent
| XColormapEvent of xColormapEvent xEvent
| XClientMessageEvent of xClientMessageEvent xEvent
| XMappingEvent of xMappingEvent xEvent
| XErrorEvent of xErrorEvent xEvent
| XKeymapEvent of xKeymapEvent xEvent
val new_xEvent : unit -> any xEvent
the return value is garbage collected
val xNextEvent : dpy:display -> event:any xEvent -> unit
man

this function modifies the event parameter, which is supposed to come from the function new_xEvent.

val xNextEventFun : dpy:display -> any xEvent
This function is supposed to replace the functions new_xEvent and xNextEvent, in order to produce more functional code. The tradeoff is that there is a new allocation of the xEvent structure at each call.
val xPeekEvent : dpy:display -> event:any xEvent -> unit
man
val xMaskEvent : dpy:display -> event_mask list -> any xEvent -> unit
man
val xWindowEvent : dpy:display -> win:window -> event_mask list -> 'a xEvent
man
val xPending : dpy:display -> int
man

type event_mode =
| AsyncPointer
| SyncPointer
| AsyncKeyboard
| SyncKeyboard
| ReplayPointer
| ReplayKeyboard
| AsyncBoth
| SyncBoth
val xAllowEvents : dpy:display -> event_mode:event_mode -> time:time -> unit
man
val xPutBackEvent : dpy:display -> event:'a xEvent -> unit
man

type queued_mode =
| QueuedAlready
| QueuedAfterFlush
| QueuedAfterReading
val xEventsQueued : dpy:display -> mode:queued_mode -> int
man
val xCheckTypedEvent : dpy:display -> event_type -> any xEvent -> bool
man, this function is imperative: the xEvent provided is modified, so is a returned value too
val xCheckTypedEvent_option : dpy:display -> event_type -> any xEvent option
replaces xCheckTypedEvent
val xEventType : event:'a xEvent -> event_type
val xEventKind : event:any xEvent -> event_kind
selects the right type of the event
val string_of_event_type : event_type:event_type -> string

XEvent Conversions



convertions from type any xEvent
val to_xMotionEvent : event:any xEvent -> xMotionEvent xEvent
val to_xKeyEvent : event:any xEvent -> xKeyEvent xEvent
val to_xKeyPressedEvent : event:any xEvent -> xKeyPressedEvent xEvent
val to_xKeyReleasedEvent : event:any xEvent -> xKeyReleasedEvent xEvent
val to_xButtonEvent : event:any xEvent -> xButtonEvent xEvent
val to_xButtonPressedEvent : event:any xEvent -> xButtonPressedEvent xEvent
val to_xButtonReleasedEvent : event:any xEvent -> xButtonReleasedEvent xEvent
val to_xCrossingEvent : event:any xEvent -> xCrossingEvent xEvent
val to_xEnterWindowEvent : event:any xEvent -> xEnterWindowEvent xEvent
val to_xLeaveWindowEvent : event:any xEvent -> xLeaveWindowEvent xEvent
val to_xFocusChangeEvent : event:any xEvent -> xFocusChangeEvent xEvent
val to_xFocusInEvent : event:any xEvent -> xFocusInEvent xEvent
val to_xFocusOutEvent : event:any xEvent -> xFocusOutEvent xEvent
val to_xKeymapEvent : event:any xEvent -> xKeymapEvent xEvent
val to_xExposeEvent : event:any xEvent -> xExposeEvent xEvent
val to_xGraphicsExposeEvent : event:any xEvent -> xGraphicsExposeEvent xEvent
val to_xNoExposeEvent : event:any xEvent -> xNoExposeEvent xEvent
val to_xVisibilityEvent : event:any xEvent -> xVisibilityEvent xEvent
val to_xCreateWindowEvent : event:any xEvent -> xCreateWindowEvent xEvent
val to_xDestroyWindowEvent : event:any xEvent -> xDestroyWindowEvent xEvent
val to_xUnmapEvent : event:any xEvent -> xUnmapEvent xEvent
val to_xMapEvent : event:any xEvent -> xMapEvent xEvent
val to_xMapRequestEvent : event:any xEvent -> xMapRequestEvent xEvent
val to_xReparentEvent : event:any xEvent -> xReparentEvent xEvent
val to_xConfigureEvent : event:any xEvent -> xConfigureEvent xEvent
val to_xConfigureRequestEvent : event:any xEvent -> xConfigureRequestEvent xEvent
val to_xGravityEvent : event:any xEvent -> xGravityEvent xEvent
val to_xResizeRequestEvent : event:any xEvent -> xResizeRequestEvent xEvent
val to_xCirculateEvent : event:any xEvent -> xCirculateEvent xEvent
val to_xCirculateRequestEvent : event:any xEvent -> xCirculateRequestEvent xEvent
val to_xPropertyEvent : event:any xEvent -> xPropertyEvent xEvent
val to_xSelectionClearEvent : event:any xEvent -> xSelectionClearEvent xEvent
val to_xSelectionRequestEvent : event:any xEvent -> xSelectionRequestEvent xEvent
val to_xSelectionEvent : event:any xEvent -> xSelectionEvent xEvent
val to_xColormapEvent : event:any xEvent -> xColormapEvent xEvent
val to_xClientMessageEvent : event:any xEvent -> xClientMessageEvent xEvent
val to_xMappingEvent : event:any xEvent -> xMappingEvent xEvent

XEvents Contents



manual about XEvent Structures

type xAnyEvent_contents = {
   xany_type : event_type;
   xany_serial : uint;
   xany_send_event : bool;
   xany_display : display;
   xany_window : window;
}
val xAnyEvent_datas : 'a xEvent -> xAnyEvent_contents

type logical_state =
| AnyModifier
| Button1Mask
| Button2Mask
| Button3Mask
| Button4Mask
| Button5Mask
| ShiftMask
| LockMask
| ControlMask
| Mod1Mask
| Mod2Mask
| Mod3Mask
| Mod4Mask
| Mod5Mask

type xKeyEvent_contents = {
   key_serial : uint;
   key_send_event : bool;
   key_display : display;
   key_window : window;
   key_root : window;
   key_subwindow : window;
   key_time : time;
   key_x : int;
   key_y : int;
   key_x_root : int;
   key_y_root : int;
   key_state : logical_state list;
   key_keycode : keycode;
   key_same_screen : bool;
}
val xKeyEvent_datas : xKeyEvent xEvent -> xKeyEvent_contents
man

type xMotionEvent_contents = {
   motion_serial : uint;
   motion_send_event : bool;
   motion_display : display;
   motion_window : window;
   motion_root : window;
   motion_subwindow : window;
   motion_time : time;
   motion_x : int;
   motion_y : int;
   motion_x_root : int;
   motion_y_root : int;
   motion_state : logical_state list;
   motion_is_hint : char;
   motion_same_screen : bool;
}
val xMotionEvent_datas : xMotionEvent xEvent -> xMotionEvent_contents
man

type button =
| AnyButton
| Button1
| Button2
| Button3
| Button4
| Button5

type xButtonEvent_contents = {
   button_serial : uint;
   button_send_event : bool;
   button_display : display;
   button_window : window;
   button_root : window;
   button_subwindow : window;
   button_time : time;
   button_x : int;
   button_y : int;
   button_x_root : int;
   button_y_root : int;
   button_state : uint;
   button : button;
   button_same_screen : bool;
}
val xButtonEvent_datas : xButtonEvent xEvent -> xButtonEvent_contents
man
module Cross: sig .. end

type xCrossingEvent_contents = {
   cross_window : window;
   cross_root : window;
   cross_subwindow : window;
   cross_time : time;
   cross_x : int;
   cross_y : int;
   cross_x_root : int;
   cross_y_root : int;
   cross_mode : Cross.crossing_mode;
   cross_detail : Cross.crossing_detail;
   cross_same_screen : bool;
   cross_focus : bool;
   cross_state : Cross.crossing_state;
}
val xCrossingEvent_datas : xCrossingEvent xEvent -> xCrossingEvent_contents
man

type focus_mode =
| NotifyNormal
| NotifyGrab
| NotifyUngrab
| NotifyWhileGrabbed

type focus_detail =
| NotifyAncestor
| NotifyVirtual
| NotifyInferior
| NotifyNonlinear
| NotifyNonlinearVirtual
| NotifyPointer
| NotifyPointerRoot
| NotifyDetailNone

type xFocusChangeEvent_contents = {
   focus_mode : focus_mode;
   focus_detail : focus_detail;
}
val xFocusChangeEvent_datas : xFocusChangeEvent xEvent -> xFocusChangeEvent_contents
man

type xKeymapEvent_contents = {
   key_vector : string;
}
val xKeymapEvent_datas : xKeymapEvent xEvent -> xKeymapEvent_contents
man

type xExposeEvent_contents = {
   expose_x : int;
   expose_y : int;
   expose_width : int;
   expose_height : int;
   expose_count : int;
}
val xExposeEvent_datas : xExposeEvent xEvent -> xExposeEvent_contents
man

type visibility_state =
| VisibilityUnobscured
| VisibilityPartiallyObscured
| VisibilityFullyObscured

type xVisibilityEvent_contents = {
   visibility_state : visibility_state;
}
val xVisibilityEvent_datas : xVisibilityEvent xEvent -> xVisibilityEvent_contents
man

type xDestroyWindowEvent_contents = {
   destroy_event : window;
   destroy_window : window;
}
val xDestroyWindowEvent_datas : xDestroyWindowEvent xEvent -> xDestroyWindowEvent_contents
man

type xReparentEvent_contents = {
   reparent_event : window;
   reparent_window : window;
   reparent_parent : window;
   reparent_x : int;
   reparent_y : int;
   reparent_override_redirect : bool;
}
val xReparentEvent_datas : xReparentEvent xEvent -> xReparentEvent_contents
man

type xConfigureEvent_contents = {
   conf_x : int;
   conf_y : int;
   conf_width : int;
   conf_height : int;
   conf_border_width : int;
   conf_above : window;
   conf_override_redirect : bool;
}
val xConfigureEvent_datas : xConfigureEvent xEvent -> xConfigureEvent_contents
man

type xconfreq_detail =
| Above
| Below
| TopIf
| BottomIf
| Opposite

type xConfigureRequestEvent_contents = {
   confreq_parent : window;
   confreq_window : window;
   confreq_x : int;
   confreq_y : int;
   confreq_width : int;
   confreq_height : int;
   confreq_border_width : int;
   confreq_above : window;
   confreq_detail : xconfreq_detail;
   confreq_value_mask : uint;
}
val xConfigureRequestEvent_datas : xConfigureRequestEvent xEvent ->
xConfigureRequestEvent_contents
man

type xResizeRequestEvent_contents = {
   resize_width : int;
   resize_height : int;
}
val xResizeRequestEvent_datas : xResizeRequestEvent xEvent -> xResizeRequestEvent_contents
man

type xSelectionEvent_contents = {
   selec_requestor : window;
   selec_selection : atom;
   selec_target : atom;
   selec_property : atom option;
   selec_time : time;
}
val xSelectionEvent_datas : xSelectionEvent xEvent -> xSelectionEvent_contents
man

type xCreateWindowEvent_contents = {
   createwindow_serial : uint;
   createwindow_send_event : bool;
   createwindow_display : display;
   createwindow_parent : window;
   createwindow_window : window;
   createwindow_x : int;
   createwindow_y : int;
   createwindow_width : int;
   createwindow_height : int;
   createwindow_border_width : int;
   createwindow_override_redirect : bool;
}
val xCreateWindowEvent_datas : xCreateWindowEvent xEvent -> xCreateWindowEvent_contents
man

type todo_contents = {
   todo_field : int;
}
type event_content =
| XMotionEvCnt of xMotionEvent_contents
| XKeyPressedEvCnt of xKeyEvent_contents
| XKeyReleasedEvCnt of xKeyEvent_contents
| XButtonPressedEvCnt of xButtonEvent_contents
| XButtonReleasedEvCnt of xButtonEvent_contents
| XCrossingEvCnt of xCrossingEvent_contents
| XFocusChangeEvCnt of xFocusChangeEvent_contents
| XKeymapEvCnt of xKeymapEvent_contents
| XExposeEvCnt of xExposeEvent_contents
| XGraphicsExposeEvCnt of todo_contents
| XNoExposeEvCnt of todo_contents
| XVisibilityEvCnt of xVisibilityEvent_contents
| XCreateWindowEvCnt of xCreateWindowEvent_contents
| XDestroyWindowEvCnt of xDestroyWindowEvent_contents
| XUnmapEvCnt of todo_contents
| XMapEvCnt of todo_contents
| XMapRequestEvCnt of todo_contents
| XReparentEvCnt of xReparentEvent_contents
| XConfigureEvCnt of xConfigureEvent_contents
| XConfigureRequestEvCnt of xConfigureRequestEvent_contents
| XGravityEvCnt of todo_contents
| XResizeRequestEvCnt of xResizeRequestEvent_contents
| XCirculateEvCnt of todo_contents
| XCirculateRequestEvCnt of todo_contents
| XPropertyEvCnt of todo_contents
| XSelectionClearEvCnt of todo_contents
| XSelectionRequestEvCnt of todo_contents
| XSelectionEvCnt of xSelectionEvent_contents
| XColormapEvCnt of todo_contents
| XClientMessageEvCnt of todo_contents
| XMappingEvCnt of todo_contents
val xSendEvent : dpy:display ->
win:window ->
propagate:bool -> event_mask:event_mask -> event_content -> unit
man

Keysym



Keyboard Utility Functions

Latin-1 Keyboard Event Functions

val xLookupString : event:xKeyEvent xEvent -> buffer:string -> int * keysym
man, Warning: the buffer parameter is filled by the function, you can provide a string of length 2, or an empty string if you're not interested by it.
val xLookupKeysym : event:xKeyEvent xEvent -> index:int -> keysym
man
val xKeycodeToKeysym : dpy:display -> keycode:keycode -> index:int -> keysym
man

Keyboard Mapping


val xRefreshKeyboardMapping : event:xMappingEvent xEvent -> unit
man
val xDisplayKeycodes : dpy:display -> keycode * keycode
man returns (min_keycodes, max_keycodes)
val xGetKeyboardMapping : dpy:display ->
first_keycode:keycode -> keycode_count:int -> keysym array array
WIP! man
val xChangeKeyboardMapping : dpy:display ->
first_keycode:keycode ->
keysyms_per_keycode:int -> keysyms:keysym array -> num_codes:int -> unit
WIP! man
val xChangeKeyboardMapping_single : dpy:display -> keycode:keycode -> keysym:int -> unit
same as xChangeKeyboardMapping but requests for only one item

Atoms


val xSetWMProtocols : dpy:display ->
win:window -> protocols:atom -> count:int -> unit
man
val xInternAtom : dpy:display -> atom_name:string -> only_if_exists:bool -> atom
if None is returned, raises Not_found
val xInternAtoms : dpy:display ->
names:string array -> only_if_exists:bool -> atom array
val xGetAtomName : dpy:display -> atom:atom -> string
man
val xEvent_xclient_data : xClientMessageEvent xEvent -> atom
alpha

Font


type font 
type xFontStruct 
val xLoadFont : dpy:display -> name:string -> font
man
val xLoadQueryFont : dpy:display -> name:string -> xFontStruct
man
val xQueryFont : dpy:display -> font:font -> xFontStruct
man
val xQueryFontGC : dpy:display -> gc:gc -> xFontStruct
val xSetFont : dpy:display -> gc:gc -> font:font -> unit
man
val xFontStruct_font : xFontStruct -> font
val xFontStruct_ascent : xFontStruct -> int
val xFontStruct_descent : xFontStruct -> int
val xFontStruct_all_chars_exist : xFontStruct -> bool
val xFontStruct_get_height : xFontStruct -> int * int
returns the (ascent, descent) pair
val xTextWidth : xFontStruct -> string -> int

type xCharStruct = {
   lbearing : int;
   rbearing : int;
   width : int;
   ascent : int;
   descent : int;
}
val xFontStruct_min_bounds : xFontStruct -> xCharStruct
val xFontStruct_max_bounds : xFontStruct -> xCharStruct

type font_struct = {
   _font : font;
   _ascent : int;
   _descent : int;
   all_chars_exist : bool;
   font_height : int * int;
   text_width : string -> int;
   min_bounds : xCharStruct;
   max_bounds : xCharStruct;
}
replaces the functions xFontStruct_*
val load_font : dpy:display -> name:string -> font_struct
replaces xLoadFont

Setting and Retrieving the Font Search Path


val xSetFontPath : dpy:display -> directories:string array -> unit
man
val xGetFontPath : dpy:display -> string array
man
val xListFonts : dpy:display -> pattern:string -> maxnames:int -> string array
man

Graphics Context


val xDefaultGC : dpy:display -> scr:screen_number -> gc
man
type xGCValues 
val new_xGCValues : unit -> xGCValues
the return value is garbage collected

type line_style =
| LineSolid
| LineOnOffDash
| LineDoubleDash

type cap_style =
| CapNotLast
| CapButt
| CapRound
| CapProjecting

type join_style =
| JoinMiter
| JoinRound
| JoinBevel

type fill_style =
| FillSolid
| FillTiled
| FillStippled
| FillOpaqueStippled

type fill_rule =
| EvenOddRule
| WindingRule

type logop_func =
| GXclear
| GXand
| GXandReverse
| GXcopy
| GXandInverted
| GXnoop
| GXxor
| GXor
| GXnor
| GXequiv
| GXinvert
| GXorReverse
| GXcopyInverted
| GXorInverted
| GXnand
| GXset

type arc_mode =
| ArcChord
| ArcPieSlice

type subwindow_mode =
| ClipByChildren
| IncludeInferiors
val xGCValues_set_foreground : gcv:xGCValues -> fg:pixel_color -> unit
val xGCValues_set_background : gcv:xGCValues -> bg:pixel_color -> unit
val xGCValues_set_graphics_exposures : gcv:xGCValues -> bool -> unit
val xGCValues_set_tile : gcv:xGCValues -> pixmap -> unit
val xGCValues_set_clip_x_origin : gcv:xGCValues -> int -> unit
val xGCValues_set_clip_y_origin : gcv:xGCValues -> int -> unit
val xGCValues_set_ts_x_origin : gcv:xGCValues -> int -> unit
val xGCValues_set_ts_y_origin : gcv:xGCValues -> int -> unit
val xGCValues_set_line_style : gcv:xGCValues -> line_style -> unit
val xGCValues_set_cap_style : gcv:xGCValues -> cap_style -> unit
val xGCValues_set_join_style : gcv:xGCValues -> join_style -> unit
val xGCValues_set_fill_style : gcv:xGCValues -> fill_style -> unit
val xGCValues_set_fill_rule : gcv:xGCValues -> fill_rule -> unit
val xGCValues_set_function : gcv:xGCValues -> logop_func -> unit
val xGCValues_set_line_width : gcv:xGCValues -> int -> unit
val xGCValues_set_arc_mode : gcv:xGCValues -> arc_mode -> unit
val xGCValues_set_font : gcv:xGCValues -> font -> unit
val xGCValues_set_subwindow_mode : gcv:xGCValues -> subwindow_mode -> unit
val xGCValues_get_foreground : gcv:xGCValues -> pixel_color
val xGCValues_get_background : gcv:xGCValues -> pixel_color
val xGCValues_get_graphics_exposures : gcv:xGCValues -> bool
val xGCValues_get_tile : gcv:xGCValues -> pixmap
val xGCValues_get_clip_x_origin : gcv:xGCValues -> int
val xGCValues_get_clip_y_origin : gcv:xGCValues -> int
val xGCValues_get_ts_x_origin : gcv:xGCValues -> int
val xGCValues_get_ts_y_origin : gcv:xGCValues -> int
val xGCValues_get_line_style : gcv:xGCValues -> line_style
val xGCValues_get_cap_style : gcv:xGCValues -> cap_style
val xGCValues_get_join_style : gcv:xGCValues -> join_style
val xGCValues_get_fill_style : gcv:xGCValues -> fill_style
val xGCValues_get_fill_rule : gcv:xGCValues -> fill_rule
val xGCValues_get_function : gcv:xGCValues -> logop_func
val xGCValues_get_line_width : gcv:xGCValues -> int
val xGCValues_get_arc_mode : gcv:xGCValues -> arc_mode
val xGCValues_get_font : gcv:xGCValues -> font
val xGCValues_get_subwindow_mode : gcv:xGCValues -> subwindow_mode

type gc_values = {
   gcValues : xGCValues;
   set_foreground : fg:pixel_color -> unit;
   set_background : bg:pixel_color -> unit;
   set_graphics_exposures : bool -> unit;
   set_tile : pixmap -> unit;
   set_clip_x_origin : int -> unit;
   set_clip_y_origin : int -> unit;
   set_ts_x_origin : int -> unit;
   set_ts_y_origin : int -> unit;
   set_line_style : line_style -> unit;
   set_cap_style : cap_style -> unit;
   set_join_style : join_style -> unit;
   set_fill_style : fill_style -> unit;
   set_fill_rule : fill_rule -> unit;
   set_function : logop_func -> unit;
   set_line_width : int -> unit;
   set_arc_mode : arc_mode -> unit;
   set_font : font -> unit;
   set_subwindow_mode : subwindow_mode -> unit;
   foreground : pixel_color;
   background : pixel_color;
   graphics_exposures : bool;
   tile : pixmap;
   clip_x_origin : int;
   clip_y_origin : int;
   ts_x_origin : int;
   ts_y_origin : int;
   line_style : line_style;
   cap_style : cap_style;
   join_style : join_style;
   fill_style : fill_style;
   fill_rule : fill_rule;
   logical_op : logop_func;
   line_width : int;
   arc_mode : arc_mode;
   gc_font : font;
   subwindow_mode : subwindow_mode;
}
a record to replace all the xGCValues_set_* and xGCValues_get_* functions
val new_gc_values : unit -> gc_values
replaces new_xGCValues

type gc_valuemask =
| GCFunction
| GCPlaneMask
| GCForeground
| GCBackground
| GCLineWidth
| GCLineStyle
| GCCapStyle
| GCJoinStyle
| GCFillStyle
| GCFillRule
| GCTile
| GCStipple
| GCTileStipXOrigin
| GCTileStipYOrigin
| GCFont
| GCSubwindowMode
| GCGraphicsExposures
| GCClipXOrigin
| GCClipYOrigin
| GCClipMask
| GCDashOffset
| GCDashList
| GCArcMode
val xCreateGC : dpy:display ->
d:'a drawable -> gc_valuemask list -> xGCValues -> gc
man
val xChangeGC : dpy:display ->
gc:gc -> gc_valuemask list -> xGCValues -> unit
man
val xGetGCValues : dpy:display -> gc:gc -> gc_valuemask list -> xGCValues
man
val xSetLineAttributes : dpy:display ->
gc:gc ->
line_width:uint ->
line_style:line_style ->
cap_style:cap_style -> join_style:join_style -> unit
man
val xSetFillStyle : dpy:display -> gc:gc -> fill_style:fill_style -> unit
man

Drawing


val xSetForeground : dpy:display -> gc:gc -> fg:pixel_color -> unit
man
val xSetBackground : dpy:display -> gc:gc -> bg:pixel_color -> unit
man
val xClearWindow : dpy:display -> win:window -> unit
man
val xClearArea : dpy:display ->
win:window ->
x:int ->
y:int -> width:uint -> height:uint -> exposures:bool -> unit
man
val xDrawPoint : dpy:display ->
d:'a drawable -> gc:gc -> x:int -> y:int -> unit
man

type coordinate_mode =
| CoordModeOrigin
| CoordModePrevious

type xPoint = {
   pnt_x : int;
   pnt_y : int;
}
val xDrawPoints : dpy:display ->
d:'a drawable ->
gc:gc -> points:xPoint array -> mode:coordinate_mode -> unit
man
val xDrawLine : dpy:display ->
d:'a drawable ->
gc:gc -> x1:int -> y1:int -> x2:int -> y2:int -> unit
man
val xDrawLines : dpy:display ->
d:'a drawable ->
gc:gc -> points:xPoint array -> mode:coordinate_mode -> unit
man

type segment = {
   x1 : int;
   y1 : int;
   x2 : int;
   y2 : int;
}
val xDrawSegments : dpy:display ->
d:'a drawable -> gc:gc -> segments:segment array -> unit
man
val xDrawRectangle : dpy:display ->
d:'a drawable ->
gc:gc -> x:int -> y:int -> width:uint -> height:uint -> unit
man
val xFillRectangle : dpy:display ->
d:'a drawable ->
gc:gc -> x:int -> y:int -> width:uint -> height:uint -> unit
man

type x_rectangle = {
   rect_x : int;
   rect_y : int;
   rect_width : uint;
   rect_height : uint;
}
val xFillRectangles : dpy:display ->
d:'a drawable -> gc:gc -> rectangles:x_rectangle array -> unit
man
val xDrawRectangles : dpy:display ->
d:'a drawable -> gc:gc -> rectangles:x_rectangle array -> unit
man
val xDrawArc : dpy:display ->
d:'a drawable ->
gc:gc ->
x:int ->
y:int ->
width:uint -> height:uint -> angle1:int -> angle2:int -> unit
man
val xFillArc : dpy:display ->
d:'a drawable ->
gc:gc ->
x:int ->
y:int ->
width:uint -> height:uint -> angle1:int -> angle2:int -> unit
man

type x_arc = {
   arc_x : int;
   arc_y : int;
   arc_width : uint;
   arc_height : uint;
   arc_angle1 : int;
   arc_angle2 : int;
}
val xDrawArcs : dpy:display ->
d:'a drawable -> gc:gc -> arcs:x_arc array -> unit
man
val xFillArcs : dpy:display ->
d:'a drawable -> gc:gc -> arcs:x_arc array -> unit
man

type shape_kind =
| Complex
| Nonconvex
| Convex
val xFillPolygon : dpy:display ->
d:'a drawable ->
gc:gc ->
points:xPoint array ->
shape:shape_kind -> mode:coordinate_mode -> unit
man
val xDrawString : dpy:display ->
d:'a drawable -> gc:gc -> x:int -> y:int -> str:string -> unit
man
val xDrawImageString : dpy:display ->
d:'a drawable -> gc:gc -> x:int -> y:int -> str:string -> unit
man

16 bit characters


type xChar2b 
val new_xChar2b : char * char -> xChar2b
normal 16 bit characters are two bytes
type xChar2b_string 
val new_xChar2b_string : (char * char) array -> xChar2b_string
val xDrawImageString16 : dpy:display ->
d:'a drawable ->
gc:gc -> x:int -> y:int -> str16:xChar2b_string -> unit
man
val xDrawString16 : dpy:display ->
d:'a drawable ->
gc:gc -> x:int -> y:int -> str16:xChar2b_string -> unit
man

Drawable


val xCopyArea : dpy:display ->
src:'a drawable ->
dest:'b drawable ->
gc:gc ->
src_x:int ->
src_y:int ->
width:uint -> height:uint -> dest_x:int -> dest_y:int -> unit
man
val xCreatePixmap : dpy:display ->
d:'a drawable ->
width:uint -> height:uint -> depth:uint -> pixmap
man
val xCreateBitmapFromData : dpy:display ->
d:'a drawable ->
data:string -> width:uint -> height:uint -> pixmap
man
val xCreatePixmapCursor : dpy:display ->
source:pixmap ->
mask:pixmap ->
foreground:xColor ->
background:xColor -> x:uint -> y:uint -> cursor
man
val xFreePixmap : dpy:display -> pixmap -> unit
man
val xQueryBestTile : dpy:display ->
d:'a drawable ->
width:uint -> height:uint -> uint * uint
man

type xPixmapFormatValues = {
   pxm_depth : int;
   bits_per_pixel : int;
   scanline_pad : int;
}
val xListPixmapFormats : dpy:display -> xPixmapFormatValues array
man
val xBitmapUnit : dpy:display -> int
man
val xBitmapPad : dpy:display -> int
man

XImage



Manipulating Images

type byte_order =
| LSBFirst
| MSBFirst
val xImageByteOrder : dpy:display -> byte_order
man

type ximage_format =
| XYBitmap
| XYPixmap
| ZPixmap
type xImage 
val xCreateImage : dpy:display ->
visual:visual ->
depth:int ->
fmt:ximage_format ->
offset:int ->
data:'a ->
width:uint ->
height:uint -> bitmap_pad:int -> bytes_per_line:int -> xImage
data can be a string or a bigarray (ala glcaml), man
val xDestroyImage : image:xImage -> unit
man
val xSubImage : image:xImage ->
x:int -> y:int -> width:uint -> height:uint -> xImage
man
val xAllPlanes : unit -> uint

man
val xGetImage : dpy:display ->
d:'a drawable ->
x:int ->
y:int ->
width:uint ->
height:uint ->
plane_mask:uint -> fmt:ximage_format -> xImage
man
type image_data = (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Genarray.t 
val xImage_data_ba : image:xImage -> image_data
val xImage_data_str : image:xImage -> string

get the raw data
val xGetPixel : image:xImage -> x:int -> y:int -> pixel_color
val xPutPixel : image:xImage -> x:int -> y:int -> pixel:pixel_color -> unit
val xAddPixel : image:xImage -> v:int -> unit
val xPutImage : dpy:display ->
d:'a drawable ->
gc:gc ->
image:xImage ->
src_x:int ->
src_y:int ->
dest_x:int -> dest_y:int -> width:uint -> height:uint -> unit

Keyboard


val xAutoRepeatOff : dpy:display -> unit
val xAutoRepeatOn : dpy:display -> unit
val xQueryKeymap : dpy:display -> string
man
val xQueryPointer : dpy:display ->
win:window ->
window * int * int * (window * int * int) option *
logical_state list
man
module Got: sig .. end
module Set: sig .. end

type xKeyboardState = {
   key_click_percent : int;
   bell_percent : int;
   bell_pitch : uint;
   bell_duration : uint;
   led_mask : uint;
   global_auto_repeat : Got.auto_repeat_mode;
   auto_repeats : string;
}
val xGetKeyboardControl : dpy:display -> xKeyboardState
man

ScreenSaver



type screensaver_mode =
| ScreenSaverActive
| ScreenSaverReset
val xForceScreenSaver : dpy:display -> mode:screensaver_mode -> unit
man

type prefer_blanking =
| DontPreferBlanking
| PreferBlanking
| DefaultBlanking

type allow_exposures =
| DontAllowExposures
| AllowExposures
| DefaultExposures

type screensaver_values = {
   timeout : int;
   interval : int;
   prefer_blanking : prefer_blanking;
   allow_exposures : allow_exposures;
}
val xGetScreenSaver : dpy:display -> screensaver_values
man
val xSetScreenSaver : dpy:display ->
timeout:int ->
interval:int ->
prefer_blanking:prefer_blanking ->
allow_exposures:allow_exposures -> unit
man
val xActivateScreenSaver : dpy:display -> unit
man
val xResetScreenSaver : dpy:display -> unit
man

Error Handler


type xID 

type xErrorEvent_contents = {
   error_display : display;
   error_resourceid : xID;
   error_serial : uint;
   error_error_code : char;
   error_request_code : char;
   error_minor_code : char;
}
val xErrorEvent_datas : xErrorEvent xEvent -> xErrorEvent_contents
val xSetErrorHandler : cb:(dpy:display -> event:xErrorEvent xEvent -> unit) -> unit
man, man

Cursor



type cursor_shape =
| XC_X_cursor
| XC_arrow
| XC_based_arrow_down
| XC_based_arrow_up
| XC_boat
| XC_bogosity
| XC_bottom_left_corner
| XC_bottom_right_corner
| XC_bottom_side
| XC_bottom_tee
| XC_box_spiral
| XC_center_ptr
| XC_circle
| XC_clock
| XC_coffee_mug
| XC_cross
| XC_cross_reverse
| XC_crosshair
| XC_diamond_cross
| XC_dot
| XC_dotbox
| XC_double_arrow
| XC_draft_large
| XC_draft_small
| XC_draped_box
| XC_exchange
| XC_fleur
| XC_gobbler
| XC_gumby
| XC_hand1
| XC_hand2
| XC_heart
| XC_icon
| XC_iron_cross
| XC_left_ptr
| XC_left_side
| XC_left_tee
| XC_leftbutton
| XC_ll_angle
| XC_lr_angle
| XC_man
| XC_middlebutton
| XC_mouse
| XC_pencil
| XC_pirate
| XC_plus
| XC_question_arrow
| XC_right_ptr
| XC_right_side
| XC_right_tee
| XC_rightbutton
| XC_rtl_logo
| XC_sailboat
| XC_sb_down_arrow
| XC_sb_h_double_arrow
| XC_sb_left_arrow
| XC_sb_right_arrow
| XC_sb_up_arrow
| XC_sb_v_double_arrow
| XC_shuttle
| XC_sizing
| XC_spider
| XC_spraycan
| XC_star
| XC_target
| XC_tcross
| XC_top_left_arrow
| XC_top_left_corner
| XC_top_right_corner
| XC_top_side
| XC_top_tee
| XC_trek
| XC_ul_angle
| XC_umbrella
| XC_ur_angle
| XC_watch
| XC_xterm
val xCreateFontCursor : dpy:display -> shape:cursor_shape -> cursor
man
val xDefineCursor : dpy:display -> win:window -> cursor:cursor -> unit
man
val xRecolorCursor : dpy:display ->
cursor:cursor ->
foreground:xColor -> background:xColor -> unit
man

Mouse Control

val xChangePointerControl : dpy:display ->
do_accel:bool ->
do_threshold:bool ->
accel_numerator:int -> accel_denominator:int -> threshold:int -> unit
man
val xGetPointerControl : dpy:display -> int * int * int
returns (accel_numerator, accel_denominator, threshold)

Window Manager


val xReparentWindow : dpy:display ->
win:window -> parent:window -> x:int -> y:int -> unit
man

Controlling the Lifetime of a Window

type change_mode =
| SetModeInsert
| SetModeDelete
val xChangeSaveSet : dpy:display -> win:window -> mode:change_mode -> unit
man
val xAddToSaveSet : dpy:display -> win:window -> unit
man
val xRemoveFromSaveSet : dpy:display -> win:window -> unit
man
val xKillClient : dpy:display -> resource:window -> unit
man

Threads

val xInitThreads : unit -> unit
val xLockDisplay : dpy:display -> unit
val xUnlockDisplay : dpy:display -> unit

ICCCM routines


val xIconifyWindow : dpy:display -> win:window -> scr:screen_number -> unit
man
val xWithdrawWindow : dpy:display -> win:window -> scr:screen_number -> unit
man
val xGetCommand : dpy:display -> win:window -> string array
man