diff --git a/Graphics/X11/Types.hsc b/Graphics/X11/Types.hsc
--- a/Graphics/X11/Types.hsc
+++ b/Graphics/X11/Types.hsc
@@ -13,1680 +13,1680 @@
 -----------------------------------------------------------------------------
 
 module Graphics.X11.Types
-	(
-
-	XID,
-	Mask,
-	Atom,
-	VisualID,
-	Time,
-	Window,
-	Drawable,
-	Font,
-	Pixmap,
-	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,
-
-	xK_VoidSymbol,
-	xK_BackSpace,
-	xK_Tab,
-	xK_Linefeed,
-	xK_Clear,
-	xK_Return,
-	xK_Pause,
-	xK_Scroll_Lock,
-	xK_Sys_Req,
-	xK_Escape,
-	xK_Delete,
-	xK_Multi_key,
-	xK_Home,
-	xK_Left,
-	xK_Up,
-	xK_Right,
-	xK_Down,
-	xK_Prior,
-	xK_Page_Up,
-	xK_Next,
-	xK_Page_Down,
-	xK_End,
-	xK_Begin,
-	xK_Select,
-	xK_Print,
-	xK_Execute,
-	xK_Insert,
-	xK_Undo,
-	xK_Redo,
-	xK_Menu,
-	xK_Find,
-	xK_Cancel,
-	xK_Help,
-	xK_Break,
-	xK_Mode_switch,
-	xK_script_switch,
-	xK_Num_Lock,
-	xK_KP_Space,
-	xK_KP_Tab,
-	xK_KP_Enter,
-	xK_KP_F1,
-	xK_KP_F2,
-	xK_KP_F3,
-	xK_KP_F4,
-	xK_KP_Home,
-	xK_KP_Left,
-	xK_KP_Up,
-	xK_KP_Right,
-	xK_KP_Down,
-	xK_KP_Prior,
-	xK_KP_Page_Up,
-	xK_KP_Next,
-	xK_KP_Page_Down,
-	xK_KP_End,
-	xK_KP_Begin,
-	xK_KP_Insert,
-	xK_KP_Delete,
-	xK_KP_Equal,
-	xK_KP_Multiply,
-	xK_KP_Add,
-	xK_KP_Separator,
-	xK_KP_Subtract,
-	xK_KP_Decimal,
-	xK_KP_Divide,
-	xK_KP_0,
-	xK_KP_1,
-	xK_KP_2,
-	xK_KP_3,
-	xK_KP_4,
-	xK_KP_5,
-	xK_KP_6,
-	xK_KP_7,
-	xK_KP_8,
-	xK_KP_9,
-	xK_F1,
-	xK_F2,
-	xK_F3,
-	xK_F4,
-	xK_F5,
-	xK_F6,
-	xK_F7,
-	xK_F8,
-	xK_F9,
-	xK_F10,
-	xK_F11,
-	xK_L1,
-	xK_F12,
-	xK_L2,
-	xK_F13,
-	xK_L3,
-	xK_F14,
-	xK_L4,
-	xK_F15,
-	xK_L5,
-	xK_F16,
-	xK_L6,
-	xK_F17,
-	xK_L7,
-	xK_F18,
-	xK_L8,
-	xK_F19,
-	xK_L9,
-	xK_F20,
-	xK_L10,
-	xK_F21,
-	xK_R1,
-	xK_F22,
-	xK_R2,
-	xK_F23,
-	xK_R3,
-	xK_F24,
-	xK_R4,
-	xK_F25,
-	xK_R5,
-	xK_F26,
-	xK_R6,
-	xK_F27,
-	xK_R7,
-	xK_F28,
-	xK_R8,
-	xK_F29,
-	xK_R9,
-	xK_F30,
-	xK_R10,
-	xK_F31,
-	xK_R11,
-	xK_F32,
-	xK_R12,
-	xK_F33,
-	xK_R13,
-	xK_F34,
-	xK_R14,
-	xK_F35,
-	xK_R15,
-	xK_Shift_L,
-	xK_Shift_R,
-	xK_Control_L,
-	xK_Control_R,
-	xK_Caps_Lock,
-	xK_Shift_Lock,
-	xK_Meta_L,
-	xK_Meta_R,
-	xK_Alt_L,
-	xK_Alt_R,
-	xK_Super_L,
-	xK_Super_R,
-	xK_Hyper_L,
-	xK_Hyper_R,
-	xK_space,
-	xK_exclam,
-	xK_quotedbl,
-	xK_numbersign,
-	xK_dollar,
-	xK_percent,
-	xK_ampersand,
-	xK_apostrophe,
-	xK_quoteright,
-	xK_parenleft,
-	xK_parenright,
-	xK_asterisk,
-	xK_plus,
-	xK_comma,
-	xK_minus,
-	xK_period,
-	xK_slash,
-	xK_0,
-	xK_1,
-	xK_2,
-	xK_3,
-	xK_4,
-	xK_5,
-	xK_6,
-	xK_7,
-	xK_8,
-	xK_9,
-	xK_colon,
-	xK_semicolon,
-	xK_less,
-	xK_equal,
-	xK_greater,
-	xK_question,
-	xK_at,
-	xK_A,
-	xK_B,
-	xK_C,
-	xK_D,
-	xK_E,
-	xK_F,
-	xK_G,
-	xK_H,
-	xK_I,
-	xK_J,
-	xK_K,
-	xK_L,
-	xK_M,
-	xK_N,
-	xK_O,
-	xK_P,
-	xK_Q,
-	xK_R,
-	xK_S,
-	xK_T,
-	xK_U,
-	xK_V,
-	xK_W,
-	xK_X,
-	xK_Y,
-	xK_Z,
-	xK_bracketleft,
-	xK_backslash,
-	xK_bracketright,
-	xK_asciicircum,
-	xK_underscore,
-	xK_grave,
-	xK_quoteleft,
-	xK_a,
-	xK_b,
-	xK_c,
-	xK_d,
-	xK_e,
-	xK_f,
-	xK_g,
-	xK_h,
-	xK_i,
-	xK_j,
-	xK_k,
-	xK_l,
-	xK_m,
-	xK_n,
-	xK_o,
-	xK_p,
-	xK_q,
-	xK_r,
-	xK_s,
-	xK_t,
-	xK_u,
-	xK_v,
-	xK_w,
-	xK_x,
-	xK_y,
-	xK_z,
-	xK_braceleft,
-	xK_bar,
-	xK_braceright,
-	xK_asciitilde,
-	xK_nobreakspace,
-	xK_exclamdown,
-	xK_cent,
-	xK_sterling,
-	xK_currency,
-	xK_yen,
-	xK_brokenbar,
-	xK_section,
-	xK_diaeresis,
-	xK_copyright,
-	xK_ordfeminine,
-	xK_guillemotleft,
-	xK_notsign,
-	xK_hyphen,
-	xK_registered,
-	xK_macron,
-	xK_degree,
-	xK_plusminus,
-	xK_twosuperior,
-	xK_threesuperior,
-	xK_acute,
-	xK_mu,
-	xK_paragraph,
-	xK_periodcentered,
-	xK_cedilla,
-	xK_onesuperior,
-	xK_masculine,
-	xK_guillemotright,
-	xK_onequarter,
-	xK_onehalf,
-	xK_threequarters,
-	xK_questiondown,
-	xK_Agrave,
-	xK_Aacute,
-	xK_Acircumflex,
-	xK_Atilde,
-	xK_Adiaeresis,
-	xK_Aring,
-	xK_AE,
-	xK_Ccedilla,
-	xK_Egrave,
-	xK_Eacute,
-	xK_Ecircumflex,
-	xK_Ediaeresis,
-	xK_Igrave,
-	xK_Iacute,
-	xK_Icircumflex,
-	xK_Idiaeresis,
-	xK_ETH,
-	xK_Eth,
-	xK_Ntilde,
-	xK_Ograve,
-	xK_Oacute,
-	xK_Ocircumflex,
-	xK_Otilde,
-	xK_Odiaeresis,
-	xK_multiply,
-	xK_Ooblique,
-	xK_Ugrave,
-	xK_Uacute,
-	xK_Ucircumflex,
-	xK_Udiaeresis,
-	xK_Yacute,
-	xK_THORN,
-	xK_Thorn,
-	xK_ssharp,
-	xK_agrave,
-	xK_aacute,
-	xK_acircumflex,
-	xK_atilde,
-	xK_adiaeresis,
-	xK_aring,
-	xK_ae,
-	xK_ccedilla,
-	xK_egrave,
-	xK_eacute,
-	xK_ecircumflex,
-	xK_ediaeresis,
-	xK_igrave,
-	xK_iacute,
-	xK_icircumflex,
-	xK_idiaeresis,
-	xK_eth,
-	xK_ntilde,
-	xK_ograve,
-	xK_oacute,
-	xK_ocircumflex,
-	xK_otilde,
-	xK_odiaeresis,
-	xK_division,
-	xK_oslash,
-	xK_ugrave,
-	xK_uacute,
-	xK_ucircumflex,
-	xK_udiaeresis,
-	xK_yacute,
-	xK_thorn,
-	xK_ydiaeresis,
-
-	-- ** Event masks
-	EventMask,
-	noEventMask,
-	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,
-
-	-- ** Event types
-	EventType,
-	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,
-	lASTEvent,
-
-	-- ** Modifiers
-	Modifier,
-	shiftMapIndex,
-	lockMapIndex,
-	controlMapIndex,
-	mod1MapIndex,
-	mod2MapIndex,
-	mod3MapIndex,
-	mod4MapIndex,
-	mod5MapIndex,
-	anyModifier,
-
-	-- ** Key masks
-	KeyMask,
-	shiftMask,
-	lockMask,
-	controlMask,
-	mod1Mask,
-	mod2Mask,
-	mod3Mask,
-	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,
-	notifyInferior,
-	notifyNonlinear,
-	notifyNonlinearVirtual,
-	notifyPointer,
-	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,
-	replayPointer,
-	asyncKeyboard,
-	syncKeyboard,
-	replayKeyboard,
-	asyncBoth,
-	syncBoth,
-
-	-- ** Focus modes
-	FocusMode,
-	revertToNone,
-	revertToPointerRoot,
-	revertToParent,
-
-	-- ** Error codes
-	ErrorCode,
-	success,
-	badRequest,
-	badValue,
-	badWindow,
-	badPixmap,
-	badAtom,
-	badCursor,
-	badFont,
-	badMatch,
-	badDrawable,
-	badAccess,
-	badAlloc,
-	badColor,
-	badGC,
-	badIDChoice,
-	badName,
-	badLength,
-	badImplementation,
-	firstExtensionError,
-	lastExtensionError,
-
-	-- ** Return status
-	Status,
-	throwIfZero,
-
-	-- ** WindowClass
-	WindowClass,
-	copyFromParent,
-	inputOutput,
-	inputOnly,
-
-	-- ** Attribute masks
-	AttributeMask,
-	cWBackPixmap,
-	cWBackPixel,
-	cWBorderPixmap,
-	cWBorderPixel,
-	cWBitGravity,
-	cWWinGravity,
-	cWBackingStore,
-	cWBackingPlanes,
-	cWBackingPixel,
-	cWOverrideRedirect,
-	cWSaveUnder,
-	cWEventMask,
-	cWDontPropagate,
-	cWColormap,
-	cWCursor,
-
-	-- ** Close down modes
-	CloseDownMode,
-	destroyAll,
-	retainPermanent,
-	retainTemporary,
-
-	-- ** QueryBestSize classes
-	QueryBestSizeClass,
-	cursorShape,
-	tileShape,
-	stippleShape,
-
-	-- ** Graphics functions
-	GXFunction,
-	gXclear,
-	gXand,
-	gXandReverse,
-	gXcopy,
-	gXandInverted,
-	gXnoop,
-	gXxor,
-	gXor,
-	gXnor,
-	gXequiv,
-	gXinvert,
-	gXorReverse,
-	gXcopyInverted,
-	gXorInverted,
-	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,
-	gCForeground,
-	gCBackground,
-	gCLineWidth,
-	gCLineStyle,
-	gCCapStyle,
-	gCJoinStyle,
-	gCFillStyle,
-	gCFillRule,
-	gCTile,
-	gCStipple,
-	gCTileStipXOrigin,
-	gCTileStipYOrigin,
-	gCFont,
-	gCSubwindowMode,
-	gCGraphicsExposures,
-	gCClipXOrigin,
-	gCClipYOrigin,
-	gCClipMask,
-	gCDashOffset,
-	gCDashList,
-	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,
-	northGravity,
-	northEastGravity,
-	westGravity,
-	centerGravity,
-	eastGravity,
-	southWestGravity,
-	southGravity,
-	southEastGravity,
-	staticGravity,
-
-	-- ** Window gravity
-	WindowGravity,
-	unmapGravity,
-
-	-- ** Backing store
-	BackingStore,
-	notUseful,
-	whenMapped,
-	always,
-	doRed,
-	doGreen,
-	doBlue,
-
-	-- ** Font direction
-	FontDirection,
-	fontLeftToRight,
-	fontRightToLeft,
-
-	-- ** Image format
-        ImageFormat,
-	xyBitmap,
-	xyPixmap,
-	zPixmap
-	) where
-
--- import Data.Int
-import Data.Word
-import Foreign.Marshal.Error
-import Foreign.C.Types
-
-#include "HsXlib.h"
-
--- ToDo: use newtype
-type XID      = #{type XID}
-type Mask     = #{type Mask}
-type Atom     = #{type Atom}
-type VisualID = #{type VisualID}
-type Time     = #{type Time}
-
--- end platform dependency
-
-type Window   = XID
-type Drawable = XID
-type Font     = XID
-type Pixmap   = XID
-type Cursor   = XID
-type Colormap = XID
-type GContext = XID
-
-type KeyCode  = Char
-
-type KeySym   = XID
-
-#{enum KeySym,
- , xK_VoidSymbol	= XK_VoidSymbol
- }
-
--- TTY Functions, cleverly chosen to map to ascii, for convenience of
--- programming, but could have been arbitrary (at the cost of lookup
--- tables in client code.
-
-#{enum KeySym,
- , xK_BackSpace		= XK_BackSpace
- , xK_Tab		= XK_Tab
- , xK_Linefeed		= XK_Linefeed
- , xK_Clear		= XK_Clear
- , xK_Return		= XK_Return
- , xK_Pause		= XK_Pause
- , xK_Scroll_Lock	= XK_Scroll_Lock
- , xK_Sys_Req		= XK_Sys_Req
- , xK_Escape		= XK_Escape
- , xK_Delete		= XK_Delete
- }
-
--- International & multi-key character composition
-#{enum KeySym,
- , xK_Multi_key		= XK_Multi_key
- }
--- xK_Codeinput		= XK_Codeinput		-- Not defined for SunOS.
--- xK_SingleCandidate	= XK_SingleCandidate	-- Not defined for SunOS.
--- xK_MultipleCandidate	= XK_MultipleCandidate	-- Not defined for SunOS.
--- xK_PreviousCandidate	= XK_PreviousCandidate	-- Not defined for SunOS.
-
--- Cursor control & motion
-#{enum KeySym,
- , xK_Home		= XK_Home
- , xK_Left		= XK_Left
- , xK_Up		= XK_Up
- , xK_Right		= XK_Right
- , xK_Down		= XK_Down
- , xK_Prior		= XK_Prior
- , xK_Page_Up		= XK_Page_Up
- , xK_Next		= XK_Next
- , xK_Page_Down		= XK_Page_Down
- , xK_End		= XK_End
- , xK_Begin		= XK_Begin
-
- , xK_Select		= XK_Select
- , xK_Print		= XK_Print
- , xK_Execute		= XK_Execute
- , xK_Insert		= XK_Insert
- , xK_Undo		= XK_Undo
- , xK_Redo		= XK_Redo
- , xK_Menu		= XK_Menu
- , xK_Find		= XK_Find
- , xK_Cancel		= XK_Cancel
- , xK_Help		= XK_Help
- , xK_Break		= XK_Break
- , xK_Mode_switch	= XK_Mode_switch
- , xK_script_switch	= XK_script_switch
- , xK_Num_Lock		= XK_Num_Lock
- }
-
--- Keypad Functions, keypad numbers cleverly chosen to map to ascii
-#{enum KeySym,
- , xK_KP_Space		= XK_KP_Space
- , xK_KP_Tab		= XK_KP_Tab
- , xK_KP_Enter		= XK_KP_Enter
- , xK_KP_F1		= XK_KP_F1
- , xK_KP_F2		= XK_KP_F2
- , xK_KP_F3		= XK_KP_F3
- , xK_KP_F4		= XK_KP_F4
- , xK_KP_Home		= XK_KP_Home
- , xK_KP_Left		= XK_KP_Left
- , xK_KP_Up		= XK_KP_Up
- , xK_KP_Right		= XK_KP_Right
- , xK_KP_Down		= XK_KP_Down
- , xK_KP_Prior		= XK_KP_Prior
- , xK_KP_Page_Up	= XK_KP_Page_Up
- , xK_KP_Next		= XK_KP_Next
- , xK_KP_Page_Down	= XK_KP_Page_Down
- , xK_KP_End		= XK_KP_End
- , xK_KP_Begin		= XK_KP_Begin
- , xK_KP_Insert		= XK_KP_Insert
- , xK_KP_Delete		= XK_KP_Delete
- , xK_KP_Equal		= XK_KP_Equal
- , xK_KP_Multiply	= XK_KP_Multiply
- , xK_KP_Add		= XK_KP_Add
- , xK_KP_Separator	= XK_KP_Separator
- , xK_KP_Subtract	= XK_KP_Subtract
- , xK_KP_Decimal	= XK_KP_Decimal
- , xK_KP_Divide		= XK_KP_Divide
-
- , xK_KP_0		= XK_KP_0
- , xK_KP_1		= XK_KP_1
- , xK_KP_2		= XK_KP_2
- , xK_KP_3		= XK_KP_3
- , xK_KP_4		= XK_KP_4
- , xK_KP_5		= XK_KP_5
- , xK_KP_6		= XK_KP_6
- , xK_KP_7		= XK_KP_7
- , xK_KP_8		= XK_KP_8
- , xK_KP_9		= XK_KP_9
-
- , xK_F1		= XK_F1
- , xK_F2		= XK_F2
- , xK_F3		= XK_F3
- , xK_F4		= XK_F4
- , xK_F5		= XK_F5
- , xK_F6		= XK_F6
- , xK_F7		= XK_F7
- , xK_F8		= XK_F8
- , xK_F9		= XK_F9
- , xK_F10		= XK_F10
- , xK_F11		= XK_F11
- , xK_L1		= XK_L1
- , xK_F12		= XK_F12
- , xK_L2		= XK_L2
- , xK_F13		= XK_F13
- , xK_L3		= XK_L3
- , xK_F14		= XK_F14
- , xK_L4		= XK_L4
- , xK_F15		= XK_F15
- , xK_L5		= XK_L5
- , xK_F16		= XK_F16
- , xK_L6		= XK_L6
- , xK_F17		= XK_F17
- , xK_L7		= XK_L7
- , xK_F18		= XK_F18
- , xK_L8		= XK_L8
- , xK_F19		= XK_F19
- , xK_L9		= XK_L9
- , xK_F20		= XK_F20
- , xK_L10		= XK_L10
- , xK_F21		= XK_F21
- , xK_R1		= XK_R1
- , xK_F22		= XK_F22
- , xK_R2		= XK_R2
- , xK_F23		= XK_F23
- , xK_R3		= XK_R3
- , xK_F24		= XK_F24
- , xK_R4		= XK_R4
- , xK_F25		= XK_F25
- , xK_R5		= XK_R5
- , xK_F26		= XK_F26
- , xK_R6		= XK_R6
- , xK_F27		= XK_F27
- , xK_R7		= XK_R7
- , xK_F28		= XK_F28
- , xK_R8		= XK_R8
- , xK_F29		= XK_F29
- , xK_R9		= XK_R9
- , xK_F30		= XK_F30
- , xK_R10		= XK_R10
- , xK_F31		= XK_F31
- , xK_R11		= XK_R11
- , xK_F32		= XK_F32
- , xK_R12		= XK_R12
- , xK_F33		= XK_F33
- , xK_R13		= XK_R13
- , xK_F34		= XK_F34
- , xK_R14		= XK_R14
- , xK_F35		= XK_F35
- , xK_R15		= XK_R15
- }
-
-#{enum KeySym,
- , xK_Shift_L		= XK_Shift_L
- , xK_Shift_R		= XK_Shift_R
- , xK_Control_L		= XK_Control_L
- , xK_Control_R		= XK_Control_R
- , xK_Caps_Lock		= XK_Caps_Lock
- , xK_Shift_Lock	= XK_Shift_Lock
-
- , xK_Meta_L		= XK_Meta_L
- , xK_Meta_R		= XK_Meta_R
- , xK_Alt_L		= XK_Alt_L
- , xK_Alt_R		= XK_Alt_R
- , xK_Super_L		= XK_Super_L
- , xK_Super_R		= XK_Super_R
- , xK_Hyper_L		= XK_Hyper_L
- , xK_Hyper_R		= XK_Hyper_R
- }
-
-#{enum KeySym,
- , xK_space		= XK_space
- , xK_exclam		= XK_exclam
- , xK_quotedbl		= XK_quotedbl
- , xK_numbersign	= XK_numbersign
- , xK_dollar		= XK_dollar
- , xK_percent		= XK_percent
- , xK_ampersand		= XK_ampersand
- , xK_apostrophe	= XK_apostrophe
- , xK_quoteright	= XK_quoteright
- , xK_parenleft		= XK_parenleft
- , xK_parenright	= XK_parenright
- , xK_asterisk		= XK_asterisk
- , xK_plus		= XK_plus
- , xK_comma		= XK_comma
- , xK_minus		= XK_minus
- , xK_period		= XK_period
- , xK_slash		= XK_slash
- , xK_0			= XK_0
- , xK_1			= XK_1
- , xK_2			= XK_2
- , xK_3			= XK_3
- , xK_4			= XK_4
- , xK_5			= XK_5
- , xK_6			= XK_6
- , xK_7			= XK_7
- , xK_8			= XK_8
- , xK_9			= XK_9
- , xK_colon		= XK_colon
- , xK_semicolon		= XK_semicolon
- , xK_less		= XK_less
- , xK_equal		= XK_equal
- , xK_greater		= XK_greater
- , xK_question		= XK_question
- , xK_at		= XK_at
- , xK_A			= XK_A
- , xK_B			= XK_B
- , xK_C			= XK_C
- , xK_D			= XK_D
- , xK_E			= XK_E
- , xK_F			= XK_F
- , xK_G			= XK_G
- , xK_H			= XK_H
- , xK_I			= XK_I
- , xK_J			= XK_J
- , xK_K			= XK_K
- , xK_L			= XK_L
- , xK_M			= XK_M
- , xK_N			= XK_N
- , xK_O			= XK_O
- , xK_P			= XK_P
- , xK_Q			= XK_Q
- , xK_R			= XK_R
- , xK_S			= XK_S
- , xK_T			= XK_T
- , xK_U			= XK_U
- , xK_V			= XK_V
- , xK_W			= XK_W
- , xK_X			= XK_X
- , xK_Y			= XK_Y
- , xK_Z			= XK_Z
- , xK_bracketleft	= XK_bracketleft
- , xK_backslash		= XK_backslash
- , xK_bracketright	= XK_bracketright
- , xK_asciicircum	= XK_asciicircum
- , xK_underscore	= XK_underscore
- , xK_grave		= XK_grave
- , xK_quoteleft		= XK_quoteleft
- , xK_a			= XK_a
- , xK_b			= XK_b
- , xK_c			= XK_c
- , xK_d			= XK_d
- , xK_e			= XK_e
- , xK_f			= XK_f
- , xK_g			= XK_g
- , xK_h			= XK_h
- , xK_i			= XK_i
- , xK_j			= XK_j
- , xK_k			= XK_k
- , xK_l			= XK_l
- , xK_m			= XK_m
- , xK_n			= XK_n
- , xK_o			= XK_o
- , xK_p			= XK_p
- , xK_q			= XK_q
- , xK_r			= XK_r
- , xK_s			= XK_s
- , xK_t			= XK_t
- , xK_u			= XK_u
- , xK_v			= XK_v
- , xK_w			= XK_w
- , xK_x			= XK_x
- , xK_y			= XK_y
- , xK_z			= XK_z
- , xK_braceleft		= XK_braceleft
- , xK_bar		= XK_bar
- , xK_braceright	= XK_braceright
- , xK_asciitilde	= XK_asciitilde
- }
-
-#{enum KeySym,
- , xK_nobreakspace	= XK_nobreakspace
- , xK_exclamdown	= XK_exclamdown
- , xK_cent		= XK_cent
- , xK_sterling		= XK_sterling
- , xK_currency		= XK_currency
- , xK_yen		= XK_yen
- , xK_brokenbar		= XK_brokenbar
- , xK_section		= XK_section
- , xK_diaeresis		= XK_diaeresis
- , xK_copyright		= XK_copyright
- , xK_ordfeminine	= XK_ordfeminine
- , xK_guillemotleft	= XK_guillemotleft
- , xK_notsign		= XK_notsign
- , xK_hyphen		= XK_hyphen
- , xK_registered	= XK_registered
- , xK_macron		= XK_macron
- , xK_degree		= XK_degree
- , xK_plusminus		= XK_plusminus
- , xK_twosuperior	= XK_twosuperior
- , xK_threesuperior	= XK_threesuperior
- , xK_acute		= XK_acute
- , xK_mu		= XK_mu
- , xK_paragraph		= XK_paragraph
- , xK_periodcentered	= XK_periodcentered
- , xK_cedilla		= XK_cedilla
- , xK_onesuperior	= XK_onesuperior
- , xK_masculine		= XK_masculine
- , xK_guillemotright	= XK_guillemotright
- , xK_onequarter	= XK_onequarter
- , xK_onehalf		= XK_onehalf
- , xK_threequarters	= XK_threequarters
- , xK_questiondown	= XK_questiondown
- , xK_Agrave		= XK_Agrave
- , xK_Aacute		= XK_Aacute
- , xK_Acircumflex	= XK_Acircumflex
- , xK_Atilde		= XK_Atilde
- , xK_Adiaeresis	= XK_Adiaeresis
- , xK_Aring		= XK_Aring
- , xK_AE		= XK_AE
- , xK_Ccedilla		= XK_Ccedilla
- , xK_Egrave		= XK_Egrave
- , xK_Eacute		= XK_Eacute
- , xK_Ecircumflex	= XK_Ecircumflex
- , xK_Ediaeresis	= XK_Ediaeresis
- , xK_Igrave		= XK_Igrave
- , xK_Iacute		= XK_Iacute
- , xK_Icircumflex	= XK_Icircumflex
- , xK_Idiaeresis	= XK_Idiaeresis
- , xK_ETH		= XK_ETH
- , xK_Eth		= XK_Eth
- , xK_Ntilde		= XK_Ntilde
- , xK_Ograve		= XK_Ograve
- , xK_Oacute		= XK_Oacute
- , xK_Ocircumflex	= XK_Ocircumflex
- , xK_Otilde		= XK_Otilde
- , xK_Odiaeresis	= XK_Odiaeresis
- , xK_multiply		= XK_multiply
- , xK_Ooblique		= XK_Ooblique
- , xK_Ugrave		= XK_Ugrave
- , xK_Uacute		= XK_Uacute
- , xK_Ucircumflex	= XK_Ucircumflex
- , xK_Udiaeresis	= XK_Udiaeresis
- , xK_Yacute		= XK_Yacute
- , xK_THORN		= XK_THORN
- , xK_Thorn		= XK_Thorn
- , xK_ssharp		= XK_ssharp
- , xK_agrave		= XK_agrave
- , xK_aacute		= XK_aacute
- , xK_acircumflex	= XK_acircumflex
- , xK_atilde		= XK_atilde
- , xK_adiaeresis	= XK_adiaeresis
- , xK_aring		= XK_aring
- , xK_ae		= XK_ae
- , xK_ccedilla		= XK_ccedilla
- , xK_egrave		= XK_egrave
- , xK_eacute		= XK_eacute
- , xK_ecircumflex	= XK_ecircumflex
- , xK_ediaeresis	= XK_ediaeresis
- , xK_igrave		= XK_igrave
- , xK_iacute		= XK_iacute
- , xK_icircumflex	= XK_icircumflex
- , xK_idiaeresis	= XK_idiaeresis
- , xK_eth		= XK_eth
- , xK_ntilde		= XK_ntilde
- , xK_ograve		= XK_ograve
- , xK_oacute		= XK_oacute
- , xK_ocircumflex	= XK_ocircumflex
- , xK_otilde		= XK_otilde
- , xK_odiaeresis	= XK_odiaeresis
- , xK_division		= XK_division
- , xK_oslash		= XK_oslash
- , xK_ugrave		= XK_ugrave
- , xK_uacute		= XK_uacute
- , xK_ucircumflex	= XK_ucircumflex
- , xK_udiaeresis	= XK_udiaeresis
- , xK_yacute		= XK_yacute
- , xK_thorn		= XK_thorn
- , xK_ydiaeresis	= XK_ydiaeresis
- }
-
-type EventMask			= Mask
-#{enum EventMask,
- , noEventMask			= NoEventMask
- , keyPressMask			= KeyPressMask
- , keyReleaseMask		= KeyReleaseMask
- , buttonPressMask		= ButtonPressMask
- , buttonReleaseMask		= ButtonReleaseMask
- , enterWindowMask		= EnterWindowMask
- , leaveWindowMask		= LeaveWindowMask
- , pointerMotionMask		= PointerMotionMask
- , pointerMotionHintMask	= PointerMotionHintMask
- , button1MotionMask		= Button1MotionMask
- , button2MotionMask		= Button2MotionMask
- , button3MotionMask		= Button3MotionMask
- , button4MotionMask		= Button4MotionMask
- , button5MotionMask		= Button5MotionMask
- , buttonMotionMask		= ButtonMotionMask
- , keymapStateMask		= KeymapStateMask
- , exposureMask			= ExposureMask
- , visibilityChangeMask		= VisibilityChangeMask
- , structureNotifyMask		= StructureNotifyMask
- , resizeRedirectMask		= ResizeRedirectMask
- , substructureNotifyMask	= SubstructureNotifyMask
- , substructureRedirectMask	= SubstructureRedirectMask
- , focusChangeMask		= FocusChangeMask
- , propertyChangeMask		= PropertyChangeMask
- , colormapChangeMask		= ColormapChangeMask
- , ownerGrabButtonMask		= OwnerGrabButtonMask
- }
-
-type EventType		= Word32
-#{enum EventType,
- , keyPress		= KeyPress
- , keyRelease		= KeyRelease
- , buttonPress		= ButtonPress
- , buttonRelease	= ButtonRelease
- , motionNotify		= MotionNotify
- , enterNotify		= EnterNotify
- , leaveNotify		= LeaveNotify
- , focusIn		= FocusIn
- , focusOut		= FocusOut
- , keymapNotify		= KeymapNotify
- , expose		= Expose
- , graphicsExpose	= GraphicsExpose
- , noExpose		= NoExpose
- , visibilityNotify	= VisibilityNotify
- , createNotify		= CreateNotify
- , destroyNotify	= DestroyNotify
- , unmapNotify		= UnmapNotify
- , mapNotify		= MapNotify
- , mapRequest		= MapRequest
- , reparentNotify	= ReparentNotify
- , configureNotify	= ConfigureNotify
- , configureRequest	= ConfigureRequest
- , gravityNotify	= GravityNotify
- , resizeRequest	= ResizeRequest
- , circulateNotify	= CirculateNotify
- , circulateRequest	= CirculateRequest
- , propertyNotify	= PropertyNotify
- , selectionClear	= SelectionClear
- , selectionRequest	= SelectionRequest
- , selectionNotify	= SelectionNotify
- , colormapNotify	= ColormapNotify
- , clientMessage	= ClientMessage
- , mappingNotify	= MappingNotify
- , lASTEvent		= LASTEvent
- }
-
-type Modifier		= CUInt
-#{enum Modifier,
- , shiftMapIndex	= ShiftMapIndex
- , lockMapIndex		= LockMapIndex
- , controlMapIndex	= ControlMapIndex
- , mod1MapIndex		= Mod1MapIndex
- , mod2MapIndex		= Mod2MapIndex
- , mod3MapIndex		= Mod3MapIndex
- , mod4MapIndex		= Mod4MapIndex
- , mod5MapIndex		= Mod5MapIndex
- , anyModifier		= AnyModifier
- }
-
-type KeyMask		= Modifier
-#{enum KeyMask,
- , shiftMask		= ShiftMask
- , lockMask		= LockMask
- , controlMask		= ControlMask
- , mod1Mask		= Mod1Mask
- , mod2Mask		= Mod2Mask
- , mod3Mask		= Mod3Mask
- , mod4Mask		= Mod4Mask
- , mod5Mask		= Mod5Mask
- }
-
-type ButtonMask		= Modifier
-#{enum ButtonMask,
- , button1Mask		= Button1Mask
- , button2Mask		= Button2Mask
- , button3Mask		= Button3Mask
- , button4Mask		= Button4Mask
- , button5Mask		= Button5Mask
- }
-
-type Button		= Word32
-#{enum Button,
- , button1		= Button1
- , button2		= Button2
- , button3		= Button3
- , button4		= Button4
- , button5		= Button5
- }
-
-type NotifyMode		= CInt
--- NotifyNormal and NotifyHint are used as detail in XMotionEvents
-#{enum NotifyMode,
- , notifyNormal		= NotifyNormal
- , notifyGrab		= NotifyGrab
- , notifyUngrab		= NotifyUngrab
- , notifyWhileGrabbed	= NotifyWhileGrabbed
- , notifyHint		= NotifyHint
- }
-
-type NotifyDetail	= CInt
-#{enum NotifyDetail,
- , notifyAncestor	= NotifyAncestor
- , notifyVirtual	= NotifyVirtual
- , notifyInferior	= NotifyInferior
- , notifyNonlinear	= NotifyNonlinear
- , notifyNonlinearVirtual = NotifyNonlinearVirtual
- , notifyPointer	= NotifyPointer
- , notifyPointerRoot	= NotifyPointerRoot
- , notifyDetailNone	= NotifyDetailNone
- }
-
-type Visibility = CInt
-#{enum Visibility,
- , visibilityUnobscured		= VisibilityUnobscured
- , visibilityPartiallyObscured	= VisibilityPartiallyObscured
- , visibilityFullyObscured	= VisibilityFullyObscured
- }
-
--- | Place of window relative to siblings
--- (used in Circulation requests or events)
-type Place = CInt
-#{enum Place,
- , placeOnTop		= PlaceOnTop
- , placeOnBottom	= PlaceOnBottom
- }
-
-type Protocol		= CInt
-#{enum Protocol,
- , familyInternet	= FamilyInternet
- , familyDECnet		= FamilyDECnet
- , familyChaos		= FamilyChaos
- }
-
-type PropertyNotification = CInt
-#{enum PropertyNotification,
- , propertyNewValue	= PropertyNewValue
- , propertyDelete	= PropertyDelete
- }
-
-type ColormapNotification = CInt
-#{enum ColormapNotification,
- , colormapUninstalled	= ColormapUninstalled
- , colormapInstalled	= ColormapInstalled
- }
-
--- Grab{Pointer,Button,Keyboard,Key} Modes
-type GrabMode		= CInt
-#{enum GrabMode,
- , grabModeSync		= GrabModeSync
- , grabModeAsync	= GrabModeAsync
- }
-
--- Grab{Pointer,Keyboard} reply status
-
-type GrabStatus		= CInt
-#{enum GrabStatus,
- , grabSuccess		= GrabSuccess
- , alreadyGrabbed	= AlreadyGrabbed
- , grabInvalidTime	= GrabInvalidTime
- , grabNotViewable	= GrabNotViewable
- , grabFrozen		= GrabFrozen
- }
-
--- AllowEvents modes
-type AllowEvents	= CInt
-#{enum AllowEvents,
- , asyncPointer		= AsyncPointer
- , syncPointer		= SyncPointer
- , replayPointer	= ReplayPointer
- , asyncKeyboard	= AsyncKeyboard
- , syncKeyboard		= SyncKeyboard
- , replayKeyboard	= ReplayKeyboard
- , asyncBoth		= AsyncBoth
- , syncBoth		= SyncBoth
- }
-
--- {Set,Get}InputFocus Modes
-type FocusMode		= CInt
-#{enum FocusMode,
- , revertToNone		= RevertToNone
- , revertToPointerRoot	= RevertToPointerRoot
- , revertToParent	= RevertToParent
- }
-
--- Error codes
-type ErrorCode		= CInt
-#{enum ErrorCode,
- , success		= Success
- , badRequest		= BadRequest
- , badValue		= BadValue
- , badWindow		= BadWindow
- , badPixmap		= BadPixmap
- , badAtom		= BadAtom
- , badCursor		= BadCursor
- , badFont		= BadFont
- , badMatch		= BadMatch
- , badDrawable		= BadDrawable
- , badAccess		= BadAccess
- , badAlloc		= BadAlloc
- , badColor		= BadColor
- , badGC		= BadGC
- , badIDChoice		= BadIDChoice
- , badName		= BadName
- , badLength		= BadLength
- , badImplementation	= BadImplementation
- , firstExtensionError	= FirstExtensionError
- , lastExtensionError	= LastExtensionError
- }
-
-type Status		= CInt
-
--- |Xlib functions with return values of type @Status@ return zero on
--- failure and nonzero on success.
-throwIfZero :: String -> IO Status -> IO ()
-throwIfZero fn_name = throwIf_ (== 0) (const ("Error in function " ++ fn_name))
-
-type WindowClass	= CInt
-#{enum WindowClass,
- , copyFromParent	= CopyFromParent
- , inputOutput		= InputOutput
- , inputOnly		= InputOnly
- }
-
--- Window attributes mask
-type AttributeMask	= Mask
-#{enum AttributeMask,
- , cWBackPixmap		= CWBackPixmap
- , cWBackPixel		= CWBackPixel
- , cWBorderPixmap	= CWBorderPixmap
- , cWBorderPixel	= CWBorderPixel
- , cWBitGravity		= CWBitGravity
- , cWWinGravity		= CWWinGravity
- , cWBackingStore	= CWBackingStore
- , cWBackingPlanes	= CWBackingPlanes
- , cWBackingPixel	= CWBackingPixel
- , cWOverrideRedirect	= CWOverrideRedirect
- , cWSaveUnder		= CWSaveUnder
- , cWEventMask		= CWEventMask
- , cWDontPropagate	= CWDontPropagate
- , cWColormap		= CWColormap
- , cWCursor		= CWCursor
- }
-
--- Used in ChangeCloseDownMode
-type CloseDownMode	= CInt
-#{enum CloseDownMode,
- , destroyAll		= DestroyAll
- , retainPermanent	= RetainPermanent
- , retainTemporary	= RetainTemporary
- }
-
-----------------------------------------------------------------
--- CURSOR STUFF
-----------------------------------------------------------------
-
-type QueryBestSizeClass = CInt
-#{enum QueryBestSizeClass,
- , cursorShape		= CursorShape
- , tileShape		= TileShape
- , stippleShape		= StippleShape
- }
-
-----------------------------------------------------------------
--- GRAPHICS DEFINITIONS
-----------------------------------------------------------------
-
--- graphics functions, as in GC.alu
-
-type   GXFunction	= CInt
-#{enum GXFunction,
- , gXclear		= GXclear
- , gXand		= GXand
- , gXandReverse		= GXandReverse
- , gXcopy		= GXcopy
- , gXandInverted	= GXandInverted
- , gXnoop		= GXnoop
- , gXxor		= GXxor
- , gXor			= GXor
- , gXnor		= GXnor
- , gXequiv		= GXequiv
- , gXinvert		= GXinvert
- , gXorReverse		= GXorReverse
- , gXcopyInverted	= GXcopyInverted
- , gXorInverted		= GXorInverted
- , gXnand		= GXnand
- , gXset		= GXset
- }
-
-type   LineStyle	= CInt
-#{enum LineStyle,
- , lineSolid		= LineSolid
- , lineOnOffDash	= LineOnOffDash
- , lineDoubleDash	= LineDoubleDash
- }
-
-type   CapStyle		= CInt
-#{enum CapStyle,
- , capNotLast		= CapNotLast
- , capButt		= CapButt
- , capRound		= CapRound
- , capProjecting	= CapProjecting
- }
-
-type   JoinStyle	= CInt
-#{enum JoinStyle,
- , joinMiter		= JoinMiter
- , joinRound		= JoinRound
- , joinBevel		= JoinBevel
- }
-
-type   FillStyle	= CInt
-#{enum FillStyle,
- , fillSolid		= FillSolid
- , fillTiled		= FillTiled
- , fillStippled		= FillStippled
- , fillOpaqueStippled	= FillOpaqueStippled
- }
-
-type   FillRule		= CInt
-#{enum FillRule,
- , evenOddRule		= EvenOddRule
- , windingRule		= WindingRule
- }
-
-type   SubWindowMode	= CInt
-#{enum SubWindowMode,
- , clipByChildren	= ClipByChildren
- , includeInferiors	= IncludeInferiors
- }
-
--- -- SetClipRectangles ordering
--- type   Ordering        = CInt
--- {enum Ordering,
--- , unsorted		= Unsorted
--- , ySorted		= YSorted
--- , yXSorted		= YXSorted
--- , yXBanded		= YXBanded
--- }
-
--- CoordinateMode for drawing routines
-type   CoordinateMode	= CInt
-#{enum CoordinateMode,
- , coordModeOrigin	= CoordModeOrigin
- , coordModePrevious	= CoordModePrevious
- }
-
-type   PolygonShape	= CInt
-#{enum PolygonShape,
- , complex		= Complex
- , nonconvex		= Nonconvex
- , convex		= Convex
- }
-
--- Arc modes for PolyFillArc
-type   ArcMode		= CInt
-#{enum ArcMode,
- , arcChord		= ArcChord
- , arcPieSlice		= ArcPieSlice
- }
-
--- GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into
--- GC.stateChanges
-
-type   GCMask		= CInt
-#{enum GCMask,
- , gCFunction		= GCFunction
- , gCPlaneMask		= GCPlaneMask
- , gCForeground		= GCForeground
- , gCBackground		= GCBackground
- , gCLineWidth		= GCLineWidth
- , gCLineStyle		= GCLineStyle
- , gCCapStyle		= GCCapStyle
- , gCJoinStyle		= GCJoinStyle
- , gCFillStyle		= GCFillStyle
- , gCFillRule		= GCFillRule
- , gCTile		= GCTile
- , gCStipple		= GCStipple
- , gCTileStipXOrigin	= GCTileStipXOrigin
- , gCTileStipYOrigin	= GCTileStipYOrigin
- , gCFont		= GCFont
- , gCSubwindowMode	= GCSubwindowMode
- , gCGraphicsExposures	= GCGraphicsExposures
- , gCClipXOrigin	= GCClipXOrigin
- , gCClipYOrigin	= GCClipYOrigin
- , gCClipMask		= GCClipMask
- , gCDashOffset		= GCDashOffset
- , gCDashList		= GCDashList
- , gCArcMode		= GCArcMode
- , gCLastBit		= GCLastBit
- }
-
-type   CirculationDirection = CInt
-#{enum CirculationDirection,
- , raiseLowest		= RaiseLowest
- , lowerHighest		= LowerHighest
- }
-
--- used in imageByteOrder and bitmapBitOrder
-type   ByteOrder	= CInt
-#{enum ByteOrder,
- , lSBFirst		= LSBFirst
- , mSBFirst		= MSBFirst
- }
-
-type   ColormapAlloc	= CInt
-#{enum ColormapAlloc,
- , allocNone		= AllocNone
- , allocAll		= AllocAll
- }
-
-type   MappingRequest   = CInt
-#{enum MappingRequest,
- , mappingModifier	= MappingModifier
- , mappingKeyboard	= MappingKeyboard
- , mappingPointer	= MappingPointer
- }
-
-type   ChangeSaveSetMode = CInt
-#{enum ChangeSaveSetMode,
- , setModeInsert	= SetModeInsert
- , setModeDelete	= SetModeDelete
- }
-
-type   BitGravity	= CInt
-#{enum BitGravity,
- , forgetGravity	= ForgetGravity
- , northWestGravity	= NorthWestGravity
- , northGravity		= NorthGravity
- , northEastGravity	= NorthEastGravity
- , westGravity		= WestGravity
- , centerGravity	= CenterGravity
- , eastGravity		= EastGravity
- , southWestGravity	= SouthWestGravity
- , southGravity		= SouthGravity
- , southEastGravity	= SouthEastGravity
- , staticGravity	= StaticGravity
- }
-
--- All the BitGravity's plus ...
-type   WindowGravity   = CInt
-#{enum WindowGravity,
- , unmapGravity		= UnmapGravity
- }
-
--- Used in CreateWindow for backing-store hint
-type   BackingStore	= CInt
-#{enum BackingStore,
- , notUseful		= NotUseful
- , whenMapped		= WhenMapped
- , always		= Always
- }
-
-#{enum Word8,
- , doRed		= DoRed
- , doGreen		= DoGreen
- , doBlue		= DoBlue
- }
-
-type   FontDirection    = CInt
-#{enum FontDirection,
- , fontLeftToRight	= FontLeftToRight
- , fontRightToLeft	= FontRightToLeft
- }
-
-type   ImageFormat    = CInt
-#{enum ImageFormat,
- , xyBitmap	= XYBitmap
- , xyPixmap	= XYPixmap
- , zPixmap	= ZPixmap
+        (
+
+        XID,
+        Mask,
+        Atom,
+        VisualID,
+        Time,
+        Window,
+        Drawable,
+        Font,
+        Pixmap,
+        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,
+
+        xK_VoidSymbol,
+        xK_BackSpace,
+        xK_Tab,
+        xK_Linefeed,
+        xK_Clear,
+        xK_Return,
+        xK_Pause,
+        xK_Scroll_Lock,
+        xK_Sys_Req,
+        xK_Escape,
+        xK_Delete,
+        xK_Multi_key,
+        xK_Home,
+        xK_Left,
+        xK_Up,
+        xK_Right,
+        xK_Down,
+        xK_Prior,
+        xK_Page_Up,
+        xK_Next,
+        xK_Page_Down,
+        xK_End,
+        xK_Begin,
+        xK_Select,
+        xK_Print,
+        xK_Execute,
+        xK_Insert,
+        xK_Undo,
+        xK_Redo,
+        xK_Menu,
+        xK_Find,
+        xK_Cancel,
+        xK_Help,
+        xK_Break,
+        xK_Mode_switch,
+        xK_script_switch,
+        xK_Num_Lock,
+        xK_KP_Space,
+        xK_KP_Tab,
+        xK_KP_Enter,
+        xK_KP_F1,
+        xK_KP_F2,
+        xK_KP_F3,
+        xK_KP_F4,
+        xK_KP_Home,
+        xK_KP_Left,
+        xK_KP_Up,
+        xK_KP_Right,
+        xK_KP_Down,
+        xK_KP_Prior,
+        xK_KP_Page_Up,
+        xK_KP_Next,
+        xK_KP_Page_Down,
+        xK_KP_End,
+        xK_KP_Begin,
+        xK_KP_Insert,
+        xK_KP_Delete,
+        xK_KP_Equal,
+        xK_KP_Multiply,
+        xK_KP_Add,
+        xK_KP_Separator,
+        xK_KP_Subtract,
+        xK_KP_Decimal,
+        xK_KP_Divide,
+        xK_KP_0,
+        xK_KP_1,
+        xK_KP_2,
+        xK_KP_3,
+        xK_KP_4,
+        xK_KP_5,
+        xK_KP_6,
+        xK_KP_7,
+        xK_KP_8,
+        xK_KP_9,
+        xK_F1,
+        xK_F2,
+        xK_F3,
+        xK_F4,
+        xK_F5,
+        xK_F6,
+        xK_F7,
+        xK_F8,
+        xK_F9,
+        xK_F10,
+        xK_F11,
+        xK_L1,
+        xK_F12,
+        xK_L2,
+        xK_F13,
+        xK_L3,
+        xK_F14,
+        xK_L4,
+        xK_F15,
+        xK_L5,
+        xK_F16,
+        xK_L6,
+        xK_F17,
+        xK_L7,
+        xK_F18,
+        xK_L8,
+        xK_F19,
+        xK_L9,
+        xK_F20,
+        xK_L10,
+        xK_F21,
+        xK_R1,
+        xK_F22,
+        xK_R2,
+        xK_F23,
+        xK_R3,
+        xK_F24,
+        xK_R4,
+        xK_F25,
+        xK_R5,
+        xK_F26,
+        xK_R6,
+        xK_F27,
+        xK_R7,
+        xK_F28,
+        xK_R8,
+        xK_F29,
+        xK_R9,
+        xK_F30,
+        xK_R10,
+        xK_F31,
+        xK_R11,
+        xK_F32,
+        xK_R12,
+        xK_F33,
+        xK_R13,
+        xK_F34,
+        xK_R14,
+        xK_F35,
+        xK_R15,
+        xK_Shift_L,
+        xK_Shift_R,
+        xK_Control_L,
+        xK_Control_R,
+        xK_Caps_Lock,
+        xK_Shift_Lock,
+        xK_Meta_L,
+        xK_Meta_R,
+        xK_Alt_L,
+        xK_Alt_R,
+        xK_Super_L,
+        xK_Super_R,
+        xK_Hyper_L,
+        xK_Hyper_R,
+        xK_space,
+        xK_exclam,
+        xK_quotedbl,
+        xK_numbersign,
+        xK_dollar,
+        xK_percent,
+        xK_ampersand,
+        xK_apostrophe,
+        xK_quoteright,
+        xK_parenleft,
+        xK_parenright,
+        xK_asterisk,
+        xK_plus,
+        xK_comma,
+        xK_minus,
+        xK_period,
+        xK_slash,
+        xK_0,
+        xK_1,
+        xK_2,
+        xK_3,
+        xK_4,
+        xK_5,
+        xK_6,
+        xK_7,
+        xK_8,
+        xK_9,
+        xK_colon,
+        xK_semicolon,
+        xK_less,
+        xK_equal,
+        xK_greater,
+        xK_question,
+        xK_at,
+        xK_A,
+        xK_B,
+        xK_C,
+        xK_D,
+        xK_E,
+        xK_F,
+        xK_G,
+        xK_H,
+        xK_I,
+        xK_J,
+        xK_K,
+        xK_L,
+        xK_M,
+        xK_N,
+        xK_O,
+        xK_P,
+        xK_Q,
+        xK_R,
+        xK_S,
+        xK_T,
+        xK_U,
+        xK_V,
+        xK_W,
+        xK_X,
+        xK_Y,
+        xK_Z,
+        xK_bracketleft,
+        xK_backslash,
+        xK_bracketright,
+        xK_asciicircum,
+        xK_underscore,
+        xK_grave,
+        xK_quoteleft,
+        xK_a,
+        xK_b,
+        xK_c,
+        xK_d,
+        xK_e,
+        xK_f,
+        xK_g,
+        xK_h,
+        xK_i,
+        xK_j,
+        xK_k,
+        xK_l,
+        xK_m,
+        xK_n,
+        xK_o,
+        xK_p,
+        xK_q,
+        xK_r,
+        xK_s,
+        xK_t,
+        xK_u,
+        xK_v,
+        xK_w,
+        xK_x,
+        xK_y,
+        xK_z,
+        xK_braceleft,
+        xK_bar,
+        xK_braceright,
+        xK_asciitilde,
+        xK_nobreakspace,
+        xK_exclamdown,
+        xK_cent,
+        xK_sterling,
+        xK_currency,
+        xK_yen,
+        xK_brokenbar,
+        xK_section,
+        xK_diaeresis,
+        xK_copyright,
+        xK_ordfeminine,
+        xK_guillemotleft,
+        xK_notsign,
+        xK_hyphen,
+        xK_registered,
+        xK_macron,
+        xK_degree,
+        xK_plusminus,
+        xK_twosuperior,
+        xK_threesuperior,
+        xK_acute,
+        xK_mu,
+        xK_paragraph,
+        xK_periodcentered,
+        xK_cedilla,
+        xK_onesuperior,
+        xK_masculine,
+        xK_guillemotright,
+        xK_onequarter,
+        xK_onehalf,
+        xK_threequarters,
+        xK_questiondown,
+        xK_Agrave,
+        xK_Aacute,
+        xK_Acircumflex,
+        xK_Atilde,
+        xK_Adiaeresis,
+        xK_Aring,
+        xK_AE,
+        xK_Ccedilla,
+        xK_Egrave,
+        xK_Eacute,
+        xK_Ecircumflex,
+        xK_Ediaeresis,
+        xK_Igrave,
+        xK_Iacute,
+        xK_Icircumflex,
+        xK_Idiaeresis,
+        xK_ETH,
+        xK_Eth,
+        xK_Ntilde,
+        xK_Ograve,
+        xK_Oacute,
+        xK_Ocircumflex,
+        xK_Otilde,
+        xK_Odiaeresis,
+        xK_multiply,
+        xK_Ooblique,
+        xK_Ugrave,
+        xK_Uacute,
+        xK_Ucircumflex,
+        xK_Udiaeresis,
+        xK_Yacute,
+        xK_THORN,
+        xK_Thorn,
+        xK_ssharp,
+        xK_agrave,
+        xK_aacute,
+        xK_acircumflex,
+        xK_atilde,
+        xK_adiaeresis,
+        xK_aring,
+        xK_ae,
+        xK_ccedilla,
+        xK_egrave,
+        xK_eacute,
+        xK_ecircumflex,
+        xK_ediaeresis,
+        xK_igrave,
+        xK_iacute,
+        xK_icircumflex,
+        xK_idiaeresis,
+        xK_eth,
+        xK_ntilde,
+        xK_ograve,
+        xK_oacute,
+        xK_ocircumflex,
+        xK_otilde,
+        xK_odiaeresis,
+        xK_division,
+        xK_oslash,
+        xK_ugrave,
+        xK_uacute,
+        xK_ucircumflex,
+        xK_udiaeresis,
+        xK_yacute,
+        xK_thorn,
+        xK_ydiaeresis,
+
+        -- ** Event masks
+        EventMask,
+        noEventMask,
+        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,
+
+        -- ** Event types
+        EventType,
+        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,
+        lASTEvent,
+
+        -- ** Modifiers
+        Modifier,
+        shiftMapIndex,
+        lockMapIndex,
+        controlMapIndex,
+        mod1MapIndex,
+        mod2MapIndex,
+        mod3MapIndex,
+        mod4MapIndex,
+        mod5MapIndex,
+        anyModifier,
+
+        -- ** Key masks
+        KeyMask,
+        shiftMask,
+        lockMask,
+        controlMask,
+        mod1Mask,
+        mod2Mask,
+        mod3Mask,
+        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,
+        notifyInferior,
+        notifyNonlinear,
+        notifyNonlinearVirtual,
+        notifyPointer,
+        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,
+        replayPointer,
+        asyncKeyboard,
+        syncKeyboard,
+        replayKeyboard,
+        asyncBoth,
+        syncBoth,
+
+        -- ** Focus modes
+        FocusMode,
+        revertToNone,
+        revertToPointerRoot,
+        revertToParent,
+
+        -- ** Error codes
+        ErrorCode,
+        success,
+        badRequest,
+        badValue,
+        badWindow,
+        badPixmap,
+        badAtom,
+        badCursor,
+        badFont,
+        badMatch,
+        badDrawable,
+        badAccess,
+        badAlloc,
+        badColor,
+        badGC,
+        badIDChoice,
+        badName,
+        badLength,
+        badImplementation,
+        firstExtensionError,
+        lastExtensionError,
+
+        -- ** Return status
+        Status,
+        throwIfZero,
+
+        -- ** WindowClass
+        WindowClass,
+        copyFromParent,
+        inputOutput,
+        inputOnly,
+
+        -- ** Attribute masks
+        AttributeMask,
+        cWBackPixmap,
+        cWBackPixel,
+        cWBorderPixmap,
+        cWBorderPixel,
+        cWBitGravity,
+        cWWinGravity,
+        cWBackingStore,
+        cWBackingPlanes,
+        cWBackingPixel,
+        cWOverrideRedirect,
+        cWSaveUnder,
+        cWEventMask,
+        cWDontPropagate,
+        cWColormap,
+        cWCursor,
+
+        -- ** Close down modes
+        CloseDownMode,
+        destroyAll,
+        retainPermanent,
+        retainTemporary,
+
+        -- ** QueryBestSize classes
+        QueryBestSizeClass,
+        cursorShape,
+        tileShape,
+        stippleShape,
+
+        -- ** Graphics functions
+        GXFunction,
+        gXclear,
+        gXand,
+        gXandReverse,
+        gXcopy,
+        gXandInverted,
+        gXnoop,
+        gXxor,
+        gXor,
+        gXnor,
+        gXequiv,
+        gXinvert,
+        gXorReverse,
+        gXcopyInverted,
+        gXorInverted,
+        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,
+        gCForeground,
+        gCBackground,
+        gCLineWidth,
+        gCLineStyle,
+        gCCapStyle,
+        gCJoinStyle,
+        gCFillStyle,
+        gCFillRule,
+        gCTile,
+        gCStipple,
+        gCTileStipXOrigin,
+        gCTileStipYOrigin,
+        gCFont,
+        gCSubwindowMode,
+        gCGraphicsExposures,
+        gCClipXOrigin,
+        gCClipYOrigin,
+        gCClipMask,
+        gCDashOffset,
+        gCDashList,
+        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,
+        northGravity,
+        northEastGravity,
+        westGravity,
+        centerGravity,
+        eastGravity,
+        southWestGravity,
+        southGravity,
+        southEastGravity,
+        staticGravity,
+
+        -- ** Window gravity
+        WindowGravity,
+        unmapGravity,
+
+        -- ** Backing store
+        BackingStore,
+        notUseful,
+        whenMapped,
+        always,
+        doRed,
+        doGreen,
+        doBlue,
+
+        -- ** Font direction
+        FontDirection,
+        fontLeftToRight,
+        fontRightToLeft,
+
+        -- ** Image format
+        ImageFormat,
+        xyBitmap,
+        xyPixmap,
+        zPixmap
+        ) where
+
+-- import Data.Int
+import Data.Word
+import Foreign.Marshal.Error
+import Foreign.C.Types
+
+#include "HsXlib.h"
+
+-- ToDo: use newtype
+type XID      = #{type XID}
+type Mask     = #{type Mask}
+type Atom     = #{type Atom}
+type VisualID = #{type VisualID}
+type Time     = #{type Time}
+
+-- end platform dependency
+
+type Window   = XID
+type Drawable = XID
+type Font     = XID
+type Pixmap   = XID
+type Cursor   = XID
+type Colormap = XID
+type GContext = XID
+
+type KeyCode  = Char
+
+type KeySym   = XID
+
+#{enum KeySym,
+ , xK_VoidSymbol        = XK_VoidSymbol
+ }
+
+-- TTY Functions, cleverly chosen to map to ascii, for convenience of
+-- programming, but could have been arbitrary (at the cost of lookup
+-- tables in client code.
+
+#{enum KeySym,
+ , xK_BackSpace         = XK_BackSpace
+ , xK_Tab               = XK_Tab
+ , xK_Linefeed          = XK_Linefeed
+ , xK_Clear             = XK_Clear
+ , xK_Return            = XK_Return
+ , xK_Pause             = XK_Pause
+ , xK_Scroll_Lock       = XK_Scroll_Lock
+ , xK_Sys_Req           = XK_Sys_Req
+ , xK_Escape            = XK_Escape
+ , xK_Delete            = XK_Delete
+ }
+
+-- International & multi-key character composition
+#{enum KeySym,
+ , xK_Multi_key         = XK_Multi_key
+ }
+-- xK_Codeinput         = XK_Codeinput          -- Not defined for SunOS.
+-- xK_SingleCandidate   = XK_SingleCandidate    -- Not defined for SunOS.
+-- xK_MultipleCandidate = XK_MultipleCandidate  -- Not defined for SunOS.
+-- xK_PreviousCandidate = XK_PreviousCandidate  -- Not defined for SunOS.
+
+-- Cursor control & motion
+#{enum KeySym,
+ , xK_Home              = XK_Home
+ , xK_Left              = XK_Left
+ , xK_Up                = XK_Up
+ , xK_Right             = XK_Right
+ , xK_Down              = XK_Down
+ , xK_Prior             = XK_Prior
+ , xK_Page_Up           = XK_Page_Up
+ , xK_Next              = XK_Next
+ , xK_Page_Down         = XK_Page_Down
+ , xK_End               = XK_End
+ , xK_Begin             = XK_Begin
+
+ , xK_Select            = XK_Select
+ , xK_Print             = XK_Print
+ , xK_Execute           = XK_Execute
+ , xK_Insert            = XK_Insert
+ , xK_Undo              = XK_Undo
+ , xK_Redo              = XK_Redo
+ , xK_Menu              = XK_Menu
+ , xK_Find              = XK_Find
+ , xK_Cancel            = XK_Cancel
+ , xK_Help              = XK_Help
+ , xK_Break             = XK_Break
+ , xK_Mode_switch       = XK_Mode_switch
+ , xK_script_switch     = XK_script_switch
+ , xK_Num_Lock          = XK_Num_Lock
+ }
+
+-- Keypad Functions, keypad numbers cleverly chosen to map to ascii
+#{enum KeySym,
+ , xK_KP_Space          = XK_KP_Space
+ , xK_KP_Tab            = XK_KP_Tab
+ , xK_KP_Enter          = XK_KP_Enter
+ , xK_KP_F1             = XK_KP_F1
+ , xK_KP_F2             = XK_KP_F2
+ , xK_KP_F3             = XK_KP_F3
+ , xK_KP_F4             = XK_KP_F4
+ , xK_KP_Home           = XK_KP_Home
+ , xK_KP_Left           = XK_KP_Left
+ , xK_KP_Up             = XK_KP_Up
+ , xK_KP_Right          = XK_KP_Right
+ , xK_KP_Down           = XK_KP_Down
+ , xK_KP_Prior          = XK_KP_Prior
+ , xK_KP_Page_Up        = XK_KP_Page_Up
+ , xK_KP_Next           = XK_KP_Next
+ , xK_KP_Page_Down      = XK_KP_Page_Down
+ , xK_KP_End            = XK_KP_End
+ , xK_KP_Begin          = XK_KP_Begin
+ , xK_KP_Insert         = XK_KP_Insert
+ , xK_KP_Delete         = XK_KP_Delete
+ , xK_KP_Equal          = XK_KP_Equal
+ , xK_KP_Multiply       = XK_KP_Multiply
+ , xK_KP_Add            = XK_KP_Add
+ , xK_KP_Separator      = XK_KP_Separator
+ , xK_KP_Subtract       = XK_KP_Subtract
+ , xK_KP_Decimal        = XK_KP_Decimal
+ , xK_KP_Divide         = XK_KP_Divide
+
+ , xK_KP_0              = XK_KP_0
+ , xK_KP_1              = XK_KP_1
+ , xK_KP_2              = XK_KP_2
+ , xK_KP_3              = XK_KP_3
+ , xK_KP_4              = XK_KP_4
+ , xK_KP_5              = XK_KP_5
+ , xK_KP_6              = XK_KP_6
+ , xK_KP_7              = XK_KP_7
+ , xK_KP_8              = XK_KP_8
+ , xK_KP_9              = XK_KP_9
+
+ , xK_F1                = XK_F1
+ , xK_F2                = XK_F2
+ , xK_F3                = XK_F3
+ , xK_F4                = XK_F4
+ , xK_F5                = XK_F5
+ , xK_F6                = XK_F6
+ , xK_F7                = XK_F7
+ , xK_F8                = XK_F8
+ , xK_F9                = XK_F9
+ , xK_F10               = XK_F10
+ , xK_F11               = XK_F11
+ , xK_L1                = XK_L1
+ , xK_F12               = XK_F12
+ , xK_L2                = XK_L2
+ , xK_F13               = XK_F13
+ , xK_L3                = XK_L3
+ , xK_F14               = XK_F14
+ , xK_L4                = XK_L4
+ , xK_F15               = XK_F15
+ , xK_L5                = XK_L5
+ , xK_F16               = XK_F16
+ , xK_L6                = XK_L6
+ , xK_F17               = XK_F17
+ , xK_L7                = XK_L7
+ , xK_F18               = XK_F18
+ , xK_L8                = XK_L8
+ , xK_F19               = XK_F19
+ , xK_L9                = XK_L9
+ , xK_F20               = XK_F20
+ , xK_L10               = XK_L10
+ , xK_F21               = XK_F21
+ , xK_R1                = XK_R1
+ , xK_F22               = XK_F22
+ , xK_R2                = XK_R2
+ , xK_F23               = XK_F23
+ , xK_R3                = XK_R3
+ , xK_F24               = XK_F24
+ , xK_R4                = XK_R4
+ , xK_F25               = XK_F25
+ , xK_R5                = XK_R5
+ , xK_F26               = XK_F26
+ , xK_R6                = XK_R6
+ , xK_F27               = XK_F27
+ , xK_R7                = XK_R7
+ , xK_F28               = XK_F28
+ , xK_R8                = XK_R8
+ , xK_F29               = XK_F29
+ , xK_R9                = XK_R9
+ , xK_F30               = XK_F30
+ , xK_R10               = XK_R10
+ , xK_F31               = XK_F31
+ , xK_R11               = XK_R11
+ , xK_F32               = XK_F32
+ , xK_R12               = XK_R12
+ , xK_F33               = XK_F33
+ , xK_R13               = XK_R13
+ , xK_F34               = XK_F34
+ , xK_R14               = XK_R14
+ , xK_F35               = XK_F35
+ , xK_R15               = XK_R15
+ }
+
+#{enum KeySym,
+ , xK_Shift_L           = XK_Shift_L
+ , xK_Shift_R           = XK_Shift_R
+ , xK_Control_L         = XK_Control_L
+ , xK_Control_R         = XK_Control_R
+ , xK_Caps_Lock         = XK_Caps_Lock
+ , xK_Shift_Lock        = XK_Shift_Lock
+
+ , xK_Meta_L            = XK_Meta_L
+ , xK_Meta_R            = XK_Meta_R
+ , xK_Alt_L             = XK_Alt_L
+ , xK_Alt_R             = XK_Alt_R
+ , xK_Super_L           = XK_Super_L
+ , xK_Super_R           = XK_Super_R
+ , xK_Hyper_L           = XK_Hyper_L
+ , xK_Hyper_R           = XK_Hyper_R
+ }
+
+#{enum KeySym,
+ , xK_space             = XK_space
+ , xK_exclam            = XK_exclam
+ , xK_quotedbl          = XK_quotedbl
+ , xK_numbersign        = XK_numbersign
+ , xK_dollar            = XK_dollar
+ , xK_percent           = XK_percent
+ , xK_ampersand         = XK_ampersand
+ , xK_apostrophe        = XK_apostrophe
+ , xK_quoteright        = XK_quoteright
+ , xK_parenleft         = XK_parenleft
+ , xK_parenright        = XK_parenright
+ , xK_asterisk          = XK_asterisk
+ , xK_plus              = XK_plus
+ , xK_comma             = XK_comma
+ , xK_minus             = XK_minus
+ , xK_period            = XK_period
+ , xK_slash             = XK_slash
+ , xK_0                 = XK_0
+ , xK_1                 = XK_1
+ , xK_2                 = XK_2
+ , xK_3                 = XK_3
+ , xK_4                 = XK_4
+ , xK_5                 = XK_5
+ , xK_6                 = XK_6
+ , xK_7                 = XK_7
+ , xK_8                 = XK_8
+ , xK_9                 = XK_9
+ , xK_colon             = XK_colon
+ , xK_semicolon         = XK_semicolon
+ , xK_less              = XK_less
+ , xK_equal             = XK_equal
+ , xK_greater           = XK_greater
+ , xK_question          = XK_question
+ , xK_at                = XK_at
+ , xK_A                 = XK_A
+ , xK_B                 = XK_B
+ , xK_C                 = XK_C
+ , xK_D                 = XK_D
+ , xK_E                 = XK_E
+ , xK_F                 = XK_F
+ , xK_G                 = XK_G
+ , xK_H                 = XK_H
+ , xK_I                 = XK_I
+ , xK_J                 = XK_J
+ , xK_K                 = XK_K
+ , xK_L                 = XK_L
+ , xK_M                 = XK_M
+ , xK_N                 = XK_N
+ , xK_O                 = XK_O
+ , xK_P                 = XK_P
+ , xK_Q                 = XK_Q
+ , xK_R                 = XK_R
+ , xK_S                 = XK_S
+ , xK_T                 = XK_T
+ , xK_U                 = XK_U
+ , xK_V                 = XK_V
+ , xK_W                 = XK_W
+ , xK_X                 = XK_X
+ , xK_Y                 = XK_Y
+ , xK_Z                 = XK_Z
+ , xK_bracketleft       = XK_bracketleft
+ , xK_backslash         = XK_backslash
+ , xK_bracketright      = XK_bracketright
+ , xK_asciicircum       = XK_asciicircum
+ , xK_underscore        = XK_underscore
+ , xK_grave             = XK_grave
+ , xK_quoteleft         = XK_quoteleft
+ , xK_a                 = XK_a
+ , xK_b                 = XK_b
+ , xK_c                 = XK_c
+ , xK_d                 = XK_d
+ , xK_e                 = XK_e
+ , xK_f                 = XK_f
+ , xK_g                 = XK_g
+ , xK_h                 = XK_h
+ , xK_i                 = XK_i
+ , xK_j                 = XK_j
+ , xK_k                 = XK_k
+ , xK_l                 = XK_l
+ , xK_m                 = XK_m
+ , xK_n                 = XK_n
+ , xK_o                 = XK_o
+ , xK_p                 = XK_p
+ , xK_q                 = XK_q
+ , xK_r                 = XK_r
+ , xK_s                 = XK_s
+ , xK_t                 = XK_t
+ , xK_u                 = XK_u
+ , xK_v                 = XK_v
+ , xK_w                 = XK_w
+ , xK_x                 = XK_x
+ , xK_y                 = XK_y
+ , xK_z                 = XK_z
+ , xK_braceleft         = XK_braceleft
+ , xK_bar               = XK_bar
+ , xK_braceright        = XK_braceright
+ , xK_asciitilde        = XK_asciitilde
+ }
+
+#{enum KeySym,
+ , xK_nobreakspace      = XK_nobreakspace
+ , xK_exclamdown        = XK_exclamdown
+ , xK_cent              = XK_cent
+ , xK_sterling          = XK_sterling
+ , xK_currency          = XK_currency
+ , xK_yen               = XK_yen
+ , xK_brokenbar         = XK_brokenbar
+ , xK_section           = XK_section
+ , xK_diaeresis         = XK_diaeresis
+ , xK_copyright         = XK_copyright
+ , xK_ordfeminine       = XK_ordfeminine
+ , xK_guillemotleft     = XK_guillemotleft
+ , xK_notsign           = XK_notsign
+ , xK_hyphen            = XK_hyphen
+ , xK_registered        = XK_registered
+ , xK_macron            = XK_macron
+ , xK_degree            = XK_degree
+ , xK_plusminus         = XK_plusminus
+ , xK_twosuperior       = XK_twosuperior
+ , xK_threesuperior     = XK_threesuperior
+ , xK_acute             = XK_acute
+ , xK_mu                = XK_mu
+ , xK_paragraph         = XK_paragraph
+ , xK_periodcentered    = XK_periodcentered
+ , xK_cedilla           = XK_cedilla
+ , xK_onesuperior       = XK_onesuperior
+ , xK_masculine         = XK_masculine
+ , xK_guillemotright    = XK_guillemotright
+ , xK_onequarter        = XK_onequarter
+ , xK_onehalf           = XK_onehalf
+ , xK_threequarters     = XK_threequarters
+ , xK_questiondown      = XK_questiondown
+ , xK_Agrave            = XK_Agrave
+ , xK_Aacute            = XK_Aacute
+ , xK_Acircumflex       = XK_Acircumflex
+ , xK_Atilde            = XK_Atilde
+ , xK_Adiaeresis        = XK_Adiaeresis
+ , xK_Aring             = XK_Aring
+ , xK_AE                = XK_AE
+ , xK_Ccedilla          = XK_Ccedilla
+ , xK_Egrave            = XK_Egrave
+ , xK_Eacute            = XK_Eacute
+ , xK_Ecircumflex       = XK_Ecircumflex
+ , xK_Ediaeresis        = XK_Ediaeresis
+ , xK_Igrave            = XK_Igrave
+ , xK_Iacute            = XK_Iacute
+ , xK_Icircumflex       = XK_Icircumflex
+ , xK_Idiaeresis        = XK_Idiaeresis
+ , xK_ETH               = XK_ETH
+ , xK_Eth               = XK_Eth
+ , xK_Ntilde            = XK_Ntilde
+ , xK_Ograve            = XK_Ograve
+ , xK_Oacute            = XK_Oacute
+ , xK_Ocircumflex       = XK_Ocircumflex
+ , xK_Otilde            = XK_Otilde
+ , xK_Odiaeresis        = XK_Odiaeresis
+ , xK_multiply          = XK_multiply
+ , xK_Ooblique          = XK_Ooblique
+ , xK_Ugrave            = XK_Ugrave
+ , xK_Uacute            = XK_Uacute
+ , xK_Ucircumflex       = XK_Ucircumflex
+ , xK_Udiaeresis        = XK_Udiaeresis
+ , xK_Yacute            = XK_Yacute
+ , xK_THORN             = XK_THORN
+ , xK_Thorn             = XK_Thorn
+ , xK_ssharp            = XK_ssharp
+ , xK_agrave            = XK_agrave
+ , xK_aacute            = XK_aacute
+ , xK_acircumflex       = XK_acircumflex
+ , xK_atilde            = XK_atilde
+ , xK_adiaeresis        = XK_adiaeresis
+ , xK_aring             = XK_aring
+ , xK_ae                = XK_ae
+ , xK_ccedilla          = XK_ccedilla
+ , xK_egrave            = XK_egrave
+ , xK_eacute            = XK_eacute
+ , xK_ecircumflex       = XK_ecircumflex
+ , xK_ediaeresis        = XK_ediaeresis
+ , xK_igrave            = XK_igrave
+ , xK_iacute            = XK_iacute
+ , xK_icircumflex       = XK_icircumflex
+ , xK_idiaeresis        = XK_idiaeresis
+ , xK_eth               = XK_eth
+ , xK_ntilde            = XK_ntilde
+ , xK_ograve            = XK_ograve
+ , xK_oacute            = XK_oacute
+ , xK_ocircumflex       = XK_ocircumflex
+ , xK_otilde            = XK_otilde
+ , xK_odiaeresis        = XK_odiaeresis
+ , xK_division          = XK_division
+ , xK_oslash            = XK_oslash
+ , xK_ugrave            = XK_ugrave
+ , xK_uacute            = XK_uacute
+ , xK_ucircumflex       = XK_ucircumflex
+ , xK_udiaeresis        = XK_udiaeresis
+ , xK_yacute            = XK_yacute
+ , xK_thorn             = XK_thorn
+ , xK_ydiaeresis        = XK_ydiaeresis
+ }
+
+type EventMask                  = Mask
+#{enum EventMask,
+ , noEventMask                  = NoEventMask
+ , keyPressMask                 = KeyPressMask
+ , keyReleaseMask               = KeyReleaseMask
+ , buttonPressMask              = ButtonPressMask
+ , buttonReleaseMask            = ButtonReleaseMask
+ , enterWindowMask              = EnterWindowMask
+ , leaveWindowMask              = LeaveWindowMask
+ , pointerMotionMask            = PointerMotionMask
+ , pointerMotionHintMask        = PointerMotionHintMask
+ , button1MotionMask            = Button1MotionMask
+ , button2MotionMask            = Button2MotionMask
+ , button3MotionMask            = Button3MotionMask
+ , button4MotionMask            = Button4MotionMask
+ , button5MotionMask            = Button5MotionMask
+ , buttonMotionMask             = ButtonMotionMask
+ , keymapStateMask              = KeymapStateMask
+ , exposureMask                 = ExposureMask
+ , visibilityChangeMask         = VisibilityChangeMask
+ , structureNotifyMask          = StructureNotifyMask
+ , resizeRedirectMask           = ResizeRedirectMask
+ , substructureNotifyMask       = SubstructureNotifyMask
+ , substructureRedirectMask     = SubstructureRedirectMask
+ , focusChangeMask              = FocusChangeMask
+ , propertyChangeMask           = PropertyChangeMask
+ , colormapChangeMask           = ColormapChangeMask
+ , ownerGrabButtonMask          = OwnerGrabButtonMask
+ }
+
+type EventType          = Word32
+#{enum EventType,
+ , keyPress             = KeyPress
+ , keyRelease           = KeyRelease
+ , buttonPress          = ButtonPress
+ , buttonRelease        = ButtonRelease
+ , motionNotify         = MotionNotify
+ , enterNotify          = EnterNotify
+ , leaveNotify          = LeaveNotify
+ , focusIn              = FocusIn
+ , focusOut             = FocusOut
+ , keymapNotify         = KeymapNotify
+ , expose               = Expose
+ , graphicsExpose       = GraphicsExpose
+ , noExpose             = NoExpose
+ , visibilityNotify     = VisibilityNotify
+ , createNotify         = CreateNotify
+ , destroyNotify        = DestroyNotify
+ , unmapNotify          = UnmapNotify
+ , mapNotify            = MapNotify
+ , mapRequest           = MapRequest
+ , reparentNotify       = ReparentNotify
+ , configureNotify      = ConfigureNotify
+ , configureRequest     = ConfigureRequest
+ , gravityNotify        = GravityNotify
+ , resizeRequest        = ResizeRequest
+ , circulateNotify      = CirculateNotify
+ , circulateRequest     = CirculateRequest
+ , propertyNotify       = PropertyNotify
+ , selectionClear       = SelectionClear
+ , selectionRequest     = SelectionRequest
+ , selectionNotify      = SelectionNotify
+ , colormapNotify       = ColormapNotify
+ , clientMessage        = ClientMessage
+ , mappingNotify        = MappingNotify
+ , lASTEvent            = LASTEvent
+ }
+
+type Modifier           = CUInt
+#{enum Modifier,
+ , shiftMapIndex        = ShiftMapIndex
+ , lockMapIndex         = LockMapIndex
+ , controlMapIndex      = ControlMapIndex
+ , mod1MapIndex         = Mod1MapIndex
+ , mod2MapIndex         = Mod2MapIndex
+ , mod3MapIndex         = Mod3MapIndex
+ , mod4MapIndex         = Mod4MapIndex
+ , mod5MapIndex         = Mod5MapIndex
+ , anyModifier          = AnyModifier
+ }
+
+type KeyMask            = Modifier
+#{enum KeyMask,
+ , shiftMask            = ShiftMask
+ , lockMask             = LockMask
+ , controlMask          = ControlMask
+ , mod1Mask             = Mod1Mask
+ , mod2Mask             = Mod2Mask
+ , mod3Mask             = Mod3Mask
+ , mod4Mask             = Mod4Mask
+ , mod5Mask             = Mod5Mask
+ }
+
+type ButtonMask         = Modifier
+#{enum ButtonMask,
+ , button1Mask          = Button1Mask
+ , button2Mask          = Button2Mask
+ , button3Mask          = Button3Mask
+ , button4Mask          = Button4Mask
+ , button5Mask          = Button5Mask
+ }
+
+type Button             = Word32
+#{enum Button,
+ , button1              = Button1
+ , button2              = Button2
+ , button3              = Button3
+ , button4              = Button4
+ , button5              = Button5
+ }
+
+type NotifyMode         = CInt
+-- NotifyNormal and NotifyHint are used as detail in XMotionEvents
+#{enum NotifyMode,
+ , notifyNormal         = NotifyNormal
+ , notifyGrab           = NotifyGrab
+ , notifyUngrab         = NotifyUngrab
+ , notifyWhileGrabbed   = NotifyWhileGrabbed
+ , notifyHint           = NotifyHint
+ }
+
+type NotifyDetail       = CInt
+#{enum NotifyDetail,
+ , notifyAncestor       = NotifyAncestor
+ , notifyVirtual        = NotifyVirtual
+ , notifyInferior       = NotifyInferior
+ , notifyNonlinear      = NotifyNonlinear
+ , notifyNonlinearVirtual = NotifyNonlinearVirtual
+ , notifyPointer        = NotifyPointer
+ , notifyPointerRoot    = NotifyPointerRoot
+ , notifyDetailNone     = NotifyDetailNone
+ }
+
+type Visibility = CInt
+#{enum Visibility,
+ , visibilityUnobscured         = VisibilityUnobscured
+ , visibilityPartiallyObscured  = VisibilityPartiallyObscured
+ , visibilityFullyObscured      = VisibilityFullyObscured
+ }
+
+-- | Place of window relative to siblings
+-- (used in Circulation requests or events)
+type Place = CInt
+#{enum Place,
+ , placeOnTop           = PlaceOnTop
+ , placeOnBottom        = PlaceOnBottom
+ }
+
+type Protocol           = CInt
+#{enum Protocol,
+ , familyInternet       = FamilyInternet
+ , familyDECnet         = FamilyDECnet
+ , familyChaos          = FamilyChaos
+ }
+
+type PropertyNotification = CInt
+#{enum PropertyNotification,
+ , propertyNewValue     = PropertyNewValue
+ , propertyDelete       = PropertyDelete
+ }
+
+type ColormapNotification = CInt
+#{enum ColormapNotification,
+ , colormapUninstalled  = ColormapUninstalled
+ , colormapInstalled    = ColormapInstalled
+ }
+
+-- Grab{Pointer,Button,Keyboard,Key} Modes
+type GrabMode           = CInt
+#{enum GrabMode,
+ , grabModeSync         = GrabModeSync
+ , grabModeAsync        = GrabModeAsync
+ }
+
+-- Grab{Pointer,Keyboard} reply status
+
+type GrabStatus         = CInt
+#{enum GrabStatus,
+ , grabSuccess          = GrabSuccess
+ , alreadyGrabbed       = AlreadyGrabbed
+ , grabInvalidTime      = GrabInvalidTime
+ , grabNotViewable      = GrabNotViewable
+ , grabFrozen           = GrabFrozen
+ }
+
+-- AllowEvents modes
+type AllowEvents        = CInt
+#{enum AllowEvents,
+ , asyncPointer         = AsyncPointer
+ , syncPointer          = SyncPointer
+ , replayPointer        = ReplayPointer
+ , asyncKeyboard        = AsyncKeyboard
+ , syncKeyboard         = SyncKeyboard
+ , replayKeyboard       = ReplayKeyboard
+ , asyncBoth            = AsyncBoth
+ , syncBoth             = SyncBoth
+ }
+
+-- {Set,Get}InputFocus Modes
+type FocusMode          = CInt
+#{enum FocusMode,
+ , revertToNone         = RevertToNone
+ , revertToPointerRoot  = RevertToPointerRoot
+ , revertToParent       = RevertToParent
+ }
+
+-- Error codes
+type ErrorCode          = CInt
+#{enum ErrorCode,
+ , success              = Success
+ , badRequest           = BadRequest
+ , badValue             = BadValue
+ , badWindow            = BadWindow
+ , badPixmap            = BadPixmap
+ , badAtom              = BadAtom
+ , badCursor            = BadCursor
+ , badFont              = BadFont
+ , badMatch             = BadMatch
+ , badDrawable          = BadDrawable
+ , badAccess            = BadAccess
+ , badAlloc             = BadAlloc
+ , badColor             = BadColor
+ , badGC                = BadGC
+ , badIDChoice          = BadIDChoice
+ , badName              = BadName
+ , badLength            = BadLength
+ , badImplementation    = BadImplementation
+ , firstExtensionError  = FirstExtensionError
+ , lastExtensionError   = LastExtensionError
+ }
+
+type Status             = CInt
+
+-- |Xlib functions with return values of type @Status@ return zero on
+-- failure and nonzero on success.
+throwIfZero :: String -> IO Status -> IO ()
+throwIfZero fn_name = throwIf_ (== 0) (const ("Error in function " ++ fn_name))
+
+type WindowClass        = CInt
+#{enum WindowClass,
+ , copyFromParent       = CopyFromParent
+ , inputOutput          = InputOutput
+ , inputOnly            = InputOnly
+ }
+
+-- Window attributes mask
+type AttributeMask      = Mask
+#{enum AttributeMask,
+ , cWBackPixmap         = CWBackPixmap
+ , cWBackPixel          = CWBackPixel
+ , cWBorderPixmap       = CWBorderPixmap
+ , cWBorderPixel        = CWBorderPixel
+ , cWBitGravity         = CWBitGravity
+ , cWWinGravity         = CWWinGravity
+ , cWBackingStore       = CWBackingStore
+ , cWBackingPlanes      = CWBackingPlanes
+ , cWBackingPixel       = CWBackingPixel
+ , cWOverrideRedirect   = CWOverrideRedirect
+ , cWSaveUnder          = CWSaveUnder
+ , cWEventMask          = CWEventMask
+ , cWDontPropagate      = CWDontPropagate
+ , cWColormap           = CWColormap
+ , cWCursor             = CWCursor
+ }
+
+-- Used in ChangeCloseDownMode
+type CloseDownMode      = CInt
+#{enum CloseDownMode,
+ , destroyAll           = DestroyAll
+ , retainPermanent      = RetainPermanent
+ , retainTemporary      = RetainTemporary
+ }
+
+----------------------------------------------------------------
+-- CURSOR STUFF
+----------------------------------------------------------------
+
+type QueryBestSizeClass = CInt
+#{enum QueryBestSizeClass,
+ , cursorShape          = CursorShape
+ , tileShape            = TileShape
+ , stippleShape         = StippleShape
+ }
+
+----------------------------------------------------------------
+-- GRAPHICS DEFINITIONS
+----------------------------------------------------------------
+
+-- graphics functions, as in GC.alu
+
+type   GXFunction       = CInt
+#{enum GXFunction,
+ , gXclear              = GXclear
+ , gXand                = GXand
+ , gXandReverse         = GXandReverse
+ , gXcopy               = GXcopy
+ , gXandInverted        = GXandInverted
+ , gXnoop               = GXnoop
+ , gXxor                = GXxor
+ , gXor                 = GXor
+ , gXnor                = GXnor
+ , gXequiv              = GXequiv
+ , gXinvert             = GXinvert
+ , gXorReverse          = GXorReverse
+ , gXcopyInverted       = GXcopyInverted
+ , gXorInverted         = GXorInverted
+ , gXnand               = GXnand
+ , gXset                = GXset
+ }
+
+type   LineStyle        = CInt
+#{enum LineStyle,
+ , lineSolid            = LineSolid
+ , lineOnOffDash        = LineOnOffDash
+ , lineDoubleDash       = LineDoubleDash
+ }
+
+type   CapStyle         = CInt
+#{enum CapStyle,
+ , capNotLast           = CapNotLast
+ , capButt              = CapButt
+ , capRound             = CapRound
+ , capProjecting        = CapProjecting
+ }
+
+type   JoinStyle        = CInt
+#{enum JoinStyle,
+ , joinMiter            = JoinMiter
+ , joinRound            = JoinRound
+ , joinBevel            = JoinBevel
+ }
+
+type   FillStyle        = CInt
+#{enum FillStyle,
+ , fillSolid            = FillSolid
+ , fillTiled            = FillTiled
+ , fillStippled         = FillStippled
+ , fillOpaqueStippled   = FillOpaqueStippled
+ }
+
+type   FillRule         = CInt
+#{enum FillRule,
+ , evenOddRule          = EvenOddRule
+ , windingRule          = WindingRule
+ }
+
+type   SubWindowMode    = CInt
+#{enum SubWindowMode,
+ , clipByChildren       = ClipByChildren
+ , includeInferiors     = IncludeInferiors
+ }
+
+-- -- SetClipRectangles ordering
+-- type   Ordering        = CInt
+-- {enum Ordering,
+-- , unsorted           = Unsorted
+-- , ySorted            = YSorted
+-- , yXSorted           = YXSorted
+-- , yXBanded           = YXBanded
+-- }
+
+-- CoordinateMode for drawing routines
+type   CoordinateMode   = CInt
+#{enum CoordinateMode,
+ , coordModeOrigin      = CoordModeOrigin
+ , coordModePrevious    = CoordModePrevious
+ }
+
+type   PolygonShape     = CInt
+#{enum PolygonShape,
+ , complex              = Complex
+ , nonconvex            = Nonconvex
+ , convex               = Convex
+ }
+
+-- Arc modes for PolyFillArc
+type   ArcMode          = CInt
+#{enum ArcMode,
+ , arcChord             = ArcChord
+ , arcPieSlice          = ArcPieSlice
+ }
+
+-- GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into
+-- GC.stateChanges
+
+type   GCMask           = CInt
+#{enum GCMask,
+ , gCFunction           = GCFunction
+ , gCPlaneMask          = GCPlaneMask
+ , gCForeground         = GCForeground
+ , gCBackground         = GCBackground
+ , gCLineWidth          = GCLineWidth
+ , gCLineStyle          = GCLineStyle
+ , gCCapStyle           = GCCapStyle
+ , gCJoinStyle          = GCJoinStyle
+ , gCFillStyle          = GCFillStyle
+ , gCFillRule           = GCFillRule
+ , gCTile               = GCTile
+ , gCStipple            = GCStipple
+ , gCTileStipXOrigin    = GCTileStipXOrigin
+ , gCTileStipYOrigin    = GCTileStipYOrigin
+ , gCFont               = GCFont
+ , gCSubwindowMode      = GCSubwindowMode
+ , gCGraphicsExposures  = GCGraphicsExposures
+ , gCClipXOrigin        = GCClipXOrigin
+ , gCClipYOrigin        = GCClipYOrigin
+ , gCClipMask           = GCClipMask
+ , gCDashOffset         = GCDashOffset
+ , gCDashList           = GCDashList
+ , gCArcMode            = GCArcMode
+ , gCLastBit            = GCLastBit
+ }
+
+type   CirculationDirection = CInt
+#{enum CirculationDirection,
+ , raiseLowest          = RaiseLowest
+ , lowerHighest         = LowerHighest
+ }
+
+-- used in imageByteOrder and bitmapBitOrder
+type   ByteOrder        = CInt
+#{enum ByteOrder,
+ , lSBFirst             = LSBFirst
+ , mSBFirst             = MSBFirst
+ }
+
+type   ColormapAlloc    = CInt
+#{enum ColormapAlloc,
+ , allocNone            = AllocNone
+ , allocAll             = AllocAll
+ }
+
+type   MappingRequest   = CInt
+#{enum MappingRequest,
+ , mappingModifier      = MappingModifier
+ , mappingKeyboard      = MappingKeyboard
+ , mappingPointer       = MappingPointer
+ }
+
+type   ChangeSaveSetMode = CInt
+#{enum ChangeSaveSetMode,
+ , setModeInsert        = SetModeInsert
+ , setModeDelete        = SetModeDelete
+ }
+
+type   BitGravity       = CInt
+#{enum BitGravity,
+ , forgetGravity        = ForgetGravity
+ , northWestGravity     = NorthWestGravity
+ , northGravity         = NorthGravity
+ , northEastGravity     = NorthEastGravity
+ , westGravity          = WestGravity
+ , centerGravity        = CenterGravity
+ , eastGravity          = EastGravity
+ , southWestGravity     = SouthWestGravity
+ , southGravity         = SouthGravity
+ , southEastGravity     = SouthEastGravity
+ , staticGravity        = StaticGravity
+ }
+
+-- All the BitGravity's plus ...
+type   WindowGravity   = CInt
+#{enum WindowGravity,
+ , unmapGravity         = UnmapGravity
+ }
+
+-- Used in CreateWindow for backing-store hint
+type   BackingStore     = CInt
+#{enum BackingStore,
+ , notUseful            = NotUseful
+ , whenMapped           = WhenMapped
+ , always               = Always
+ }
+
+#{enum Word8,
+ , doRed                = DoRed
+ , doGreen              = DoGreen
+ , doBlue               = DoBlue
+ }
+
+type   FontDirection    = CInt
+#{enum FontDirection,
+ , fontLeftToRight      = FontLeftToRight
+ , fontRightToLeft      = FontRightToLeft
+ }
+
+type   ImageFormat    = CInt
+#{enum ImageFormat,
+ , xyBitmap     = XYBitmap
+ , xyPixmap     = XYPixmap
+ , zPixmap      = ZPixmap
  }
