Permalink
Browse files

[project @ 2004-03-14 13:45:36 by ross]

basic docs
  • Loading branch information...
1 parent ee04b23 commit bd633f1026901b472060eb4c5d95c83d72150173 ross committed Mar 14, 2004
View
@@ -27,9 +27,16 @@ module Graphics.X11.Types
Cursor,
Colormap,
GContext,
+ KeyCode,
+
+ -- * Enumeration types
+ -- | These types were introduced to make function types clearer.
+ -- Note that the types are synonyms for 'Int', so no extra
+ -- typesafety was obtained.
+
+ -- ** Key symbols
KeySym,
- KeyCode,
xK_VoidSymbol,
xK_BackSpace,
xK_Tab,
@@ -374,6 +381,7 @@ module Graphics.X11.Types
xK_thorn,
xK_ydiaeresis,
+ -- ** Event masks
EventMask,
noEventMask,
keyPressMask,
@@ -402,6 +410,7 @@ module Graphics.X11.Types
colormapChangeMask,
ownerGrabButtonMask,
+ -- ** Event types
EventType,
keyPress,
keyRelease,
@@ -438,6 +447,7 @@ module Graphics.X11.Types
mappingNotify,
lASTEvent,
+ -- ** Modifiers
Modifier,
shiftMapIndex,
lockMapIndex,
@@ -449,6 +459,7 @@ module Graphics.X11.Types
mod5MapIndex,
anyModifier,
+ -- ** Key masks
KeyMask,
shiftMask,
lockMask,
@@ -459,27 +470,31 @@ module Graphics.X11.Types
mod4Mask,
mod5Mask,
+ -- ** Button masks
ButtonMask,
button1Mask,
button2Mask,
button3Mask,
button4Mask,
button5Mask,
+ -- ** Buttons
Button,
button1,
button2,
button3,
button4,
button5,
+ -- ** Notify modes
NotifyMode,
notifyNormal,
notifyGrab,
notifyUngrab,
notifyWhileGrabbed,
notifyHint,
+ -- ** Notify details
NotifyDetail,
notifyAncestor,
notifyVirtual,
@@ -490,39 +505,47 @@ module Graphics.X11.Types
notifyPointerRoot,
notifyDetailNone,
+ -- ** Visibility
Visibility,
visibilityUnobscured,
visibilityPartiallyObscured,
visibilityFullyObscured,
+ -- ** Place of window
Place,
placeOnTop,
placeOnBottom,
+ -- ** Protocols
Protocol,
familyInternet,
familyDECnet,
familyChaos,
+ -- ** Property notification
PropertyNotification,
propertyNewValue,
propertyDelete,
+ -- ** Colormap notification
ColormapNotification,
colormapUninstalled,
colormapInstalled,
+ -- ** Grab modes
GrabMode,
grabModeSync,
grabModeAsync,
+ -- ** Grab status
GrabStatus,
grabSuccess,
alreadyGrabbed,
grabInvalidTime,
grabNotViewable,
grabFrozen,
+ -- ** Allow events
AllowEvents,
asyncPointer,
syncPointer,
@@ -533,11 +556,13 @@ module Graphics.X11.Types
asyncBoth,
syncBoth,
+ -- ** Focus modes
FocusMode,
revertToNone,
revertToPointerRoot,
revertToParent,
+ -- ** Return status
Status,
success,
badRequest,
@@ -560,14 +585,17 @@ module Graphics.X11.Types
firstExtensionError,
lastExtensionError,
+ -- *** Exceptions
throwUnlessSuccess,
throwIfZero,
+ -- ** WindowClass
WindowClass,
copyFromParent,
inputOutput,
inputOnly,
+ -- ** Attribute masks
AttributeMask,
cWBackPixmap,
cWBackPixel,
@@ -585,16 +613,19 @@ module Graphics.X11.Types
cWColormap,
cWCursor,
+ -- ** Close down modes
CloseDownMode,
destroyAll,
retainPermanent,
retainTemporary,
+ -- ** QueryBestSize classes
QueryBestSizeClass,
cursorShape,
tileShape,
stippleShape,
+ -- ** Graphics functions
GXFunction,
gXclear,
gXand,
@@ -613,49 +644,59 @@ module Graphics.X11.Types
gXnand,
gXset,
+ -- ** Line styles
LineStyle,
lineSolid,
lineOnOffDash,
lineDoubleDash,
+ -- ** Cap styles
CapStyle,
capNotLast,
capButt,
capRound,
capProjecting,
+ -- ** Join styles
JoinStyle,
joinMiter,
joinRound,
joinBevel,
+ -- ** Fill styles
FillStyle,
fillSolid,
fillTiled,
fillStippled,
fillOpaqueStippled,
+ -- ** Fill rules
FillRule,
evenOddRule,
windingRule,
+ -- ** Subwindow modes
SubWindowMode,
clipByChildren,
includeInferiors,
+ -- ** Coordinate modes
CoordinateMode,
coordModeOrigin,
coordModePrevious,
+ -- ** Polygon shapes
PolygonShape,
complex,
nonconvex,
convex,
+ -- ** Arc modes
ArcMode,
arcChord,
arcPieSlice,
+ -- ** GC masks
GCMask,
gCFunction,
gCPlaneMask,
@@ -682,27 +723,33 @@ module Graphics.X11.Types
gCArcMode,
gCLastBit,
+ -- ** Circulation direction
CirculationDirection,
raiseLowest,
lowerHighest,
+ -- ** Byte order
ByteOrder,
lSBFirst,
mSBFirst,
+ -- ** ColormapAlloc
ColormapAlloc,
allocNone,
allocAll,
+ -- ** Mapping requests
MappingRequest,
mappingModifier,
mappingKeyboard,
mappingPointer,
+ -- ** ChangeSaveSetMode
ChangeSaveSetMode,
setModeInsert,
setModeDelete,
+ -- ** Bit gravity
BitGravity,
forgetGravity,
northWestGravity,
@@ -716,9 +763,11 @@ module Graphics.X11.Types
southEastGravity,
staticGravity,
+ -- ** Window gravity
WindowGravity,
unmapGravity,
+ -- ** Backing store
BackingStore,
notUseful,
whenMapped,
@@ -727,6 +776,7 @@ module Graphics.X11.Types
doGreen,
doBlue,
+ -- ** Font direction
FontDirection,
fontLeftToRight,
fontRightToLeft,
@@ -1282,7 +1332,8 @@ type Visibility = Int
, visibilityFullyObscured = VisibilityFullyObscured
}
--- Window's place relative to siblings (used in Circulation requests/events)
+-- | Place of window relative to siblings
+-- (used in Circulation requests or events)
type Place = Int
#{enum Place,
, placeOnTop = PlaceOnTop
View
@@ -10,13 +10,28 @@
--
-- A collection of FFI declarations for interfacing with Xlib.
--
+-- The library aims to provide a direct translation of the X
+-- binding into Haskell so the most important documentation you
+-- should read is /The Xlib Programming Manual/, available online at
+-- <http://tronche.com/gui/x/xlib/>. Let me say that again because
+-- it is very important. Get hold of this documentation and read it:
+-- it tells you almost everything you need to know to use this library.
+--
-----------------------------------------------------------------------------
module Graphics.X11.Xlib
- ( module Graphics.X11.Types,
- free,
+ ( -- * Conventions
+ -- $conventions
+
+ -- * Types
+ module Graphics.X11.Types,
+ -- module Graphics.X11.Xlib.Types,
+ Display, Screen, Visual, FontStruct, GC, XSetWindowAttributes,
+ Pixel, Position, Dimension, Angle,
+ ScreenNumber, Byte, Buffer,
+ Point, Rectangle, Arc, Segment, Color,
- module Graphics.X11.Xlib.Types,
+ -- * X11 library functions
module Graphics.X11.Xlib.Event,
module Graphics.X11.Xlib.Display,
module Graphics.X11.Xlib.Screen,
@@ -43,7 +58,32 @@ import Graphics.X11.Xlib.Atom
import Graphics.X11.Xlib.Region
import Graphics.X11.Xlib.Misc
-import Foreign.Marshal.Alloc( free )
+{- $conventions
+
+In translating the library, we had to change names to conform with
+Haskell's lexical syntax: function names and names of constants must start
+with a lowercase letter; type names must start with an uppercase letter.
+The case of the remaining letters is unchanged.
+
+In addition, we chose to take advantage of Haskell's module system to
+allow us to drop common prefixes (@X@, @XA_@, etc.) attached to X11
+identifiers.
+
+We named enumeration types so that function types would be easier
+to understand. For example, we added 'Status', 'WindowClass', etc.
+Note that the types are synonyms for 'Int' so no extra typesafety was
+obtained.
+
+We consistently raise exceptions when a function returns an error code.
+In practice, this only affects the following functions because most Xlib
+functions do not return error codes: 'allocColor', 'allocNamedColor',
+'fetchBuffer', 'fetchBytes', 'fontFromGC', 'getGeometry', 'getIconName',
+'iconifyWindow', 'loadQueryFont', 'lookupColor', 'openDisplay',
+'parseColor', 'queryBestCursor', 'queryBestSize', 'queryBestStipple',
+'queryBestTile', 'rotateBuffers', 'selectInput', 'storeBuffer',
+'storeBytes', 'withdrawWindow'.
+
+-}
----------------------------------------------------------------
-- End
@@ -99,6 +99,8 @@ import Foreign.C.String
----------------------------------------------------------------
-- AC, 1/9/2000: Added definition for XInternAtom
+
+-- | interface to the X11 library function @XInternAtom()@.
internAtom :: Display -> String -> Bool -> IO Atom
internAtom display atom_name only_if_exists =
withCString atom_name $ \ c_atom_name ->
Oops, something went wrong.

0 comments on commit bd633f1

Please sign in to comment.