diff --git a/Graphics/X11/Xinerama.hsc b/Graphics/X11/Xinerama.hsc
--- a/Graphics/X11/Xinerama.hsc
+++ b/Graphics/X11/Xinerama.hsc
@@ -1,12 +1,27 @@
--- | Interface to Xinerama API
-module Graphics.X11.Xinerama
-  (XineramaScreenInfo(..), 
-   xineramaIsActive, 
-   xineramaQueryExtension, 
-   xineramaQueryVersion, 
+--------------------------------------------------------------------
+-- |
+-- Module    : Graphics.X11.Xinerama
+-- Copyright : (c) Haskell.org, 2007
+-- License   : BSD3
+--
+-- Maintainer: Don Stewart <dons@galois.com>
+-- Stability : provisional
+-- Portability: portable
+--
+--------------------------------------------------------------------
+--
+-- Interface to Xinerama API
+--
+
+module Graphics.X11.Xinerama (
+   XineramaScreenInfo(..),
+   xineramaIsActive,
+   xineramaQueryExtension,
+   xineramaQueryVersion,
    xineramaQueryScreens,
    compiledWithXinerama,
-   getScreenInfo) where
+   getScreenInfo
+ ) where
 
 #include <X11_extras_config.h>
 
@@ -17,12 +32,12 @@
 import Control.Monad
 
 -- | Representation of the XineramaScreenInfo struct
-data XineramaScreenInfo = XineramaScreenInfo 
-                          { xsi_screen_number :: CInt,
-                            xsi_x_org         :: CShort,
-                            xsi_y_org         :: CShort,
-                            xsi_width         :: CShort,
-                            xsi_height        :: CShort }
+data XineramaScreenInfo = XineramaScreenInfo
+                          { xsi_screen_number :: !CInt,
+                            xsi_x_org         :: !CShort,
+                            xsi_y_org         :: !CShort,
+                            xsi_width         :: !CShort,
+                            xsi_height        :: !CShort }
                             deriving (Show)
 
 -- | Wrapper around xineramaQueryScreens that fakes a single screen when
@@ -40,7 +55,7 @@
                         , rect_y      = fromIntegral $ wa_y wa
                         , rect_width  = fromIntegral $ wa_width wa
                         , rect_height = fromIntegral $ wa_height wa }]
- where 
+ where
     xsiToRect xsi = Rectangle
                     { rect_x        = fromIntegral $ xsi_x_org xsi
                     , rect_y        = fromIntegral $ xsi_y_org xsi
@@ -103,15 +118,18 @@
 
 foreign import ccall "XineramaQueryExtension"
   cXineramaQueryExtension :: Display -> Ptr CInt -> Ptr CInt -> IO Bool
+
 foreign import ccall "XineramaQueryVersion"
   cXineramaQueryVersion :: Display -> Ptr CInt -> Ptr CInt -> IO Bool
+
 foreign import ccall "XineramaQueryScreens"
   cXineramaQueryScreens :: Display -> Ptr CInt -> IO (Ptr XineramaScreenInfo)
+
 foreign import ccall "XFree"
   cXFree :: Ptr a -> IO CInt
 
 wrapPtr2 :: (Storable a, Storable b) => (Ptr a -> Ptr b -> IO c) -> (c -> a -> b -> d) -> IO d
-wrapPtr2 cfun f = 
+wrapPtr2 cfun f =
   withPool $ \pool -> do aptr <- pooledMalloc pool
                          bptr <- pooledMalloc pool
                          ret <- cfun aptr bptr
@@ -137,4 +155,5 @@
 
 xineramaQueryScreens :: Display -> IO (Maybe [XineramaScreenInfo])
 xineramaQueryScreens _ = return Nothing
+
 #endif
diff --git a/Graphics/X11/Xlib/Atom.hsc b/Graphics/X11/Xlib/Atom.hsc
--- a/Graphics/X11/Xlib/Atom.hsc
+++ b/Graphics/X11/Xlib/Atom.hsc
@@ -103,10 +103,10 @@
 -- | 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 ->
-	xInternAtom display c_atom_name only_if_exists
+        withCString atom_name $ \ c_atom_name ->
+        xInternAtom display c_atom_name only_if_exists
 foreign import ccall unsafe "XInternAtom"
-	xInternAtom :: Display -> CString -> Bool -> IO Atom
+        xInternAtom :: Display -> CString -> Bool -> IO Atom
 
 -- XInternAtoms omitted
 -- XGetAtomName omitted
@@ -117,75 +117,75 @@
 -- XDeleteProperty omitted
 
 #{enum Atom,
- , pRIMARY 		= XA_PRIMARY
- , sECONDARY 		= XA_SECONDARY
- , aRC 			= XA_ARC
- , aTOM 		= XA_ATOM
- , bITMAP 		= XA_BITMAP
- , cARDINAL 		= XA_CARDINAL
- , cOLORMAP 		= XA_COLORMAP
- , cURSOR 		= XA_CURSOR
- , cUT_BUFFER0 		= XA_CUT_BUFFER0
- , cUT_BUFFER1 		= XA_CUT_BUFFER1
- , cUT_BUFFER2 		= XA_CUT_BUFFER2
- , cUT_BUFFER3 		= XA_CUT_BUFFER3
- , cUT_BUFFER4 		= XA_CUT_BUFFER4
- , cUT_BUFFER5 		= XA_CUT_BUFFER5
- , cUT_BUFFER6 		= XA_CUT_BUFFER6
- , cUT_BUFFER7 		= XA_CUT_BUFFER7
- , dRAWABLE 		= XA_DRAWABLE
- , fONT 		= XA_FONT
- , iNTEGER 		= XA_INTEGER
- , pIXMAP 		= XA_PIXMAP
- , pOINT 		= XA_POINT
- , rECTANGLE 		= XA_RECTANGLE
- , rESOURCE_MANAGER 	= XA_RESOURCE_MANAGER
- , rGB_COLOR_MAP 	= XA_RGB_COLOR_MAP
- , rGB_BEST_MAP 	= XA_RGB_BEST_MAP
- , rGB_BLUE_MAP 	= XA_RGB_BLUE_MAP
- , rGB_DEFAULT_MAP 	= XA_RGB_DEFAULT_MAP
- , rGB_GRAY_MAP 	= XA_RGB_GRAY_MAP
- , rGB_GREEN_MAP 	= XA_RGB_GREEN_MAP
- , rGB_RED_MAP 		= XA_RGB_RED_MAP
- , sTRING 		= XA_STRING
- , vISUALID 		= XA_VISUALID
- , wINDOW 		= XA_WINDOW
- , wM_COMMAND 		= XA_WM_COMMAND
- , wM_HINTS 		= XA_WM_HINTS
- , wM_CLIENT_MACHINE 	= XA_WM_CLIENT_MACHINE
- , wM_ICON_NAME 	= XA_WM_ICON_NAME
- , wM_ICON_SIZE 	= XA_WM_ICON_SIZE
- , wM_NAME 		= XA_WM_NAME
- , wM_NORMAL_HINTS 	= XA_WM_NORMAL_HINTS
- , wM_SIZE_HINTS 	= XA_WM_SIZE_HINTS
- , wM_ZOOM_HINTS 	= XA_WM_ZOOM_HINTS
- , mIN_SPACE 		= XA_MIN_SPACE
- , nORM_SPACE 		= XA_NORM_SPACE
- , mAX_SPACE 		= XA_MAX_SPACE
- , eND_SPACE 		= XA_END_SPACE
- , sUPERSCRIPT_X 	= XA_SUPERSCRIPT_X
- , sUPERSCRIPT_Y 	= XA_SUPERSCRIPT_Y
- , sUBSCRIPT_X 		= XA_SUBSCRIPT_X
- , sUBSCRIPT_Y 		= XA_SUBSCRIPT_Y
- , uNDERLINE_POSITION 	= XA_UNDERLINE_POSITION
- , uNDERLINE_THICKNESS 	= XA_UNDERLINE_THICKNESS
- , sTRIKEOUT_ASCENT 	= XA_STRIKEOUT_ASCENT
- , sTRIKEOUT_DESCENT 	= XA_STRIKEOUT_DESCENT
- , iTALIC_ANGLE 	= XA_ITALIC_ANGLE
- , x_HEIGHT 		= XA_X_HEIGHT
- , qUAD_WIDTH 		= XA_QUAD_WIDTH
- , wEIGHT 		= XA_WEIGHT
- , pOINT_SIZE 		= XA_POINT_SIZE
- , rESOLUTION 		= XA_RESOLUTION
- , cOPYRIGHT 		= XA_COPYRIGHT
- , nOTICE 		= XA_NOTICE
- , fONT_NAME 		= XA_FONT_NAME
- , fAMILY_NAME 		= XA_FAMILY_NAME
- , fULL_NAME 		= XA_FULL_NAME
- , cAP_HEIGHT 		= XA_CAP_HEIGHT
- , wM_CLASS 		= XA_WM_CLASS
- , wM_TRANSIENT_FOR 	= XA_WM_TRANSIENT_FOR
- , lAST_PREDEFINED 	= XA_LAST_PREDEFINED
+ , pRIMARY              = XA_PRIMARY
+ , sECONDARY            = XA_SECONDARY
+ , aRC                  = XA_ARC
+ , aTOM                 = XA_ATOM
+ , bITMAP               = XA_BITMAP
+ , cARDINAL             = XA_CARDINAL
+ , cOLORMAP             = XA_COLORMAP
+ , cURSOR               = XA_CURSOR
+ , cUT_BUFFER0          = XA_CUT_BUFFER0
+ , cUT_BUFFER1          = XA_CUT_BUFFER1
+ , cUT_BUFFER2          = XA_CUT_BUFFER2
+ , cUT_BUFFER3          = XA_CUT_BUFFER3
+ , cUT_BUFFER4          = XA_CUT_BUFFER4
+ , cUT_BUFFER5          = XA_CUT_BUFFER5
+ , cUT_BUFFER6          = XA_CUT_BUFFER6
+ , cUT_BUFFER7          = XA_CUT_BUFFER7
+ , dRAWABLE             = XA_DRAWABLE
+ , fONT                 = XA_FONT
+ , iNTEGER              = XA_INTEGER
+ , pIXMAP               = XA_PIXMAP
+ , pOINT                = XA_POINT
+ , rECTANGLE            = XA_RECTANGLE
+ , rESOURCE_MANAGER     = XA_RESOURCE_MANAGER
+ , rGB_COLOR_MAP        = XA_RGB_COLOR_MAP
+ , rGB_BEST_MAP         = XA_RGB_BEST_MAP
+ , rGB_BLUE_MAP         = XA_RGB_BLUE_MAP
+ , rGB_DEFAULT_MAP      = XA_RGB_DEFAULT_MAP
+ , rGB_GRAY_MAP         = XA_RGB_GRAY_MAP
+ , rGB_GREEN_MAP        = XA_RGB_GREEN_MAP
+ , rGB_RED_MAP          = XA_RGB_RED_MAP
+ , sTRING               = XA_STRING
+ , vISUALID             = XA_VISUALID
+ , wINDOW               = XA_WINDOW
+ , wM_COMMAND           = XA_WM_COMMAND
+ , wM_HINTS             = XA_WM_HINTS
+ , wM_CLIENT_MACHINE    = XA_WM_CLIENT_MACHINE
+ , wM_ICON_NAME         = XA_WM_ICON_NAME
+ , wM_ICON_SIZE         = XA_WM_ICON_SIZE
+ , wM_NAME              = XA_WM_NAME
+ , wM_NORMAL_HINTS      = XA_WM_NORMAL_HINTS
+ , wM_SIZE_HINTS        = XA_WM_SIZE_HINTS
+ , wM_ZOOM_HINTS        = XA_WM_ZOOM_HINTS
+ , mIN_SPACE            = XA_MIN_SPACE
+ , nORM_SPACE           = XA_NORM_SPACE
+ , mAX_SPACE            = XA_MAX_SPACE
+ , eND_SPACE            = XA_END_SPACE
+ , sUPERSCRIPT_X        = XA_SUPERSCRIPT_X
+ , sUPERSCRIPT_Y        = XA_SUPERSCRIPT_Y
+ , sUBSCRIPT_X          = XA_SUBSCRIPT_X
+ , sUBSCRIPT_Y          = XA_SUBSCRIPT_Y
+ , uNDERLINE_POSITION   = XA_UNDERLINE_POSITION
+ , uNDERLINE_THICKNESS  = XA_UNDERLINE_THICKNESS
+ , sTRIKEOUT_ASCENT     = XA_STRIKEOUT_ASCENT
+ , sTRIKEOUT_DESCENT    = XA_STRIKEOUT_DESCENT
+ , iTALIC_ANGLE         = XA_ITALIC_ANGLE
+ , x_HEIGHT             = XA_X_HEIGHT
+ , qUAD_WIDTH           = XA_QUAD_WIDTH
+ , wEIGHT               = XA_WEIGHT
+ , pOINT_SIZE           = XA_POINT_SIZE
+ , rESOLUTION           = XA_RESOLUTION
+ , cOPYRIGHT            = XA_COPYRIGHT
+ , nOTICE               = XA_NOTICE
+ , fONT_NAME            = XA_FONT_NAME
+ , fAMILY_NAME          = XA_FAMILY_NAME
+ , fULL_NAME            = XA_FULL_NAME
+ , cAP_HEIGHT           = XA_CAP_HEIGHT
+ , wM_CLASS             = XA_WM_CLASS
+ , wM_TRANSIENT_FOR     = XA_WM_TRANSIENT_FOR
+ , lAST_PREDEFINED      = XA_LAST_PREDEFINED
  }
 
 ----------------------------------------------------------------
diff --git a/Graphics/X11/Xlib/Color.hs b/Graphics/X11/Xlib/Color.hs
--- a/Graphics/X11/Xlib/Color.hs
+++ b/Graphics/X11/Xlib/Color.hs
@@ -44,55 +44,59 @@
 -- | interface to the X11 library function @XLookupColor()@.
 lookupColor :: Display -> Colormap -> String -> IO (Color, Color)
 lookupColor display colormap color_name =
-	withCString color_name $ \c_color_name ->
-	alloca $ \ exact_def_return ->
-	alloca $ \ screen_def_return -> do
-	throwIfZero "lookupColor" $
-		xLookupColor display colormap c_color_name
-			exact_def_return screen_def_return
-	exact_def <- peek exact_def_return
-	screen_def <- peek screen_def_return
-	return (exact_def, screen_def)
+        withCString color_name $ \c_color_name ->
+        alloca $ \ exact_def_return ->
+        alloca $ \ screen_def_return -> do
+        throwIfZero "lookupColor" $
+                xLookupColor display colormap c_color_name
+                        exact_def_return screen_def_return
+        exact_def <- peek exact_def_return
+        screen_def <- peek screen_def_return
+        return (exact_def, screen_def)
+
 foreign import ccall unsafe "HsXlib.h XLookupColor"
-	xLookupColor :: Display -> Colormap -> CString ->
-		Ptr Color -> Ptr Color -> IO Status
+        xLookupColor :: Display -> Colormap -> CString ->
+                Ptr Color -> Ptr Color -> IO Status
 
 -- | interface to the X11 library function @XAllocNamedColor()@.
 allocNamedColor :: Display -> Colormap -> String -> IO (Color, Color)
 allocNamedColor display colormap color_name =
-	withCString color_name $ \c_color_name ->
-	alloca $ \ exact_def_return ->
-	alloca $ \ screen_def_return -> do
-	throwIfZero "allocNamedColor" $
-		xAllocNamedColor display colormap c_color_name
-			exact_def_return screen_def_return
-	exact_def <- peek exact_def_return
-	screen_def <- peek screen_def_return
-	return (exact_def, screen_def)
+        withCString color_name $ \c_color_name ->
+        alloca $ \ exact_def_return ->
+        alloca $ \ screen_def_return -> do
+        throwIfZero "allocNamedColor" $
+                xAllocNamedColor display colormap c_color_name
+                        exact_def_return screen_def_return
+        exact_def <- peek exact_def_return
+        screen_def <- peek screen_def_return
+        return (exact_def, screen_def)
+
 foreign import ccall unsafe "HsXlib.h XAllocNamedColor"
-	xAllocNamedColor :: Display -> Colormap -> CString ->
-		Ptr Color -> Ptr Color -> IO Status
+        xAllocNamedColor :: Display -> Colormap -> CString ->
+                Ptr Color -> Ptr Color -> IO Status
 
 -- | interface to the X11 library function @XAllocColor()@.
 allocColor :: Display -> Colormap -> Color -> IO Color
 allocColor display colormap color =
-	with color $ \ color_ptr -> do
-	throwIfZero "allocColor" $
-		xAllocColor display colormap color_ptr
-	peek color_ptr
+        with color $ \ color_ptr -> do
+        throwIfZero "allocColor" $
+                xAllocColor display colormap color_ptr
+        peek color_ptr
+
 foreign import ccall unsafe "HsXlib.h XAllocColor"
-	xAllocColor :: Display -> Colormap -> Ptr Color -> IO Status
+        xAllocColor :: Display -> Colormap -> Ptr Color -> IO Status
 
 -- | interface to the X11 library function @XParseColor()@.
 parseColor :: Display -> Colormap -> String -> IO Color
 parseColor display colormap color_spec =
-	withCString color_spec $ \ spec ->
-	alloca $ \ exact_def_return -> do
-	throwIfZero "parseColor" $
-		xParseColor display colormap spec exact_def_return
-	peek exact_def_return
+        withCString color_spec $ \ spec ->
+        alloca $ \ exact_def_return -> do
+        throwIfZero "parseColor" $
+                xParseColor display colormap spec exact_def_return
+        peek exact_def_return
+
 foreign import ccall unsafe "HsXlib.h XParseColor"
-	xParseColor :: Display -> Colormap -> CString -> Ptr Color -> IO Status
+        xParseColor :: Display -> Colormap -> CString -> Ptr Color -> IO Status
 
 -- ToDo: Can't express relationship between arg4 and res1 properly (or arg5, res2)
 -- %errfun Zero XAllocColorCells :: Display -> Colormap -> Bool -> Int -> Int -> IO (ListPixel, ListPixel) using err = XAllocColorCells(arg1,arg2,arg3,arg4_size,res1,arg5_size,res2)
@@ -103,18 +107,20 @@
 -- | interface to the X11 library function @XFreeColors()@.
 freeColors :: Display -> Colormap -> [Pixel] -> Pixel -> IO ()
 freeColors display colormap pixels planes =
-	withArray pixels $ \ pixel_array ->
-	xFreeColors display colormap pixel_array (fromIntegral (length pixels)) planes
+        withArray pixels $ \ pixel_array ->
+        xFreeColors display colormap pixel_array (fromIntegral (length pixels)) planes
+
 foreign import ccall unsafe "HsXlib.h XFreeColors"
-	xFreeColors :: Display -> Colormap -> Ptr Pixel -> CInt -> Pixel -> IO ()
+        xFreeColors :: Display -> Colormap -> Ptr Pixel -> CInt -> Pixel -> IO ()
 
 -- | interface to the X11 library function @XStoreColor()@.
 storeColor :: Display -> Colormap -> Color -> IO ()
 storeColor display colormap color =
-	with color $ \ color_ptr ->
-	xStoreColor display colormap color_ptr
+        with color $ \ color_ptr ->
+        xStoreColor display colormap color_ptr
+
 foreign import ccall unsafe "HsXlib.h XStoreColor"
-	xStoreColor  :: Display -> Colormap -> Ptr Color -> IO ()
+        xStoreColor  :: Display -> Colormap -> Ptr Color -> IO ()
 
 -- %fun XStoreColors :: Display -> Colormap -> ListColor -> IO ()
 -- %code XStoreColors(arg1,arg2,arg3,arg3_size)
@@ -123,40 +129,42 @@
 -- | interface to the X11 library function @XQueryColor()@.
 queryColor :: Display -> Colormap -> Color -> IO Color
 queryColor display colormap color =
-	with color $ \ color_ptr -> do
-	xQueryColor display colormap color_ptr
-	peek color_ptr
+        with color $ \ color_ptr -> do
+        xQueryColor display colormap color_ptr
+        peek color_ptr
+
 foreign import ccall unsafe "HsXlib.h XQueryColor"
-	xQueryColor  :: Display -> Colormap -> Ptr Color -> IO ()
+        xQueryColor  :: Display -> Colormap -> Ptr Color -> IO ()
 
 -- | interface to the X11 library function @XQueryColors()@.
 queryColors :: Display -> Colormap -> [Color] -> IO [Color]
 queryColors display colormap colors =
-	withArrayLen colors $ \ ncolors color_array -> do
-	xQueryColors display colormap color_array (fromIntegral ncolors)
-	peekArray ncolors color_array
+        withArrayLen colors $ \ ncolors color_array -> do
+        xQueryColors display colormap color_array (fromIntegral ncolors)
+        peekArray ncolors color_array
+
 foreign import ccall unsafe "HsXlib.h XQueryColors"
-	xQueryColors :: Display -> Colormap -> Ptr Color -> CInt -> IO ()
+        xQueryColors :: Display -> Colormap -> Ptr Color -> CInt -> IO ()
 
 -- | interface to the X11 library function @XInstallColormap()@.
 foreign import ccall unsafe "HsXlib.h XInstallColormap"
-	installColormap     :: Display -> Colormap -> IO ()
+        installColormap     :: Display -> Colormap -> IO ()
 
 -- | interface to the X11 library function @XUninstallColormap()@.
 foreign import ccall unsafe "HsXlib.h XUninstallColormap"
-	uninstallColormap   :: Display -> Colormap -> IO ()
+        uninstallColormap   :: Display -> Colormap -> IO ()
 
 -- | interface to the X11 library function @XCopyColormapAndFree()@.
 foreign import ccall unsafe "HsXlib.h XCopyColormapAndFree"
-	copyColormapAndFree :: Display -> Colormap -> IO Colormap
+        copyColormapAndFree :: Display -> Colormap -> IO Colormap
 
 -- | interface to the X11 library function @XCreateColormap()@.
 foreign import ccall unsafe "HsXlib.h XCreateColormap"
-	createColormap      :: Display -> Window   -> Visual -> ColormapAlloc -> IO Colormap
+        createColormap      :: Display -> Window   -> Visual -> ColormapAlloc -> IO Colormap
 
 -- | interface to the X11 library function @XFreeColormap()@.
 foreign import ccall unsafe "HsXlib.h XFreeColormap"
-	freeColormap        :: Display -> Colormap -> IO ()
+        freeColormap        :: Display -> Colormap -> IO ()
 
 ----------------------------------------------------------------
 -- End
diff --git a/Graphics/X11/Xlib/Context.hs b/Graphics/X11/Xlib/Context.hs
--- a/Graphics/X11/Xlib/Context.hs
+++ b/Graphics/X11/Xlib/Context.hs
@@ -56,31 +56,31 @@
 
 -- | interface to the X11 library function @XSetArcMode()@.
 foreign import ccall unsafe "HsXlib.h XSetArcMode"
-	setArcMode     	     :: Display -> GC -> ArcMode               -> IO ()
+        setArcMode           :: Display -> GC -> ArcMode               -> IO ()
 
 -- | interface to the X11 library function @XSetBackground()@.
 foreign import ccall unsafe "HsXlib.h XSetBackground"
-	setBackground  	     :: Display -> GC -> Pixel                 -> IO ()
+        setBackground        :: Display -> GC -> Pixel                 -> IO ()
 
 -- | interface to the X11 library function @XSetForeground()@.
 foreign import ccall unsafe "HsXlib.h XSetForeground"
-	setForeground 	     :: Display -> GC -> Pixel                 -> IO ()
+        setForeground        :: Display -> GC -> Pixel                 -> IO ()
 
 -- | interface to the X11 library function @XSetFunction()@.
 foreign import ccall unsafe "HsXlib.h XSetFunction"
-	setFunction	     :: Display -> GC -> GXFunction            -> IO ()
+        setFunction          :: Display -> GC -> GXFunction            -> IO ()
 
 -- | interface to the X11 library function @XSetGraphicsExposures()@.
 foreign import ccall unsafe "HsXlib.h XSetGraphicsExposures"
-	setGraphicsExposures :: Display -> GC -> Bool                  -> IO ()
+        setGraphicsExposures :: Display -> GC -> Bool                  -> IO ()
 
 -- | interface to the X11 library function @XSetClipMask()@.
 foreign import ccall unsafe "HsXlib.h XSetClipMask"
-	setClipMask          :: Display -> GC -> Pixmap                -> IO ()
+        setClipMask          :: Display -> GC -> Pixmap                -> IO ()
 
 -- | interface to the X11 library function @XSetClipOrigin()@.
 foreign import ccall unsafe "HsXlib.h XSetClipOrigin"
-	setClipOrigin        :: Display -> GC -> Position -> Position  -> IO ()
+        setClipOrigin        :: Display -> GC -> Position -> Position  -> IO ()
 
 -- XSetClipRectangles omitted because it's not clear when it's safe to delete the
 -- array of rectangles
@@ -88,59 +88,59 @@
 -- | interface to the X11 library function @XSetDashes()@.
 setDashes            :: Display -> GC -> CInt -> String -> CInt  -> IO ()
 setDashes display gc dash_offset dashes n =
-	withCString dashes $ \ dash_list ->
-	xSetDashes display gc dash_offset dash_list n
+        withCString dashes $ \ dash_list ->
+        xSetDashes display gc dash_offset dash_list n
 foreign import ccall unsafe "HsXlib.h XSetDashes"
-	xSetDashes           :: Display -> GC -> CInt -> CString -> CInt -> IO ()
+        xSetDashes           :: Display -> GC -> CInt -> CString -> CInt -> IO ()
 
 -- | interface to the X11 library function @XSetFillRule()@.
 foreign import ccall unsafe "HsXlib.h XSetFillRule"
-	setFillRule          :: Display -> GC -> FillRule              -> IO ()
+        setFillRule          :: Display -> GC -> FillRule              -> IO ()
 
 -- | interface to the X11 library function @XSetFillStyle()@.
 foreign import ccall unsafe "HsXlib.h XSetFillStyle"
-	setFillStyle         :: Display -> GC -> FillStyle             -> IO ()
+        setFillStyle         :: Display -> GC -> FillStyle             -> IO ()
 
 -- | interface to the X11 library function @XSetFont()@.
 foreign import ccall unsafe "HsXlib.h XSetFont"
-	setFont              :: Display -> GC -> Font                  -> IO ()
+        setFont              :: Display -> GC -> Font                  -> IO ()
 
 -- | interface to the X11 library function @XSetLineAttributes()@.
 foreign import ccall unsafe "HsXlib.h XSetLineAttributes"
-	setLineAttributes    :: Display -> GC -> CInt -> LineStyle ->
-					CapStyle -> JoinStyle -> IO ()
+        setLineAttributes    :: Display -> GC -> CInt -> LineStyle ->
+                                        CapStyle -> JoinStyle -> IO ()
 
 -- | interface to the X11 library function @XSetPlaneMask()@.
 foreign import ccall unsafe "HsXlib.h XSetPlaneMask"
-	setPlaneMask         :: Display -> GC -> Pixel                 -> IO ()
+        setPlaneMask         :: Display -> GC -> Pixel                 -> IO ()
 
 -- | interface to the X11 library function @XSetState()@.
 foreign import ccall unsafe "HsXlib.h XSetState"
-	setState             :: Display -> GC -> Pixel -> Pixel ->
-					GXFunction -> Pixel            -> IO ()
+        setState             :: Display -> GC -> Pixel -> Pixel ->
+                                        GXFunction -> Pixel            -> IO ()
 
 -- | interface to the X11 library function @XSetStipple()@.
 foreign import ccall unsafe "HsXlib.h XSetStipple"
-	setStipple           :: Display -> GC -> Pixmap                -> IO ()
+        setStipple           :: Display -> GC -> Pixmap                -> IO ()
 
 -- | interface to the X11 library function @XSetSubwindowMode()@.
 foreign import ccall unsafe "HsXlib.h XSetSubwindowMode"
-	setSubwindowMode     :: Display -> GC -> SubWindowMode         -> IO ()
+        setSubwindowMode     :: Display -> GC -> SubWindowMode         -> IO ()
 
 -- | interface to the X11 library function @XSetTSOrigin()@.
 foreign import ccall unsafe "HsXlib.h XSetTSOrigin"
-	setTSOrigin          :: Display -> GC -> Position -> Position  -> IO ()
+        setTSOrigin          :: Display -> GC -> Position -> Position  -> IO ()
 
 -- | interface to the X11 library function @XSetTile()@.
 foreign import ccall unsafe "HsXlib.h XSetTile"
-	setTile              :: Display -> GC -> Pixmap                -> IO ()
+        setTile              :: Display -> GC -> Pixmap                -> IO ()
 
 -- ToDo: create a real interface to this
 -- | partial interface to the X11 library function @XCreateGC()@.
 createGC :: Display -> Drawable -> IO GC
 createGC display d = xCreateGC display d 0 nullPtr
 foreign import ccall unsafe "HsXlib.h XCreateGC"
-	xCreateGC  :: Display -> Drawable -> ValueMask -> Ptr GCValues -> IO GC
+        xCreateGC  :: Display -> Drawable -> ValueMask -> Ptr GCValues -> IO GC
 
 type ValueMask = Word32
 
@@ -151,40 +151,40 @@
 -- {%
 -- typedef unsigned long GCMask; /* cf XtGCMask */
 -- typedef struct _gcvalues {
---     GCMask	mask;
---     XGCValues	values;
+--     GCMask   mask;
+--     XGCValues        values;
 -- }* GCValueSet;
 -- %}
 --
--- IMPURE GCValueSet	emptyGCValueSet()
+-- IMPURE GCValueSet    emptyGCValueSet()
 -- RESULT: (RETVAL = (GCValueSet) malloc(sizeof(struct _gcvalues))) ? RETVAL->mask = 0, RETVAL : RETVAL;
 -- POST: RETVAL != NULL
 --
--- IMPURE void	setGCForeground(colour, set)
--- IN Pixel	colour
--- IN GCValueSet	set
+-- IMPURE void  setGCForeground(colour, set)
+-- IN Pixel     colour
+-- IN GCValueSet        set
 -- RESULT: set->mask |= GCForeground; set->values.foreground = colour
 --
--- IMPURE void	setGCBackground(colour, set)
--- IN Pixel	colour
--- IN GCValueSet	set
+-- IMPURE void  setGCBackground(colour, set)
+-- IN Pixel     colour
+-- IN GCValueSet        set
 -- RESULT: set->mask |= GCBackground; set->values.background = colour
 --
--- IMPURE void	freeGCValueSet(set)
--- IN GCValueSet	set
+-- IMPURE void  freeGCValueSet(set)
+-- IN GCValueSet        set
 -- RESULT: free(set)
 --
--- IMPURE GC	XCreateGC(display, d, set->mask, &(set->values))
+-- IMPURE GC    XCreateGC(display, d, set->mask, &(set->values))
 -- NAME: xCreateGC
--- IN Display*	display
--- IN Drawable	d
--- IN GCValueSet	set
+-- IN Display*  display
+-- IN Drawable  d
+-- IN GCValueSet        set
 --
--- IMPURE void	XChangeGC(display, gc, set->mask, &(set->values))
+-- IMPURE void  XChangeGC(display, gc, set->mask, &(set->values))
 -- NAME: xChangeGC
--- IN Display*	display
--- IN GC		gc
--- IN GCValueSet	set
+-- IN Display*  display
+-- IN GC                gc
+-- IN GCValueSet        set
 --
 -- STARTH
 -- -- Code that packages GCValueSets up in a clean monoidic way.
@@ -220,19 +220,19 @@
 
 -- | interface to the X11 library function @XGContextFromGC()@.
 foreign import ccall unsafe "HsXlib.h XGContextFromGC"
-	gContextFromGC :: GC -> GContext
+        gContextFromGC :: GC -> GContext
 
 -- | interface to the X11 library function @XFreeGC()@.
 foreign import ccall unsafe "HsXlib.h XFreeGC"
-	freeGC  :: Display -> GC -> IO ()
+        freeGC  :: Display -> GC -> IO ()
 
 -- | interface to the X11 library function @XFlushGC()@.
 foreign import ccall unsafe "HsXlib.h XFlushGC"
-	flushGC :: Display -> GC -> IO ()
+        flushGC :: Display -> GC -> IO ()
 
 -- | interface to the X11 library function @XCopyGC()@.
 foreign import ccall unsafe "HsXlib.h XCopyGC"
-	copyGC  :: Display -> GC -> Mask -> GC -> IO ()
+        copyGC  :: Display -> GC -> Mask -> GC -> IO ()
 
 ----------------------------------------------------------------
 -- End
diff --git a/Graphics/X11/Xlib/Display.hs b/Graphics/X11/Xlib/Display.hs
--- a/Graphics/X11/Xlib/Display.hs
+++ b/Graphics/X11/Xlib/Display.hs
@@ -62,15 +62,15 @@
 
 -- | interface to the X11 library function @XAllPlanes()@.
 foreign import ccall unsafe "HsXlib.h XAllPlanes"
-	allPlanes_aux           :: Pixel
+        allPlanes_aux           :: Pixel
 
 -- | interface to the X11 library function @XBlackPixel()@.
 foreign import ccall unsafe "HsXlib.h XBlackPixel"
-	blackPixel              :: Display -> ScreenNumber -> Pixel
+        blackPixel              :: Display -> ScreenNumber -> Pixel
 
 -- | interface to the X11 library function @XWhitePixel()@.
 foreign import ccall unsafe "HsXlib.h XWhitePixel"
-	whitePixel              :: Display -> ScreenNumber -> Pixel
+        whitePixel              :: Display -> ScreenNumber -> Pixel
 
 -- This may vary from one execution to another but I believe it
 -- is constant during any given execution and so it can be made PURE
@@ -82,149 +82,149 @@
 
 -- | interface to the X11 library function @XConnectionNumber()@.
 foreign import ccall unsafe "HsXlib.h XConnectionNumber"
-	connectionNumber        :: Display -> CInt
+        connectionNumber        :: Display -> CInt
 
 -- | interface to the X11 library function @XDefaultColormap()@.
 foreign import ccall unsafe "HsXlib.h XDefaultColormap"
-	defaultColormap         :: Display -> ScreenNumber -> Colormap
+        defaultColormap         :: Display -> ScreenNumber -> Colormap
 
 -- XListDepths :: Display -> ScreenNumber -> ListInt using res1 = XListDepths(arg1,arg2,&res1_size)
 
 -- | interface to the X11 library function @XDefaultGC()@.
 foreign import ccall unsafe "HsXlib.h XDefaultGC"
-	defaultGC               :: Display -> ScreenNumber -> GC
+        defaultGC               :: Display -> ScreenNumber -> GC
 
 -- | interface to the X11 library function @XDefaultDepth()@.
 foreign import ccall unsafe "HsXlib.h XDefaultDepth"
-	defaultDepth            :: Display -> ScreenNumber -> CInt
+        defaultDepth            :: Display -> ScreenNumber -> CInt
 
 -- | interface to the X11 library function @XDefaultScreen()@.
 foreign import ccall unsafe "HsXlib.h XDefaultScreen"
-	defaultScreen           :: Display -> ScreenNumber
+        defaultScreen           :: Display -> ScreenNumber
 
 -- | interface to the X11 library function @XDefaultScreenOfDisplay()@.
 foreign import ccall unsafe "HsXlib.h XDefaultScreenOfDisplay"
-	defaultScreenOfDisplay  :: Display -> Screen
+        defaultScreenOfDisplay  :: Display -> Screen
 
 -- | interface to the X11 library function @XDisplayHeight()@.
 foreign import ccall unsafe "HsXlib.h XDisplayHeight"
-	displayHeight           :: Display -> ScreenNumber -> CInt
+        displayHeight           :: Display -> ScreenNumber -> CInt
 
 -- | interface to the X11 library function @XDisplayHeightMM()@.
 foreign import ccall unsafe "HsXlib.h XDisplayHeightMM"
-	displayHeightMM         :: Display -> ScreenNumber -> CInt
+        displayHeightMM         :: Display -> ScreenNumber -> CInt
 
 -- | interface to the X11 library function @XDisplayWidth()@.
 foreign import ccall unsafe "HsXlib.h XDisplayWidth"
-	displayWidth            :: Display -> ScreenNumber -> CInt
+        displayWidth            :: Display -> ScreenNumber -> CInt
 
 -- | interface to the X11 library function @XDisplayWidthMM()@.
 foreign import ccall unsafe "HsXlib.h XDisplayWidthMM"
-	displayWidthMM          :: Display -> ScreenNumber -> CInt
+        displayWidthMM          :: Display -> ScreenNumber -> CInt
 
 -- | interface to the X11 library function @XMaxRequestSize()@.
 foreign import ccall unsafe "HsXlib.h XMaxRequestSize"
-	maxRequestSize          :: Display -> CInt
+        maxRequestSize          :: Display -> CInt
 
 -- | interface to the X11 library function @XDisplayMotionBufferSize()@.
 foreign import ccall unsafe "HsXlib.h XDisplayMotionBufferSize"
-	displayMotionBufferSize :: Display -> CInt
---Disnae exist in X11R5 	XExtendedMaxRequestSize :: Display -> Int
+        displayMotionBufferSize :: Display -> CInt
+--Disnae exist in X11R5         XExtendedMaxRequestSize :: Display -> Int
 
 -- | interface to the X11 library function @XResourceManagerString()@.
 resourceManagerString   :: Display -> String
 resourceManagerString display = xlibCString (xResourceManagerString display)
 foreign import ccall unsafe "HsXlib.h XResourceManagerString"
-	xResourceManagerString  :: Display -> IO CString
+        xResourceManagerString  :: Display -> IO CString
 
 -- | interface to the X11 library function @XScreenResourceString()@.
 screenResourceString    :: Screen   -> String
 screenResourceString screen = xlibCString (xScreenResourceString screen)
 foreign import ccall unsafe "HsXlib.h XScreenResourceString"
-	xScreenResourceString   :: Screen   -> IO CString
+        xScreenResourceString   :: Screen   -> IO CString
 
 -- | interface to the X11 library function @XDisplayString()@.
 displayString           :: Display -> String
 displayString display = xlibCString (xDisplayString display)
 foreign import ccall unsafe "HsXlib.h XDisplayString"
-	xDisplayString          :: Display -> IO CString
+        xDisplayString          :: Display -> IO CString
 
 -- | interface to the X11 library function @XImageByteOrder()@.
 foreign import ccall unsafe "HsXlib.h XImageByteOrder"
-	imageByteOrder          :: Display -> CInt
+        imageByteOrder          :: Display -> CInt
 
 -- | interface to the X11 library function @XProtocolRevision()@.
 foreign import ccall unsafe "HsXlib.h XProtocolRevision"
-	protocolRevision        :: Display -> CInt
+        protocolRevision        :: Display -> CInt
 
 -- | interface to the X11 library function @XProtocolVersion()@.
 foreign import ccall unsafe "HsXlib.h XProtocolVersion"
-	protocolVersion         :: Display -> CInt
+        protocolVersion         :: Display -> CInt
 
 -- | interface to the X11 library function @XServerVendor()@.
 serverVendor            :: Display -> String
 serverVendor display = xlibCString (xServerVendor display)
 foreign import ccall unsafe "HsXlib.h XServerVendor"
-	xServerVendor           :: Display -> IO CString
+        xServerVendor           :: Display -> IO CString
 
---Disnae exist: 	XServerRelease          :: Display -> Int
+--Disnae exist:         XServerRelease          :: Display -> Int
 
 -- | interface to the X11 library function @XScreenCount()@.
 foreign import ccall unsafe "HsXlib.h XScreenCount"
-	screenCount             :: Display -> CInt
+        screenCount             :: Display -> CInt
 
 -- | interface to the X11 library function @XDefaultVisual()@.
 foreign import ccall unsafe "HsXlib.h XDefaultVisual"
-	defaultVisual           :: Display -> ScreenNumber -> Visual
+        defaultVisual           :: Display -> ScreenNumber -> Visual
 
 -- | interface to the X11 library function @XDisplayCells()@.
 foreign import ccall unsafe "HsXlib.h XDisplayCells"
-	displayCells            :: Display -> ScreenNumber -> CInt
+        displayCells            :: Display -> ScreenNumber -> CInt
 
 -- | interface to the X11 library function @XDisplayPlanes()@.
 foreign import ccall unsafe "HsXlib.h XDisplayPlanes"
-	displayPlanes           :: Display -> ScreenNumber -> CInt
+        displayPlanes           :: Display -> ScreenNumber -> CInt
 
 -- | interface to the X11 library function @XScreenOfDisplay()@.
 foreign import ccall unsafe "HsXlib.h XScreenOfDisplay"
-	screenOfDisplay         :: Display -> ScreenNumber -> Screen
+        screenOfDisplay         :: Display -> ScreenNumber -> Screen
 
 -- | interface to the X11 library function @XDefaultRootWindow()@.
 foreign import ccall unsafe "HsXlib.h XDefaultRootWindow"
-	defaultRootWindow       :: Display -> Window
+        defaultRootWindow       :: Display -> Window
 
 -- The following are believed to be order dependent
 
 -- | interface to the X11 library function @XRootWindow()@.
 foreign import ccall unsafe "HsXlib.h XRootWindow"
-	rootWindow    	        :: Display -> ScreenNumber -> IO Window
+        rootWindow              :: Display -> ScreenNumber -> IO Window
 
 -- | interface to the X11 library function @XQLength()@.
 foreign import ccall unsafe "HsXlib.h XQLength"
-	qLength       	        :: Display -> IO CInt
+        qLength                 :: Display -> IO CInt
 
 -- | interface to the X11 library function @XNoOp()@.
 foreign import ccall unsafe "HsXlib.h XNoOp"
-	noOp          	        :: Display -> IO ()
+        noOp                    :: Display -> IO ()
 
 -- | interface to the X11 library function @XOpenDisplay()@.
 openDisplay :: String -> IO Display
 openDisplay name =
-	withCString name $ \ c_name -> do
-	display <- throwIfNull "openDisplay" (xOpenDisplay c_name)
-	return (Display display)
+        withCString name $ \ c_name -> do
+        display <- throwIfNull "openDisplay" (xOpenDisplay c_name)
+        return (Display display)
 foreign import ccall unsafe "HsXlib.h XOpenDisplay"
-	xOpenDisplay :: CString -> IO (Ptr Display)
+        xOpenDisplay :: CString -> IO (Ptr Display)
 
 -- | interface to the X11 library function @XCloseDisplay()@.
 foreign import ccall unsafe "HsXlib.h XCloseDisplay"
-	closeDisplay            :: Display -> IO ()
+        closeDisplay            :: Display -> IO ()
 
 -- | convert a CString owned by Xlib to a Haskell String
 xlibCString :: IO CString -> String
 xlibCString act = unsafePerformIO $ do
-	cs <- act
-	peekCString cs
+        cs <- act
+        peekCString cs
 
 ----------------------------------------------------------------
 -- End
diff --git a/Graphics/X11/Xlib/Extras.hsc b/Graphics/X11/Xlib/Extras.hsc
--- a/Graphics/X11/Xlib/Extras.hsc
+++ b/Graphics/X11/Xlib/Extras.hsc
@@ -1,11 +1,10 @@
 {-# OPTIONS -fglasgow-exts -fno-warn-name-shadowing #-}
 -----------------------------------------------------------------------------
 -- |
--- Module      :
--- Copyright   :  (c) Spencer Janssen
--- License     :  BSD3-style (see LICENSE)
--- 
--- Stability   :  stable
+-- Module      : Graphics.X11.Xlib.Extras
+-- Copyright   : 2007 (c) Spencer Janssen
+-- License     : BSD3-style (see LICENSE)
+-- Stability   : experimental
 --
 -----------------------------------------------------------------------------
 --
@@ -1083,30 +1082,30 @@
             xFree prop_ptr
             return $ Just retval
 
-getWindowProperty8 :: Display -> Atom -> Window -> IO (Maybe [Word8])
+getWindowProperty8 :: Display -> Atom -> Window -> IO (Maybe [CChar])
 getWindowProperty8 = rawGetWindowProperty 8
 
-getWindowProperty16 :: Display -> Atom -> Window -> IO (Maybe [Word16])
+getWindowProperty16 :: Display -> Atom -> Window -> IO (Maybe [CShort])
 getWindowProperty16 = rawGetWindowProperty 16
 
-getWindowProperty32 :: Display -> Atom -> Window -> IO (Maybe [Word32])
+getWindowProperty32 :: Display -> Atom -> Window -> IO (Maybe [CLong])
 getWindowProperty32 = rawGetWindowProperty 32
 
 -- this assumes bytes are 8 bits.  I hope X isn't more portable than that :(
 
-changeProperty8 :: Display -> Window -> Atom -> Atom -> CInt -> [Word8] -> IO ()
+changeProperty8 :: Display -> Window -> Atom -> Atom -> CInt -> [CChar] -> IO ()
 changeProperty8 dpy w prop typ mode dat =
     withArrayLen dat $ \ len ptr -> do
         xChangeProperty dpy w prop typ 8 mode (castPtr ptr) (fromIntegral len)
         return ()
 
-changeProperty16 :: Display -> Window -> Atom -> Atom -> CInt -> [Word16] -> IO ()
+changeProperty16 :: Display -> Window -> Atom -> Atom -> CInt -> [CShort] -> IO ()
 changeProperty16 dpy w prop typ mode dat =
     withArrayLen dat $ \ len ptr -> do
         xChangeProperty dpy w prop typ 16 mode (castPtr ptr) (fromIntegral len)
         return ()
 
-changeProperty32 :: Display -> Window -> Atom -> Atom -> CInt -> [Word32] -> IO ()
+changeProperty32 :: Display -> Window -> Atom -> Atom -> CInt -> [CLong] -> IO ()
 changeProperty32 dpy w prop typ mode dat =
     withArrayLen dat $ \ len ptr -> do
         xChangeProperty dpy w prop typ 32 mode (castPtr ptr) (fromIntegral len)
diff --git a/Graphics/X11/Xlib/Region.hs b/Graphics/X11/Xlib/Region.hs
--- a/Graphics/X11/Xlib/Region.hs
+++ b/Graphics/X11/Xlib/Region.hs
@@ -60,9 +60,9 @@
 
 newtype Region = Region (ForeignPtr Region)
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Ord, Show, Typeable, Data)
+        deriving (Eq, Ord, Show, Typeable, Data)
 #else
-	deriving (Eq, Ord, Show)
+        deriving (Eq, Ord, Show)
 #endif
 
 withRegion :: Region -> (Ptr Region -> IO a) -> IO a
@@ -89,8 +89,8 @@
 
 makeRegion :: Ptr Region -> IO Region
 makeRegion rp = do
-	r <- newForeignPtr xDestroyRegionPtr rp
-	return (Region r)
+        r <- newForeignPtr xDestroyRegionPtr rp
+        return (Region r)
 
 -- an empty region
 -- (often used as "out argument" to binary operators which return regions)
@@ -98,19 +98,19 @@
 -- | interface to the X11 library function @XCreateRegion()@.
 createRegion :: IO Region
 createRegion = do
-	rp <- xCreateRegion
-	makeRegion rp
+        rp <- xCreateRegion
+        makeRegion rp
 foreign import ccall unsafe "HsXlib.h XCreateRegion"
         xCreateRegion :: IO (Ptr Region)
 
 -- | interface to the X11 library function @XPolygonRegion()@.
 polygonRegion :: [Point] -> FillRule -> IO Region
 polygonRegion points fill_rule =
-	withArrayLen points $ \ n point_arr -> do
-	rp <- xPolygonRegion point_arr (fromIntegral n) fill_rule
-	makeRegion rp
+        withArrayLen points $ \ n point_arr -> do
+        rp <- xPolygonRegion point_arr (fromIntegral n) fill_rule
+        makeRegion rp
 foreign import ccall unsafe "HsXlib.h XPolygonRegion"
-	xPolygonRegion :: Ptr Point -> CInt -> FillRule -> IO (Ptr Region)
+        xPolygonRegion :: Ptr Point -> CInt -> FillRule -> IO (Ptr Region)
 
 ----------------------------------------------------------------
 -- Combining Regions
@@ -125,57 +125,57 @@
 -- | interface to the X11 library function @XIntersectRegion()@.
 intersectRegion     :: Region -> Region -> Region -> IO CInt
 intersectRegion src1 src2 dest =
-	withRegion src1 $ \ src1_ptr ->
-	withRegion src2 $ \ src2_ptr ->
-	withRegion dest $ \ dest_ptr ->
-	xIntersectRegion src1_ptr src2_ptr dest_ptr
+        withRegion src1 $ \ src1_ptr ->
+        withRegion src2 $ \ src2_ptr ->
+        withRegion dest $ \ dest_ptr ->
+        xIntersectRegion src1_ptr src2_ptr dest_ptr
 foreign import ccall unsafe
-	"HsXlib.h XIntersectRegion" xIntersectRegion ::
-	Ptr Region -> Ptr Region -> Ptr Region -> IO CInt
+        "HsXlib.h XIntersectRegion" xIntersectRegion ::
+        Ptr Region -> Ptr Region -> Ptr Region -> IO CInt
 
 -- | interface to the X11 library function @XSubtractRegion()@.
 subtractRegion     :: Region -> Region -> Region -> IO CInt
 subtractRegion src1 src2 dest =
-	withRegion src1 $ \ src1_ptr ->
-	withRegion src2 $ \ src2_ptr ->
-	withRegion dest $ \ dest_ptr ->
-	xSubtractRegion src1_ptr src2_ptr dest_ptr
+        withRegion src1 $ \ src1_ptr ->
+        withRegion src2 $ \ src2_ptr ->
+        withRegion dest $ \ dest_ptr ->
+        xSubtractRegion src1_ptr src2_ptr dest_ptr
 foreign import ccall unsafe
-	"HsXlib.h XSubtractRegion" xSubtractRegion ::
-	Ptr Region -> Ptr Region -> Ptr Region -> IO CInt
+        "HsXlib.h XSubtractRegion" xSubtractRegion ::
+        Ptr Region -> Ptr Region -> Ptr Region -> IO CInt
 
 -- | interface to the X11 library function @XUnionRectWithRegion()@.
 unionRectWithRegion     :: Rectangle -> Region -> Region -> IO CInt
 unionRectWithRegion rect src dest =
-	with rect $ \ rect_ptr ->
-	withRegion src $ \ src_ptr ->
-	withRegion dest $ \ dest_ptr ->
-	xUnionRectWithRegion rect_ptr src_ptr dest_ptr
+        with rect $ \ rect_ptr ->
+        withRegion src $ \ src_ptr ->
+        withRegion dest $ \ dest_ptr ->
+        xUnionRectWithRegion rect_ptr src_ptr dest_ptr
 foreign import ccall unsafe
-	"HsXlib.h XUnionRectWithRegion" xUnionRectWithRegion ::
-	Ptr Rectangle -> Ptr Region -> Ptr Region -> IO CInt
+        "HsXlib.h XUnionRectWithRegion" xUnionRectWithRegion ::
+        Ptr Rectangle -> Ptr Region -> Ptr Region -> IO CInt
 
 -- | interface to the X11 library function @XUnionRegion()@.
 unionRegion     :: Region -> Region -> Region -> IO CInt
 unionRegion src1 src2 dest =
-	withRegion src1 $ \ src1_ptr ->
-	withRegion src2 $ \ src2_ptr ->
-	withRegion dest $ \ dest_ptr ->
-	xUnionRegion src1_ptr src2_ptr dest_ptr
+        withRegion src1 $ \ src1_ptr ->
+        withRegion src2 $ \ src2_ptr ->
+        withRegion dest $ \ dest_ptr ->
+        xUnionRegion src1_ptr src2_ptr dest_ptr
 foreign import ccall unsafe
-	"HsXlib.h XUnionRegion" xUnionRegion ::
-	Ptr Region -> Ptr Region -> Ptr Region -> IO CInt
+        "HsXlib.h XUnionRegion" xUnionRegion ::
+        Ptr Region -> Ptr Region -> Ptr Region -> IO CInt
 
 -- | interface to the X11 library function @XXorRegion()@.
 xorRegion     :: Region -> Region -> Region -> IO CInt
 xorRegion src1 src2 dest =
-	withRegion src1 $ \ src1_ptr ->
-	withRegion src2 $ \ src2_ptr ->
-	withRegion dest $ \ dest_ptr ->
-	xXorRegion src1_ptr src2_ptr dest_ptr
+        withRegion src1 $ \ src1_ptr ->
+        withRegion src2 $ \ src2_ptr ->
+        withRegion dest $ \ dest_ptr ->
+        xXorRegion src1_ptr src2_ptr dest_ptr
 foreign import ccall unsafe
-	"HsXlib.h XXorRegion" xXorRegion ::
-	Ptr Region -> Ptr Region -> Ptr Region -> IO CInt
+        "HsXlib.h XXorRegion" xXorRegion ::
+        Ptr Region -> Ptr Region -> Ptr Region -> IO CInt
 
 ----------------------------------------------------------------
 -- Examining regions (tests, bounding boxes, etc)
@@ -185,46 +185,46 @@
 emptyRegion :: Region -> IO Bool
 emptyRegion r = withRegion r xEmptyRegion
 foreign import ccall unsafe "HsXlib.h XEmptyRegion"
-	xEmptyRegion :: Ptr Region -> IO Bool
+        xEmptyRegion :: Ptr Region -> IO Bool
 
 -- | interface to the X11 library function @XEqualRegion()@.
 equalRegion :: Region -> Region -> IO Bool
 equalRegion r1 r2 =
-	withRegion r1 $ \ rp1 ->
-	withRegion r2 $ \ rp2 ->
-	xEqualRegion rp1 rp2
+        withRegion r1 $ \ rp1 ->
+        withRegion r2 $ \ rp2 ->
+        xEqualRegion rp1 rp2
 foreign import ccall unsafe "HsXlib.h XEqualRegion"
-	xEqualRegion :: Ptr Region -> Ptr Region -> IO Bool
+        xEqualRegion :: Ptr Region -> Ptr Region -> IO Bool
 
 -- | interface to the X11 library function @XPointInRegion()@.
 pointInRegion :: Region -> Point -> IO Bool
 pointInRegion r (Point x y) =
-	withRegion r $ \ rp ->
-	xPointInRegion rp x y
+        withRegion r $ \ rp ->
+        xPointInRegion rp x y
 foreign import ccall unsafe "HsXlib.h XPointInRegion"
-	xPointInRegion :: Ptr Region -> Position -> Position -> IO Bool
+        xPointInRegion :: Ptr Region -> Position -> Position -> IO Bool
 
 -- | interface to the X11 library function @XRectInRegion()@.
 rectInRegion :: Region -> Rectangle -> IO RectInRegionResult
 rectInRegion r (Rectangle x y w h) =
-	withRegion r $ \ rp ->
-	xRectInRegion rp x y w h
+        withRegion r $ \ rp ->
+        xRectInRegion rp x y w h
 foreign import ccall unsafe "HsXlib.h XRectInRegion"
-	xRectInRegion :: Ptr Region -> Position -> Position ->
-		Dimension -> Dimension -> IO RectInRegionResult
+        xRectInRegion :: Ptr Region -> Position -> Position ->
+                Dimension -> Dimension -> IO RectInRegionResult
 
 -- I have no idea what the int is for
 
 -- | interface to the X11 library function @XClipBox()@.
 clipBox :: Region -> IO (Rectangle,CInt)
 clipBox r =
-	withRegion r $ \ rp ->
-	alloca $ \ rect_ptr -> do
-	res <- xClipBox rp rect_ptr
-	rect <- peek rect_ptr
-	return (rect, res)
+        withRegion r $ \ rp ->
+        alloca $ \ rect_ptr -> do
+        res <- xClipBox rp rect_ptr
+        rect <- peek rect_ptr
+        return (rect, res)
 foreign import ccall unsafe "HsXlib.h XClipBox"
-	xClipBox :: Ptr Region -> Ptr Rectangle -> IO CInt
+        xClipBox :: Ptr Region -> Ptr Rectangle -> IO CInt
 
 ----------------------------------------------------------------
 -- Modifying regions
@@ -237,10 +237,10 @@
 -- | interface to the X11 library function @XOffsetRegion()@.
 offsetRegion :: Region -> Point -> IO CInt
 offsetRegion r (Point x y) =
-	withRegion r $ \ rp ->
-	xOffsetRegion rp x y
+        withRegion r $ \ rp ->
+        xOffsetRegion rp x y
 foreign import ccall unsafe "HsXlib.h XOffsetRegion"
-	xOffsetRegion :: Ptr Region -> Position -> Position -> IO CInt
+        xOffsetRegion :: Ptr Region -> Position -> Position -> IO CInt
 
 -- increase size of region by +ve or -ve number of pixels
 -- while preserving the centre of the region (ie half the pixels
@@ -249,10 +249,10 @@
 -- | interface to the X11 library function @XShrinkRegion()@.
 shrinkRegion :: Region -> Point -> IO CInt
 shrinkRegion r (Point x y) =
-	withRegion r $ \ rp ->
-	xShrinkRegion rp x y
+        withRegion r $ \ rp ->
+        xShrinkRegion rp x y
 foreign import ccall unsafe "HsXlib.h XShrinkRegion"
-	xShrinkRegion :: Ptr Region -> Position -> Position -> IO CInt
+        xShrinkRegion :: Ptr Region -> Position -> Position -> IO CInt
 
 ----------------------------------------------------------------
 -- Graphics Context
@@ -263,10 +263,10 @@
 -- | interface to the X11 library function @XSetRegion()@.
 setRegion :: Display -> GC -> Region -> IO CInt
 setRegion disp gc r =
-	withRegion r $ \ rp ->
-	xSetRegion disp gc rp
+        withRegion r $ \ rp ->
+        xSetRegion disp gc rp
 foreign import ccall unsafe "HsXlib.h XSetRegion"
-	xSetRegion :: Display -> GC -> Ptr Region -> IO CInt
+        xSetRegion :: Display -> GC -> Ptr Region -> IO CInt
 
 ----------------------------------------------------------------
 -- End
diff --git a/Graphics/X11/Xlib/Screen.hs b/Graphics/X11/Xlib/Screen.hs
--- a/Graphics/X11/Xlib/Screen.hs
+++ b/Graphics/X11/Xlib/Screen.hs
@@ -49,84 +49,84 @@
 
 -- | interface to the X11 library function @XBlackPixelOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XBlackPixelOfScreen"
-	blackPixelOfScreen      :: Screen -> Pixel
+        blackPixelOfScreen      :: Screen -> Pixel
 
 -- | interface to the X11 library function @XWhitePixelOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XWhitePixelOfScreen"
-	whitePixelOfScreen      :: Screen -> Pixel
+        whitePixelOfScreen      :: Screen -> Pixel
 
 -- | interface to the X11 library function @XCellsOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XCellsOfScreen"
-	cellsOfScreen           :: Screen -> CInt
+        cellsOfScreen           :: Screen -> CInt
 
 -- | interface to the X11 library function @XDefaultColormapOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XDefaultColormapOfScreen"
-	defaultColormapOfScreen :: Screen -> Colormap
+        defaultColormapOfScreen :: Screen -> Colormap
 
 -- | interface to the X11 library function @XDefaultDepthOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XDefaultDepthOfScreen"
-	defaultDepthOfScreen    :: Screen -> CInt
+        defaultDepthOfScreen    :: Screen -> CInt
 
 -- | interface to the X11 library function @XDefaultGCOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XDefaultGCOfScreen"
-	defaultGCOfScreen       :: Screen -> GC
+        defaultGCOfScreen       :: Screen -> GC
 
 -- | interface to the X11 library function @XDefaultVisualOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XDefaultVisualOfScreen"
-	defaultVisualOfScreen   :: Screen -> Visual
+        defaultVisualOfScreen   :: Screen -> Visual
 
 -- | interface to the X11 library function @XDoesBackingStore()@.
 foreign import ccall unsafe "HsXlib.h XDoesBackingStore"
-	doesBackingStore        :: Screen -> Bool
+        doesBackingStore        :: Screen -> Bool
 
 -- | interface to the X11 library function @XDoesSaveUnders()@.
 foreign import ccall unsafe "HsXlib.h XDoesSaveUnders"
-	doesSaveUnders          :: Screen -> Bool
+        doesSaveUnders          :: Screen -> Bool
 
 -- | interface to the X11 library function @XDisplayOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XDisplayOfScreen"
-	displayOfScreen         :: Screen -> Display
+        displayOfScreen         :: Screen -> Display
 
 -- | interface to the X11 library function @XEventMaskOfScreen()@.
 -- Event mask at connection setup time - not current event mask!
 foreign import ccall unsafe "HsXlib.h XEventMaskOfScreen"
-	eventMaskOfScreen       :: Screen -> EventMask
+        eventMaskOfScreen       :: Screen -> EventMask
 
 -- | interface to the X11 library function @XMinCmapsOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XMinCmapsOfScreen"
-	minCmapsOfScreen        :: Screen -> CInt
+        minCmapsOfScreen        :: Screen -> CInt
 
 -- | interface to the X11 library function @XMaxCmapsOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XMaxCmapsOfScreen"
-	maxCmapsOfScreen        :: Screen -> CInt
+        maxCmapsOfScreen        :: Screen -> CInt
 
 -- | interface to the X11 library function @XRootWindowOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XRootWindowOfScreen"
-	rootWindowOfScreen      :: Screen -> Window
+        rootWindowOfScreen      :: Screen -> Window
 
 -- | interface to the X11 library function @XWidthOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XWidthOfScreen"
-	widthOfScreen           :: Screen -> Dimension
+        widthOfScreen           :: Screen -> Dimension
 
 -- | interface to the X11 library function @XWidthMMOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XWidthMMOfScreen"
-	widthMMOfScreen         :: Screen -> Dimension
+        widthMMOfScreen         :: Screen -> Dimension
 
 -- | interface to the X11 library function @XHeightOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XHeightOfScreen"
-	heightOfScreen          :: Screen -> Dimension
+        heightOfScreen          :: Screen -> Dimension
 
 -- | interface to the X11 library function @XHeightMMOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XHeightMMOfScreen"
-	heightMMOfScreen        :: Screen -> Dimension
+        heightMMOfScreen        :: Screen -> Dimension
 
 -- | interface to the X11 library function @XPlanesOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XPlanesOfScreen"
-	planesOfScreen          :: Screen -> CInt
+        planesOfScreen          :: Screen -> CInt
 
 -- | interface to the X11 library function @XScreenNumberOfScreen()@.
 foreign import ccall unsafe "HsXlib.h XScreenNumberOfScreen"
-	screenNumberOfScreen    :: Screen -> ScreenNumber
+        screenNumberOfScreen    :: Screen -> ScreenNumber
 
 ----------------------------------------------------------------
 -- End
diff --git a/Graphics/X11/Xlib/Types.hsc b/Graphics/X11/Xlib/Types.hsc
--- a/Graphics/X11/Xlib/Types.hsc
+++ b/Graphics/X11/Xlib/Types.hsc
@@ -15,9 +15,9 @@
 
 -- #hide
 module Graphics.X11.Xlib.Types(
-	Display(..), Screen, Visual, GC, GCValues, SetWindowAttributes,
-	Image(..), Point(..), Rectangle(..), Arc(..), Segment(..), Color(..),
-	Pixel, Position, Dimension, Angle, ScreenNumber, Buffer
+        Display(..), Screen, Visual, GC, GCValues, SetWindowAttributes,
+        Image(..), Point(..), Rectangle(..), Arc(..), Segment(..), Color(..),
+        Pixel, Position, Dimension, Angle, ScreenNumber, Buffer
         ) where
 
 -- import Control.Monad( zipWithM_ )
@@ -41,57 +41,57 @@
 -- | pointer to an X11 @Display@ structure
 newtype Display    = Display    (Ptr Display)
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Ord, Show, Typeable, Data)
+        deriving (Eq, Ord, Show, Typeable, Data)
 #else
-	deriving (Eq, Ord, Show)
+        deriving (Eq, Ord, Show)
 #endif
 
 -- | pointer to an X11 @Screen@ structure
 newtype Screen     = Screen     (Ptr Screen)
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Ord, Show, Typeable, Data)
+        deriving (Eq, Ord, Show, Typeable, Data)
 #else
-	deriving (Eq, Ord, Show)
+        deriving (Eq, Ord, Show)
 #endif
 
 -- | pointer to an X11 @Visual@ structure
 newtype Visual     = Visual     (Ptr Visual)
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Ord, Show, Typeable, Data)
+        deriving (Eq, Ord, Show, Typeable, Data)
 #else
-	deriving (Eq, Ord, Show)
+        deriving (Eq, Ord, Show)
 #endif
 
 -- | pointer to an X11 @GC@ structure
 newtype GC         = GC         (Ptr GC)
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Ord, Show, Typeable, Data)
+        deriving (Eq, Ord, Show, Typeable, Data)
 #else
-	deriving (Eq, Ord, Show)
+        deriving (Eq, Ord, Show)
 #endif
 
 -- | pointer to an X11 @XGCValues@ structure
 newtype GCValues   = GCValues  (Ptr GCValues)
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Ord, Show, Typeable, Data)
+        deriving (Eq, Ord, Show, Typeable, Data)
 #else
-	deriving (Eq, Ord, Show)
+        deriving (Eq, Ord, Show)
 #endif
 
 -- | pointer to an X11 @XSetWindowAttributes@ structure
 newtype SetWindowAttributes = SetWindowAttributes (Ptr SetWindowAttributes)
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Ord, Show, Typeable, Data)
+        deriving (Eq, Ord, Show, Typeable, Data)
 #else
-	deriving (Eq, Ord, Show)
+        deriving (Eq, Ord, Show)
 #endif
 
 -- | pointer to an X11 @XImage@ structure
 newtype Image    = Image    (Ptr Image)
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Ord, Show, Typeable, Data)
+        deriving (Eq, Ord, Show, Typeable, Data)
 #else
-	deriving (Eq, Ord, Show)
+        deriving (Eq, Ord, Show)
 #endif
 
 type Pixel         = #{type unsigned long}
@@ -111,30 +111,30 @@
 
 peekPositionField :: Ptr a -> CInt -> IO Position
 peekPositionField ptr off = do
-	v <- peekByteOff ptr (fromIntegral off)
-	return (fromIntegral (v::ShortPosition))
+        v <- peekByteOff ptr (fromIntegral off)
+        return (fromIntegral (v::ShortPosition))
 
 peekDimensionField :: Ptr a -> CInt -> IO Dimension
 peekDimensionField ptr off = do
-	v <- peekByteOff ptr (fromIntegral off)
-	return (fromIntegral (v::ShortDimension))
+        v <- peekByteOff ptr (fromIntegral off)
+        return (fromIntegral (v::ShortDimension))
 
 peekAngleField :: Ptr a -> CInt -> IO Angle
 peekAngleField ptr off = do
-	v <- peekByteOff ptr (fromIntegral off)
-	return (fromIntegral (v::ShortAngle))
+        v <- peekByteOff ptr (fromIntegral off)
+        return (fromIntegral (v::ShortAngle))
 
 pokePositionField :: Ptr a -> CInt -> Position -> IO ()
 pokePositionField ptr off v =
-	pokeByteOff ptr (fromIntegral off) (fromIntegral v::ShortPosition)
+        pokeByteOff ptr (fromIntegral off) (fromIntegral v::ShortPosition)
 
 pokeDimensionField :: Ptr a -> CInt -> Dimension -> IO ()
 pokeDimensionField ptr off v =
-	pokeByteOff ptr (fromIntegral off) (fromIntegral v::ShortDimension)
+        pokeByteOff ptr (fromIntegral off) (fromIntegral v::ShortDimension)
 
 pokeAngleField :: Ptr a -> CInt -> Angle -> IO ()
 pokeAngleField ptr off v =
-	pokeByteOff ptr (fromIntegral off) (fromIntegral v::ShortAngle)
+        pokeByteOff ptr (fromIntegral off) (fromIntegral v::ShortAngle)
 
 ----------------------------------------------------------------
 -- Point
@@ -143,21 +143,21 @@
 -- | counterpart of an X11 @XPoint@ structure
 data Point = Point { pt_x :: !Position, pt_y :: !Position }
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Show, Typeable, Data)
+        deriving (Eq, Show, Typeable, Data)
 #else
-	deriving (Eq, Show)
+        deriving (Eq, Show)
 #endif
 
 instance Storable Point where
-	sizeOf _ = #{size XPoint}
-	alignment _ = alignment (undefined::CInt)
-	peek p = do
-		x <- peekPositionField p #{offset XPoint,x}
-		y <- peekPositionField p #{offset XPoint,y}
-		return (Point x y)
-	poke p (Point x y) = do
-		pokePositionField p #{offset XPoint,x} x
-		pokePositionField p #{offset XPoint,y} y
+        sizeOf _ = #{size XPoint}
+        alignment _ = alignment (undefined::CInt)
+        peek p = do
+                x <- peekPositionField p #{offset XPoint,x}
+                y <- peekPositionField p #{offset XPoint,y}
+                return (Point x y)
+        poke p (Point x y) = do
+                pokePositionField p #{offset XPoint,x} x
+                pokePositionField p #{offset XPoint,y} y
 
 ----------------------------------------------------------------
 -- Rectangle
@@ -165,31 +165,31 @@
 
 -- | counterpart of an X11 @XRectangle@ structure
 data Rectangle = Rectangle {
-	rect_x      :: !Position,
-	rect_y      :: !Position,
-	rect_width  :: !Dimension,
-	rect_height :: !Dimension
-	}
+        rect_x      :: !Position,
+        rect_y      :: !Position,
+        rect_width  :: !Dimension,
+        rect_height :: !Dimension
+        }
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Show, Typeable, Data)
+        deriving (Eq, Show, Typeable, Data)
 #else
-	deriving (Eq, Show)
+        deriving (Eq, Show)
 #endif
 
 instance Storable Rectangle where
-	sizeOf _ = #{size XRectangle}
-	alignment _ = alignment (undefined::CInt)
-	peek p = do
-		x	<- peekPositionField p #{offset XRectangle,x}
-		y	<- peekPositionField p #{offset XRectangle,y}
-		width	<- peekDimensionField p #{offset XRectangle,width}
-		height	<- peekDimensionField p #{offset XRectangle,height}
-		return (Rectangle x y width height)
-	poke p (Rectangle x y width height) = do
-		pokePositionField p #{offset XRectangle,x} x
-		pokePositionField p #{offset XRectangle,y} y
-		pokeDimensionField p #{offset XRectangle,width} width
-		pokeDimensionField p #{offset XRectangle,height} height
+        sizeOf _ = #{size XRectangle}
+        alignment _ = alignment (undefined::CInt)
+        peek p = do
+                x       <- peekPositionField p #{offset XRectangle,x}
+                y       <- peekPositionField p #{offset XRectangle,y}
+                width   <- peekDimensionField p #{offset XRectangle,width}
+                height  <- peekDimensionField p #{offset XRectangle,height}
+                return (Rectangle x y width height)
+        poke p (Rectangle x y width height) = do
+                pokePositionField p #{offset XRectangle,x} x
+                pokePositionField p #{offset XRectangle,y} y
+                pokeDimensionField p #{offset XRectangle,width} width
+                pokeDimensionField p #{offset XRectangle,height} height
 
 ----------------------------------------------------------------
 -- Arc
@@ -197,37 +197,37 @@
 
 -- | counterpart of an X11 @XArc@ structure
 data Arc = Arc {
-	arc_x :: Position,
-	arc_y :: Position,
-	arc_width :: Dimension,
-	arc_height :: Dimension,
-	arc_angle1 :: Angle,
-	arc_angle2 :: Angle
-	}
+        arc_x :: Position,
+        arc_y :: Position,
+        arc_width :: Dimension,
+        arc_height :: Dimension,
+        arc_angle1 :: Angle,
+        arc_angle2 :: Angle
+        }
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Show, Typeable)
+        deriving (Eq, Show, Typeable)
 #else
-	deriving (Eq, Show)
+        deriving (Eq, Show)
 #endif
 
 instance Storable Arc where
-	sizeOf _ = #{size XArc}
-	alignment _ = alignment (undefined::CInt)
-	peek p = do
-		x	<- peekPositionField p #{offset XArc,x}
-		y	<- peekPositionField p #{offset XArc,y}
-		width	<- peekDimensionField p #{offset XArc,width}
-		height	<- peekDimensionField p #{offset XArc,height}
-		angle1	<- peekAngleField p #{offset XArc,angle1}
-		angle2	<- peekAngleField p #{offset XArc,angle2}
-		return (Arc x y width height angle1 angle2)
-	poke p (Arc x y width height angle1 angle2) = do
-		pokePositionField p #{offset XArc,x} x
-		pokePositionField p #{offset XArc,y} y
-		pokeDimensionField p #{offset XArc,width} width
-		pokeDimensionField p #{offset XArc,height} height
-		pokeAngleField p #{offset XArc,angle1} angle1
-		pokeAngleField p #{offset XArc,angle2} angle2
+        sizeOf _ = #{size XArc}
+        alignment _ = alignment (undefined::CInt)
+        peek p = do
+                x       <- peekPositionField p #{offset XArc,x}
+                y       <- peekPositionField p #{offset XArc,y}
+                width   <- peekDimensionField p #{offset XArc,width}
+                height  <- peekDimensionField p #{offset XArc,height}
+                angle1  <- peekAngleField p #{offset XArc,angle1}
+                angle2  <- peekAngleField p #{offset XArc,angle2}
+                return (Arc x y width height angle1 angle2)
+        poke p (Arc x y width height angle1 angle2) = do
+                pokePositionField p #{offset XArc,x} x
+                pokePositionField p #{offset XArc,y} y
+                pokeDimensionField p #{offset XArc,width} width
+                pokeDimensionField p #{offset XArc,height} height
+                pokeAngleField p #{offset XArc,angle1} angle1
+                pokeAngleField p #{offset XArc,angle2} angle2
 
 ----------------------------------------------------------------
 -- Segment
@@ -235,31 +235,31 @@
 
 -- | counterpart of an X11 @XSegment@ structure
 data Segment = Segment {
-	seg_x1 :: Position,
-	seg_y1 :: Position,
-	seg_x2 :: Position,
-	seg_y2 :: Position
-	}
+        seg_x1 :: Position,
+        seg_y1 :: Position,
+        seg_x2 :: Position,
+        seg_y2 :: Position
+        }
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Show, Typeable, Data)
+        deriving (Eq, Show, Typeable, Data)
 #else
-	deriving (Eq, Show)
+        deriving (Eq, Show)
 #endif
 
 instance Storable Segment where
-	sizeOf _ = #{size XSegment}
-	alignment _ = alignment (undefined::CInt)
-	peek p = do
-		x1 <- peekPositionField p #{offset XSegment,x1}
-		y1 <- peekPositionField p #{offset XSegment,y1}
-		x2 <- peekPositionField p #{offset XSegment,x2}
-		y2 <- peekPositionField p #{offset XSegment,y2}
-		return (Segment x1 y1 x2 y2)
-	poke p (Segment x1 y1 x2 y2) = do
-		pokePositionField p #{offset XSegment,x1} x1
-		pokePositionField p #{offset XSegment,y1} y1
-		pokePositionField p #{offset XSegment,x2} x2
-		pokePositionField p #{offset XSegment,y2} y2
+        sizeOf _ = #{size XSegment}
+        alignment _ = alignment (undefined::CInt)
+        peek p = do
+                x1 <- peekPositionField p #{offset XSegment,x1}
+                y1 <- peekPositionField p #{offset XSegment,y1}
+                x2 <- peekPositionField p #{offset XSegment,x2}
+                y2 <- peekPositionField p #{offset XSegment,y2}
+                return (Segment x1 y1 x2 y2)
+        poke p (Segment x1 y1 x2 y2) = do
+                pokePositionField p #{offset XSegment,x1} x1
+                pokePositionField p #{offset XSegment,y1} y1
+                pokePositionField p #{offset XSegment,x2} x2
+                pokePositionField p #{offset XSegment,y2} y2
 
 ----------------------------------------------------------------
 -- Color
@@ -267,34 +267,34 @@
 
 -- | counterpart of an X11 @XColor@ structure
 data Color = Color {
-	color_pixel :: Pixel,
-	color_red :: Word16,
-	color_green :: Word16,
-	color_blue :: Word16,
-	color_flags :: Word8
-	}
+        color_pixel :: Pixel,
+        color_red :: Word16,
+        color_green :: Word16,
+        color_blue :: Word16,
+        color_flags :: Word8
+        }
 #if __GLASGOW_HASKELL__
-	deriving (Eq, Show, Typeable, Data)
+        deriving (Eq, Show, Typeable, Data)
 #else
-	deriving (Eq, Show)
+        deriving (Eq, Show)
 #endif
 
 instance Storable Color where
-	sizeOf _ = #{size XColor}
-	alignment _ = alignment (undefined::CInt)
-	peek p = do
-		pixel	<- #{peek XColor,pixel}	p
-		red	<- #{peek XColor,red}	p
-		green	<- #{peek XColor,green}	p
-		blue	<- #{peek XColor,blue}	p
-		flags	<- #{peek XColor,flags}	p
-		return (Color pixel red green blue flags)
-	poke p (Color pixel red green blue flags) = do
-		#{poke XColor,pixel}	p pixel
-		#{poke XColor,red}	p red
-		#{poke XColor,green}	p green
-		#{poke XColor,blue}	p blue
-		#{poke XColor,flags}	p flags
+        sizeOf _ = #{size XColor}
+        alignment _ = alignment (undefined::CInt)
+        peek p = do
+                pixel   <- #{peek XColor,pixel} p
+                red     <- #{peek XColor,red}   p
+                green   <- #{peek XColor,green} p
+                blue    <- #{peek XColor,blue}  p
+                flags   <- #{peek XColor,flags} p
+                return (Color pixel red green blue flags)
+        poke p (Color pixel red green blue flags) = do
+                #{poke XColor,pixel}    p pixel
+                #{poke XColor,red}      p red
+                #{poke XColor,green}    p green
+                #{poke XColor,blue}     p blue
+                #{poke XColor,flags}    p flags
 
 ----------------------------------------------------------------
 -- End
diff --git a/Graphics/X11/Xlib/Window.hs b/Graphics/X11/Xlib/Window.hs
--- a/Graphics/X11/Xlib/Window.hs
+++ b/Graphics/X11/Xlib/Window.hs
@@ -62,21 +62,21 @@
 -- | interface to the X11 library function @XStoreName()@.
 storeName :: Display -> Window -> String -> IO ()
 storeName display window name =
-	withCString name $ \ c_name ->
-	xStoreName display window c_name
+        withCString name $ \ c_name ->
+        xStoreName display window c_name
 foreign import ccall unsafe "HsXlib.h XStoreName"
-	xStoreName :: Display -> Window -> CString -> IO ()
+        xStoreName :: Display -> Window -> CString -> IO ()
 
 -- | interface to the X11 library function @XCreateSimpleWindow()@.
 foreign import ccall unsafe "HsXlib.h XCreateSimpleWindow"
-	createSimpleWindow :: Display -> Window -> Position -> Position ->
-		Dimension -> Dimension -> CInt -> Pixel -> Pixel -> IO Window
+        createSimpleWindow :: Display -> Window -> Position -> Position ->
+                Dimension -> Dimension -> CInt -> Pixel -> Pixel -> IO Window
 
 -- | interface to the X11 library function @XCreateWindow()@.
 foreign import ccall unsafe "HsXlib.h XCreateWindow"
-	createWindow :: Display -> Window -> Position -> Position ->
-		Dimension -> Dimension -> CInt -> CInt -> WindowClass ->
-		Visual -> AttributeMask -> Ptr SetWindowAttributes -> IO Window
+        createWindow :: Display -> Window -> Position -> Position ->
+                Dimension -> Dimension -> CInt -> CInt -> WindowClass ->
+                Visual -> AttributeMask -> Ptr SetWindowAttributes -> IO Window
 
 ----------------------------------------------------------------
 
@@ -84,140 +84,140 @@
 
 -- | interface to the X11 library function @XTranslateCoordinates()@.
 translateCoordinates :: Display -> Window -> Window -> Position -> Position ->
-	IO (Bool,Position,Position,Window)
+        IO (Bool,Position,Position,Window)
 translateCoordinates display src_w dest_w src_x src_y =
-	alloca $ \ dest_x_return ->
-	alloca $ \ dest_y_return ->
-	alloca $ \ child_return -> do
-	res <- xTranslateCoordinates display src_w dest_w src_x src_y
-			dest_x_return dest_y_return child_return
-	dest_x <- peek dest_x_return
-	dest_y <- peek dest_y_return
-	child  <- peek child_return
-	return (res, dest_x, dest_y, child)
+        alloca $ \ dest_x_return ->
+        alloca $ \ dest_y_return ->
+        alloca $ \ child_return -> do
+        res <- xTranslateCoordinates display src_w dest_w src_x src_y
+                        dest_x_return dest_y_return child_return
+        dest_x <- peek dest_x_return
+        dest_y <- peek dest_y_return
+        child  <- peek child_return
+        return (res, dest_x, dest_y, child)
 foreign import ccall unsafe "HsXlib.h XTranslateCoordinates"
-	xTranslateCoordinates :: Display -> Window -> Window ->
-		Position -> Position ->
-		Ptr Position -> Ptr Position -> Ptr Window -> IO Bool
+        xTranslateCoordinates :: Display -> Window -> Window ->
+                Position -> Position ->
+                Ptr Position -> Ptr Position -> Ptr Window -> IO Bool
 
 -- | interface to the X11 library function @XMoveResizeWindow()@.
 foreign import ccall unsafe "HsXlib.h XMoveResizeWindow"
-	moveResizeWindow             :: Display -> Window -> Position  -> Position  -> Dimension -> Dimension -> IO ()
+        moveResizeWindow             :: Display -> Window -> Position  -> Position  -> Dimension -> Dimension -> IO ()
 
 -- | interface to the X11 library function @XResizeWindow()@.
 foreign import ccall unsafe "HsXlib.h XResizeWindow"
-	resizeWindow                 :: Display -> Window -> Dimension -> Dimension -> IO ()
+        resizeWindow                 :: Display -> Window -> Dimension -> Dimension -> IO ()
 
 -- | interface to the X11 library function @XMoveWindow()@.
 foreign import ccall unsafe "HsXlib.h XMoveWindow"
-	moveWindow                   :: Display -> Window -> Position  -> Position  -> IO ()
+        moveWindow                   :: Display -> Window -> Position  -> Position  -> IO ()
 
 -- | interface to the X11 library function @XReparentWindow()@.
 foreign import ccall unsafe "HsXlib.h XReparentWindow"
-	reparentWindow               :: Display -> Window -> Window -> Position -> Position  -> IO ()
+        reparentWindow               :: Display -> Window -> Window -> Position -> Position  -> IO ()
 
 -- | interface to the X11 library function @XMapSubwindows()@.
 foreign import ccall unsafe "HsXlib.h XMapSubwindows"
-	mapSubwindows                :: Display -> Window -> IO ()
+        mapSubwindows                :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XUnmapSubwindows()@.
 foreign import ccall unsafe "HsXlib.h XUnmapSubwindows"
-	unmapSubwindows              :: Display -> Window -> IO ()
+        unmapSubwindows              :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XMapWindow()@.
 foreign import ccall unsafe "HsXlib.h XMapWindow"
-	mapWindow                    :: Display -> Window -> IO ()
+        mapWindow                    :: Display -> Window -> IO ()
 -- Disnae exist: %fun XUnmapWindows                :: Display -> Window -> IO ()
 -- Disnae exist: %fun XMapRaisedWindow             :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XLowerWindow()@.
 foreign import ccall unsafe "HsXlib.h XLowerWindow"
-	lowerWindow                  :: Display -> Window -> IO ()
+        lowerWindow                  :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XRaiseWindow()@.
 foreign import ccall unsafe "HsXlib.h XRaiseWindow"
-	raiseWindow                  :: Display -> Window -> IO ()
+        raiseWindow                  :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XCirculateSubwindowsDown()@.
 foreign import ccall unsafe "HsXlib.h XCirculateSubwindowsDown"
-	circulateSubwindowsDown      :: Display -> Window -> IO ()
+        circulateSubwindowsDown      :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XCirculateSubwindowsUp()@.
 foreign import ccall unsafe "HsXlib.h XCirculateSubwindowsUp"
-	circulateSubwindowsUp        :: Display -> Window -> IO ()
+        circulateSubwindowsUp        :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XCirculateSubwindows()@.
 foreign import ccall unsafe "HsXlib.h XCirculateSubwindows"
-	circulateSubwindows          :: Display -> Window -> CirculationDirection -> IO ()
+        circulateSubwindows          :: Display -> Window -> CirculationDirection -> IO ()
 
 -- | interface to the X11 library function @XIconifyWindow()@.
 iconifyWindow  :: Display -> Window -> ScreenNumber -> IO ()
 iconifyWindow display window screenno =
-	throwIfZero "iconifyWindow"
-		(xIconifyWindow display window screenno)
+        throwIfZero "iconifyWindow"
+                (xIconifyWindow display window screenno)
 foreign import ccall unsafe "HsXlib.h XIconifyWindow"
-	xIconifyWindow  :: Display -> Window -> ScreenNumber -> IO Status
+        xIconifyWindow  :: Display -> Window -> ScreenNumber -> IO Status
 
 -- | interface to the X11 library function @XWithdrawWindow()@.
 withdrawWindow :: Display -> Window -> ScreenNumber -> IO ()
 withdrawWindow display window screenno =
-	throwIfZero "withdrawWindow"
-		(xWithdrawWindow display window screenno)
+        throwIfZero "withdrawWindow"
+                (xWithdrawWindow display window screenno)
 foreign import ccall unsafe "HsXlib.h XWithdrawWindow"
-	xWithdrawWindow :: Display -> Window -> ScreenNumber -> IO Status
+        xWithdrawWindow :: Display -> Window -> ScreenNumber -> IO Status
 
 -- | interface to the X11 library function @XDestroyWindow()@.
 foreign import ccall unsafe "HsXlib.h XDestroyWindow"
-	destroyWindow                :: Display -> Window -> IO ()
+        destroyWindow                :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XDestroySubwindows()@.
 foreign import ccall unsafe "HsXlib.h XDestroySubwindows"
-	destroySubwindows            :: Display -> Window -> IO ()
+        destroySubwindows            :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XSetWindowBorder()@.
 foreign import ccall unsafe "HsXlib.h XSetWindowBorder"
-	setWindowBorder              :: Display -> Window -> Pixel     -> IO ()
+        setWindowBorder              :: Display -> Window -> Pixel     -> IO ()
 
 -- | interface to the X11 library function @XSetWindowBorderPixmap()@.
 foreign import ccall unsafe "HsXlib.h XSetWindowBorderPixmap"
-	setWindowBorderPixmap        :: Display -> Window -> Pixmap    -> IO ()
+        setWindowBorderPixmap        :: Display -> Window -> Pixmap    -> IO ()
 
 -- | interface to the X11 library function @XSetWindowBorderWidth()@.
 foreign import ccall unsafe "HsXlib.h XSetWindowBorderWidth"
-	setWindowBorderWidth         :: Display -> Window -> Dimension -> IO ()
+        setWindowBorderWidth         :: Display -> Window -> Dimension -> IO ()
 
 -- | interface to the X11 library function @XSetWindowBackground()@.
 foreign import ccall unsafe "HsXlib.h XSetWindowBackground"
-	setWindowBackground          :: Display -> Window -> Pixel     -> IO ()
+        setWindowBackground          :: Display -> Window -> Pixel     -> IO ()
 
 -- | interface to the X11 library function @XSetWindowBackgroundPixmap()@.
 foreign import ccall unsafe "HsXlib.h XSetWindowBackgroundPixmap"
-	setWindowBackgroundPixmap    :: Display -> Window -> Pixmap    -> IO ()
+        setWindowBackgroundPixmap    :: Display -> Window -> Pixmap    -> IO ()
 
 -- | interface to the X11 library function @XSetWindowColormap()@.
 foreign import ccall unsafe "HsXlib.h XSetWindowColormap"
-	setWindowColormap            :: Display -> Window -> Colormap  -> IO ()
+        setWindowColormap            :: Display -> Window -> Colormap  -> IO ()
 
 -- | interface to the X11 library function @XAddToSaveSet()@.
 foreign import ccall unsafe "HsXlib.h XAddToSaveSet"
-	addToSaveSet                 :: Display -> Window -> IO ()
+        addToSaveSet                 :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XRemoveFromSaveSet()@.
 foreign import ccall unsafe "HsXlib.h XRemoveFromSaveSet"
-	removeFromSaveSet            :: Display -> Window -> IO ()
+        removeFromSaveSet            :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XChangeSaveSet()@.
 foreign import ccall unsafe "HsXlib.h XChangeSaveSet"
-	changeSaveSet                :: Display -> Window -> ChangeSaveSetMode -> IO ()
+        changeSaveSet                :: Display -> Window -> ChangeSaveSetMode -> IO ()
 
 -- | interface to the X11 library function @XClearWindow()@.
 foreign import ccall unsafe "HsXlib.h XClearWindow"
-	clearWindow                  :: Display -> Window -> IO ()
+        clearWindow                  :: Display -> Window -> IO ()
 
 -- | interface to the X11 library function @XClearArea()@.
 foreign import ccall unsafe "HsXlib.h XClearArea"
-	clearArea                    :: Display -> Window ->
-		Position -> Position -> Dimension -> Dimension -> Bool -> IO ()
+        clearArea                    :: Display -> Window ->
+                Position -> Position -> Dimension -> Dimension -> Bool -> IO ()
 
 -- This is almost good enough - but doesn't call XFree
 -- -- %errfun BadStatus XQueryTree :: Display -> Window -> IO (Window, Window, ListWindow) using err = XQueryTree(arg1,arg2,&res1,&res2,&res3,&res3_size)
@@ -234,10 +234,10 @@
 -- | interface to the X11 library function @XRestackWindows()@.
 restackWindows :: Display -> [Window] -> IO ()
 restackWindows display windows =
-	withArray windows $ \ window_array ->
-	xRestackWindows display window_array (fromIntegral (length windows))
+        withArray windows $ \ window_array ->
+        xRestackWindows display window_array (fromIntegral (length windows))
 foreign import ccall unsafe "HsXlib.h XRestackWindows"
-	xRestackWindows :: Display -> Ptr Window -> CInt -> IO ()
+        xRestackWindows :: Display -> Ptr Window -> CInt -> IO ()
 
 -- ToDo: I want to be able to write this
 -- -- %fun XListInstalledColormaps :: Display -> Window -> IO ListColormap using res1 = XListInstalledColormaps(arg1,arg2,&res1_size)
diff --git a/X11.buildinfo.in b/X11.buildinfo.in
--- a/X11.buildinfo.in
+++ b/X11.buildinfo.in
@@ -2,6 +2,6 @@
 -- System-dependent values used by Distribution.Simple.defaultUserHooks
 --
 buildable: @BUILD_PACKAGE_BOOL@
-cc-options: @X_CFLAGS@
-ld-options: @X_LIBS@
+cc-options: @X_CFLAGS@ @CPPFLAGS@
+ld-options: @X_LIBS@ @LDFLAGS@
 @EXTRA_LIBRARIES@
diff --git a/X11.cabal b/X11.cabal
--- a/X11.cabal
+++ b/X11.cabal
@@ -1,5 +1,5 @@
 name:		        X11
-version:	        1.3.0
+version:	        1.4.0
 license:	        BSD3
 license-file:	    LICENSE
 copyright:	        Alastair Reid, 1999-2003, libraries@haskell.org 2003-2007
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -3935,7 +3935,7 @@
 # If there's some oddball X11 include path, we need it to check there for
 # Xinerama headers.
 if test -n "$x_includes"; then
-    CPPFLAGS="$CPPFLAGS -I $x_includes"
+    CPPFLAGS="$CPPFLAGS -I$x_includes"
 fi
 
 # Build the package if we found X11 stuff
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,7 @@
 # If there's some oddball X11 include path, we need it to check there for
 # Xinerama headers.
 if test -n "$x_includes"; then
-    CPPFLAGS="$CPPFLAGS -I $x_includes"
+    CPPFLAGS="$CPPFLAGS -I$x_includes"
 fi
 
 # Build the package if we found X11 stuff
