diff --git a/Graphics/XHB.hs b/Graphics/XHB.hs
--- a/Graphics/XHB.hs
+++ b/Graphics/XHB.hs
@@ -21,6 +21,7 @@
     , module Graphics.XHB.Gen.Xproto
     , Xid
     , XidLike(..)
+    , xidNone
     , SimpleEnum(..)
     , BitEnum(..)
     , fromMask
@@ -38,14 +39,6 @@
     , Event(..)
     , SomeEvent
     , UnknownEvent(..)
-    , CARD8
-    , CARD16
-    , CARD32
-    , INT8
-    , INT16
-    , INT32
-    , BOOL
-    , BYTE
      ) where
 
 import Graphics.XHB.Connection
diff --git a/Graphics/XHB/Connection.hs b/Graphics/XHB/Connection.hs
--- a/Graphics/XHB/Connection.hs
+++ b/Graphics/XHB/Connection.hs
@@ -156,8 +156,8 @@
 
 -- reverse-lookup infrastructure for extensions.  Not pretty or
 -- maybe not even fast. But it is straight-forward.
-queryExtMap :: (QueryExtensionReply -> CARD8)
-            -> ReadLoop -> CARD8 -> IO (Maybe (ExtensionId, CARD8))
+queryExtMap :: (QueryExtensionReply -> Word8)
+            -> ReadLoop -> Word8 -> IO (Maybe (ExtensionId, Word8))
 queryExtMap f r code = do
   ext_map <- atomically . readTVar $ read_extensions r
   return $ findFromCode ext_map
@@ -171,13 +171,13 @@
          where num = f extInfo
 
 -- | Returns the extension id and the base event code
-extensionIdFromEventCode :: ReadLoop -> CARD8
-                         -> IO (Maybe (ExtensionId, CARD8))
+extensionIdFromEventCode :: ReadLoop -> Word8
+                         -> IO (Maybe (ExtensionId, Word8))
 extensionIdFromEventCode = queryExtMap first_event_QueryExtensionReply
 
 -- | Returns the extension id and the base error code
-extensionIdFromErrorCode :: ReadLoop -> CARD8
-                         -> IO (Maybe (ExtensionId, CARD8))
+extensionIdFromErrorCode :: ReadLoop -> Word8
+                         -> IO (Maybe (ExtensionId, Word8))
 extensionIdFromErrorCode = queryExtMap first_error_QueryExtensionReply
 
 
@@ -243,10 +243,7 @@
   atomically $ do
     nextPend <- readTChan $ read_reps rl
     if (pended_sequence nextPend) == (grep_sequence genRep)
-     then case pended_reply nextPend of
-            WrappedReply replyHole -> 
-                let reply = flip runGet bytes $ deserializeInReadLoop rl
-                in putReceipt replyHole $ Right reply
+     then putReceipt (pended_reply nextPend) $ Right bytes
      else unGetTChan (read_reps rl) nextPend
 
 
@@ -262,8 +259,7 @@
   atomically $ do
     nextPend <- readTChan $ read_reps rl
     if (pended_sequence nextPend) == (grep_sequence genRep)
-     then case pended_reply nextPend of
-            WrappedReply replyHole -> putReceipt replyHole (Left err)
+     then putReceipt (pended_reply nextPend) $ Left err 
      else do
        unGetTChan (read_reps rl) nextPend
        writeTChan (read_error_queue rl) err
diff --git a/Graphics/XHB/Connection/Extension.hs b/Graphics/XHB/Connection/Extension.hs
--- a/Graphics/XHB/Connection/Extension.hs
+++ b/Graphics/XHB/Connection/Extension.hs
@@ -70,4 +70,4 @@
 _extensionOpCode = major_opcode_QueryExtensionReply
 
 _extensionPresent :: QueryExtensionReply -> Bool
-_extensionPresent = (/= 0) . present_QueryExtensionReply
+_extensionPresent = present_QueryExtensionReply
diff --git a/Graphics/XHB/Connection/Internal.hs b/Graphics/XHB/Connection/Internal.hs
--- a/Graphics/XHB/Connection/Internal.hs
+++ b/Graphics/XHB/Connection/Internal.hs
@@ -44,14 +44,14 @@
 
   return ()
 
-sendRequestWithReply :: Deserialize a => Connection -> ByteString -> Receipt a -> IO ()
+sendRequestWithReply :: Connection -> ByteString -> RawReceipt -> IO ()
 sendRequestWithReply c bytes r = withConnectionHandle c $ \h -> do
 
   BS.hPut h bytes
 
   atomically $ do
     seq <- nextSequence c
-    writeTChan (conn_reps c) $ PendedReply seq $ WrappedReply r
+    writeTChan (conn_reps c) $ PendedReply seq r
 
 
 -- Returns the next sequence ID
diff --git a/Graphics/XHB/Connection/Types.hs b/Graphics/XHB/Connection/Types.hs
--- a/Graphics/XHB/Connection/Types.hs
+++ b/Graphics/XHB/Connection/Types.hs
@@ -36,7 +36,5 @@
 
 data PendedReply = PendedReply
     {pended_sequence :: SequenceId
-    ,pended_reply :: WrappedReply
+    ,pended_reply :: RawReceipt
     }
-
-data WrappedReply = forall a . Deserialize a => WrappedReply (Receipt a)
diff --git a/Graphics/XHB/Shared.hs b/Graphics/XHB/Shared.hs
--- a/Graphics/XHB/Shared.hs
+++ b/Graphics/XHB/Shared.hs
@@ -27,14 +27,6 @@
 import Data.ByteString.Lazy (ByteString)
 
 import Control.Concurrent.STM
-    ( TMVar
-    , STM
-    , putTMVar
-    , newEmptyTMVarIO
-    , takeTMVar
-    , putTMVar
-    , atomically
-    )
 
 import System.ByteOrder
 
@@ -50,18 +42,6 @@
 byteOrderToNum LittleEndian = fromEnum '\o154' -- l
 byteOrderToNum Mixed{} = error "Mixed endian platforms not supported."
 
-type CARD8  = Word8
-type CARD16 = Word16
-type CARD32 = Word32
-
-type INT32 = Int32
-type INT16 = Int16
-type INT8  = Int8
-
-type BOOL = Word8
-
-type BYTE = Word8
-
 newtype Xid = MkXid Word32
  deriving (Eq, Ord, Serialize, Deserialize)
 
@@ -76,6 +56,9 @@
     fromXid = id
     toXid   = id
 
+xidNone :: Xid
+xidNone = MkXid 0
+
 -- Enums and ValueParams
 
 class SimpleEnum a where
@@ -139,23 +122,40 @@
 -- In units of four bytes
 type ReplyLength = Word32
 
-newtype Receipt a = MkReceipt
-    {unReceipt :: TMVar (Either SomeError a)}
+-- The Receipt type allows the sender of the request
+-- to arbitrarily munge the result before handing
+-- it back to the caller
+newtype Receipt a = MkReceipt (TVar (InnerReceipt a))
 
-newEmptyReceiptIO :: IO (Receipt a)
-newEmptyReceiptIO = MkReceipt `fmap` newEmptyTMVarIO
+type RawReceipt = TMVar (Either SomeError ByteString)
 
-putReceipt :: Receipt a -> Either SomeError a -> STM ()
-putReceipt = putTMVar . unReceipt
+data InnerReceipt a
+    = Item (Either SomeError a)
+    | Result RawReceipt (ByteString -> a)
 
+newEmptyReceipt :: (ByteString -> a) -> IO (Receipt a, RawReceipt)
+newEmptyReceipt f = do
+  rawReceipt <- newEmptyTMVarIO
+  ref <- newTVarIO $ Result rawReceipt f
+  return $ (MkReceipt ref, rawReceipt)
+
+newDeserReceipt :: Deserialize a => IO (Receipt a, RawReceipt)
+newDeserReceipt = newEmptyReceipt $ runGet deserialize
+
+putReceipt :: RawReceipt -> Either SomeError ByteString -> STM ()
+putReceipt = putTMVar
+
 -- | Extracts a reply from the receipt from the request.
 -- Blocks until the reply is available.
 getReply :: Receipt a -> IO (Either SomeError a)
-getReply (MkReceipt r)
-    = atomically $ do
-        a <- takeTMVar r
-        putTMVar r a
-        return a
+getReply (MkReceipt ref) = atomically $
+    readTVar ref >>= \ircpt -> case ircpt of
+       Item a -> return a
+       Result rrcpt f -> do
+         res <- takeTMVar rrcpt
+         let ret = either Left (Right . f) res
+         writeTVar ref $ Item ret
+         return ret
 
 -- Because new errors and events are introduced with each extension,
 -- I don't want to give the users of this library pattern-match
@@ -218,6 +218,24 @@
 
 --Instances
 
+
+instance Serialize Bool where
+    serialize = serialize `fmap` boolToWord
+    size = size . boolToWord
+
+instance Deserialize Bool where
+    deserialize = wordToBool `fmap` deserialize
+
+boolToWord :: Bool -> Word8
+wordToBool :: Word8 -> Bool
+
+boolToWord True = 1
+boolToWord False = 0
+
+wordToBool 0 = False
+wordToBool _ = True
+
+
 -- Words
 instance Serialize Word8 where
     serialize = putWord8
@@ -369,5 +387,5 @@
 putSkip 0 = return ()
 putSkip n = replicateM_ n $ putWord8 0
 
-isCard32 :: CARD32 -> a
+isCard32 :: Word32 -> a
 isCard32 = undefined
diff --git a/patched/Graphics/XHB/Gen/BigRequests.hs b/patched/Graphics/XHB/Gen/BigRequests.hs
--- a/patched/Graphics/XHB/Gen/BigRequests.hs
+++ b/patched/Graphics/XHB/Gen/BigRequests.hs
@@ -7,6 +7,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
  
@@ -14,12 +17,12 @@
 extension = "BIG-REQUESTS"
  
 enable ::
-         Graphics.XHB.Connection.Types.Connection ->
-           IO (Receipt EnableReply)
+         Graphics.XHB.Connection.Types.Connection -> IO (Receipt Word32)
 enable c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (maximum_request_length_EnableReply `fmap` deserialize))
        let req = MkEnable
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/BigRequests/Types.hs b/patched/Graphics/XHB/Gen/BigRequests/Types.hs
--- a/patched/Graphics/XHB/Gen/BigRequests/Types.hs
+++ b/patched/Graphics/XHB/Gen/BigRequests/Types.hs
@@ -2,6 +2,7 @@
        (deserializeError, deserializeEvent, Enable(..), EnableReply(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -28,11 +29,11 @@
           = do putWord8 extOpCode
                putWord8 0
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data EnableReply = MkEnableReply{maximum_request_length_EnableReply
-                                 :: CARD32}
+                                 :: Word32}
                  deriving (Show, Typeable)
  
 instance Deserialize EnableReply where
diff --git a/patched/Graphics/XHB/Gen/Composite.hs b/patched/Graphics/XHB/Gen/Composite.hs
--- a/patched/Graphics/XHB/Gen/Composite.hs
+++ b/patched/Graphics/XHB/Gen/Composite.hs
@@ -10,6 +10,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -25,18 +28,18 @@
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)
+                 Word32 -> Word32 -> IO (Receipt QueryVersionReply)
 queryVersion c client_major_version client_minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion client_major_version client_minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 redirectWindow ::
                  Graphics.XHB.Connection.Types.Connection ->
-                   WINDOW -> CARD8 -> IO ()
+                   WINDOW -> Word8 -> IO ()
 redirectWindow c window update
   = do let req = MkRedirectWindow window update
        putAction <- serializeExtensionRequest c req
@@ -45,7 +48,7 @@
  
 redirectSubwindows ::
                      Graphics.XHB.Connection.Types.Connection ->
-                       WINDOW -> CARD8 -> IO ()
+                       WINDOW -> Word8 -> IO ()
 redirectSubwindows c window update
   = do let req = MkRedirectSubwindows window update
        putAction <- serializeExtensionRequest c req
@@ -54,7 +57,7 @@
  
 unredirectWindow ::
                    Graphics.XHB.Connection.Types.Connection ->
-                     WINDOW -> CARD8 -> IO ()
+                     WINDOW -> Word8 -> IO ()
 unredirectWindow c window update
   = do let req = MkUnredirectWindow window update
        putAction <- serializeExtensionRequest c req
@@ -63,7 +66,7 @@
  
 unredirectSubwindows ::
                        Graphics.XHB.Connection.Types.Connection ->
-                         WINDOW -> CARD8 -> IO ()
+                         WINDOW -> Word8 -> IO ()
 unredirectSubwindows c window update
   = do let req = MkUnredirectSubwindows window update
        putAction <- serializeExtensionRequest c req
@@ -90,13 +93,14 @@
  
 getOverlayWindow ::
                    Graphics.XHB.Connection.Types.Connection ->
-                     WINDOW -> IO (Receipt GetOverlayWindowReply)
+                     WINDOW -> IO (Receipt WINDOW)
 getOverlayWindow c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (overlay_win_GetOverlayWindowReply `fmap` deserialize))
        let req = MkGetOverlayWindow window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 releaseOverlayWindow ::
diff --git a/patched/Graphics/XHB/Gen/Composite/Types.hs b/patched/Graphics/XHB/Gen/Composite/Types.hs
--- a/patched/Graphics/XHB/Gen/Composite/Types.hs
+++ b/patched/Graphics/XHB/Gen/Composite/Types.hs
@@ -7,6 +7,7 @@
         GetOverlayWindowReply(..), ReleaseOverlayWindow(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -41,8 +42,8 @@
         fromValue 1 = RedirectManual
  
 data QueryVersion = MkQueryVersion{client_major_version_QueryVersion
-                                   :: CARD32,
-                                   client_minor_version_QueryVersion :: CARD32}
+                                   :: Word32,
+                                   client_minor_version_QueryVersion :: Word32}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -53,14 +54,14 @@
                let size__
                      = 4 + size (client_major_version_QueryVersion x) +
                          size (client_minor_version_QueryVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (client_major_version_QueryVersion x)
                serialize (client_minor_version_QueryVersion x)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{major_version_QueryVersionReply
-                                             :: CARD32,
-                                             minor_version_QueryVersionReply :: CARD32}
+                                             :: Word32,
+                                             minor_version_QueryVersionReply :: Word32}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -77,7 +78,7 @@
  
 data RedirectWindow = MkRedirectWindow{window_RedirectWindow ::
                                        WINDOW,
-                                       update_RedirectWindow :: CARD8}
+                                       update_RedirectWindow :: Word8}
                     deriving (Show, Typeable)
  
 instance ExtensionRequest RedirectWindow where
@@ -89,7 +90,7 @@
                      = 4 + size (window_RedirectWindow x) +
                          size (update_RedirectWindow x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_RedirectWindow x)
                serialize (update_RedirectWindow x)
                putSkip 3
@@ -97,7 +98,7 @@
  
 data RedirectSubwindows = MkRedirectSubwindows{window_RedirectSubwindows
                                                :: WINDOW,
-                                               update_RedirectSubwindows :: CARD8}
+                                               update_RedirectSubwindows :: Word8}
                         deriving (Show, Typeable)
  
 instance ExtensionRequest RedirectSubwindows where
@@ -109,7 +110,7 @@
                      = 4 + size (window_RedirectSubwindows x) +
                          size (update_RedirectSubwindows x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_RedirectSubwindows x)
                serialize (update_RedirectSubwindows x)
                putSkip 3
@@ -117,7 +118,7 @@
  
 data UnredirectWindow = MkUnredirectWindow{window_UnredirectWindow
                                            :: WINDOW,
-                                           update_UnredirectWindow :: CARD8}
+                                           update_UnredirectWindow :: Word8}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest UnredirectWindow where
@@ -129,7 +130,7 @@
                      = 4 + size (window_UnredirectWindow x) +
                          size (update_UnredirectWindow x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_UnredirectWindow x)
                serialize (update_UnredirectWindow x)
                putSkip 3
@@ -137,7 +138,7 @@
  
 data UnredirectSubwindows = MkUnredirectSubwindows{window_UnredirectSubwindows
                                                    :: WINDOW,
-                                                   update_UnredirectSubwindows :: CARD8}
+                                                   update_UnredirectSubwindows :: Word8}
                           deriving (Show, Typeable)
  
 instance ExtensionRequest UnredirectSubwindows where
@@ -149,7 +150,7 @@
                      = 4 + size (window_UnredirectSubwindows x) +
                          size (update_UnredirectSubwindows x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_UnredirectSubwindows x)
                serialize (update_UnredirectSubwindows x)
                putSkip 3
@@ -169,7 +170,7 @@
                let size__
                      = 4 + size (region_CreateRegionFromBorderClip x) +
                          size (window_CreateRegionFromBorderClip x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (region_CreateRegionFromBorderClip x)
                serialize (window_CreateRegionFromBorderClip x)
                putSkip (requiredPadding size__)
@@ -187,7 +188,7 @@
                let size__
                      = 4 + size (window_NameWindowPixmap x) +
                          size (pixmap_NameWindowPixmap x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_NameWindowPixmap x)
                serialize (pixmap_NameWindowPixmap x)
                putSkip (requiredPadding size__)
@@ -202,7 +203,7 @@
           = do putWord8 extOpCode
                putWord8 7
                let size__ = 4 + size (window_GetOverlayWindow x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetOverlayWindow x)
                putSkip (requiredPadding size__)
  
@@ -231,6 +232,6 @@
           = do putWord8 extOpCode
                putWord8 8
                let size__ = 4 + size (window_ReleaseOverlayWindow x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_ReleaseOverlayWindow x)
                putSkip (requiredPadding size__)
diff --git a/patched/Graphics/XHB/Gen/DPMS.hs b/patched/Graphics/XHB/Gen/DPMS.hs
--- a/patched/Graphics/XHB/Gen/DPMS.hs
+++ b/patched/Graphics/XHB/Gen/DPMS.hs
@@ -8,6 +8,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
  
@@ -16,35 +19,35 @@
  
 getVersion ::
              Graphics.XHB.Connection.Types.Connection ->
-               CARD16 -> CARD16 -> IO (Receipt GetVersionReply)
+               Word16 -> Word16 -> IO (Receipt GetVersionReply)
 getVersion c client_major_version client_minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetVersion client_major_version client_minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 capable ::
-          Graphics.XHB.Connection.Types.Connection ->
-            IO (Receipt CapableReply)
+          Graphics.XHB.Connection.Types.Connection -> IO (Receipt Bool)
 capable c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (capable_CapableReply `fmap` deserialize))
        let req = MkCapable
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getTimeouts ::
               Graphics.XHB.Connection.Types.Connection ->
                 IO (Receipt GetTimeoutsReply)
 getTimeouts c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetTimeouts
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setTimeouts ::
@@ -55,7 +58,7 @@
        sendRequest c chunk
  
 forceLevel ::
-             Graphics.XHB.Connection.Types.Connection -> CARD16 -> IO ()
+             Graphics.XHB.Connection.Types.Connection -> Word16 -> IO ()
 forceLevel c power_level
   = do let req = MkForceLevel power_level
        putAction <- serializeExtensionRequest c req
@@ -65,9 +68,9 @@
 info ::
        Graphics.XHB.Connection.Types.Connection -> IO (Receipt InfoReply)
 info c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkInfo
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/DPMS/Types.hs b/patched/Graphics/XHB/Gen/DPMS/Types.hs
--- a/patched/Graphics/XHB/Gen/DPMS/Types.hs
+++ b/patched/Graphics/XHB/Gen/DPMS/Types.hs
@@ -5,6 +5,7 @@
         ForceLevel(..), Info(..), InfoReply(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -23,8 +24,8 @@
 deserializeEvent _ = Nothing
  
 data GetVersion = MkGetVersion{client_major_version_GetVersion ::
-                               CARD16,
-                               client_minor_version_GetVersion :: CARD16}
+                               Word16,
+                               client_minor_version_GetVersion :: Word16}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest GetVersion where
@@ -35,14 +36,14 @@
                let size__
                      = 4 + size (client_major_version_GetVersion x) +
                          size (client_minor_version_GetVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (client_major_version_GetVersion x)
                serialize (client_minor_version_GetVersion x)
                putSkip (requiredPadding size__)
  
 data GetVersionReply = MkGetVersionReply{server_major_version_GetVersionReply
-                                         :: CARD16,
-                                         server_minor_version_GetVersionReply :: CARD16}
+                                         :: Word16,
+                                         server_minor_version_GetVersionReply :: Word16}
                      deriving (Show, Typeable)
  
 instance Deserialize GetVersionReply where
@@ -66,10 +67,10 @@
           = do putWord8 extOpCode
                putWord8 1
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
-data CapableReply = MkCapableReply{capable_CapableReply :: BOOL}
+data CapableReply = MkCapableReply{capable_CapableReply :: Bool}
                   deriving (Show, Typeable)
  
 instance Deserialize CapableReply where
@@ -92,13 +93,13 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data GetTimeoutsReply = MkGetTimeoutsReply{standby_timeout_GetTimeoutsReply
-                                           :: CARD16,
-                                           suspend_timeout_GetTimeoutsReply :: CARD16,
-                                           off_timeout_GetTimeoutsReply :: CARD16}
+                                           :: Word16,
+                                           suspend_timeout_GetTimeoutsReply :: Word16,
+                                           off_timeout_GetTimeoutsReply :: Word16}
                       deriving (Show, Typeable)
  
 instance Deserialize GetTimeoutsReply where
@@ -116,9 +117,9 @@
                  (MkGetTimeoutsReply standby_timeout suspend_timeout off_timeout)
  
 data SetTimeouts = MkSetTimeouts{standby_timeout_SetTimeouts ::
-                                 CARD16,
-                                 suspend_timeout_SetTimeouts :: CARD16,
-                                 off_timeout_SetTimeouts :: CARD16}
+                                 Word16,
+                                 suspend_timeout_SetTimeouts :: Word16,
+                                 off_timeout_SetTimeouts :: Word16}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest SetTimeouts where
@@ -130,13 +131,13 @@
                      = 4 + size (standby_timeout_SetTimeouts x) +
                          size (suspend_timeout_SetTimeouts x)
                          + size (off_timeout_SetTimeouts x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (standby_timeout_SetTimeouts x)
                serialize (suspend_timeout_SetTimeouts x)
                serialize (off_timeout_SetTimeouts x)
                putSkip (requiredPadding size__)
  
-data ForceLevel = MkForceLevel{power_level_ForceLevel :: CARD16}
+data ForceLevel = MkForceLevel{power_level_ForceLevel :: Word16}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest ForceLevel where
@@ -145,7 +146,7 @@
           = do putWord8 extOpCode
                putWord8 6
                let size__ = 4 + size (power_level_ForceLevel x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (power_level_ForceLevel x)
                putSkip (requiredPadding size__)
  
@@ -158,11 +159,11 @@
           = do putWord8 extOpCode
                putWord8 7
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
-data InfoReply = MkInfoReply{power_level_InfoReply :: CARD16,
-                             state_InfoReply :: BOOL}
+data InfoReply = MkInfoReply{power_level_InfoReply :: Word16,
+                             state_InfoReply :: Bool}
                deriving (Show, Typeable)
  
 instance Deserialize InfoReply where
diff --git a/patched/Graphics/XHB/Gen/Damage.hs b/patched/Graphics/XHB/Gen/Damage.hs
--- a/patched/Graphics/XHB/Gen/Damage.hs
+++ b/patched/Graphics/XHB/Gen/Damage.hs
@@ -9,6 +9,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -24,13 +27,13 @@
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)
+                 Word32 -> Word32 -> IO (Receipt QueryVersionReply)
 queryVersion c client_major_version client_minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion client_major_version client_minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 create ::
diff --git a/patched/Graphics/XHB/Gen/Damage/Types.hs b/patched/Graphics/XHB/Gen/Damage/Types.hs
--- a/patched/Graphics/XHB/Gen/Damage/Types.hs
+++ b/patched/Graphics/XHB/Gen/Damage/Types.hs
@@ -4,6 +4,7 @@
         Subtract(..), Add(..), Notify(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -49,8 +50,8 @@
         fromValue 3 = ReportLevelNonEmpty
  
 data QueryVersion = MkQueryVersion{client_major_version_QueryVersion
-                                   :: CARD32,
-                                   client_minor_version_QueryVersion :: CARD32}
+                                   :: Word32,
+                                   client_minor_version_QueryVersion :: Word32}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -61,14 +62,14 @@
                let size__
                      = 4 + size (client_major_version_QueryVersion x) +
                          size (client_minor_version_QueryVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (client_major_version_QueryVersion x)
                serialize (client_minor_version_QueryVersion x)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{major_version_QueryVersionReply
-                                             :: CARD32,
-                                             minor_version_QueryVersionReply :: CARD32}
+                                             :: Word32,
+                                             minor_version_QueryVersionReply :: Word32}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -84,7 +85,7 @@
                return (MkQueryVersionReply major_version minor_version)
  
 data Create = MkCreate{damage_Create :: DAMAGE,
-                       drawable_Create :: DRAWABLE, level_Create :: CARD8}
+                       drawable_Create :: DRAWABLE, level_Create :: Word8}
             deriving (Show, Typeable)
  
 instance ExtensionRequest Create where
@@ -96,7 +97,7 @@
                      = 4 + size (damage_Create x) + size (drawable_Create x) +
                          size (level_Create x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (damage_Create x)
                serialize (drawable_Create x)
                serialize (level_Create x)
@@ -112,7 +113,7 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4 + size (damage_Destroy x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (damage_Destroy x)
                putSkip (requiredPadding size__)
  
@@ -128,7 +129,7 @@
                let size__
                      = 4 + size (damage_Subtract x) + size (repair_Subtract x) +
                          size (parts_Subtract x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (damage_Subtract x)
                serialize (repair_Subtract x)
                serialize (parts_Subtract x)
@@ -143,12 +144,12 @@
           = do putWord8 extOpCode
                putWord8 4
                let size__ = 4 + size (drawable_Add x) + size (region_Add x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_Add x)
                serialize (region_Add x)
                putSkip (requiredPadding size__)
  
-data Notify = MkNotify{level_Notify :: CARD8,
+data Notify = MkNotify{level_Notify :: Word8,
                        drawable_Notify :: DRAWABLE, damage_Notify :: DAMAGE,
                        timestamp_Notify :: TIMESTAMP, area_Notify :: RECTANGLE,
                        geometry_Notify :: RECTANGLE}
diff --git a/patched/Graphics/XHB/Gen/Glx.hs b/patched/Graphics/XHB/Gen/Glx.hs
--- a/patched/Graphics/XHB/Gen/Glx.hs
+++ b/patched/Graphics/XHB/Gen/Glx.hs
@@ -32,6 +32,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -45,7 +48,7 @@
  
 render ::
          Graphics.XHB.Connection.Types.Connection ->
-           CONTEXT_TAG -> [BYTE] -> IO ()
+           CONTEXT_TAG -> [Word8] -> IO ()
 render c context_tag data_
   = do let req = MkRender context_tag data_
        putAction <- serializeExtensionRequest c req
@@ -77,34 +80,36 @@
  
 makeCurrent ::
               Graphics.XHB.Connection.Types.Connection ->
-                MakeCurrent -> IO (Receipt MakeCurrentReply)
+                MakeCurrent -> IO (Receipt CONTEXT_TAG)
 makeCurrent c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (context_tag_MakeCurrentReply `fmap` deserialize))
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 isDirect ::
            Graphics.XHB.Connection.Types.Connection ->
-             Graphics.XHB.Gen.Glx.Types.CONTEXT -> IO (Receipt IsDirectReply)
+             Graphics.XHB.Gen.Glx.Types.CONTEXT -> IO (Receipt Bool)
 isDirect c context
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (is_direct_IsDirectReply `fmap` deserialize))
        let req = MkIsDirect context
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)
+                 Word32 -> Word32 -> IO (Receipt QueryVersionReply)
 queryVersion c major_version minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion major_version minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 waitGL ::
@@ -156,13 +161,13 @@
  
 getVisualConfigs ::
                    Graphics.XHB.Connection.Types.Connection ->
-                     CARD32 -> IO (Receipt GetVisualConfigsReply)
+                     Word32 -> IO (Receipt GetVisualConfigsReply)
 getVisualConfigs c screen
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetVisualConfigs screen
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 destroyGLXPixmap ::
@@ -185,32 +190,33 @@
                          Graphics.XHB.Connection.Types.Connection ->
                            VendorPrivateWithReply -> IO (Receipt VendorPrivateWithReplyReply)
 vendorPrivateWithReply c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryExtensionsString ::
                         Graphics.XHB.Connection.Types.Connection ->
-                          CARD32 -> IO (Receipt QueryExtensionsStringReply)
+                          Word32 -> IO (Receipt Word32)
 queryExtensionsString c screen
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (n_QueryExtensionsStringReply `fmap` deserialize))
        let req = MkQueryExtensionsString screen
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryServerString ::
                     Graphics.XHB.Connection.Types.Connection ->
-                      CARD32 -> CARD32 -> IO (Receipt QueryServerStringReply)
+                      Word32 -> Word32 -> IO (Receipt QueryServerStringReply)
 queryServerString c screen name
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryServerString screen name
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 clientInfo ::
@@ -222,13 +228,13 @@
  
 getFBConfigs ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD32 -> IO (Receipt GetFBConfigsReply)
+                 Word32 -> IO (Receipt GetFBConfigsReply)
 getFBConfigs c screen
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetFBConfigs screen
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createPixmap ::
@@ -260,21 +266,22 @@
                  Graphics.XHB.Gen.Glx.Types.CONTEXT ->
                    IO (Receipt QueryContextReply)
 queryContext c context
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryContext context
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 makeContextCurrent ::
                      Graphics.XHB.Connection.Types.Connection ->
-                       MakeContextCurrent -> IO (Receipt MakeContextCurrentReply)
+                       MakeContextCurrent -> IO (Receipt CONTEXT_TAG)
 makeContextCurrent c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (context_tag_MakeContextCurrentReply `fmap` deserialize))
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createPbuffer ::
@@ -297,11 +304,11 @@
                           Graphics.XHB.Gen.Glx.Types.DRAWABLE ->
                             IO (Receipt GetDrawableAttributesReply)
 getDrawableAttributes c drawable
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetDrawableAttributes drawable
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 changeDrawableAttributes ::
@@ -352,13 +359,14 @@
  
 genLists ::
            Graphics.XHB.Connection.Types.Connection ->
-             CONTEXT_TAG -> INT32 -> IO (Receipt GenListsReply)
+             CONTEXT_TAG -> Int32 -> IO (Receipt Word32)
 genLists c context_tag range
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (ret_val_GenListsReply `fmap` deserialize))
        let req = MkGenLists context_tag range
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 feedbackBuffer ::
@@ -370,7 +378,7 @@
  
 selectBuffer ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CONTEXT_TAG -> INT32 -> IO ()
+                 CONTEXT_TAG -> Int32 -> IO ()
 selectBuffer c context_tag size
   = do let req = MkSelectBuffer context_tag size
        putAction <- serializeExtensionRequest c req
@@ -379,24 +387,24 @@
  
 renderMode ::
              Graphics.XHB.Connection.Types.Connection ->
-               CONTEXT_TAG -> CARD32 -> IO (Receipt RenderModeReply)
+               CONTEXT_TAG -> Word32 -> IO (Receipt RenderModeReply)
 renderMode c context_tag mode
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkRenderMode context_tag mode
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 finish ::
          Graphics.XHB.Connection.Types.Connection ->
            CONTEXT_TAG -> IO (Receipt FinishReply)
 finish c context_tag
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkFinish context_tag
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 pixelStoref ::
@@ -415,314 +423,319 @@
  
 readPixels ::
              Graphics.XHB.Connection.Types.Connection ->
-               ReadPixels -> IO (Receipt ReadPixelsReply)
+               ReadPixels -> IO (Receipt [Word8])
 readPixels c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (data_ReadPixelsReply `fmap` deserialize))
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getBooleanv ::
               Graphics.XHB.Connection.Types.Connection ->
-                CONTEXT_TAG -> INT32 -> IO (Receipt GetBooleanvReply)
+                CONTEXT_TAG -> Int32 -> IO (Receipt GetBooleanvReply)
 getBooleanv c context_tag pname
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetBooleanv context_tag pname
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getClipPlane ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CONTEXT_TAG -> INT32 -> IO (Receipt GetClipPlaneReply)
+                 CONTEXT_TAG -> Int32 -> IO (Receipt [FLOAT64])
 getClipPlane c context_tag plane
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (data_GetClipPlaneReply `fmap` deserialize))
        let req = MkGetClipPlane context_tag plane
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getDoublev ::
              Graphics.XHB.Connection.Types.Connection ->
-               CONTEXT_TAG -> CARD32 -> IO (Receipt GetDoublevReply)
+               CONTEXT_TAG -> Word32 -> IO (Receipt GetDoublevReply)
 getDoublev c context_tag pname
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetDoublev context_tag pname
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getError ::
            Graphics.XHB.Connection.Types.Connection ->
-             CONTEXT_TAG -> IO (Receipt GetErrorReply)
+             CONTEXT_TAG -> IO (Receipt Int32)
 getError c context_tag
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (error_GetErrorReply `fmap` deserialize))
        let req = MkGetError context_tag
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getFloatv ::
             Graphics.XHB.Connection.Types.Connection ->
-              CONTEXT_TAG -> CARD32 -> IO (Receipt GetFloatvReply)
+              CONTEXT_TAG -> Word32 -> IO (Receipt GetFloatvReply)
 getFloatv c context_tag pname
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetFloatv context_tag pname
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getIntegerv ::
               Graphics.XHB.Connection.Types.Connection ->
-                CONTEXT_TAG -> CARD32 -> IO (Receipt GetIntegervReply)
+                CONTEXT_TAG -> Word32 -> IO (Receipt GetIntegervReply)
 getIntegerv c context_tag pname
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetIntegerv context_tag pname
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getLightfv ::
              Graphics.XHB.Connection.Types.Connection ->
                GetLightfv -> IO (Receipt GetLightfvReply)
 getLightfv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getLightiv ::
              Graphics.XHB.Connection.Types.Connection ->
                GetLightiv -> IO (Receipt GetLightivReply)
 getLightiv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getMapdv ::
            Graphics.XHB.Connection.Types.Connection ->
              GetMapdv -> IO (Receipt GetMapdvReply)
 getMapdv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getMapfv ::
            Graphics.XHB.Connection.Types.Connection ->
              GetMapfv -> IO (Receipt GetMapfvReply)
 getMapfv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getMapiv ::
            Graphics.XHB.Connection.Types.Connection ->
              GetMapiv -> IO (Receipt GetMapivReply)
 getMapiv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getMaterialfv ::
                 Graphics.XHB.Connection.Types.Connection ->
                   GetMaterialfv -> IO (Receipt GetMaterialfvReply)
 getMaterialfv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getMaterialiv ::
                 Graphics.XHB.Connection.Types.Connection ->
                   GetMaterialiv -> IO (Receipt GetMaterialivReply)
 getMaterialiv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getPixelMapfv ::
                 Graphics.XHB.Connection.Types.Connection ->
-                  CONTEXT_TAG -> CARD32 -> IO (Receipt GetPixelMapfvReply)
+                  CONTEXT_TAG -> Word32 -> IO (Receipt GetPixelMapfvReply)
 getPixelMapfv c context_tag map
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetPixelMapfv context_tag map
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getPixelMapuiv ::
                  Graphics.XHB.Connection.Types.Connection ->
-                   CONTEXT_TAG -> CARD32 -> IO (Receipt GetPixelMapuivReply)
+                   CONTEXT_TAG -> Word32 -> IO (Receipt GetPixelMapuivReply)
 getPixelMapuiv c context_tag map
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetPixelMapuiv context_tag map
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getPixelMapusv ::
                  Graphics.XHB.Connection.Types.Connection ->
-                   CONTEXT_TAG -> CARD32 -> IO (Receipt GetPixelMapusvReply)
+                   CONTEXT_TAG -> Word32 -> IO (Receipt GetPixelMapusvReply)
 getPixelMapusv c context_tag map
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetPixelMapusv context_tag map
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getPolygonStipple ::
                     Graphics.XHB.Connection.Types.Connection ->
-                      CONTEXT_TAG -> BOOL -> IO (Receipt GetPolygonStippleReply)
+                      CONTEXT_TAG -> Bool -> IO (Receipt [Word8])
 getPolygonStipple c context_tag lsb_first
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (data_GetPolygonStippleReply `fmap` deserialize))
        let req = MkGetPolygonStipple context_tag lsb_first
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getString ::
             Graphics.XHB.Connection.Types.Connection ->
-              CONTEXT_TAG -> CARD32 -> IO (Receipt GetStringReply)
+              CONTEXT_TAG -> Word32 -> IO (Receipt GetStringReply)
 getString c context_tag name
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetString context_tag name
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getTexEnvfv ::
               Graphics.XHB.Connection.Types.Connection ->
                 GetTexEnvfv -> IO (Receipt GetTexEnvfvReply)
 getTexEnvfv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getTexEnviv ::
               Graphics.XHB.Connection.Types.Connection ->
                 GetTexEnviv -> IO (Receipt GetTexEnvivReply)
 getTexEnviv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getTexGendv ::
               Graphics.XHB.Connection.Types.Connection ->
                 GetTexGendv -> IO (Receipt GetTexGendvReply)
 getTexGendv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getTexGenfv ::
               Graphics.XHB.Connection.Types.Connection ->
                 GetTexGenfv -> IO (Receipt GetTexGenfvReply)
 getTexGenfv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getTexGeniv ::
               Graphics.XHB.Connection.Types.Connection ->
                 GetTexGeniv -> IO (Receipt GetTexGenivReply)
 getTexGeniv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getTexImage ::
               Graphics.XHB.Connection.Types.Connection ->
                 GetTexImage -> IO (Receipt GetTexImageReply)
 getTexImage c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getTexParameterfv ::
                     Graphics.XHB.Connection.Types.Connection ->
                       GetTexParameterfv -> IO (Receipt GetTexParameterfvReply)
 getTexParameterfv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getTexParameteriv ::
                     Graphics.XHB.Connection.Types.Connection ->
                       GetTexParameteriv -> IO (Receipt GetTexParameterivReply)
 getTexParameteriv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getTexLevelParameterfv ::
                          Graphics.XHB.Connection.Types.Connection ->
                            GetTexLevelParameterfv -> IO (Receipt GetTexLevelParameterfvReply)
 getTexLevelParameterfv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getTexLevelParameteriv ::
                          Graphics.XHB.Connection.Types.Connection ->
                            GetTexLevelParameteriv -> IO (Receipt GetTexLevelParameterivReply)
 getTexLevelParameteriv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 isList ::
          Graphics.XHB.Connection.Types.Connection ->
-           CONTEXT_TAG -> CARD32 -> IO (Receipt IsListReply)
+           CONTEXT_TAG -> Word32 -> IO (Receipt BOOL32)
 isList c context_tag list
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (ret_val_IsListReply `fmap` deserialize))
        let req = MkIsList context_tag list
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 flush ::
@@ -737,10 +750,10 @@
                       Graphics.XHB.Connection.Types.Connection ->
                         AreTexturesResident -> IO (Receipt AreTexturesResidentReply)
 areTexturesResident c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 deleteTextures ::
@@ -752,34 +765,36 @@
  
 genTextures ::
               Graphics.XHB.Connection.Types.Connection ->
-                CONTEXT_TAG -> INT32 -> IO (Receipt GenTexturesReply)
+                CONTEXT_TAG -> Int32 -> IO (Receipt [Word32])
 genTextures c context_tag n
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (data_GenTexturesReply `fmap` deserialize))
        let req = MkGenTextures context_tag n
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 isTexture ::
             Graphics.XHB.Connection.Types.Connection ->
-              CONTEXT_TAG -> CARD32 -> IO (Receipt IsTextureReply)
+              CONTEXT_TAG -> Word32 -> IO (Receipt BOOL32)
 isTexture c context_tag texture
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (ret_val_IsTextureReply `fmap` deserialize))
        let req = MkIsTexture context_tag texture
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getColorTable ::
                 Graphics.XHB.Connection.Types.Connection ->
                   GetColorTable -> IO (Receipt GetColorTableReply)
 getColorTable c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getColorTableParameterfv ::
@@ -787,10 +802,10 @@
                              GetColorTableParameterfv ->
                                IO (Receipt GetColorTableParameterfvReply)
 getColorTableParameterfv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getColorTableParameteriv ::
@@ -798,20 +813,20 @@
                              GetColorTableParameteriv ->
                                IO (Receipt GetColorTableParameterivReply)
 getColorTableParameteriv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getConvolutionFilter ::
                        Graphics.XHB.Connection.Types.Connection ->
                          GetConvolutionFilter -> IO (Receipt GetConvolutionFilterReply)
 getConvolutionFilter c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getConvolutionParameterfv ::
@@ -819,10 +834,10 @@
                               GetConvolutionParameterfv ->
                                 IO (Receipt GetConvolutionParameterfvReply)
 getConvolutionParameterfv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getConvolutionParameteriv ::
@@ -830,30 +845,30 @@
                               GetConvolutionParameteriv ->
                                 IO (Receipt GetConvolutionParameterivReply)
 getConvolutionParameteriv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getSeparableFilter ::
                      Graphics.XHB.Connection.Types.Connection ->
                        GetSeparableFilter -> IO (Receipt GetSeparableFilterReply)
 getSeparableFilter c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getHistogram ::
                Graphics.XHB.Connection.Types.Connection ->
                  GetHistogram -> IO (Receipt GetHistogramReply)
 getHistogram c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getHistogramParameterfv ::
@@ -861,10 +876,10 @@
                             GetHistogramParameterfv ->
                               IO (Receipt GetHistogramParameterfvReply)
 getHistogramParameterfv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getHistogramParameteriv ::
@@ -872,40 +887,41 @@
                             GetHistogramParameteriv ->
                               IO (Receipt GetHistogramParameterivReply)
 getHistogramParameteriv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getMinmax ::
             Graphics.XHB.Connection.Types.Connection ->
-              GetMinmax -> IO (Receipt GetMinmaxReply)
+              GetMinmax -> IO (Receipt [Word8])
 getMinmax c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (data_GetMinmaxReply `fmap` deserialize))
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getMinmaxParameterfv ::
                        Graphics.XHB.Connection.Types.Connection ->
                          GetMinmaxParameterfv -> IO (Receipt GetMinmaxParameterfvReply)
 getMinmaxParameterfv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getMinmaxParameteriv ::
                        Graphics.XHB.Connection.Types.Connection ->
                          GetMinmaxParameteriv -> IO (Receipt GetMinmaxParameterivReply)
 getMinmaxParameteriv c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getCompressedTexImageARB ::
@@ -913,10 +929,10 @@
                              GetCompressedTexImageARB ->
                                IO (Receipt GetCompressedTexImageARBReply)
 getCompressedTexImageARB c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 deleteQueriesARB ::
@@ -929,52 +945,54 @@
  
 genQueriesARB ::
                 Graphics.XHB.Connection.Types.Connection ->
-                  CONTEXT_TAG -> INT32 -> IO (Receipt GenQueriesARBReply)
+                  CONTEXT_TAG -> Int32 -> IO (Receipt [Word32])
 genQueriesARB c context_tag n
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (data_GenQueriesARBReply `fmap` deserialize))
        let req = MkGenQueriesARB context_tag n
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 isQueryARB ::
              Graphics.XHB.Connection.Types.Connection ->
-               CONTEXT_TAG -> CARD32 -> IO (Receipt IsQueryARBReply)
+               CONTEXT_TAG -> Word32 -> IO (Receipt BOOL32)
 isQueryARB c context_tag id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (ret_val_IsQueryARBReply `fmap` deserialize))
        let req = MkIsQueryARB context_tag id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getQueryivARB ::
                 Graphics.XHB.Connection.Types.Connection ->
                   GetQueryivARB -> IO (Receipt GetQueryivARBReply)
 getQueryivARB c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getQueryObjectivARB ::
                       Graphics.XHB.Connection.Types.Connection ->
                         GetQueryObjectivARB -> IO (Receipt GetQueryObjectivARBReply)
 getQueryObjectivARB c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getQueryObjectuivARB ::
                        Graphics.XHB.Connection.Types.Connection ->
                          GetQueryObjectuivARB -> IO (Receipt GetQueryObjectuivARBReply)
 getQueryObjectuivARB c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/Glx/Types.hs b/patched/Graphics/XHB/Gen/Glx/Types.hs
--- a/patched/Graphics/XHB/Gen/Glx/Types.hs
+++ b/patched/Graphics/XHB/Gen/Glx/Types.hs
@@ -70,6 +70,7 @@
         GetQueryObjectuivARB(..), GetQueryObjectuivARBReply(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -143,12 +144,12 @@
  
 type FLOAT64 = CDouble
  
-type BOOL32 = CARD32
+type BOOL32 = Word32
  
-type CONTEXT_TAG = CARD32
+type CONTEXT_TAG = Word32
  
-data Generic = MkGeneric{bad_value_Generic :: CARD32,
-                         minor_opcode_Generic :: CARD16, major_opcode_Generic :: CARD8}
+data Generic = MkGeneric{bad_value_Generic :: Word32,
+                         minor_opcode_Generic :: Word16, major_opcode_Generic :: Word8}
              deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error Generic
@@ -162,9 +163,9 @@
                skip 21
                return (MkGeneric bad_value minor_opcode major_opcode)
  
-data BadContext = MkBadContext{bad_value_BadContext :: CARD32,
-                               minor_opcode_BadContext :: CARD16,
-                               major_opcode_BadContext :: CARD8}
+data BadContext = MkBadContext{bad_value_BadContext :: Word32,
+                               minor_opcode_BadContext :: Word16,
+                               major_opcode_BadContext :: Word8}
                 deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadContext
@@ -179,9 +180,9 @@
                return (MkBadContext bad_value minor_opcode major_opcode)
  
 data BadContextState = MkBadContextState{bad_value_BadContextState
-                                         :: CARD32,
-                                         minor_opcode_BadContextState :: CARD16,
-                                         major_opcode_BadContextState :: CARD8}
+                                         :: Word32,
+                                         minor_opcode_BadContextState :: Word16,
+                                         major_opcode_BadContextState :: Word8}
                      deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadContextState
@@ -195,9 +196,9 @@
                skip 21
                return (MkBadContextState bad_value minor_opcode major_opcode)
  
-data BadDrawable = MkBadDrawable{bad_value_BadDrawable :: CARD32,
-                                 minor_opcode_BadDrawable :: CARD16,
-                                 major_opcode_BadDrawable :: CARD8}
+data BadDrawable = MkBadDrawable{bad_value_BadDrawable :: Word32,
+                                 minor_opcode_BadDrawable :: Word16,
+                                 major_opcode_BadDrawable :: Word8}
                  deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadDrawable
@@ -211,8 +212,8 @@
                skip 21
                return (MkBadDrawable bad_value minor_opcode major_opcode)
  
-data BadPixmap = MkBadPixmap{bad_value_BadPixmap :: CARD32,
-                             minor_opcode_BadPixmap :: CARD16, major_opcode_BadPixmap :: CARD8}
+data BadPixmap = MkBadPixmap{bad_value_BadPixmap :: Word32,
+                             minor_opcode_BadPixmap :: Word16, major_opcode_BadPixmap :: Word8}
                deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadPixmap
@@ -227,9 +228,9 @@
                return (MkBadPixmap bad_value minor_opcode major_opcode)
  
 data BadContextTag = MkBadContextTag{bad_value_BadContextTag ::
-                                     CARD32,
-                                     minor_opcode_BadContextTag :: CARD16,
-                                     major_opcode_BadContextTag :: CARD8}
+                                     Word32,
+                                     minor_opcode_BadContextTag :: Word16,
+                                     major_opcode_BadContextTag :: Word8}
                    deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadContextTag
@@ -244,9 +245,9 @@
                return (MkBadContextTag bad_value minor_opcode major_opcode)
  
 data BadCurrentWindow = MkBadCurrentWindow{bad_value_BadCurrentWindow
-                                           :: CARD32,
-                                           minor_opcode_BadCurrentWindow :: CARD16,
-                                           major_opcode_BadCurrentWindow :: CARD8}
+                                           :: Word32,
+                                           minor_opcode_BadCurrentWindow :: Word16,
+                                           major_opcode_BadCurrentWindow :: Word8}
                       deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadCurrentWindow
@@ -261,9 +262,9 @@
                return (MkBadCurrentWindow bad_value minor_opcode major_opcode)
  
 data BadRenderRequest = MkBadRenderRequest{bad_value_BadRenderRequest
-                                           :: CARD32,
-                                           minor_opcode_BadRenderRequest :: CARD16,
-                                           major_opcode_BadRenderRequest :: CARD8}
+                                           :: Word32,
+                                           minor_opcode_BadRenderRequest :: Word16,
+                                           major_opcode_BadRenderRequest :: Word8}
                       deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadRenderRequest
@@ -278,9 +279,9 @@
                return (MkBadRenderRequest bad_value minor_opcode major_opcode)
  
 data BadLargeRequest = MkBadLargeRequest{bad_value_BadLargeRequest
-                                         :: CARD32,
-                                         minor_opcode_BadLargeRequest :: CARD16,
-                                         major_opcode_BadLargeRequest :: CARD8}
+                                         :: Word32,
+                                         minor_opcode_BadLargeRequest :: Word16,
+                                         major_opcode_BadLargeRequest :: Word8}
                      deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadLargeRequest
@@ -295,11 +296,11 @@
                return (MkBadLargeRequest bad_value minor_opcode major_opcode)
  
 data UnsupportedPrivateRequest = MkUnsupportedPrivateRequest{bad_value_UnsupportedPrivateRequest
-                                                             :: CARD32,
+                                                             :: Word32,
                                                              minor_opcode_UnsupportedPrivateRequest
-                                                             :: CARD16,
+                                                             :: Word16,
                                                              major_opcode_UnsupportedPrivateRequest
-                                                             :: CARD8}
+                                                             :: Word8}
                                deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error UnsupportedPrivateRequest
@@ -314,9 +315,9 @@
                return
                  (MkUnsupportedPrivateRequest bad_value minor_opcode major_opcode)
  
-data BadFBConfig = MkBadFBConfig{bad_value_BadFBConfig :: CARD32,
-                                 minor_opcode_BadFBConfig :: CARD16,
-                                 major_opcode_BadFBConfig :: CARD8}
+data BadFBConfig = MkBadFBConfig{bad_value_BadFBConfig :: Word32,
+                                 minor_opcode_BadFBConfig :: Word16,
+                                 major_opcode_BadFBConfig :: Word8}
                  deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadFBConfig
@@ -330,9 +331,9 @@
                skip 21
                return (MkBadFBConfig bad_value minor_opcode major_opcode)
  
-data BadPbuffer = MkBadPbuffer{bad_value_BadPbuffer :: CARD32,
-                               minor_opcode_BadPbuffer :: CARD16,
-                               major_opcode_BadPbuffer :: CARD8}
+data BadPbuffer = MkBadPbuffer{bad_value_BadPbuffer :: Word32,
+                               minor_opcode_BadPbuffer :: Word16,
+                               major_opcode_BadPbuffer :: Word8}
                 deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadPbuffer
@@ -347,9 +348,9 @@
                return (MkBadPbuffer bad_value minor_opcode major_opcode)
  
 data BadCurrentDrawable = MkBadCurrentDrawable{bad_value_BadCurrentDrawable
-                                               :: CARD32,
-                                               minor_opcode_BadCurrentDrawable :: CARD16,
-                                               major_opcode_BadCurrentDrawable :: CARD8}
+                                               :: Word32,
+                                               minor_opcode_BadCurrentDrawable :: Word16,
+                                               major_opcode_BadCurrentDrawable :: Word8}
                         deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadCurrentDrawable
@@ -363,8 +364,8 @@
                skip 21
                return (MkBadCurrentDrawable bad_value minor_opcode major_opcode)
  
-data BadWindow = MkBadWindow{bad_value_BadWindow :: CARD32,
-                             minor_opcode_BadWindow :: CARD16, major_opcode_BadWindow :: CARD8}
+data BadWindow = MkBadWindow{bad_value_BadWindow :: Word32,
+                             minor_opcode_BadWindow :: Word16, major_opcode_BadWindow :: Word8}
                deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadWindow
@@ -379,16 +380,16 @@
                return (MkBadWindow bad_value minor_opcode major_opcode)
  
 data PbufferClobber = MkPbufferClobber{event_type_PbufferClobber ::
-                                       CARD16,
-                                       draw_type_PbufferClobber :: CARD16,
+                                       Word16,
+                                       draw_type_PbufferClobber :: Word16,
                                        drawable_PbufferClobber ::
                                        Graphics.XHB.Gen.Glx.Types.DRAWABLE,
-                                       b_mask_PbufferClobber :: CARD32,
-                                       aux_buffer_PbufferClobber :: CARD16,
-                                       x_PbufferClobber :: CARD16, y_PbufferClobber :: CARD16,
-                                       width_PbufferClobber :: CARD16,
-                                       height_PbufferClobber :: CARD16,
-                                       count_PbufferClobber :: CARD16}
+                                       b_mask_PbufferClobber :: Word32,
+                                       aux_buffer_PbufferClobber :: Word16,
+                                       x_PbufferClobber :: Word16, y_PbufferClobber :: Word16,
+                                       width_PbufferClobber :: Word16,
+                                       height_PbufferClobber :: Word16,
+                                       count_PbufferClobber :: Word16}
                     deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event PbufferClobber
@@ -435,7 +436,7 @@
         fromValue 32794 = PBCDTPbuffer
  
 data Render = MkRender{context_tag_Render :: CONTEXT_TAG,
-                       data_Render :: [BYTE]}
+                       data_Render :: [Word8]}
             deriving (Show, Typeable)
  
 instance ExtensionRequest Render where
@@ -445,16 +446,16 @@
                putWord8 1
                let size__
                      = 4 + size (context_tag_Render x) + sum (map size (data_Render x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_Render x)
                serializeList (data_Render x)
                putSkip (requiredPadding size__)
  
 data RenderLarge = MkRenderLarge{context_tag_RenderLarge ::
                                  CONTEXT_TAG,
-                                 request_num_RenderLarge :: CARD16,
-                                 request_total_RenderLarge :: CARD16,
-                                 data_len_RenderLarge :: CARD32, data_RenderLarge :: [BYTE]}
+                                 request_num_RenderLarge :: Word16,
+                                 request_total_RenderLarge :: Word16,
+                                 data_len_RenderLarge :: Word32, data_RenderLarge :: [Word8]}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest RenderLarge where
@@ -468,7 +469,7 @@
                          + size (request_total_RenderLarge x)
                          + size (data_len_RenderLarge x)
                          + sum (map size (data_RenderLarge x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_RenderLarge x)
                serialize (request_num_RenderLarge x)
                serialize (request_total_RenderLarge x)
@@ -479,9 +480,9 @@
 data CreateContext = MkCreateContext{context_CreateContext ::
                                      Graphics.XHB.Gen.Glx.Types.CONTEXT,
                                      visual_CreateContext :: VISUALID,
-                                     screen_CreateContext :: CARD32,
+                                     screen_CreateContext :: Word32,
                                      share_list_CreateContext :: Graphics.XHB.Gen.Glx.Types.CONTEXT,
-                                     is_direct_CreateContext :: BOOL}
+                                     is_direct_CreateContext :: Bool}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest CreateContext where
@@ -496,7 +497,7 @@
                          + size (share_list_CreateContext x)
                          + size (is_direct_CreateContext x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_CreateContext x)
                serialize (visual_CreateContext x)
                serialize (screen_CreateContext x)
@@ -515,7 +516,7 @@
           = do putWord8 extOpCode
                putWord8 4
                let size__ = 4 + size (context_DestroyContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_DestroyContext x)
                putSkip (requiredPadding size__)
  
@@ -533,7 +534,7 @@
                let size__
                      = 4 + size (drawable_MakeCurrent x) + size (context_MakeCurrent x)
                          + size (old_context_tag_MakeCurrent x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_MakeCurrent x)
                serialize (context_MakeCurrent x)
                serialize (old_context_tag_MakeCurrent x)
@@ -564,12 +565,12 @@
           = do putWord8 extOpCode
                putWord8 6
                let size__ = 4 + size (context_IsDirect x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_IsDirect x)
                putSkip (requiredPadding size__)
  
 data IsDirectReply = MkIsDirectReply{is_direct_IsDirectReply ::
-                                     BOOL}
+                                     Bool}
                    deriving (Show, Typeable)
  
 instance Deserialize IsDirectReply where
@@ -584,8 +585,8 @@
                return (MkIsDirectReply is_direct)
  
 data QueryVersion = MkQueryVersion{major_version_QueryVersion ::
-                                   CARD32,
-                                   minor_version_QueryVersion :: CARD32}
+                                   Word32,
+                                   minor_version_QueryVersion :: Word32}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -596,14 +597,14 @@
                let size__
                      = 4 + size (major_version_QueryVersion x) +
                          size (minor_version_QueryVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (major_version_QueryVersion x)
                serialize (minor_version_QueryVersion x)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{major_version_QueryVersionReply
-                                             :: CARD32,
-                                             minor_version_QueryVersionReply :: CARD32}
+                                             :: Word32,
+                                             minor_version_QueryVersionReply :: Word32}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -627,7 +628,7 @@
           = do putWord8 extOpCode
                putWord8 8
                let size__ = 4 + size (context_tag_WaitGL x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_WaitGL x)
                putSkip (requiredPadding size__)
  
@@ -640,14 +641,14 @@
           = do putWord8 extOpCode
                putWord8 9
                let size__ = 4 + size (context_tag_WaitX x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_WaitX x)
                putSkip (requiredPadding size__)
  
 data CopyContext = MkCopyContext{src_CopyContext ::
                                  Graphics.XHB.Gen.Glx.Types.CONTEXT,
                                  dest_CopyContext :: Graphics.XHB.Gen.Glx.Types.CONTEXT,
-                                 mask_CopyContext :: CARD32,
+                                 mask_CopyContext :: Word32,
                                  src_context_tag_CopyContext :: CONTEXT_TAG}
                  deriving (Show, Typeable)
  
@@ -660,7 +661,7 @@
                      = 4 + size (src_CopyContext x) + size (dest_CopyContext x) +
                          size (mask_CopyContext x)
                          + size (src_context_tag_CopyContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (src_CopyContext x)
                serialize (dest_CopyContext x)
                serialize (mask_CopyContext x)
@@ -743,14 +744,14 @@
                let size__
                      = 4 + size (context_tag_SwapBuffers x) +
                          size (drawable_SwapBuffers x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_SwapBuffers x)
                serialize (drawable_SwapBuffers x)
                putSkip (requiredPadding size__)
  
 data UseXFont = MkUseXFont{context_tag_UseXFont :: CONTEXT_TAG,
-                           font_UseXFont :: FONT, first_UseXFont :: CARD32,
-                           count_UseXFont :: CARD32, list_base_UseXFont :: CARD32}
+                           font_UseXFont :: FONT, first_UseXFont :: Word32,
+                           count_UseXFont :: Word32, list_base_UseXFont :: Word32}
               deriving (Show, Typeable)
  
 instance ExtensionRequest UseXFont where
@@ -763,7 +764,7 @@
                          size (first_UseXFont x)
                          + size (count_UseXFont x)
                          + size (list_base_UseXFont x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_UseXFont x)
                serialize (font_UseXFont x)
                serialize (first_UseXFont x)
@@ -772,7 +773,7 @@
                putSkip (requiredPadding size__)
  
 data CreateGLXPixmap = MkCreateGLXPixmap{screen_CreateGLXPixmap ::
-                                         CARD32,
+                                         Word32,
                                          visual_CreateGLXPixmap :: VISUALID,
                                          pixmap_CreateGLXPixmap ::
                                          Graphics.XHB.Gen.Xproto.Types.PIXMAP,
@@ -790,7 +791,7 @@
                          size (visual_CreateGLXPixmap x)
                          + size (pixmap_CreateGLXPixmap x)
                          + size (glx_pixmap_CreateGLXPixmap x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_CreateGLXPixmap x)
                serialize (visual_CreateGLXPixmap x)
                serialize (pixmap_CreateGLXPixmap x)
@@ -798,7 +799,7 @@
                putSkip (requiredPadding size__)
  
 data GetVisualConfigs = MkGetVisualConfigs{screen_GetVisualConfigs
-                                           :: CARD32}
+                                           :: Word32}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest GetVisualConfigs where
@@ -807,15 +808,15 @@
           = do putWord8 extOpCode
                putWord8 14
                let size__ = 4 + size (screen_GetVisualConfigs x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_GetVisualConfigs x)
                putSkip (requiredPadding size__)
  
 data GetVisualConfigsReply = MkGetVisualConfigsReply{num_visuals_GetVisualConfigsReply
-                                                     :: CARD32,
-                                                     num_properties_GetVisualConfigsReply :: CARD32,
+                                                     :: Word32,
+                                                     num_properties_GetVisualConfigsReply :: Word32,
                                                      property_list_GetVisualConfigsReply ::
-                                                     [CARD32]}
+                                                     [Word32]}
                            deriving (Show, Typeable)
  
 instance Deserialize GetVisualConfigsReply where
@@ -842,14 +843,14 @@
           = do putWord8 extOpCode
                putWord8 15
                let size__ = 4 + size (glx_pixmap_DestroyGLXPixmap x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (glx_pixmap_DestroyGLXPixmap x)
                putSkip (requiredPadding size__)
  
 data VendorPrivate = MkVendorPrivate{vendor_code_VendorPrivate ::
-                                     CARD32,
+                                     Word32,
                                      context_tag_VendorPrivate :: CONTEXT_TAG,
-                                     data_VendorPrivate :: [BYTE]}
+                                     data_VendorPrivate :: [Word8]}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest VendorPrivate where
@@ -861,17 +862,17 @@
                      = 4 + size (vendor_code_VendorPrivate x) +
                          size (context_tag_VendorPrivate x)
                          + sum (map size (data_VendorPrivate x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (vendor_code_VendorPrivate x)
                serialize (context_tag_VendorPrivate x)
                serializeList (data_VendorPrivate x)
                putSkip (requiredPadding size__)
  
 data VendorPrivateWithReply = MkVendorPrivateWithReply{vendor_code_VendorPrivateWithReply
-                                                       :: CARD32,
+                                                       :: Word32,
                                                        context_tag_VendorPrivateWithReply ::
                                                        CONTEXT_TAG,
-                                                       data_VendorPrivateWithReply :: [BYTE]}
+                                                       data_VendorPrivateWithReply :: [Word8]}
                             deriving (Show, Typeable)
  
 instance ExtensionRequest VendorPrivateWithReply where
@@ -883,18 +884,18 @@
                      = 4 + size (vendor_code_VendorPrivateWithReply x) +
                          size (context_tag_VendorPrivateWithReply x)
                          + sum (map size (data_VendorPrivateWithReply x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (vendor_code_VendorPrivateWithReply x)
                serialize (context_tag_VendorPrivateWithReply x)
                serializeList (data_VendorPrivateWithReply x)
                putSkip (requiredPadding size__)
  
 data VendorPrivateWithReplyReply = MkVendorPrivateWithReplyReply{retval_VendorPrivateWithReplyReply
-                                                                 :: CARD32,
+                                                                 :: Word32,
                                                                  data1_VendorPrivateWithReplyReply
-                                                                 :: [BYTE],
+                                                                 :: [Word8],
                                                                  data2_VendorPrivateWithReplyReply
-                                                                 :: [BYTE]}
+                                                                 :: [Word8]}
                                  deriving (Show, Typeable)
  
 instance Deserialize VendorPrivateWithReplyReply where
@@ -910,7 +911,7 @@
                return (MkVendorPrivateWithReplyReply retval data1 data2)
  
 data QueryExtensionsString = MkQueryExtensionsString{screen_QueryExtensionsString
-                                                     :: CARD32}
+                                                     :: Word32}
                            deriving (Show, Typeable)
  
 instance ExtensionRequest QueryExtensionsString where
@@ -919,12 +920,12 @@
           = do putWord8 extOpCode
                putWord8 18
                let size__ = 4 + size (screen_QueryExtensionsString x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_QueryExtensionsString x)
                putSkip (requiredPadding size__)
  
 data QueryExtensionsStringReply = MkQueryExtensionsStringReply{n_QueryExtensionsStringReply
-                                                               :: CARD32}
+                                                               :: Word32}
                                 deriving (Show, Typeable)
  
 instance Deserialize QueryExtensionsStringReply where
@@ -940,8 +941,8 @@
                return (MkQueryExtensionsStringReply n)
  
 data QueryServerString = MkQueryServerString{screen_QueryServerString
-                                             :: CARD32,
-                                             name_QueryServerString :: CARD32}
+                                             :: Word32,
+                                             name_QueryServerString :: Word32}
                        deriving (Show, Typeable)
  
 instance ExtensionRequest QueryServerString where
@@ -952,13 +953,13 @@
                let size__
                      = 4 + size (screen_QueryServerString x) +
                          size (name_QueryServerString x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_QueryServerString x)
                serialize (name_QueryServerString x)
                putSkip (requiredPadding size__)
  
 data QueryServerStringReply = MkQueryServerStringReply{str_len_QueryServerStringReply
-                                                       :: CARD32,
+                                                       :: Word32,
                                                        string_QueryServerStringReply :: [CChar]}
                             deriving (Show, Typeable)
  
@@ -975,8 +976,8 @@
                let _ = isCard32 length
                return (MkQueryServerStringReply str_len string)
  
-data ClientInfo = MkClientInfo{major_version_ClientInfo :: CARD32,
-                               minor_version_ClientInfo :: CARD32, str_len_ClientInfo :: CARD32,
+data ClientInfo = MkClientInfo{major_version_ClientInfo :: Word32,
+                               minor_version_ClientInfo :: Word32, str_len_ClientInfo :: Word32,
                                string_ClientInfo :: [CChar]}
                 deriving (Show, Typeable)
  
@@ -990,14 +991,14 @@
                          size (minor_version_ClientInfo x)
                          + size (str_len_ClientInfo x)
                          + sum (map size (string_ClientInfo x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (major_version_ClientInfo x)
                serialize (minor_version_ClientInfo x)
                serialize (str_len_ClientInfo x)
                serializeList (string_ClientInfo x)
                putSkip (requiredPadding size__)
  
-data GetFBConfigs = MkGetFBConfigs{screen_GetFBConfigs :: CARD32}
+data GetFBConfigs = MkGetFBConfigs{screen_GetFBConfigs :: Word32}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest GetFBConfigs where
@@ -1006,14 +1007,14 @@
           = do putWord8 extOpCode
                putWord8 21
                let size__ = 4 + size (screen_GetFBConfigs x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_GetFBConfigs x)
                putSkip (requiredPadding size__)
  
 data GetFBConfigsReply = MkGetFBConfigsReply{num_FB_configs_GetFBConfigsReply
-                                             :: CARD32,
-                                             num_properties_GetFBConfigsReply :: CARD32,
-                                             property_list_GetFBConfigsReply :: [CARD32]}
+                                             :: Word32,
+                                             num_properties_GetFBConfigsReply :: Word32,
+                                             property_list_GetFBConfigsReply :: [Word32]}
                        deriving (Show, Typeable)
  
 instance Deserialize GetFBConfigsReply where
@@ -1030,12 +1031,12 @@
                return
                  (MkGetFBConfigsReply num_FB_configs num_properties property_list)
  
-data CreatePixmap = MkCreatePixmap{screen_CreatePixmap :: CARD32,
-                                   fbconfig_CreatePixmap :: CARD32,
+data CreatePixmap = MkCreatePixmap{screen_CreatePixmap :: Word32,
+                                   fbconfig_CreatePixmap :: Word32,
                                    pixmap_CreatePixmap :: Graphics.XHB.Gen.Xproto.Types.PIXMAP,
                                    glx_pixmap_CreatePixmap :: Graphics.XHB.Gen.Glx.Types.PIXMAP,
-                                   num_attribs_CreatePixmap :: CARD32,
-                                   attribs_CreatePixmap :: [CARD32]}
+                                   num_attribs_CreatePixmap :: Word32,
+                                   attribs_CreatePixmap :: [Word32]}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest CreatePixmap where
@@ -1049,7 +1050,7 @@
                          + size (glx_pixmap_CreatePixmap x)
                          + size (num_attribs_CreatePixmap x)
                          + sum (map size (attribs_CreatePixmap x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_CreatePixmap x)
                serialize (fbconfig_CreatePixmap x)
                serialize (pixmap_CreatePixmap x)
@@ -1068,19 +1069,19 @@
           = do putWord8 extOpCode
                putWord8 23
                let size__ = 4 + size (glx_pixmap_DestroyPixmap x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (glx_pixmap_DestroyPixmap x)
                putSkip (requiredPadding size__)
  
 data CreateNewContext = MkCreateNewContext{context_CreateNewContext
                                            :: Graphics.XHB.Gen.Glx.Types.CONTEXT,
-                                           fbconfig_CreateNewContext :: CARD32,
-                                           screen_CreateNewContext :: CARD32,
-                                           render_type_CreateNewContext :: CARD32,
-                                           share_list_CreateNewContext :: CARD32,
-                                           is_direct_CreateNewContext :: BOOL,
-                                           reserved1_CreateNewContext :: CARD8,
-                                           reserved2_CreateNewContext :: CARD16}
+                                           fbconfig_CreateNewContext :: Word32,
+                                           screen_CreateNewContext :: Word32,
+                                           render_type_CreateNewContext :: Word32,
+                                           share_list_CreateNewContext :: Word32,
+                                           is_direct_CreateNewContext :: Bool,
+                                           reserved1_CreateNewContext :: Word8,
+                                           reserved2_CreateNewContext :: Word16}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest CreateNewContext where
@@ -1097,7 +1098,7 @@
                          + size (is_direct_CreateNewContext x)
                          + size (reserved1_CreateNewContext x)
                          + size (reserved2_CreateNewContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_CreateNewContext x)
                serialize (fbconfig_CreateNewContext x)
                serialize (screen_CreateNewContext x)
@@ -1118,13 +1119,13 @@
           = do putWord8 extOpCode
                putWord8 25
                let size__ = 4 + size (context_QueryContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_QueryContext x)
                putSkip (requiredPadding size__)
  
 data QueryContextReply = MkQueryContextReply{num_attribs_QueryContextReply
-                                             :: CARD32,
-                                             attribs_QueryContextReply :: [CARD32]}
+                                             :: Word32,
+                                             attribs_QueryContextReply :: [Word32]}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryContextReply where
@@ -1160,7 +1161,7 @@
                          size (drawable_MakeContextCurrent x)
                          + size (read_drawable_MakeContextCurrent x)
                          + size (context_MakeContextCurrent x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (old_context_tag_MakeContextCurrent x)
                serialize (drawable_MakeContextCurrent x)
                serialize (read_drawable_MakeContextCurrent x)
@@ -1183,11 +1184,11 @@
                return (MkMakeContextCurrentReply context_tag)
  
 data CreatePbuffer = MkCreatePbuffer{screen_CreatePbuffer ::
-                                     CARD32,
+                                     Word32,
                                      fbconfig_CreatePbuffer :: FBCONFIG,
                                      pbuffer_CreatePbuffer :: PBUFFER,
-                                     num_attribs_CreatePbuffer :: CARD32,
-                                     attribs_CreatePbuffer :: [CARD32]}
+                                     num_attribs_CreatePbuffer :: Word32,
+                                     attribs_CreatePbuffer :: [Word32]}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest CreatePbuffer where
@@ -1201,7 +1202,7 @@
                          + size (pbuffer_CreatePbuffer x)
                          + size (num_attribs_CreatePbuffer x)
                          + sum (map size (attribs_CreatePbuffer x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_CreatePbuffer x)
                serialize (fbconfig_CreatePbuffer x)
                serialize (pbuffer_CreatePbuffer x)
@@ -1219,7 +1220,7 @@
           = do putWord8 extOpCode
                putWord8 28
                let size__ = 4 + size (pbuffer_DestroyPbuffer x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (pbuffer_DestroyPbuffer x)
                putSkip (requiredPadding size__)
  
@@ -1233,14 +1234,14 @@
           = do putWord8 extOpCode
                putWord8 29
                let size__ = 4 + size (drawable_GetDrawableAttributes x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_GetDrawableAttributes x)
                putSkip (requiredPadding size__)
  
 data GetDrawableAttributesReply = MkGetDrawableAttributesReply{num_attribs_GetDrawableAttributesReply
-                                                               :: CARD32,
+                                                               :: Word32,
                                                                attribs_GetDrawableAttributesReply ::
-                                                               [CARD32]}
+                                                               [Word32]}
                                 deriving (Show, Typeable)
  
 instance Deserialize GetDrawableAttributesReply where
@@ -1259,9 +1260,9 @@
 data ChangeDrawableAttributes = MkChangeDrawableAttributes{drawable_ChangeDrawableAttributes
                                                            :: Graphics.XHB.Gen.Glx.Types.DRAWABLE,
                                                            num_attribs_ChangeDrawableAttributes ::
-                                                           CARD32,
+                                                           Word32,
                                                            attribs_ChangeDrawableAttributes ::
-                                                           [CARD32]}
+                                                           [Word32]}
                               deriving (Show, Typeable)
  
 instance ExtensionRequest ChangeDrawableAttributes where
@@ -1273,18 +1274,18 @@
                      = 4 + size (drawable_ChangeDrawableAttributes x) +
                          size (num_attribs_ChangeDrawableAttributes x)
                          + sum (map size (attribs_ChangeDrawableAttributes x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_ChangeDrawableAttributes x)
                serialize (num_attribs_ChangeDrawableAttributes x)
                serializeList (attribs_ChangeDrawableAttributes x)
                putSkip (requiredPadding size__)
  
-data CreateWindow = MkCreateWindow{screen_CreateWindow :: CARD32,
+data CreateWindow = MkCreateWindow{screen_CreateWindow :: Word32,
                                    fbconfig_CreateWindow :: FBCONFIG,
                                    window_CreateWindow :: Graphics.XHB.Gen.Xproto.Types.WINDOW,
                                    glx_window_CreateWindow :: Graphics.XHB.Gen.Glx.Types.WINDOW,
-                                   num_attribs_CreateWindow :: CARD32,
-                                   attribs_CreateWindow :: [CARD32]}
+                                   num_attribs_CreateWindow :: Word32,
+                                   attribs_CreateWindow :: [Word32]}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest CreateWindow where
@@ -1298,7 +1299,7 @@
                          + size (glx_window_CreateWindow x)
                          + size (num_attribs_CreateWindow x)
                          + sum (map size (attribs_CreateWindow x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_CreateWindow x)
                serialize (fbconfig_CreateWindow x)
                serialize (window_CreateWindow x)
@@ -1317,12 +1318,12 @@
           = do putWord8 extOpCode
                putWord8 32
                let size__ = 4 + size (glxwindow_DeleteWindow x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (glxwindow_DeleteWindow x)
                putSkip (requiredPadding size__)
  
 data NewList = MkNewList{context_tag_NewList :: CONTEXT_TAG,
-                         list_NewList :: CARD32, mode_NewList :: CARD32}
+                         list_NewList :: Word32, mode_NewList :: Word32}
              deriving (Show, Typeable)
  
 instance ExtensionRequest NewList where
@@ -1333,7 +1334,7 @@
                let size__
                      = 4 + size (context_tag_NewList x) + size (list_NewList x) +
                          size (mode_NewList x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_NewList x)
                serialize (list_NewList x)
                serialize (mode_NewList x)
@@ -1348,13 +1349,13 @@
           = do putWord8 extOpCode
                putWord8 102
                let size__ = 4 + size (context_tag_EndList x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_EndList x)
                putSkip (requiredPadding size__)
  
 data DeleteLists = MkDeleteLists{context_tag_DeleteLists ::
                                  CONTEXT_TAG,
-                                 list_DeleteLists :: CARD32, range_DeleteLists :: INT32}
+                                 list_DeleteLists :: Word32, range_DeleteLists :: Int32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest DeleteLists where
@@ -1365,14 +1366,14 @@
                let size__
                      = 4 + size (context_tag_DeleteLists x) + size (list_DeleteLists x)
                          + size (range_DeleteLists x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_DeleteLists x)
                serialize (list_DeleteLists x)
                serialize (range_DeleteLists x)
                putSkip (requiredPadding size__)
  
 data GenLists = MkGenLists{context_tag_GenLists :: CONTEXT_TAG,
-                           range_GenLists :: INT32}
+                           range_GenLists :: Int32}
               deriving (Show, Typeable)
  
 instance ExtensionRequest GenLists where
@@ -1382,13 +1383,13 @@
                putWord8 104
                let size__
                      = 4 + size (context_tag_GenLists x) + size (range_GenLists x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GenLists x)
                serialize (range_GenLists x)
                putSkip (requiredPadding size__)
  
 data GenListsReply = MkGenListsReply{ret_val_GenListsReply ::
-                                     CARD32}
+                                     Word32}
                    deriving (Show, Typeable)
  
 instance Deserialize GenListsReply where
@@ -1403,7 +1404,7 @@
  
 data FeedbackBuffer = MkFeedbackBuffer{context_tag_FeedbackBuffer
                                        :: CONTEXT_TAG,
-                                       size_FeedbackBuffer :: INT32, type_FeedbackBuffer :: INT32}
+                                       size_FeedbackBuffer :: Int32, type_FeedbackBuffer :: Int32}
                     deriving (Show, Typeable)
  
 instance ExtensionRequest FeedbackBuffer where
@@ -1415,7 +1416,7 @@
                      = 4 + size (context_tag_FeedbackBuffer x) +
                          size (size_FeedbackBuffer x)
                          + size (type_FeedbackBuffer x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_FeedbackBuffer x)
                serialize (size_FeedbackBuffer x)
                serialize (type_FeedbackBuffer x)
@@ -1423,7 +1424,7 @@
  
 data SelectBuffer = MkSelectBuffer{context_tag_SelectBuffer ::
                                    CONTEXT_TAG,
-                                   size_SelectBuffer :: INT32}
+                                   size_SelectBuffer :: Int32}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest SelectBuffer where
@@ -1434,14 +1435,14 @@
                let size__
                      = 4 + size (context_tag_SelectBuffer x) +
                          size (size_SelectBuffer x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_SelectBuffer x)
                serialize (size_SelectBuffer x)
                putSkip (requiredPadding size__)
  
 data RenderMode = MkRenderMode{context_tag_RenderMode ::
                                CONTEXT_TAG,
-                               mode_RenderMode :: CARD32}
+                               mode_RenderMode :: Word32}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest RenderMode where
@@ -1451,16 +1452,16 @@
                putWord8 107
                let size__
                      = 4 + size (context_tag_RenderMode x) + size (mode_RenderMode x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_RenderMode x)
                serialize (mode_RenderMode x)
                putSkip (requiredPadding size__)
  
 data RenderModeReply = MkRenderModeReply{ret_val_RenderModeReply ::
-                                         CARD32,
-                                         n_RenderModeReply :: CARD32,
-                                         new_mode_RenderModeReply :: CARD32,
-                                         data_RenderModeReply :: [CARD32]}
+                                         Word32,
+                                         n_RenderModeReply :: Word32,
+                                         new_mode_RenderModeReply :: Word32,
+                                         data_RenderModeReply :: [Word32]}
                      deriving (Show, Typeable)
  
 instance Deserialize RenderModeReply where
@@ -1498,7 +1499,7 @@
           = do putWord8 extOpCode
                putWord8 108
                let size__ = 4 + size (context_tag_Finish x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_Finish x)
                putSkip (requiredPadding size__)
  
@@ -1516,7 +1517,7 @@
  
 data PixelStoref = MkPixelStoref{context_tag_PixelStoref ::
                                  CONTEXT_TAG,
-                                 pname_PixelStoref :: CARD32, datum_PixelStoref :: FLOAT32}
+                                 pname_PixelStoref :: Word32, datum_PixelStoref :: FLOAT32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest PixelStoref where
@@ -1527,7 +1528,7 @@
                let size__
                      = 4 + size (context_tag_PixelStoref x) + size (pname_PixelStoref x)
                          + size (datum_PixelStoref x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_PixelStoref x)
                serialize (pname_PixelStoref x)
                serialize (datum_PixelStoref x)
@@ -1535,7 +1536,7 @@
  
 data PixelStorei = MkPixelStorei{context_tag_PixelStorei ::
                                  CONTEXT_TAG,
-                                 pname_PixelStorei :: CARD32, datum_PixelStorei :: INT32}
+                                 pname_PixelStorei :: Word32, datum_PixelStorei :: Int32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest PixelStorei where
@@ -1546,7 +1547,7 @@
                let size__
                      = 4 + size (context_tag_PixelStorei x) + size (pname_PixelStorei x)
                          + size (datum_PixelStorei x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_PixelStorei x)
                serialize (pname_PixelStorei x)
                serialize (datum_PixelStorei x)
@@ -1554,10 +1555,10 @@
  
 data ReadPixels = MkReadPixels{context_tag_ReadPixels ::
                                CONTEXT_TAG,
-                               x_ReadPixels :: INT32, y_ReadPixels :: INT32,
-                               width_ReadPixels :: INT32, height_ReadPixels :: INT32,
-                               format_ReadPixels :: CARD32, type_ReadPixels :: CARD32,
-                               swap_bytes_ReadPixels :: BOOL, lsb_first_ReadPixels :: BOOL}
+                               x_ReadPixels :: Int32, y_ReadPixels :: Int32,
+                               width_ReadPixels :: Int32, height_ReadPixels :: Int32,
+                               format_ReadPixels :: Word32, type_ReadPixels :: Word32,
+                               swap_bytes_ReadPixels :: Bool, lsb_first_ReadPixels :: Bool}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest ReadPixels where
@@ -1574,7 +1575,7 @@
                          + size (type_ReadPixels x)
                          + size (swap_bytes_ReadPixels x)
                          + size (lsb_first_ReadPixels x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_ReadPixels x)
                serialize (x_ReadPixels x)
                serialize (y_ReadPixels x)
@@ -1587,7 +1588,7 @@
                putSkip (requiredPadding size__)
  
 data ReadPixelsReply = MkReadPixelsReply{data_ReadPixelsReply ::
-                                         [BYTE]}
+                                         [Word8]}
                      deriving (Show, Typeable)
  
 instance Deserialize ReadPixelsReply where
@@ -1603,7 +1604,7 @@
  
 data GetBooleanv = MkGetBooleanv{context_tag_GetBooleanv ::
                                  CONTEXT_TAG,
-                                 pname_GetBooleanv :: INT32}
+                                 pname_GetBooleanv :: Int32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest GetBooleanv where
@@ -1613,15 +1614,15 @@
                putWord8 112
                let size__
                      = 4 + size (context_tag_GetBooleanv x) + size (pname_GetBooleanv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetBooleanv x)
                serialize (pname_GetBooleanv x)
                putSkip (requiredPadding size__)
  
 data GetBooleanvReply = MkGetBooleanvReply{n_GetBooleanvReply ::
-                                           CARD32,
-                                           datum_GetBooleanvReply :: BOOL,
-                                           data_GetBooleanvReply :: [BOOL]}
+                                           Word32,
+                                           datum_GetBooleanvReply :: Bool,
+                                           data_GetBooleanvReply :: [Bool]}
                       deriving (Show, Typeable)
  
 instance Deserialize GetBooleanvReply where
@@ -1640,7 +1641,7 @@
  
 data GetClipPlane = MkGetClipPlane{context_tag_GetClipPlane ::
                                    CONTEXT_TAG,
-                                   plane_GetClipPlane :: INT32}
+                                   plane_GetClipPlane :: Int32}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest GetClipPlane where
@@ -1651,7 +1652,7 @@
                let size__
                      = 4 + size (context_tag_GetClipPlane x) +
                          size (plane_GetClipPlane x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetClipPlane x)
                serialize (plane_GetClipPlane x)
                putSkip (requiredPadding size__)
@@ -1674,7 +1675,7 @@
  
 data GetDoublev = MkGetDoublev{context_tag_GetDoublev ::
                                CONTEXT_TAG,
-                               pname_GetDoublev :: CARD32}
+                               pname_GetDoublev :: Word32}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest GetDoublev where
@@ -1684,13 +1685,13 @@
                putWord8 114
                let size__
                      = 4 + size (context_tag_GetDoublev x) + size (pname_GetDoublev x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetDoublev x)
                serialize (pname_GetDoublev x)
                putSkip (requiredPadding size__)
  
 data GetDoublevReply = MkGetDoublevReply{n_GetDoublevReply ::
-                                         CARD32,
+                                         Word32,
                                          datum_GetDoublevReply :: FLOAT64,
                                          data_GetDoublevReply :: [FLOAT64]}
                      deriving (Show, Typeable)
@@ -1718,11 +1719,11 @@
           = do putWord8 extOpCode
                putWord8 115
                let size__ = 4 + size (context_tag_GetError x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetError x)
                putSkip (requiredPadding size__)
  
-data GetErrorReply = MkGetErrorReply{error_GetErrorReply :: INT32}
+data GetErrorReply = MkGetErrorReply{error_GetErrorReply :: Int32}
                    deriving (Show, Typeable)
  
 instance Deserialize GetErrorReply where
@@ -1736,7 +1737,7 @@
                return (MkGetErrorReply error)
  
 data GetFloatv = MkGetFloatv{context_tag_GetFloatv :: CONTEXT_TAG,
-                             pname_GetFloatv :: CARD32}
+                             pname_GetFloatv :: Word32}
                deriving (Show, Typeable)
  
 instance ExtensionRequest GetFloatv where
@@ -1746,12 +1747,12 @@
                putWord8 116
                let size__
                      = 4 + size (context_tag_GetFloatv x) + size (pname_GetFloatv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetFloatv x)
                serialize (pname_GetFloatv x)
                putSkip (requiredPadding size__)
  
-data GetFloatvReply = MkGetFloatvReply{n_GetFloatvReply :: CARD32,
+data GetFloatvReply = MkGetFloatvReply{n_GetFloatvReply :: Word32,
                                        datum_GetFloatvReply :: FLOAT32,
                                        data_GetFloatvReply :: [FLOAT32]}
                     deriving (Show, Typeable)
@@ -1772,7 +1773,7 @@
  
 data GetIntegerv = MkGetIntegerv{context_tag_GetIntegerv ::
                                  CONTEXT_TAG,
-                                 pname_GetIntegerv :: CARD32}
+                                 pname_GetIntegerv :: Word32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest GetIntegerv where
@@ -1782,15 +1783,15 @@
                putWord8 117
                let size__
                      = 4 + size (context_tag_GetIntegerv x) + size (pname_GetIntegerv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetIntegerv x)
                serialize (pname_GetIntegerv x)
                putSkip (requiredPadding size__)
  
 data GetIntegervReply = MkGetIntegervReply{n_GetIntegervReply ::
-                                           CARD32,
-                                           datum_GetIntegervReply :: INT32,
-                                           data_GetIntegervReply :: [INT32]}
+                                           Word32,
+                                           datum_GetIntegervReply :: Int32,
+                                           data_GetIntegervReply :: [Int32]}
                       deriving (Show, Typeable)
  
 instance Deserialize GetIntegervReply where
@@ -1809,7 +1810,7 @@
  
 data GetLightfv = MkGetLightfv{context_tag_GetLightfv ::
                                CONTEXT_TAG,
-                               light_GetLightfv :: CARD32, pname_GetLightfv :: CARD32}
+                               light_GetLightfv :: Word32, pname_GetLightfv :: Word32}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest GetLightfv where
@@ -1820,14 +1821,14 @@
                let size__
                      = 4 + size (context_tag_GetLightfv x) + size (light_GetLightfv x) +
                          size (pname_GetLightfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetLightfv x)
                serialize (light_GetLightfv x)
                serialize (pname_GetLightfv x)
                putSkip (requiredPadding size__)
  
 data GetLightfvReply = MkGetLightfvReply{n_GetLightfvReply ::
-                                         CARD32,
+                                         Word32,
                                          datum_GetLightfvReply :: FLOAT32,
                                          data_GetLightfvReply :: [FLOAT32]}
                      deriving (Show, Typeable)
@@ -1848,7 +1849,7 @@
  
 data GetLightiv = MkGetLightiv{context_tag_GetLightiv ::
                                CONTEXT_TAG,
-                               light_GetLightiv :: CARD32, pname_GetLightiv :: CARD32}
+                               light_GetLightiv :: Word32, pname_GetLightiv :: Word32}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest GetLightiv where
@@ -1859,16 +1860,16 @@
                let size__
                      = 4 + size (context_tag_GetLightiv x) + size (light_GetLightiv x) +
                          size (pname_GetLightiv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetLightiv x)
                serialize (light_GetLightiv x)
                serialize (pname_GetLightiv x)
                putSkip (requiredPadding size__)
  
 data GetLightivReply = MkGetLightivReply{n_GetLightivReply ::
-                                         CARD32,
-                                         datum_GetLightivReply :: INT32,
-                                         data_GetLightivReply :: [INT32]}
+                                         Word32,
+                                         datum_GetLightivReply :: Int32,
+                                         data_GetLightivReply :: [Int32]}
                      deriving (Show, Typeable)
  
 instance Deserialize GetLightivReply where
@@ -1886,7 +1887,7 @@
                return (MkGetLightivReply n datum data_)
  
 data GetMapdv = MkGetMapdv{context_tag_GetMapdv :: CONTEXT_TAG,
-                           target_GetMapdv :: CARD32, query_GetMapdv :: CARD32}
+                           target_GetMapdv :: Word32, query_GetMapdv :: Word32}
               deriving (Show, Typeable)
  
 instance ExtensionRequest GetMapdv where
@@ -1897,13 +1898,13 @@
                let size__
                      = 4 + size (context_tag_GetMapdv x) + size (target_GetMapdv x) +
                          size (query_GetMapdv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetMapdv x)
                serialize (target_GetMapdv x)
                serialize (query_GetMapdv x)
                putSkip (requiredPadding size__)
  
-data GetMapdvReply = MkGetMapdvReply{n_GetMapdvReply :: CARD32,
+data GetMapdvReply = MkGetMapdvReply{n_GetMapdvReply :: Word32,
                                      datum_GetMapdvReply :: FLOAT64,
                                      data_GetMapdvReply :: [FLOAT64]}
                    deriving (Show, Typeable)
@@ -1923,7 +1924,7 @@
                return (MkGetMapdvReply n datum data_)
  
 data GetMapfv = MkGetMapfv{context_tag_GetMapfv :: CONTEXT_TAG,
-                           target_GetMapfv :: CARD32, query_GetMapfv :: CARD32}
+                           target_GetMapfv :: Word32, query_GetMapfv :: Word32}
               deriving (Show, Typeable)
  
 instance ExtensionRequest GetMapfv where
@@ -1934,13 +1935,13 @@
                let size__
                      = 4 + size (context_tag_GetMapfv x) + size (target_GetMapfv x) +
                          size (query_GetMapfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetMapfv x)
                serialize (target_GetMapfv x)
                serialize (query_GetMapfv x)
                putSkip (requiredPadding size__)
  
-data GetMapfvReply = MkGetMapfvReply{n_GetMapfvReply :: CARD32,
+data GetMapfvReply = MkGetMapfvReply{n_GetMapfvReply :: Word32,
                                      datum_GetMapfvReply :: FLOAT32,
                                      data_GetMapfvReply :: [FLOAT32]}
                    deriving (Show, Typeable)
@@ -1960,7 +1961,7 @@
                return (MkGetMapfvReply n datum data_)
  
 data GetMapiv = MkGetMapiv{context_tag_GetMapiv :: CONTEXT_TAG,
-                           target_GetMapiv :: CARD32, query_GetMapiv :: CARD32}
+                           target_GetMapiv :: Word32, query_GetMapiv :: Word32}
               deriving (Show, Typeable)
  
 instance ExtensionRequest GetMapiv where
@@ -1971,14 +1972,14 @@
                let size__
                      = 4 + size (context_tag_GetMapiv x) + size (target_GetMapiv x) +
                          size (query_GetMapiv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetMapiv x)
                serialize (target_GetMapiv x)
                serialize (query_GetMapiv x)
                putSkip (requiredPadding size__)
  
-data GetMapivReply = MkGetMapivReply{n_GetMapivReply :: CARD32,
-                                     datum_GetMapivReply :: INT32, data_GetMapivReply :: [INT32]}
+data GetMapivReply = MkGetMapivReply{n_GetMapivReply :: Word32,
+                                     datum_GetMapivReply :: Int32, data_GetMapivReply :: [Int32]}
                    deriving (Show, Typeable)
  
 instance Deserialize GetMapivReply where
@@ -1997,7 +1998,7 @@
  
 data GetMaterialfv = MkGetMaterialfv{context_tag_GetMaterialfv ::
                                      CONTEXT_TAG,
-                                     face_GetMaterialfv :: CARD32, pname_GetMaterialfv :: CARD32}
+                                     face_GetMaterialfv :: Word32, pname_GetMaterialfv :: Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest GetMaterialfv where
@@ -2009,14 +2010,14 @@
                      = 4 + size (context_tag_GetMaterialfv x) +
                          size (face_GetMaterialfv x)
                          + size (pname_GetMaterialfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetMaterialfv x)
                serialize (face_GetMaterialfv x)
                serialize (pname_GetMaterialfv x)
                putSkip (requiredPadding size__)
  
 data GetMaterialfvReply = MkGetMaterialfvReply{n_GetMaterialfvReply
-                                               :: CARD32,
+                                               :: Word32,
                                                datum_GetMaterialfvReply :: FLOAT32,
                                                data_GetMaterialfvReply :: [FLOAT32]}
                         deriving (Show, Typeable)
@@ -2037,7 +2038,7 @@
  
 data GetMaterialiv = MkGetMaterialiv{context_tag_GetMaterialiv ::
                                      CONTEXT_TAG,
-                                     face_GetMaterialiv :: CARD32, pname_GetMaterialiv :: CARD32}
+                                     face_GetMaterialiv :: Word32, pname_GetMaterialiv :: Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest GetMaterialiv where
@@ -2049,16 +2050,16 @@
                      = 4 + size (context_tag_GetMaterialiv x) +
                          size (face_GetMaterialiv x)
                          + size (pname_GetMaterialiv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetMaterialiv x)
                serialize (face_GetMaterialiv x)
                serialize (pname_GetMaterialiv x)
                putSkip (requiredPadding size__)
  
 data GetMaterialivReply = MkGetMaterialivReply{n_GetMaterialivReply
-                                               :: CARD32,
-                                               datum_GetMaterialivReply :: INT32,
-                                               data_GetMaterialivReply :: [INT32]}
+                                               :: Word32,
+                                               datum_GetMaterialivReply :: Int32,
+                                               data_GetMaterialivReply :: [Int32]}
                         deriving (Show, Typeable)
  
 instance Deserialize GetMaterialivReply where
@@ -2077,7 +2078,7 @@
  
 data GetPixelMapfv = MkGetPixelMapfv{context_tag_GetPixelMapfv ::
                                      CONTEXT_TAG,
-                                     map_GetPixelMapfv :: CARD32}
+                                     map_GetPixelMapfv :: Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest GetPixelMapfv where
@@ -2088,13 +2089,13 @@
                let size__
                      = 4 + size (context_tag_GetPixelMapfv x) +
                          size (map_GetPixelMapfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetPixelMapfv x)
                serialize (map_GetPixelMapfv x)
                putSkip (requiredPadding size__)
  
 data GetPixelMapfvReply = MkGetPixelMapfvReply{n_GetPixelMapfvReply
-                                               :: CARD32,
+                                               :: Word32,
                                                datum_GetPixelMapfvReply :: FLOAT32,
                                                data_GetPixelMapfvReply :: [FLOAT32]}
                         deriving (Show, Typeable)
@@ -2115,7 +2116,7 @@
  
 data GetPixelMapuiv = MkGetPixelMapuiv{context_tag_GetPixelMapuiv
                                        :: CONTEXT_TAG,
-                                       map_GetPixelMapuiv :: CARD32}
+                                       map_GetPixelMapuiv :: Word32}
                     deriving (Show, Typeable)
  
 instance ExtensionRequest GetPixelMapuiv where
@@ -2126,15 +2127,15 @@
                let size__
                      = 4 + size (context_tag_GetPixelMapuiv x) +
                          size (map_GetPixelMapuiv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetPixelMapuiv x)
                serialize (map_GetPixelMapuiv x)
                putSkip (requiredPadding size__)
  
 data GetPixelMapuivReply = MkGetPixelMapuivReply{n_GetPixelMapuivReply
-                                                 :: CARD32,
-                                                 datum_GetPixelMapuivReply :: CARD32,
-                                                 data_GetPixelMapuivReply :: [CARD32]}
+                                                 :: Word32,
+                                                 datum_GetPixelMapuivReply :: Word32,
+                                                 data_GetPixelMapuivReply :: [Word32]}
                          deriving (Show, Typeable)
  
 instance Deserialize GetPixelMapuivReply where
@@ -2153,7 +2154,7 @@
  
 data GetPixelMapusv = MkGetPixelMapusv{context_tag_GetPixelMapusv
                                        :: CONTEXT_TAG,
-                                       map_GetPixelMapusv :: CARD32}
+                                       map_GetPixelMapusv :: Word32}
                     deriving (Show, Typeable)
  
 instance ExtensionRequest GetPixelMapusv where
@@ -2164,15 +2165,15 @@
                let size__
                      = 4 + size (context_tag_GetPixelMapusv x) +
                          size (map_GetPixelMapusv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetPixelMapusv x)
                serialize (map_GetPixelMapusv x)
                putSkip (requiredPadding size__)
  
 data GetPixelMapusvReply = MkGetPixelMapusvReply{n_GetPixelMapusvReply
-                                                 :: CARD32,
-                                                 datum_GetPixelMapusvReply :: CARD16,
-                                                 data_GetPixelMapusvReply :: [CARD16]}
+                                                 :: Word32,
+                                                 datum_GetPixelMapusvReply :: Word16,
+                                                 data_GetPixelMapusvReply :: [Word16]}
                          deriving (Show, Typeable)
  
 instance Deserialize GetPixelMapusvReply where
@@ -2191,7 +2192,7 @@
  
 data GetPolygonStipple = MkGetPolygonStipple{context_tag_GetPolygonStipple
                                              :: CONTEXT_TAG,
-                                             lsb_first_GetPolygonStipple :: BOOL}
+                                             lsb_first_GetPolygonStipple :: Bool}
                        deriving (Show, Typeable)
  
 instance ExtensionRequest GetPolygonStipple where
@@ -2202,13 +2203,13 @@
                let size__
                      = 4 + size (context_tag_GetPolygonStipple x) +
                          size (lsb_first_GetPolygonStipple x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetPolygonStipple x)
                serialize (lsb_first_GetPolygonStipple x)
                putSkip (requiredPadding size__)
  
 data GetPolygonStippleReply = MkGetPolygonStippleReply{data_GetPolygonStippleReply
-                                                       :: [BYTE]}
+                                                       :: [Word8]}
                             deriving (Show, Typeable)
  
 instance Deserialize GetPolygonStippleReply where
@@ -2223,7 +2224,7 @@
                return (MkGetPolygonStippleReply data_)
  
 data GetString = MkGetString{context_tag_GetString :: CONTEXT_TAG,
-                             name_GetString :: CARD32}
+                             name_GetString :: Word32}
                deriving (Show, Typeable)
  
 instance ExtensionRequest GetString where
@@ -2233,12 +2234,12 @@
                putWord8 129
                let size__
                      = 4 + size (context_tag_GetString x) + size (name_GetString x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetString x)
                serialize (name_GetString x)
                putSkip (requiredPadding size__)
  
-data GetStringReply = MkGetStringReply{n_GetStringReply :: CARD32,
+data GetStringReply = MkGetStringReply{n_GetStringReply :: Word32,
                                        string_GetStringReply :: [CChar]}
                     deriving (Show, Typeable)
  
@@ -2257,7 +2258,7 @@
  
 data GetTexEnvfv = MkGetTexEnvfv{context_tag_GetTexEnvfv ::
                                  CONTEXT_TAG,
-                                 target_GetTexEnvfv :: CARD32, pname_GetTexEnvfv :: CARD32}
+                                 target_GetTexEnvfv :: Word32, pname_GetTexEnvfv :: Word32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest GetTexEnvfv where
@@ -2269,14 +2270,14 @@
                      = 4 + size (context_tag_GetTexEnvfv x) +
                          size (target_GetTexEnvfv x)
                          + size (pname_GetTexEnvfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetTexEnvfv x)
                serialize (target_GetTexEnvfv x)
                serialize (pname_GetTexEnvfv x)
                putSkip (requiredPadding size__)
  
 data GetTexEnvfvReply = MkGetTexEnvfvReply{n_GetTexEnvfvReply ::
-                                           CARD32,
+                                           Word32,
                                            datum_GetTexEnvfvReply :: FLOAT32,
                                            data_GetTexEnvfvReply :: [FLOAT32]}
                       deriving (Show, Typeable)
@@ -2297,7 +2298,7 @@
  
 data GetTexEnviv = MkGetTexEnviv{context_tag_GetTexEnviv ::
                                  CONTEXT_TAG,
-                                 target_GetTexEnviv :: CARD32, pname_GetTexEnviv :: CARD32}
+                                 target_GetTexEnviv :: Word32, pname_GetTexEnviv :: Word32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest GetTexEnviv where
@@ -2309,16 +2310,16 @@
                      = 4 + size (context_tag_GetTexEnviv x) +
                          size (target_GetTexEnviv x)
                          + size (pname_GetTexEnviv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetTexEnviv x)
                serialize (target_GetTexEnviv x)
                serialize (pname_GetTexEnviv x)
                putSkip (requiredPadding size__)
  
 data GetTexEnvivReply = MkGetTexEnvivReply{n_GetTexEnvivReply ::
-                                           CARD32,
-                                           datum_GetTexEnvivReply :: INT32,
-                                           data_GetTexEnvivReply :: [INT32]}
+                                           Word32,
+                                           datum_GetTexEnvivReply :: Int32,
+                                           data_GetTexEnvivReply :: [Int32]}
                       deriving (Show, Typeable)
  
 instance Deserialize GetTexEnvivReply where
@@ -2337,7 +2338,7 @@
  
 data GetTexGendv = MkGetTexGendv{context_tag_GetTexGendv ::
                                  CONTEXT_TAG,
-                                 coord_GetTexGendv :: CARD32, pname_GetTexGendv :: CARD32}
+                                 coord_GetTexGendv :: Word32, pname_GetTexGendv :: Word32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest GetTexGendv where
@@ -2348,14 +2349,14 @@
                let size__
                      = 4 + size (context_tag_GetTexGendv x) + size (coord_GetTexGendv x)
                          + size (pname_GetTexGendv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetTexGendv x)
                serialize (coord_GetTexGendv x)
                serialize (pname_GetTexGendv x)
                putSkip (requiredPadding size__)
  
 data GetTexGendvReply = MkGetTexGendvReply{n_GetTexGendvReply ::
-                                           CARD32,
+                                           Word32,
                                            datum_GetTexGendvReply :: FLOAT64,
                                            data_GetTexGendvReply :: [FLOAT64]}
                       deriving (Show, Typeable)
@@ -2376,7 +2377,7 @@
  
 data GetTexGenfv = MkGetTexGenfv{context_tag_GetTexGenfv ::
                                  CONTEXT_TAG,
-                                 coord_GetTexGenfv :: CARD32, pname_GetTexGenfv :: CARD32}
+                                 coord_GetTexGenfv :: Word32, pname_GetTexGenfv :: Word32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest GetTexGenfv where
@@ -2387,14 +2388,14 @@
                let size__
                      = 4 + size (context_tag_GetTexGenfv x) + size (coord_GetTexGenfv x)
                          + size (pname_GetTexGenfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetTexGenfv x)
                serialize (coord_GetTexGenfv x)
                serialize (pname_GetTexGenfv x)
                putSkip (requiredPadding size__)
  
 data GetTexGenfvReply = MkGetTexGenfvReply{n_GetTexGenfvReply ::
-                                           CARD32,
+                                           Word32,
                                            datum_GetTexGenfvReply :: FLOAT32,
                                            data_GetTexGenfvReply :: [FLOAT32]}
                       deriving (Show, Typeable)
@@ -2415,7 +2416,7 @@
  
 data GetTexGeniv = MkGetTexGeniv{context_tag_GetTexGeniv ::
                                  CONTEXT_TAG,
-                                 coord_GetTexGeniv :: CARD32, pname_GetTexGeniv :: CARD32}
+                                 coord_GetTexGeniv :: Word32, pname_GetTexGeniv :: Word32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest GetTexGeniv where
@@ -2426,16 +2427,16 @@
                let size__
                      = 4 + size (context_tag_GetTexGeniv x) + size (coord_GetTexGeniv x)
                          + size (pname_GetTexGeniv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetTexGeniv x)
                serialize (coord_GetTexGeniv x)
                serialize (pname_GetTexGeniv x)
                putSkip (requiredPadding size__)
  
 data GetTexGenivReply = MkGetTexGenivReply{n_GetTexGenivReply ::
-                                           CARD32,
-                                           datum_GetTexGenivReply :: INT32,
-                                           data_GetTexGenivReply :: [INT32]}
+                                           Word32,
+                                           datum_GetTexGenivReply :: Int32,
+                                           data_GetTexGenivReply :: [Int32]}
                       deriving (Show, Typeable)
  
 instance Deserialize GetTexGenivReply where
@@ -2454,9 +2455,9 @@
  
 data GetTexImage = MkGetTexImage{context_tag_GetTexImage ::
                                  CONTEXT_TAG,
-                                 target_GetTexImage :: CARD32, level_GetTexImage :: INT32,
-                                 format_GetTexImage :: CARD32, type_GetTexImage :: CARD32,
-                                 swap_bytes_GetTexImage :: BOOL}
+                                 target_GetTexImage :: Word32, level_GetTexImage :: Int32,
+                                 format_GetTexImage :: Word32, type_GetTexImage :: Word32,
+                                 swap_bytes_GetTexImage :: Bool}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest GetTexImage where
@@ -2471,7 +2472,7 @@
                          + size (format_GetTexImage x)
                          + size (type_GetTexImage x)
                          + size (swap_bytes_GetTexImage x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetTexImage x)
                serialize (target_GetTexImage x)
                serialize (level_GetTexImage x)
@@ -2481,10 +2482,10 @@
                putSkip (requiredPadding size__)
  
 data GetTexImageReply = MkGetTexImageReply{width_GetTexImageReply
-                                           :: INT32,
-                                           height_GetTexImageReply :: INT32,
-                                           depth_GetTexImageReply :: INT32,
-                                           data_GetTexImageReply :: [BYTE]}
+                                           :: Int32,
+                                           height_GetTexImageReply :: Int32,
+                                           depth_GetTexImageReply :: Int32,
+                                           data_GetTexImageReply :: [Word8]}
                       deriving (Show, Typeable)
  
 instance Deserialize GetTexImageReply where
@@ -2504,8 +2505,8 @@
  
 data GetTexParameterfv = MkGetTexParameterfv{context_tag_GetTexParameterfv
                                              :: CONTEXT_TAG,
-                                             target_GetTexParameterfv :: CARD32,
-                                             pname_GetTexParameterfv :: CARD32}
+                                             target_GetTexParameterfv :: Word32,
+                                             pname_GetTexParameterfv :: Word32}
                        deriving (Show, Typeable)
  
 instance ExtensionRequest GetTexParameterfv where
@@ -2517,14 +2518,14 @@
                      = 4 + size (context_tag_GetTexParameterfv x) +
                          size (target_GetTexParameterfv x)
                          + size (pname_GetTexParameterfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetTexParameterfv x)
                serialize (target_GetTexParameterfv x)
                serialize (pname_GetTexParameterfv x)
                putSkip (requiredPadding size__)
  
 data GetTexParameterfvReply = MkGetTexParameterfvReply{n_GetTexParameterfvReply
-                                                       :: CARD32,
+                                                       :: Word32,
                                                        datum_GetTexParameterfvReply :: FLOAT32,
                                                        data_GetTexParameterfvReply :: [FLOAT32]}
                             deriving (Show, Typeable)
@@ -2545,8 +2546,8 @@
  
 data GetTexParameteriv = MkGetTexParameteriv{context_tag_GetTexParameteriv
                                              :: CONTEXT_TAG,
-                                             target_GetTexParameteriv :: CARD32,
-                                             pname_GetTexParameteriv :: CARD32}
+                                             target_GetTexParameteriv :: Word32,
+                                             pname_GetTexParameteriv :: Word32}
                        deriving (Show, Typeable)
  
 instance ExtensionRequest GetTexParameteriv where
@@ -2558,16 +2559,16 @@
                      = 4 + size (context_tag_GetTexParameteriv x) +
                          size (target_GetTexParameteriv x)
                          + size (pname_GetTexParameteriv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetTexParameteriv x)
                serialize (target_GetTexParameteriv x)
                serialize (pname_GetTexParameteriv x)
                putSkip (requiredPadding size__)
  
 data GetTexParameterivReply = MkGetTexParameterivReply{n_GetTexParameterivReply
-                                                       :: CARD32,
-                                                       datum_GetTexParameterivReply :: INT32,
-                                                       data_GetTexParameterivReply :: [INT32]}
+                                                       :: Word32,
+                                                       datum_GetTexParameterivReply :: Int32,
+                                                       data_GetTexParameterivReply :: [Int32]}
                             deriving (Show, Typeable)
  
 instance Deserialize GetTexParameterivReply where
@@ -2586,9 +2587,9 @@
  
 data GetTexLevelParameterfv = MkGetTexLevelParameterfv{context_tag_GetTexLevelParameterfv
                                                        :: CONTEXT_TAG,
-                                                       target_GetTexLevelParameterfv :: CARD32,
-                                                       level_GetTexLevelParameterfv :: INT32,
-                                                       pname_GetTexLevelParameterfv :: CARD32}
+                                                       target_GetTexLevelParameterfv :: Word32,
+                                                       level_GetTexLevelParameterfv :: Int32,
+                                                       pname_GetTexLevelParameterfv :: Word32}
                             deriving (Show, Typeable)
  
 instance ExtensionRequest GetTexLevelParameterfv where
@@ -2601,7 +2602,7 @@
                          size (target_GetTexLevelParameterfv x)
                          + size (level_GetTexLevelParameterfv x)
                          + size (pname_GetTexLevelParameterfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetTexLevelParameterfv x)
                serialize (target_GetTexLevelParameterfv x)
                serialize (level_GetTexLevelParameterfv x)
@@ -2609,7 +2610,7 @@
                putSkip (requiredPadding size__)
  
 data GetTexLevelParameterfvReply = MkGetTexLevelParameterfvReply{n_GetTexLevelParameterfvReply
-                                                                 :: CARD32,
+                                                                 :: Word32,
                                                                  datum_GetTexLevelParameterfvReply
                                                                  :: FLOAT32,
                                                                  data_GetTexLevelParameterfvReply ::
@@ -2632,9 +2633,9 @@
  
 data GetTexLevelParameteriv = MkGetTexLevelParameteriv{context_tag_GetTexLevelParameteriv
                                                        :: CONTEXT_TAG,
-                                                       target_GetTexLevelParameteriv :: CARD32,
-                                                       level_GetTexLevelParameteriv :: INT32,
-                                                       pname_GetTexLevelParameteriv :: CARD32}
+                                                       target_GetTexLevelParameteriv :: Word32,
+                                                       level_GetTexLevelParameteriv :: Int32,
+                                                       pname_GetTexLevelParameteriv :: Word32}
                             deriving (Show, Typeable)
  
 instance ExtensionRequest GetTexLevelParameteriv where
@@ -2647,7 +2648,7 @@
                          size (target_GetTexLevelParameteriv x)
                          + size (level_GetTexLevelParameteriv x)
                          + size (pname_GetTexLevelParameteriv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetTexLevelParameteriv x)
                serialize (target_GetTexLevelParameteriv x)
                serialize (level_GetTexLevelParameteriv x)
@@ -2655,11 +2656,11 @@
                putSkip (requiredPadding size__)
  
 data GetTexLevelParameterivReply = MkGetTexLevelParameterivReply{n_GetTexLevelParameterivReply
-                                                                 :: CARD32,
+                                                                 :: Word32,
                                                                  datum_GetTexLevelParameterivReply
-                                                                 :: INT32,
+                                                                 :: Int32,
                                                                  data_GetTexLevelParameterivReply ::
-                                                                 [INT32]}
+                                                                 [Int32]}
                                  deriving (Show, Typeable)
  
 instance Deserialize GetTexLevelParameterivReply where
@@ -2677,7 +2678,7 @@
                return (MkGetTexLevelParameterivReply n datum data_)
  
 data IsList = MkIsList{context_tag_IsList :: CONTEXT_TAG,
-                       list_IsList :: CARD32}
+                       list_IsList :: Word32}
             deriving (Show, Typeable)
  
 instance ExtensionRequest IsList where
@@ -2686,7 +2687,7 @@
           = do putWord8 extOpCode
                putWord8 141
                let size__ = 4 + size (context_tag_IsList x) + size (list_IsList x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_IsList x)
                serialize (list_IsList x)
                putSkip (requiredPadding size__)
@@ -2713,14 +2714,14 @@
           = do putWord8 extOpCode
                putWord8 142
                let size__ = 4 + size (context_tag_Flush x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_Flush x)
                putSkip (requiredPadding size__)
  
 data AreTexturesResident = MkAreTexturesResident{context_tag_AreTexturesResident
                                                  :: CONTEXT_TAG,
-                                                 n_AreTexturesResident :: INT32,
-                                                 textures_AreTexturesResident :: [CARD32]}
+                                                 n_AreTexturesResident :: Int32,
+                                                 textures_AreTexturesResident :: [Word32]}
                          deriving (Show, Typeable)
  
 instance ExtensionRequest AreTexturesResident where
@@ -2732,7 +2733,7 @@
                      = 4 + size (context_tag_AreTexturesResident x) +
                          size (n_AreTexturesResident x)
                          + sum (map size (textures_AreTexturesResident x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_AreTexturesResident x)
                serialize (n_AreTexturesResident x)
                serializeList (textures_AreTexturesResident x)
@@ -2740,7 +2741,7 @@
  
 data AreTexturesResidentReply = MkAreTexturesResidentReply{ret_val_AreTexturesResidentReply
                                                            :: BOOL32,
-                                                           data_AreTexturesResidentReply :: [BOOL]}
+                                                           data_AreTexturesResidentReply :: [Bool]}
                               deriving (Show, Typeable)
  
 instance Deserialize AreTexturesResidentReply where
@@ -2757,8 +2758,8 @@
  
 data DeleteTextures = MkDeleteTextures{context_tag_DeleteTextures
                                        :: CONTEXT_TAG,
-                                       n_DeleteTextures :: INT32,
-                                       textures_DeleteTextures :: [CARD32]}
+                                       n_DeleteTextures :: Int32,
+                                       textures_DeleteTextures :: [Word32]}
                     deriving (Show, Typeable)
  
 instance ExtensionRequest DeleteTextures where
@@ -2770,7 +2771,7 @@
                      = 4 + size (context_tag_DeleteTextures x) +
                          size (n_DeleteTextures x)
                          + sum (map size (textures_DeleteTextures x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_DeleteTextures x)
                serialize (n_DeleteTextures x)
                serializeList (textures_DeleteTextures x)
@@ -2778,7 +2779,7 @@
  
 data GenTextures = MkGenTextures{context_tag_GenTextures ::
                                  CONTEXT_TAG,
-                                 n_GenTextures :: INT32}
+                                 n_GenTextures :: Int32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest GenTextures where
@@ -2788,13 +2789,13 @@
                putWord8 145
                let size__
                      = 4 + size (context_tag_GenTextures x) + size (n_GenTextures x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GenTextures x)
                serialize (n_GenTextures x)
                putSkip (requiredPadding size__)
  
 data GenTexturesReply = MkGenTexturesReply{data_GenTexturesReply ::
-                                           [CARD32]}
+                                           [Word32]}
                       deriving (Show, Typeable)
  
 instance Deserialize GenTexturesReply where
@@ -2809,7 +2810,7 @@
                return (MkGenTexturesReply data_)
  
 data IsTexture = MkIsTexture{context_tag_IsTexture :: CONTEXT_TAG,
-                             texture_IsTexture :: CARD32}
+                             texture_IsTexture :: Word32}
                deriving (Show, Typeable)
  
 instance ExtensionRequest IsTexture where
@@ -2819,7 +2820,7 @@
                putWord8 146
                let size__
                      = 4 + size (context_tag_IsTexture x) + size (texture_IsTexture x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_IsTexture x)
                serialize (texture_IsTexture x)
                putSkip (requiredPadding size__)
@@ -2840,8 +2841,8 @@
  
 data GetColorTable = MkGetColorTable{context_tag_GetColorTable ::
                                      CONTEXT_TAG,
-                                     target_GetColorTable :: CARD32, format_GetColorTable :: CARD32,
-                                     type_GetColorTable :: CARD32, swap_bytes_GetColorTable :: BOOL}
+                                     target_GetColorTable :: Word32, format_GetColorTable :: Word32,
+                                     type_GetColorTable :: Word32, swap_bytes_GetColorTable :: Bool}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest GetColorTable where
@@ -2855,7 +2856,7 @@
                          + size (format_GetColorTable x)
                          + size (type_GetColorTable x)
                          + size (swap_bytes_GetColorTable x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetColorTable x)
                serialize (target_GetColorTable x)
                serialize (format_GetColorTable x)
@@ -2864,8 +2865,8 @@
                putSkip (requiredPadding size__)
  
 data GetColorTableReply = MkGetColorTableReply{width_GetColorTableReply
-                                               :: INT32,
-                                               data_GetColorTableReply :: [BYTE]}
+                                               :: Int32,
+                                               data_GetColorTableReply :: [Word8]}
                         deriving (Show, Typeable)
  
 instance Deserialize GetColorTableReply where
@@ -2884,8 +2885,8 @@
 data GetColorTableParameterfv = MkGetColorTableParameterfv{context_tag_GetColorTableParameterfv
                                                            :: CONTEXT_TAG,
                                                            target_GetColorTableParameterfv ::
-                                                           CARD32,
-                                                           pname_GetColorTableParameterfv :: CARD32}
+                                                           Word32,
+                                                           pname_GetColorTableParameterfv :: Word32}
                               deriving (Show, Typeable)
  
 instance ExtensionRequest GetColorTableParameterfv where
@@ -2897,14 +2898,14 @@
                      = 4 + size (context_tag_GetColorTableParameterfv x) +
                          size (target_GetColorTableParameterfv x)
                          + size (pname_GetColorTableParameterfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetColorTableParameterfv x)
                serialize (target_GetColorTableParameterfv x)
                serialize (pname_GetColorTableParameterfv x)
                putSkip (requiredPadding size__)
  
 data GetColorTableParameterfvReply = MkGetColorTableParameterfvReply{n_GetColorTableParameterfvReply
-                                                                     :: CARD32,
+                                                                     :: Word32,
                                                                      datum_GetColorTableParameterfvReply
                                                                      :: FLOAT32,
                                                                      data_GetColorTableParameterfvReply
@@ -2928,8 +2929,8 @@
 data GetColorTableParameteriv = MkGetColorTableParameteriv{context_tag_GetColorTableParameteriv
                                                            :: CONTEXT_TAG,
                                                            target_GetColorTableParameteriv ::
-                                                           CARD32,
-                                                           pname_GetColorTableParameteriv :: CARD32}
+                                                           Word32,
+                                                           pname_GetColorTableParameteriv :: Word32}
                               deriving (Show, Typeable)
  
 instance ExtensionRequest GetColorTableParameteriv where
@@ -2941,18 +2942,18 @@
                      = 4 + size (context_tag_GetColorTableParameteriv x) +
                          size (target_GetColorTableParameteriv x)
                          + size (pname_GetColorTableParameteriv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetColorTableParameteriv x)
                serialize (target_GetColorTableParameteriv x)
                serialize (pname_GetColorTableParameteriv x)
                putSkip (requiredPadding size__)
  
 data GetColorTableParameterivReply = MkGetColorTableParameterivReply{n_GetColorTableParameterivReply
-                                                                     :: CARD32,
+                                                                     :: Word32,
                                                                      datum_GetColorTableParameterivReply
-                                                                     :: INT32,
+                                                                     :: Int32,
                                                                      data_GetColorTableParameterivReply
-                                                                     :: [INT32]}
+                                                                     :: [Int32]}
                                    deriving (Show, Typeable)
  
 instance Deserialize GetColorTableParameterivReply where
@@ -2971,10 +2972,10 @@
  
 data GetConvolutionFilter = MkGetConvolutionFilter{context_tag_GetConvolutionFilter
                                                    :: CONTEXT_TAG,
-                                                   target_GetConvolutionFilter :: CARD32,
-                                                   format_GetConvolutionFilter :: CARD32,
-                                                   type_GetConvolutionFilter :: CARD32,
-                                                   swap_bytes_GetConvolutionFilter :: BOOL}
+                                                   target_GetConvolutionFilter :: Word32,
+                                                   format_GetConvolutionFilter :: Word32,
+                                                   type_GetConvolutionFilter :: Word32,
+                                                   swap_bytes_GetConvolutionFilter :: Bool}
                           deriving (Show, Typeable)
  
 instance ExtensionRequest GetConvolutionFilter where
@@ -2988,7 +2989,7 @@
                          + size (format_GetConvolutionFilter x)
                          + size (type_GetConvolutionFilter x)
                          + size (swap_bytes_GetConvolutionFilter x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetConvolutionFilter x)
                serialize (target_GetConvolutionFilter x)
                serialize (format_GetConvolutionFilter x)
@@ -2997,11 +2998,11 @@
                putSkip (requiredPadding size__)
  
 data GetConvolutionFilterReply = MkGetConvolutionFilterReply{width_GetConvolutionFilterReply
-                                                             :: INT32,
+                                                             :: Int32,
                                                              height_GetConvolutionFilterReply ::
-                                                             INT32,
+                                                             Int32,
                                                              data_GetConvolutionFilterReply ::
-                                                             [BYTE]}
+                                                             [Word8]}
                                deriving (Show, Typeable)
  
 instance Deserialize GetConvolutionFilterReply where
@@ -3021,9 +3022,9 @@
 data GetConvolutionParameterfv = MkGetConvolutionParameterfv{context_tag_GetConvolutionParameterfv
                                                              :: CONTEXT_TAG,
                                                              target_GetConvolutionParameterfv ::
-                                                             CARD32,
+                                                             Word32,
                                                              pname_GetConvolutionParameterfv ::
-                                                             CARD32}
+                                                             Word32}
                                deriving (Show, Typeable)
  
 instance ExtensionRequest GetConvolutionParameterfv where
@@ -3035,14 +3036,14 @@
                      = 4 + size (context_tag_GetConvolutionParameterfv x) +
                          size (target_GetConvolutionParameterfv x)
                          + size (pname_GetConvolutionParameterfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetConvolutionParameterfv x)
                serialize (target_GetConvolutionParameterfv x)
                serialize (pname_GetConvolutionParameterfv x)
                putSkip (requiredPadding size__)
  
 data GetConvolutionParameterfvReply = MkGetConvolutionParameterfvReply{n_GetConvolutionParameterfvReply
-                                                                       :: CARD32,
+                                                                       :: Word32,
                                                                        datum_GetConvolutionParameterfvReply
                                                                        :: FLOAT32,
                                                                        data_GetConvolutionParameterfvReply
@@ -3066,9 +3067,9 @@
 data GetConvolutionParameteriv = MkGetConvolutionParameteriv{context_tag_GetConvolutionParameteriv
                                                              :: CONTEXT_TAG,
                                                              target_GetConvolutionParameteriv ::
-                                                             CARD32,
+                                                             Word32,
                                                              pname_GetConvolutionParameteriv ::
-                                                             CARD32}
+                                                             Word32}
                                deriving (Show, Typeable)
  
 instance ExtensionRequest GetConvolutionParameteriv where
@@ -3080,18 +3081,18 @@
                      = 4 + size (context_tag_GetConvolutionParameteriv x) +
                          size (target_GetConvolutionParameteriv x)
                          + size (pname_GetConvolutionParameteriv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetConvolutionParameteriv x)
                serialize (target_GetConvolutionParameteriv x)
                serialize (pname_GetConvolutionParameteriv x)
                putSkip (requiredPadding size__)
  
 data GetConvolutionParameterivReply = MkGetConvolutionParameterivReply{n_GetConvolutionParameterivReply
-                                                                       :: CARD32,
+                                                                       :: Word32,
                                                                        datum_GetConvolutionParameterivReply
-                                                                       :: INT32,
+                                                                       :: Int32,
                                                                        data_GetConvolutionParameterivReply
-                                                                       :: [INT32]}
+                                                                       :: [Int32]}
                                     deriving (Show, Typeable)
  
 instance Deserialize GetConvolutionParameterivReply where
@@ -3110,10 +3111,10 @@
  
 data GetSeparableFilter = MkGetSeparableFilter{context_tag_GetSeparableFilter
                                                :: CONTEXT_TAG,
-                                               target_GetSeparableFilter :: CARD32,
-                                               format_GetSeparableFilter :: CARD32,
-                                               type_GetSeparableFilter :: CARD32,
-                                               swap_bytes_GetSeparableFilter :: BOOL}
+                                               target_GetSeparableFilter :: Word32,
+                                               format_GetSeparableFilter :: Word32,
+                                               type_GetSeparableFilter :: Word32,
+                                               swap_bytes_GetSeparableFilter :: Bool}
                         deriving (Show, Typeable)
  
 instance ExtensionRequest GetSeparableFilter where
@@ -3127,7 +3128,7 @@
                          + size (format_GetSeparableFilter x)
                          + size (type_GetSeparableFilter x)
                          + size (swap_bytes_GetSeparableFilter x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetSeparableFilter x)
                serialize (target_GetSeparableFilter x)
                serialize (format_GetSeparableFilter x)
@@ -3136,10 +3137,10 @@
                putSkip (requiredPadding size__)
  
 data GetSeparableFilterReply = MkGetSeparableFilterReply{row_w_GetSeparableFilterReply
-                                                         :: INT32,
-                                                         col_h_GetSeparableFilterReply :: INT32,
+                                                         :: Int32,
+                                                         col_h_GetSeparableFilterReply :: Int32,
                                                          rows_and_cols_GetSeparableFilterReply ::
-                                                         [BYTE]}
+                                                         [Word8]}
                              deriving (Show, Typeable)
  
 instance Deserialize GetSeparableFilterReply where
@@ -3159,9 +3160,9 @@
  
 data GetHistogram = MkGetHistogram{context_tag_GetHistogram ::
                                    CONTEXT_TAG,
-                                   target_GetHistogram :: CARD32, format_GetHistogram :: CARD32,
-                                   type_GetHistogram :: CARD32, swap_bytes_GetHistogram :: BOOL,
-                                   reset_GetHistogram :: BOOL}
+                                   target_GetHistogram :: Word32, format_GetHistogram :: Word32,
+                                   type_GetHistogram :: Word32, swap_bytes_GetHistogram :: Bool,
+                                   reset_GetHistogram :: Bool}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest GetHistogram where
@@ -3176,7 +3177,7 @@
                          + size (type_GetHistogram x)
                          + size (swap_bytes_GetHistogram x)
                          + size (reset_GetHistogram x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetHistogram x)
                serialize (target_GetHistogram x)
                serialize (format_GetHistogram x)
@@ -3186,8 +3187,8 @@
                putSkip (requiredPadding size__)
  
 data GetHistogramReply = MkGetHistogramReply{width_GetHistogramReply
-                                             :: INT32,
-                                             data_GetHistogramReply :: [BYTE]}
+                                             :: Int32,
+                                             data_GetHistogramReply :: [Word8]}
                        deriving (Show, Typeable)
  
 instance Deserialize GetHistogramReply where
@@ -3205,8 +3206,8 @@
  
 data GetHistogramParameterfv = MkGetHistogramParameterfv{context_tag_GetHistogramParameterfv
                                                          :: CONTEXT_TAG,
-                                                         target_GetHistogramParameterfv :: CARD32,
-                                                         pname_GetHistogramParameterfv :: CARD32}
+                                                         target_GetHistogramParameterfv :: Word32,
+                                                         pname_GetHistogramParameterfv :: Word32}
                              deriving (Show, Typeable)
  
 instance ExtensionRequest GetHistogramParameterfv where
@@ -3218,14 +3219,14 @@
                      = 4 + size (context_tag_GetHistogramParameterfv x) +
                          size (target_GetHistogramParameterfv x)
                          + size (pname_GetHistogramParameterfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetHistogramParameterfv x)
                serialize (target_GetHistogramParameterfv x)
                serialize (pname_GetHistogramParameterfv x)
                putSkip (requiredPadding size__)
  
 data GetHistogramParameterfvReply = MkGetHistogramParameterfvReply{n_GetHistogramParameterfvReply
-                                                                   :: CARD32,
+                                                                   :: Word32,
                                                                    datum_GetHistogramParameterfvReply
                                                                    :: FLOAT32,
                                                                    data_GetHistogramParameterfvReply
@@ -3248,8 +3249,8 @@
  
 data GetHistogramParameteriv = MkGetHistogramParameteriv{context_tag_GetHistogramParameteriv
                                                          :: CONTEXT_TAG,
-                                                         target_GetHistogramParameteriv :: CARD32,
-                                                         pname_GetHistogramParameteriv :: CARD32}
+                                                         target_GetHistogramParameteriv :: Word32,
+                                                         pname_GetHistogramParameteriv :: Word32}
                              deriving (Show, Typeable)
  
 instance ExtensionRequest GetHistogramParameteriv where
@@ -3261,18 +3262,18 @@
                      = 4 + size (context_tag_GetHistogramParameteriv x) +
                          size (target_GetHistogramParameteriv x)
                          + size (pname_GetHistogramParameteriv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetHistogramParameteriv x)
                serialize (target_GetHistogramParameteriv x)
                serialize (pname_GetHistogramParameteriv x)
                putSkip (requiredPadding size__)
  
 data GetHistogramParameterivReply = MkGetHistogramParameterivReply{n_GetHistogramParameterivReply
-                                                                   :: CARD32,
+                                                                   :: Word32,
                                                                    datum_GetHistogramParameterivReply
-                                                                   :: INT32,
+                                                                   :: Int32,
                                                                    data_GetHistogramParameterivReply
-                                                                   :: [INT32]}
+                                                                   :: [Int32]}
                                   deriving (Show, Typeable)
  
 instance Deserialize GetHistogramParameterivReply where
@@ -3290,9 +3291,9 @@
                return (MkGetHistogramParameterivReply n datum data_)
  
 data GetMinmax = MkGetMinmax{context_tag_GetMinmax :: CONTEXT_TAG,
-                             target_GetMinmax :: CARD32, format_GetMinmax :: CARD32,
-                             type_GetMinmax :: CARD32, swap_bytes_GetMinmax :: BOOL,
-                             reset_GetMinmax :: BOOL}
+                             target_GetMinmax :: Word32, format_GetMinmax :: Word32,
+                             type_GetMinmax :: Word32, swap_bytes_GetMinmax :: Bool,
+                             reset_GetMinmax :: Bool}
                deriving (Show, Typeable)
  
 instance ExtensionRequest GetMinmax where
@@ -3306,7 +3307,7 @@
                          + size (type_GetMinmax x)
                          + size (swap_bytes_GetMinmax x)
                          + size (reset_GetMinmax x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetMinmax x)
                serialize (target_GetMinmax x)
                serialize (format_GetMinmax x)
@@ -3316,7 +3317,7 @@
                putSkip (requiredPadding size__)
  
 data GetMinmaxReply = MkGetMinmaxReply{data_GetMinmaxReply ::
-                                       [BYTE]}
+                                       [Word8]}
                     deriving (Show, Typeable)
  
 instance Deserialize GetMinmaxReply where
@@ -3332,8 +3333,8 @@
  
 data GetMinmaxParameterfv = MkGetMinmaxParameterfv{context_tag_GetMinmaxParameterfv
                                                    :: CONTEXT_TAG,
-                                                   target_GetMinmaxParameterfv :: CARD32,
-                                                   pname_GetMinmaxParameterfv :: CARD32}
+                                                   target_GetMinmaxParameterfv :: Word32,
+                                                   pname_GetMinmaxParameterfv :: Word32}
                           deriving (Show, Typeable)
  
 instance ExtensionRequest GetMinmaxParameterfv where
@@ -3345,14 +3346,14 @@
                      = 4 + size (context_tag_GetMinmaxParameterfv x) +
                          size (target_GetMinmaxParameterfv x)
                          + size (pname_GetMinmaxParameterfv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetMinmaxParameterfv x)
                serialize (target_GetMinmaxParameterfv x)
                serialize (pname_GetMinmaxParameterfv x)
                putSkip (requiredPadding size__)
  
 data GetMinmaxParameterfvReply = MkGetMinmaxParameterfvReply{n_GetMinmaxParameterfvReply
-                                                             :: CARD32,
+                                                             :: Word32,
                                                              datum_GetMinmaxParameterfvReply ::
                                                              FLOAT32,
                                                              data_GetMinmaxParameterfvReply ::
@@ -3375,8 +3376,8 @@
  
 data GetMinmaxParameteriv = MkGetMinmaxParameteriv{context_tag_GetMinmaxParameteriv
                                                    :: CONTEXT_TAG,
-                                                   target_GetMinmaxParameteriv :: CARD32,
-                                                   pname_GetMinmaxParameteriv :: CARD32}
+                                                   target_GetMinmaxParameteriv :: Word32,
+                                                   pname_GetMinmaxParameteriv :: Word32}
                           deriving (Show, Typeable)
  
 instance ExtensionRequest GetMinmaxParameteriv where
@@ -3388,18 +3389,18 @@
                      = 4 + size (context_tag_GetMinmaxParameteriv x) +
                          size (target_GetMinmaxParameteriv x)
                          + size (pname_GetMinmaxParameteriv x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetMinmaxParameteriv x)
                serialize (target_GetMinmaxParameteriv x)
                serialize (pname_GetMinmaxParameteriv x)
                putSkip (requiredPadding size__)
  
 data GetMinmaxParameterivReply = MkGetMinmaxParameterivReply{n_GetMinmaxParameterivReply
-                                                             :: CARD32,
+                                                             :: Word32,
                                                              datum_GetMinmaxParameterivReply ::
-                                                             INT32,
+                                                             Int32,
                                                              data_GetMinmaxParameterivReply ::
-                                                             [INT32]}
+                                                             [Int32]}
                                deriving (Show, Typeable)
  
 instance Deserialize GetMinmaxParameterivReply where
@@ -3419,8 +3420,8 @@
 data GetCompressedTexImageARB = MkGetCompressedTexImageARB{context_tag_GetCompressedTexImageARB
                                                            :: CONTEXT_TAG,
                                                            target_GetCompressedTexImageARB ::
-                                                           CARD32,
-                                                           level_GetCompressedTexImageARB :: INT32}
+                                                           Word32,
+                                                           level_GetCompressedTexImageARB :: Int32}
                               deriving (Show, Typeable)
  
 instance ExtensionRequest GetCompressedTexImageARB where
@@ -3432,16 +3433,16 @@
                      = 4 + size (context_tag_GetCompressedTexImageARB x) +
                          size (target_GetCompressedTexImageARB x)
                          + size (level_GetCompressedTexImageARB x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetCompressedTexImageARB x)
                serialize (target_GetCompressedTexImageARB x)
                serialize (level_GetCompressedTexImageARB x)
                putSkip (requiredPadding size__)
  
 data GetCompressedTexImageARBReply = MkGetCompressedTexImageARBReply{size_GetCompressedTexImageARBReply
-                                                                     :: INT32,
+                                                                     :: Int32,
                                                                      data_GetCompressedTexImageARBReply
-                                                                     :: [BYTE]}
+                                                                     :: [Word8]}
                                    deriving (Show, Typeable)
  
 instance Deserialize GetCompressedTexImageARBReply where
@@ -3459,8 +3460,8 @@
  
 data DeleteQueriesARB = MkDeleteQueriesARB{context_tag_DeleteQueriesARB
                                            :: CONTEXT_TAG,
-                                           n_DeleteQueriesARB :: INT32,
-                                           ids_DeleteQueriesARB :: [CARD32]}
+                                           n_DeleteQueriesARB :: Int32,
+                                           ids_DeleteQueriesARB :: [Word32]}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest DeleteQueriesARB where
@@ -3472,7 +3473,7 @@
                      = 4 + size (context_tag_DeleteQueriesARB x) +
                          size (n_DeleteQueriesARB x)
                          + sum (map size (ids_DeleteQueriesARB x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_DeleteQueriesARB x)
                serialize (n_DeleteQueriesARB x)
                serializeList (ids_DeleteQueriesARB x)
@@ -3480,7 +3481,7 @@
  
 data GenQueriesARB = MkGenQueriesARB{context_tag_GenQueriesARB ::
                                      CONTEXT_TAG,
-                                     n_GenQueriesARB :: INT32}
+                                     n_GenQueriesARB :: Int32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest GenQueriesARB where
@@ -3490,13 +3491,13 @@
                putWord8 162
                let size__
                      = 4 + size (context_tag_GenQueriesARB x) + size (n_GenQueriesARB x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GenQueriesARB x)
                serialize (n_GenQueriesARB x)
                putSkip (requiredPadding size__)
  
 data GenQueriesARBReply = MkGenQueriesARBReply{data_GenQueriesARBReply
-                                               :: [CARD32]}
+                                               :: [Word32]}
                         deriving (Show, Typeable)
  
 instance Deserialize GenQueriesARBReply where
@@ -3512,7 +3513,7 @@
  
 data IsQueryARB = MkIsQueryARB{context_tag_IsQueryARB ::
                                CONTEXT_TAG,
-                               id_IsQueryARB :: CARD32}
+                               id_IsQueryARB :: Word32}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest IsQueryARB where
@@ -3522,7 +3523,7 @@
                putWord8 163
                let size__
                      = 4 + size (context_tag_IsQueryARB x) + size (id_IsQueryARB x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_IsQueryARB x)
                serialize (id_IsQueryARB x)
                putSkip (requiredPadding size__)
@@ -3543,7 +3544,7 @@
  
 data GetQueryivARB = MkGetQueryivARB{context_tag_GetQueryivARB ::
                                      CONTEXT_TAG,
-                                     target_GetQueryivARB :: CARD32, pname_GetQueryivARB :: CARD32}
+                                     target_GetQueryivARB :: Word32, pname_GetQueryivARB :: Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest GetQueryivARB where
@@ -3555,16 +3556,16 @@
                      = 4 + size (context_tag_GetQueryivARB x) +
                          size (target_GetQueryivARB x)
                          + size (pname_GetQueryivARB x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetQueryivARB x)
                serialize (target_GetQueryivARB x)
                serialize (pname_GetQueryivARB x)
                putSkip (requiredPadding size__)
  
 data GetQueryivARBReply = MkGetQueryivARBReply{n_GetQueryivARBReply
-                                               :: CARD32,
-                                               datum_GetQueryivARBReply :: INT32,
-                                               data_GetQueryivARBReply :: [INT32]}
+                                               :: Word32,
+                                               datum_GetQueryivARBReply :: Int32,
+                                               data_GetQueryivARBReply :: [Int32]}
                         deriving (Show, Typeable)
  
 instance Deserialize GetQueryivARBReply where
@@ -3583,8 +3584,8 @@
  
 data GetQueryObjectivARB = MkGetQueryObjectivARB{context_tag_GetQueryObjectivARB
                                                  :: CONTEXT_TAG,
-                                                 id_GetQueryObjectivARB :: CARD32,
-                                                 pname_GetQueryObjectivARB :: CARD32}
+                                                 id_GetQueryObjectivARB :: Word32,
+                                                 pname_GetQueryObjectivARB :: Word32}
                          deriving (Show, Typeable)
  
 instance ExtensionRequest GetQueryObjectivARB where
@@ -3596,16 +3597,16 @@
                      = 4 + size (context_tag_GetQueryObjectivARB x) +
                          size (id_GetQueryObjectivARB x)
                          + size (pname_GetQueryObjectivARB x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetQueryObjectivARB x)
                serialize (id_GetQueryObjectivARB x)
                serialize (pname_GetQueryObjectivARB x)
                putSkip (requiredPadding size__)
  
 data GetQueryObjectivARBReply = MkGetQueryObjectivARBReply{n_GetQueryObjectivARBReply
-                                                           :: CARD32,
-                                                           datum_GetQueryObjectivARBReply :: INT32,
-                                                           data_GetQueryObjectivARBReply :: [INT32]}
+                                                           :: Word32,
+                                                           datum_GetQueryObjectivARBReply :: Int32,
+                                                           data_GetQueryObjectivARBReply :: [Int32]}
                               deriving (Show, Typeable)
  
 instance Deserialize GetQueryObjectivARBReply where
@@ -3624,8 +3625,8 @@
  
 data GetQueryObjectuivARB = MkGetQueryObjectuivARB{context_tag_GetQueryObjectuivARB
                                                    :: CONTEXT_TAG,
-                                                   id_GetQueryObjectuivARB :: CARD32,
-                                                   pname_GetQueryObjectuivARB :: CARD32}
+                                                   id_GetQueryObjectuivARB :: Word32,
+                                                   pname_GetQueryObjectuivARB :: Word32}
                           deriving (Show, Typeable)
  
 instance ExtensionRequest GetQueryObjectuivARB where
@@ -3637,18 +3638,18 @@
                      = 4 + size (context_tag_GetQueryObjectuivARB x) +
                          size (id_GetQueryObjectuivARB x)
                          + size (pname_GetQueryObjectuivARB x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_tag_GetQueryObjectuivARB x)
                serialize (id_GetQueryObjectuivARB x)
                serialize (pname_GetQueryObjectuivARB x)
                putSkip (requiredPadding size__)
  
 data GetQueryObjectuivARBReply = MkGetQueryObjectuivARBReply{n_GetQueryObjectuivARBReply
-                                                             :: CARD32,
+                                                             :: Word32,
                                                              datum_GetQueryObjectuivARBReply ::
-                                                             CARD32,
+                                                             Word32,
                                                              data_GetQueryObjectuivARBReply ::
-                                                             [CARD32]}
+                                                             [Word32]}
                                deriving (Show, Typeable)
  
 instance Deserialize GetQueryObjectuivARBReply where
diff --git a/patched/Graphics/XHB/Gen/Input.hs b/patched/Graphics/XHB/Gen/Input.hs
--- a/patched/Graphics/XHB/Gen/Input.hs
+++ b/patched/Graphics/XHB/Gen/Input.hs
@@ -19,6 +19,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -31,39 +34,39 @@
  
 getExtensionVersion ::
                       Graphics.XHB.Connection.Types.Connection ->
-                        CARD16 -> [CChar] -> IO (Receipt GetExtensionVersionReply)
+                        Word16 -> [CChar] -> IO (Receipt GetExtensionVersionReply)
 getExtensionVersion c name_len name
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetExtensionVersion name_len name
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 listInputDevices ::
                    Graphics.XHB.Connection.Types.Connection ->
                      IO (Receipt ListInputDevicesReply)
 listInputDevices c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListInputDevices
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 openDevice ::
              Graphics.XHB.Connection.Types.Connection ->
-               CARD8 -> IO (Receipt OpenDeviceReply)
+               Word8 -> IO (Receipt OpenDeviceReply)
 openDevice c device_id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkOpenDevice device_id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 closeDevice ::
-              Graphics.XHB.Connection.Types.Connection -> CARD8 -> IO ()
+              Graphics.XHB.Connection.Types.Connection -> Word8 -> IO ()
 closeDevice c device_id
   = do let req = MkCloseDevice device_id
        putAction <- serializeExtensionRequest c req
@@ -72,13 +75,14 @@
  
 setDeviceMode ::
                 Graphics.XHB.Connection.Types.Connection ->
-                  CARD8 -> CARD8 -> IO (Receipt SetDeviceModeReply)
+                  Word8 -> Word8 -> IO (Receipt Word8)
 setDeviceMode c device_id mode
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_SetDeviceModeReply `fmap` deserialize))
        let req = MkSetDeviceMode device_id mode
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 selectExtensionEvent ::
@@ -93,11 +97,11 @@
                              Graphics.XHB.Connection.Types.Connection ->
                                WINDOW -> IO (Receipt GetSelectedExtensionEventsReply)
 getSelectedExtensionEvents c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetSelectedExtensionEvents window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 changeDeviceDontPropagateList ::
@@ -112,57 +116,60 @@
                              Graphics.XHB.Connection.Types.Connection ->
                                WINDOW -> IO (Receipt GetDeviceDontPropagateListReply)
 getDeviceDontPropagateList c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetDeviceDontPropagateList window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getDeviceMotionEvents ::
                         Graphics.XHB.Connection.Types.Connection ->
                           GetDeviceMotionEvents -> IO (Receipt GetDeviceMotionEventsReply)
 getDeviceMotionEvents c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 changeKeyboardDevice ::
                        Graphics.XHB.Connection.Types.Connection ->
-                         CARD8 -> IO (Receipt ChangeKeyboardDeviceReply)
+                         Word8 -> IO (Receipt Word8)
 changeKeyboardDevice c device_id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_ChangeKeyboardDeviceReply `fmap` deserialize))
        let req = MkChangeKeyboardDevice device_id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 changePointerDevice ::
                       Graphics.XHB.Connection.Types.Connection ->
-                        ChangePointerDevice -> IO (Receipt ChangePointerDeviceReply)
+                        ChangePointerDevice -> IO (Receipt Word8)
 changePointerDevice c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_ChangePointerDeviceReply `fmap` deserialize))
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 grabDevice ::
              Graphics.XHB.Connection.Types.Connection ->
-               GrabDevice -> IO (Receipt GrabDeviceReply)
+               GrabDevice -> IO (Receipt Word8)
 grabDevice c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_GrabDeviceReply `fmap` deserialize))
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 ungrabDevice ::
                Graphics.XHB.Connection.Types.Connection ->
-                 TIMESTAMP -> CARD8 -> IO ()
+                 TIMESTAMP -> Word8 -> IO ()
 ungrabDevice c time device_id
   = do let req = MkUngrabDevice time device_id
        putAction <- serializeExtensionRequest c req
@@ -210,13 +217,13 @@
  
 getDeviceFocus ::
                  Graphics.XHB.Connection.Types.Connection ->
-                   CARD8 -> IO (Receipt GetDeviceFocusReply)
+                   Word8 -> IO (Receipt GetDeviceFocusReply)
 getDeviceFocus c device_id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetDeviceFocus device_id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setDeviceFocus ::
@@ -228,23 +235,24 @@
  
 getFeedbackControl ::
                      Graphics.XHB.Connection.Types.Connection ->
-                       CARD8 -> IO (Receipt GetFeedbackControlReply)
+                       Word8 -> IO (Receipt Word16)
 getFeedbackControl c device_id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (num_feedback_GetFeedbackControlReply `fmap` deserialize))
        let req = MkGetFeedbackControl device_id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getDeviceKeyMapping ::
                       Graphics.XHB.Connection.Types.Connection ->
                         GetDeviceKeyMapping -> IO (Receipt GetDeviceKeyMappingReply)
 getDeviceKeyMapping c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 changeDeviceKeyMapping ::
@@ -257,56 +265,58 @@
  
 getDeviceModifierMapping ::
                            Graphics.XHB.Connection.Types.Connection ->
-                             CARD8 -> IO (Receipt GetDeviceModifierMappingReply)
+                             Word8 -> IO (Receipt GetDeviceModifierMappingReply)
 getDeviceModifierMapping c device_id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetDeviceModifierMapping device_id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setDeviceModifierMapping ::
                            Graphics.XHB.Connection.Types.Connection ->
-                             SetDeviceModifierMapping ->
-                               IO (Receipt SetDeviceModifierMappingReply)
+                             SetDeviceModifierMapping -> IO (Receipt Word8)
 setDeviceModifierMapping c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_SetDeviceModifierMappingReply `fmap` deserialize))
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getDeviceButtonMapping ::
                          Graphics.XHB.Connection.Types.Connection ->
-                           CARD8 -> IO (Receipt GetDeviceButtonMappingReply)
+                           Word8 -> IO (Receipt GetDeviceButtonMappingReply)
 getDeviceButtonMapping c device_id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetDeviceButtonMapping device_id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setDeviceButtonMapping ::
                          Graphics.XHB.Connection.Types.Connection ->
-                           SetDeviceButtonMapping -> IO (Receipt SetDeviceButtonMappingReply)
+                           SetDeviceButtonMapping -> IO (Receipt Word8)
 setDeviceButtonMapping c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_SetDeviceButtonMappingReply `fmap` deserialize))
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryDeviceState ::
                    Graphics.XHB.Connection.Types.Connection ->
-                     CARD8 -> IO (Receipt QueryDeviceStateReply)
+                     Word8 -> IO (Receipt Word8)
 queryDeviceState c device_id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (num_classes_QueryDeviceStateReply `fmap` deserialize))
        let req = MkQueryDeviceState device_id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 sendExtensionEvent ::
@@ -326,21 +336,23 @@
  
 setDeviceValuators ::
                      Graphics.XHB.Connection.Types.Connection ->
-                       SetDeviceValuators -> IO (Receipt SetDeviceValuatorsReply)
+                       SetDeviceValuators -> IO (Receipt Word8)
 setDeviceValuators c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_SetDeviceValuatorsReply `fmap` deserialize))
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getDeviceControl ::
                    Graphics.XHB.Connection.Types.Connection ->
-                     CARD16 -> CARD8 -> IO (Receipt GetDeviceControlReply)
+                     Word16 -> Word8 -> IO (Receipt Word8)
 getDeviceControl c control_id device_id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_GetDeviceControlReply `fmap` deserialize))
        let req = MkGetDeviceControl control_id device_id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/Input/Types.hs b/patched/Graphics/XHB/Gen/Input/Types.hs
--- a/patched/Graphics/XHB/Gen/Input/Types.hs
+++ b/patched/Graphics/XHB/Gen/Input/Types.hs
@@ -48,6 +48,7 @@
         DevicePresenceNotify(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -102,9 +103,9 @@
   = return (liftM toEvent (deserialize :: Get DevicePresenceNotify))
 deserializeEvent _ = Nothing
  
-type KeyCode = CARD8
+type KeyCode = Word8
  
-type EventClass = CARD32
+type EventClass = Word32
  
 data ValuatorMode = ValuatorModeRelative
                   | ValuatorModeAbsolute
@@ -125,7 +126,7 @@
         fromValue 1 = PropagateModeDeleteFromList
  
 data GetExtensionVersion = MkGetExtensionVersion{name_len_GetExtensionVersion
-                                                 :: CARD16,
+                                                 :: Word16,
                                                  name_GetExtensionVersion :: [CChar]}
                          deriving (Show, Typeable)
  
@@ -137,18 +138,18 @@
                let size__
                      = 4 + size (name_len_GetExtensionVersion x) + 2 +
                          sum (map size (name_GetExtensionVersion x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (name_len_GetExtensionVersion x)
                putSkip 2
                serializeList (name_GetExtensionVersion x)
                putSkip (requiredPadding size__)
  
 data GetExtensionVersionReply = MkGetExtensionVersionReply{server_major_GetExtensionVersionReply
-                                                           :: CARD16,
+                                                           :: Word16,
                                                            server_minor_GetExtensionVersionReply ::
-                                                           CARD16,
+                                                           Word16,
                                                            present_GetExtensionVersionReply ::
-                                                           CARD8}
+                                                           Word8}
                               deriving (Show, Typeable)
  
 instance Deserialize GetExtensionVersionReply where
@@ -166,8 +167,8 @@
                  (MkGetExtensionVersionReply server_major server_minor present)
  
 data DeviceInfo = MkDeviceInfo{device_type_DeviceInfo :: ATOM,
-                               device_id_DeviceInfo :: CARD8, num_class_info_DeviceInfo :: CARD8,
-                               device_use_DeviceInfo :: CARD8}
+                               device_id_DeviceInfo :: Word8, num_class_info_DeviceInfo :: Word8,
+                               device_use_DeviceInfo :: Word8}
                 deriving (Show, Typeable)
  
 instance Serialize DeviceInfo where
@@ -202,11 +203,11 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data ListInputDevicesReply = MkListInputDevicesReply{devices_len_ListInputDevicesReply
-                                                     :: CARD8,
+                                                     :: Word8,
                                                      devices_ListInputDevicesReply :: [DeviceInfo]}
                            deriving (Show, Typeable)
  
@@ -240,8 +241,8 @@
         fromValue 3 = DeviceUseIsXExtensionKeyboard
         fromValue 4 = DeviceUseIsXExtensionPointer
  
-data InputInfo = MkInputInfo{class_id_InputInfo :: CARD8,
-                             len_InputInfo :: CARD8}
+data InputInfo = MkInputInfo{class_id_InputInfo :: Word8,
+                             len_InputInfo :: Word8}
                deriving (Show, Typeable)
  
 instance Serialize InputInfo where
@@ -256,9 +257,9 @@
                len <- deserialize
                return (MkInputInfo class_id len)
  
-data KeyInfo = MkKeyInfo{class_id_KeyInfo :: CARD8,
-                         len_KeyInfo :: CARD8, min_keycode_KeyInfo :: KeyCode,
-                         max_keycode_KeyInfo :: KeyCode, num_keys_KeyInfo :: CARD16}
+data KeyInfo = MkKeyInfo{class_id_KeyInfo :: Word8,
+                         len_KeyInfo :: Word8, min_keycode_KeyInfo :: KeyCode,
+                         max_keycode_KeyInfo :: KeyCode, num_keys_KeyInfo :: Word16}
              deriving (Show, Typeable)
  
 instance Serialize KeyInfo where
@@ -286,8 +287,8 @@
                skip 2
                return (MkKeyInfo class_id len min_keycode max_keycode num_keys)
  
-data ButtonInfo = MkButtonInfo{class_id_ButtonInfo :: CARD8,
-                               len_ButtonInfo :: CARD8, num_buttons_ButtonInfo :: CARD16}
+data ButtonInfo = MkButtonInfo{class_id_ButtonInfo :: Word8,
+                               len_ButtonInfo :: Word8, num_buttons_ButtonInfo :: Word16}
                 deriving (Show, Typeable)
  
 instance Serialize ButtonInfo where
@@ -306,8 +307,8 @@
                num_buttons <- deserialize
                return (MkButtonInfo class_id len num_buttons)
  
-data AxisInfo = MkAxisInfo{resolution_AxisInfo :: CARD32,
-                           minimum_AxisInfo :: CARD32, maximum_AxisInfo :: CARD32}
+data AxisInfo = MkAxisInfo{resolution_AxisInfo :: Word32,
+                           minimum_AxisInfo :: Word32, maximum_AxisInfo :: Word32}
               deriving (Show, Typeable)
  
 instance Serialize AxisInfo where
@@ -326,9 +327,9 @@
                maximum <- deserialize
                return (MkAxisInfo resolution minimum maximum)
  
-data ValuatorInfo = MkValuatorInfo{class_id_ValuatorInfo :: CARD8,
-                                   len_ValuatorInfo :: CARD8, axes_len_ValuatorInfo :: CARD8,
-                                   mode_ValuatorInfo :: CARD8, motion_size_ValuatorInfo :: CARD32,
+data ValuatorInfo = MkValuatorInfo{class_id_ValuatorInfo :: Word8,
+                                   len_ValuatorInfo :: Word8, axes_len_ValuatorInfo :: Word8,
+                                   mode_ValuatorInfo :: Word8, motion_size_ValuatorInfo :: Word32,
                                    axes_ValuatorInfo :: [AxisInfo]}
                   deriving (Show, Typeable)
  
@@ -358,8 +359,8 @@
                return (MkValuatorInfo class_id len axes_len mode motion_size axes)
  
 data InputClassInfo = MkInputClassInfo{class_id_InputClassInfo ::
-                                       CARD8,
-                                       event_type_base_InputClassInfo :: CARD8}
+                                       Word8,
+                                       event_type_base_InputClassInfo :: Word8}
                     deriving (Show, Typeable)
  
 instance Serialize InputClassInfo where
@@ -376,7 +377,7 @@
                event_type_base <- deserialize
                return (MkInputClassInfo class_id event_type_base)
  
-data OpenDevice = MkOpenDevice{device_id_OpenDevice :: CARD8}
+data OpenDevice = MkOpenDevice{device_id_OpenDevice :: Word8}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest OpenDevice where
@@ -385,13 +386,13 @@
           = do putWord8 extOpCode
                putWord8 3
                let size__ = 4 + size (device_id_OpenDevice x) + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_OpenDevice x)
                putSkip 3
                putSkip (requiredPadding size__)
  
 data OpenDeviceReply = MkOpenDeviceReply{num_classes_OpenDeviceReply
-                                         :: CARD8,
+                                         :: Word8,
                                          class_info_OpenDeviceReply :: [InputClassInfo]}
                      deriving (Show, Typeable)
  
@@ -431,7 +432,7 @@
         fromValue 5 = InputClassFocus
         fromValue 6 = InputClassOther
  
-data CloseDevice = MkCloseDevice{device_id_CloseDevice :: CARD8}
+data CloseDevice = MkCloseDevice{device_id_CloseDevice :: Word8}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest CloseDevice where
@@ -440,14 +441,14 @@
           = do putWord8 extOpCode
                putWord8 4
                let size__ = 4 + size (device_id_CloseDevice x) + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_CloseDevice x)
                putSkip 3
                putSkip (requiredPadding size__)
  
 data SetDeviceMode = MkSetDeviceMode{device_id_SetDeviceMode ::
-                                     CARD8,
-                                     mode_SetDeviceMode :: CARD8}
+                                     Word8,
+                                     mode_SetDeviceMode :: Word8}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest SetDeviceMode where
@@ -459,14 +460,14 @@
                      = 4 + size (device_id_SetDeviceMode x) +
                          size (mode_SetDeviceMode x)
                          + 2
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_SetDeviceMode x)
                serialize (mode_SetDeviceMode x)
                putSkip 2
                putSkip (requiredPadding size__)
  
 data SetDeviceModeReply = MkSetDeviceModeReply{status_SetDeviceModeReply
-                                               :: CARD8}
+                                               :: Word8}
                         deriving (Show, Typeable)
  
 instance Deserialize SetDeviceModeReply where
@@ -482,7 +483,7 @@
  
 data SelectExtensionEvent = MkSelectExtensionEvent{window_SelectExtensionEvent
                                                    :: WINDOW,
-                                                   num_classes_SelectExtensionEvent :: CARD16,
+                                                   num_classes_SelectExtensionEvent :: Word16,
                                                    classes_SelectExtensionEvent :: [EventClass]}
                           deriving (Show, Typeable)
  
@@ -496,7 +497,7 @@
                          size (num_classes_SelectExtensionEvent x)
                          + 2
                          + sum (map size (classes_SelectExtensionEvent x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_SelectExtensionEvent x)
                serialize (num_classes_SelectExtensionEvent x)
                putSkip 2
@@ -513,14 +514,14 @@
           = do putWord8 extOpCode
                putWord8 7
                let size__ = 4 + size (window_GetSelectedExtensionEvents x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetSelectedExtensionEvents x)
                putSkip (requiredPadding size__)
  
 data GetSelectedExtensionEventsReply = MkGetSelectedExtensionEventsReply{num_this_classes_GetSelectedExtensionEventsReply
-                                                                         :: CARD16,
+                                                                         :: Word16,
                                                                          num_all_classes_GetSelectedExtensionEventsReply
-                                                                         :: CARD16,
+                                                                         :: Word16,
                                                                          this_classes_GetSelectedExtensionEventsReply
                                                                          :: [EventClass],
                                                                          all_classes_GetSelectedExtensionEventsReply
@@ -547,9 +548,9 @@
 data ChangeDeviceDontPropagateList = MkChangeDeviceDontPropagateList{window_ChangeDeviceDontPropagateList
                                                                      :: WINDOW,
                                                                      num_classes_ChangeDeviceDontPropagateList
-                                                                     :: CARD16,
+                                                                     :: Word16,
                                                                      mode_ChangeDeviceDontPropagateList
-                                                                     :: CARD8,
+                                                                     :: Word8,
                                                                      classes_ChangeDeviceDontPropagateList
                                                                      :: [EventClass]}
                                    deriving (Show, Typeable)
@@ -565,7 +566,7 @@
                          + size (mode_ChangeDeviceDontPropagateList x)
                          + 1
                          + sum (map size (classes_ChangeDeviceDontPropagateList x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_ChangeDeviceDontPropagateList x)
                serialize (num_classes_ChangeDeviceDontPropagateList x)
                serialize (mode_ChangeDeviceDontPropagateList x)
@@ -583,12 +584,12 @@
           = do putWord8 extOpCode
                putWord8 9
                let size__ = 4 + size (window_GetDeviceDontPropagateList x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetDeviceDontPropagateList x)
                putSkip (requiredPadding size__)
  
 data GetDeviceDontPropagateListReply = MkGetDeviceDontPropagateListReply{num_classes_GetDeviceDontPropagateListReply
-                                                                         :: CARD16,
+                                                                         :: Word16,
                                                                          classes_GetDeviceDontPropagateListReply
                                                                          :: [EventClass]}
                                      deriving (Show, Typeable)
@@ -608,7 +609,7 @@
 data GetDeviceMotionEvents = MkGetDeviceMotionEvents{start_GetDeviceMotionEvents
                                                      :: TIMESTAMP,
                                                      stop_GetDeviceMotionEvents :: TIMESTAMP,
-                                                     device_id_GetDeviceMotionEvents :: CARD8}
+                                                     device_id_GetDeviceMotionEvents :: Word8}
                            deriving (Show, Typeable)
  
 instance ExtensionRequest GetDeviceMotionEvents where
@@ -620,18 +621,18 @@
                      = 4 + size (start_GetDeviceMotionEvents x) +
                          size (stop_GetDeviceMotionEvents x)
                          + size (device_id_GetDeviceMotionEvents x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (start_GetDeviceMotionEvents x)
                serialize (stop_GetDeviceMotionEvents x)
                serialize (device_id_GetDeviceMotionEvents x)
                putSkip (requiredPadding size__)
  
 data GetDeviceMotionEventsReply = MkGetDeviceMotionEventsReply{num_coords_GetDeviceMotionEventsReply
-                                                               :: CARD32,
+                                                               :: Word32,
                                                                num_axes_GetDeviceMotionEventsReply
-                                                               :: CARD8,
+                                                               :: Word8,
                                                                device_mode_GetDeviceMotionEventsReply
-                                                               :: CARD8}
+                                                               :: Word8}
                                 deriving (Show, Typeable)
  
 instance Deserialize GetDeviceMotionEventsReply where
@@ -662,7 +663,7 @@
                return (MkDeviceTimeCoord time)
  
 data ChangeKeyboardDevice = MkChangeKeyboardDevice{device_id_ChangeKeyboardDevice
-                                                   :: CARD8}
+                                                   :: Word8}
                           deriving (Show, Typeable)
  
 instance ExtensionRequest ChangeKeyboardDevice where
@@ -671,13 +672,13 @@
           = do putWord8 extOpCode
                putWord8 11
                let size__ = 4 + size (device_id_ChangeKeyboardDevice x) + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_ChangeKeyboardDevice x)
                putSkip 3
                putSkip (requiredPadding size__)
  
 data ChangeKeyboardDeviceReply = MkChangeKeyboardDeviceReply{status_ChangeKeyboardDeviceReply
-                                                             :: CARD8}
+                                                             :: Word8}
                                deriving (Show, Typeable)
  
 instance Deserialize ChangeKeyboardDeviceReply where
@@ -692,9 +693,9 @@
                return (MkChangeKeyboardDeviceReply status)
  
 data ChangePointerDevice = MkChangePointerDevice{x_axis_ChangePointerDevice
-                                                 :: CARD8,
-                                                 y_axis_ChangePointerDevice :: CARD8,
-                                                 device_id_ChangePointerDevice :: CARD8}
+                                                 :: Word8,
+                                                 y_axis_ChangePointerDevice :: Word8,
+                                                 device_id_ChangePointerDevice :: Word8}
                          deriving (Show, Typeable)
  
 instance ExtensionRequest ChangePointerDevice where
@@ -707,7 +708,7 @@
                          size (y_axis_ChangePointerDevice x)
                          + size (device_id_ChangePointerDevice x)
                          + 1
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (x_axis_ChangePointerDevice x)
                serialize (y_axis_ChangePointerDevice x)
                serialize (device_id_ChangePointerDevice x)
@@ -715,7 +716,7 @@
                putSkip (requiredPadding size__)
  
 data ChangePointerDeviceReply = MkChangePointerDeviceReply{status_ChangePointerDeviceReply
-                                                           :: CARD8}
+                                                           :: Word8}
                               deriving (Show, Typeable)
  
 instance Deserialize ChangePointerDeviceReply where
@@ -730,10 +731,10 @@
                return (MkChangePointerDeviceReply status)
  
 data GrabDevice = MkGrabDevice{grab_window_GrabDevice :: WINDOW,
-                               time_GrabDevice :: TIMESTAMP, num_classes_GrabDevice :: CARD16,
-                               this_device_mode_GrabDevice :: CARD8,
-                               other_device_mode_GrabDevice :: CARD8,
-                               owner_events_GrabDevice :: BOOL, device_id_GrabDevice :: CARD8,
+                               time_GrabDevice :: TIMESTAMP, num_classes_GrabDevice :: Word16,
+                               this_device_mode_GrabDevice :: Word8,
+                               other_device_mode_GrabDevice :: Word8,
+                               owner_events_GrabDevice :: Bool, device_id_GrabDevice :: Word8,
                                classes_GrabDevice :: [EventClass]}
                 deriving (Show, Typeable)
  
@@ -751,7 +752,7 @@
                          + size (device_id_GrabDevice x)
                          + 2
                          + sum (map size (classes_GrabDevice x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (grab_window_GrabDevice x)
                serialize (time_GrabDevice x)
                serialize (num_classes_GrabDevice x)
@@ -764,7 +765,7 @@
                putSkip (requiredPadding size__)
  
 data GrabDeviceReply = MkGrabDeviceReply{status_GrabDeviceReply ::
-                                         CARD8}
+                                         Word8}
                      deriving (Show, Typeable)
  
 instance Deserialize GrabDeviceReply where
@@ -779,7 +780,7 @@
                return (MkGrabDeviceReply status)
  
 data UngrabDevice = MkUngrabDevice{time_UngrabDevice :: TIMESTAMP,
-                                   device_id_UngrabDevice :: CARD8}
+                                   device_id_UngrabDevice :: Word8}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest UngrabDevice where
@@ -789,21 +790,21 @@
                putWord8 14
                let size__
                      = 4 + size (time_UngrabDevice x) + size (device_id_UngrabDevice x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (time_UngrabDevice x)
                serialize (device_id_UngrabDevice x)
                putSkip (requiredPadding size__)
  
 data GrabDeviceKey = MkGrabDeviceKey{grab_window_GrabDeviceKey ::
                                      WINDOW,
-                                     num_classes_GrabDeviceKey :: CARD16,
-                                     modifiers_GrabDeviceKey :: CARD16,
-                                     modifier_device_GrabDeviceKey :: CARD8,
-                                     grabbed_device_GrabDeviceKey :: CARD8,
-                                     key_GrabDeviceKey :: CARD8,
-                                     this_device_mode_GrabDeviceKey :: CARD8,
-                                     other_device_mode_GrabDeviceKey :: CARD8,
-                                     owner_events_GrabDeviceKey :: BOOL,
+                                     num_classes_GrabDeviceKey :: Word16,
+                                     modifiers_GrabDeviceKey :: Word16,
+                                     modifier_device_GrabDeviceKey :: Word8,
+                                     grabbed_device_GrabDeviceKey :: Word8,
+                                     key_GrabDeviceKey :: Word8,
+                                     this_device_mode_GrabDeviceKey :: Word8,
+                                     other_device_mode_GrabDeviceKey :: Word8,
+                                     owner_events_GrabDeviceKey :: Bool,
                                      classes_GrabDeviceKey :: [EventClass]}
                    deriving (Show, Typeable)
  
@@ -824,7 +825,7 @@
                          + size (owner_events_GrabDeviceKey x)
                          + 2
                          + sum (map size (classes_GrabDeviceKey x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (grab_window_GrabDeviceKey x)
                serialize (num_classes_GrabDeviceKey x)
                serialize (modifiers_GrabDeviceKey x)
@@ -840,10 +841,10 @@
  
 data UngrabDeviceKey = MkUngrabDeviceKey{grabWindow_UngrabDeviceKey
                                          :: WINDOW,
-                                         modifiers_UngrabDeviceKey :: CARD16,
-                                         modifier_device_UngrabDeviceKey :: CARD8,
-                                         key_UngrabDeviceKey :: CARD8,
-                                         grabbed_device_UngrabDeviceKey :: CARD8}
+                                         modifiers_UngrabDeviceKey :: Word16,
+                                         modifier_device_UngrabDeviceKey :: Word8,
+                                         key_UngrabDeviceKey :: Word8,
+                                         grabbed_device_UngrabDeviceKey :: Word8}
                      deriving (Show, Typeable)
  
 instance ExtensionRequest UngrabDeviceKey where
@@ -857,7 +858,7 @@
                          + size (modifier_device_UngrabDeviceKey x)
                          + size (key_UngrabDeviceKey x)
                          + size (grabbed_device_UngrabDeviceKey x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (grabWindow_UngrabDeviceKey x)
                serialize (modifiers_UngrabDeviceKey x)
                serialize (modifier_device_UngrabDeviceKey x)
@@ -867,14 +868,14 @@
  
 data GrabDeviceButton = MkGrabDeviceButton{grab_window_GrabDeviceButton
                                            :: WINDOW,
-                                           grabbed_device_GrabDeviceButton :: CARD8,
-                                           modifier_device_GrabDeviceButton :: CARD8,
-                                           num_classes_GrabDeviceButton :: CARD16,
-                                           modifiers_GrabDeviceButton :: CARD16,
-                                           this_device_mode_GrabDeviceButton :: CARD8,
-                                           other_device_mode_GrabDeviceButton :: CARD8,
-                                           button_GrabDeviceButton :: CARD8,
-                                           owner_events_GrabDeviceButton :: CARD8,
+                                           grabbed_device_GrabDeviceButton :: Word8,
+                                           modifier_device_GrabDeviceButton :: Word8,
+                                           num_classes_GrabDeviceButton :: Word16,
+                                           modifiers_GrabDeviceButton :: Word16,
+                                           this_device_mode_GrabDeviceButton :: Word8,
+                                           other_device_mode_GrabDeviceButton :: Word8,
+                                           button_GrabDeviceButton :: Word8,
+                                           owner_events_GrabDeviceButton :: Word8,
                                            classes_GrabDeviceButton :: [EventClass]}
                       deriving (Show, Typeable)
  
@@ -895,7 +896,7 @@
                          + size (owner_events_GrabDeviceButton x)
                          + 2
                          + sum (map size (classes_GrabDeviceButton x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (grab_window_GrabDeviceButton x)
                serialize (grabbed_device_GrabDeviceButton x)
                serialize (modifier_device_GrabDeviceButton x)
@@ -911,10 +912,10 @@
  
 data UngrabDeviceButton = MkUngrabDeviceButton{grab_window_UngrabDeviceButton
                                                :: WINDOW,
-                                               modifiers_UngrabDeviceButton :: CARD16,
-                                               modifier_device_UngrabDeviceButton :: CARD8,
-                                               button_UngrabDeviceButton :: CARD8,
-                                               grabbed_device_UngrabDeviceButton :: CARD8}
+                                               modifiers_UngrabDeviceButton :: Word16,
+                                               modifier_device_UngrabDeviceButton :: Word8,
+                                               button_UngrabDeviceButton :: Word8,
+                                               grabbed_device_UngrabDeviceButton :: Word8}
                         deriving (Show, Typeable)
  
 instance ExtensionRequest UngrabDeviceButton where
@@ -928,7 +929,7 @@
                          + size (modifier_device_UngrabDeviceButton x)
                          + size (button_UngrabDeviceButton x)
                          + size (grabbed_device_UngrabDeviceButton x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (grab_window_UngrabDeviceButton x)
                serialize (modifiers_UngrabDeviceButton x)
                serialize (modifier_device_UngrabDeviceButton x)
@@ -938,8 +939,8 @@
  
 data AllowDeviceEvents = MkAllowDeviceEvents{time_AllowDeviceEvents
                                              :: TIMESTAMP,
-                                             mode_AllowDeviceEvents :: CARD8,
-                                             device_id_AllowDeviceEvents :: CARD8}
+                                             mode_AllowDeviceEvents :: Word8,
+                                             device_id_AllowDeviceEvents :: Word8}
                        deriving (Show, Typeable)
  
 instance ExtensionRequest AllowDeviceEvents where
@@ -951,14 +952,14 @@
                      = 4 + size (time_AllowDeviceEvents x) +
                          size (mode_AllowDeviceEvents x)
                          + size (device_id_AllowDeviceEvents x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (time_AllowDeviceEvents x)
                serialize (mode_AllowDeviceEvents x)
                serialize (device_id_AllowDeviceEvents x)
                putSkip (requiredPadding size__)
  
 data GetDeviceFocus = MkGetDeviceFocus{device_id_GetDeviceFocus ::
-                                       CARD8}
+                                       Word8}
                     deriving (Show, Typeable)
  
 instance ExtensionRequest GetDeviceFocus where
@@ -967,7 +968,7 @@
           = do putWord8 extOpCode
                putWord8 20
                let size__ = 4 + size (device_id_GetDeviceFocus x) + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_GetDeviceFocus x)
                putSkip 3
                putSkip (requiredPadding size__)
@@ -975,7 +976,7 @@
 data GetDeviceFocusReply = MkGetDeviceFocusReply{focus_GetDeviceFocusReply
                                                  :: WINDOW,
                                                  time_GetDeviceFocusReply :: TIMESTAMP,
-                                                 revert_to_GetDeviceFocusReply :: CARD8}
+                                                 revert_to_GetDeviceFocusReply :: Word8}
                          deriving (Show, Typeable)
  
 instance Deserialize GetDeviceFocusReply where
@@ -994,8 +995,8 @@
 data SetDeviceFocus = MkSetDeviceFocus{focus_SetDeviceFocus ::
                                        WINDOW,
                                        time_SetDeviceFocus :: TIMESTAMP,
-                                       revert_to_SetDeviceFocus :: CARD8,
-                                       device_id_SetDeviceFocus :: CARD8}
+                                       revert_to_SetDeviceFocus :: Word8,
+                                       device_id_SetDeviceFocus :: Word8}
                     deriving (Show, Typeable)
  
 instance ExtensionRequest SetDeviceFocus where
@@ -1007,7 +1008,7 @@
                      = 4 + size (focus_SetDeviceFocus x) + size (time_SetDeviceFocus x)
                          + size (revert_to_SetDeviceFocus x)
                          + size (device_id_SetDeviceFocus x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (focus_SetDeviceFocus x)
                serialize (time_SetDeviceFocus x)
                serialize (revert_to_SetDeviceFocus x)
@@ -1015,7 +1016,7 @@
                putSkip (requiredPadding size__)
  
 data GetFeedbackControl = MkGetFeedbackControl{device_id_GetFeedbackControl
-                                               :: CARD8}
+                                               :: Word8}
                         deriving (Show, Typeable)
  
 instance ExtensionRequest GetFeedbackControl where
@@ -1024,13 +1025,13 @@
           = do putWord8 extOpCode
                putWord8 22
                let size__ = 4 + size (device_id_GetFeedbackControl x) + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_GetFeedbackControl x)
                putSkip 3
                putSkip (requiredPadding size__)
  
 data GetFeedbackControlReply = MkGetFeedbackControlReply{num_feedback_GetFeedbackControlReply
-                                                         :: CARD16}
+                                                         :: Word16}
                              deriving (Show, Typeable)
  
 instance Deserialize GetFeedbackControlReply where
@@ -1045,8 +1046,8 @@
                return (MkGetFeedbackControlReply num_feedback)
  
 data FeedbackState = MkFeedbackState{class_id_FeedbackState ::
-                                     CARD8,
-                                     id_FeedbackState :: CARD8, len_FeedbackState :: CARD16}
+                                     Word8,
+                                     id_FeedbackState :: Word8, len_FeedbackState :: Word16}
                    deriving (Show, Typeable)
  
 instance Serialize FeedbackState where
@@ -1066,17 +1067,17 @@
                return (MkFeedbackState class_id id len)
  
 data KbdFeedbackState = MkKbdFeedbackState{class_id_KbdFeedbackState
-                                           :: CARD8,
-                                           id_KbdFeedbackState :: CARD8,
-                                           len_KbdFeedbackState :: CARD16,
-                                           pitch_KbdFeedbackState :: CARD16,
-                                           duration_KbdFeedbackState :: CARD16,
-                                           led_mask_KbdFeedbackState :: CARD32,
-                                           led_values_KbdFeedbackState :: CARD32,
-                                           global_auto_repeat_KbdFeedbackState :: BOOL,
-                                           click_KbdFeedbackState :: CARD8,
-                                           percent_KbdFeedbackState :: CARD8,
-                                           auto_repeats_KbdFeedbackState :: [CARD8]}
+                                           :: Word8,
+                                           id_KbdFeedbackState :: Word8,
+                                           len_KbdFeedbackState :: Word16,
+                                           pitch_KbdFeedbackState :: Word16,
+                                           duration_KbdFeedbackState :: Word16,
+                                           led_mask_KbdFeedbackState :: Word32,
+                                           led_values_KbdFeedbackState :: Word32,
+                                           global_auto_repeat_KbdFeedbackState :: Bool,
+                                           click_KbdFeedbackState :: Word8,
+                                           percent_KbdFeedbackState :: Word8,
+                                           auto_repeats_KbdFeedbackState :: [Word8]}
                       deriving (Show, Typeable)
  
 instance Serialize KbdFeedbackState where
@@ -1129,12 +1130,12 @@
                     auto_repeats)
  
 data PtrFeedbackState = MkPtrFeedbackState{class_id_PtrFeedbackState
-                                           :: CARD8,
-                                           id_PtrFeedbackState :: CARD8,
-                                           len_PtrFeedbackState :: CARD16,
-                                           accel_num_PtrFeedbackState :: CARD16,
-                                           accel_denom_PtrFeedbackState :: CARD16,
-                                           threshold_PtrFeedbackState :: CARD16}
+                                           :: Word8,
+                                           id_PtrFeedbackState :: Word8,
+                                           len_PtrFeedbackState :: Word16,
+                                           accel_num_PtrFeedbackState :: Word16,
+                                           accel_denom_PtrFeedbackState :: Word16,
+                                           threshold_PtrFeedbackState :: Word16}
                       deriving (Show, Typeable)
  
 instance Serialize PtrFeedbackState where
@@ -1168,12 +1169,12 @@
                     threshold)
  
 data IntegerFeedbackState = MkIntegerFeedbackState{class_id_IntegerFeedbackState
-                                                   :: CARD8,
-                                                   id_IntegerFeedbackState :: CARD8,
-                                                   len_IntegerFeedbackState :: CARD16,
-                                                   resolution_IntegerFeedbackState :: CARD32,
-                                                   min_value_IntegerFeedbackState :: INT32,
-                                                   max_value_IntegerFeedbackState :: INT32}
+                                                   :: Word8,
+                                                   id_IntegerFeedbackState :: Word8,
+                                                   len_IntegerFeedbackState :: Word16,
+                                                   resolution_IntegerFeedbackState :: Word32,
+                                                   min_value_IntegerFeedbackState :: Int32,
+                                                   max_value_IntegerFeedbackState :: Int32}
                           deriving (Show, Typeable)
  
 instance Serialize IntegerFeedbackState where
@@ -1205,11 +1206,11 @@
                     max_value)
  
 data StringFeedbackState = MkStringFeedbackState{class_id_StringFeedbackState
-                                                 :: CARD8,
-                                                 id_StringFeedbackState :: CARD8,
-                                                 len_StringFeedbackState :: CARD16,
-                                                 max_symbols_StringFeedbackState :: CARD16,
-                                                 num_keysyms_StringFeedbackState :: CARD16,
+                                                 :: Word8,
+                                                 id_StringFeedbackState :: Word8,
+                                                 len_StringFeedbackState :: Word16,
+                                                 max_symbols_StringFeedbackState :: Word16,
+                                                 num_keysyms_StringFeedbackState :: Word16,
                                                  keysyms_StringFeedbackState :: [KEYSYM]}
                          deriving (Show, Typeable)
  
@@ -1242,12 +1243,12 @@
                     keysyms)
  
 data BellFeedbackState = MkBellFeedbackState{class_id_BellFeedbackState
-                                             :: CARD8,
-                                             id_BellFeedbackState :: CARD8,
-                                             len_BellFeedbackState :: CARD16,
-                                             percent_BellFeedbackState :: CARD8,
-                                             pitch_BellFeedbackState :: CARD16,
-                                             duration_BellFeedbackState :: CARD16}
+                                             :: Word8,
+                                             id_BellFeedbackState :: Word8,
+                                             len_BellFeedbackState :: Word16,
+                                             percent_BellFeedbackState :: Word8,
+                                             pitch_BellFeedbackState :: Word16,
+                                             duration_BellFeedbackState :: Word16}
                        deriving (Show, Typeable)
  
 instance Serialize BellFeedbackState where
@@ -1280,11 +1281,11 @@
                return (MkBellFeedbackState class_id id len percent pitch duration)
  
 data LedFeedbackState = MkLedFeedbackState{class_id_LedFeedbackState
-                                           :: CARD8,
-                                           id_LedFeedbackState :: CARD8,
-                                           len_LedFeedbackState :: CARD16,
-                                           led_mask_LedFeedbackState :: CARD32,
-                                           led_values_LedFeedbackState :: CARD32}
+                                           :: Word8,
+                                           id_LedFeedbackState :: Word8,
+                                           len_LedFeedbackState :: Word16,
+                                           led_mask_LedFeedbackState :: Word32,
+                                           led_values_LedFeedbackState :: Word32}
                       deriving (Show, Typeable)
  
 instance Serialize LedFeedbackState where
@@ -1309,8 +1310,8 @@
                led_values <- deserialize
                return (MkLedFeedbackState class_id id len led_mask led_values)
  
-data FeedbackCtl = MkFeedbackCtl{class_id_FeedbackCtl :: CARD8,
-                                 id_FeedbackCtl :: CARD8, len_FeedbackCtl :: CARD16}
+data FeedbackCtl = MkFeedbackCtl{class_id_FeedbackCtl :: Word8,
+                                 id_FeedbackCtl :: Word8, len_FeedbackCtl :: Word16}
                  deriving (Show, Typeable)
  
 instance Serialize FeedbackCtl where
@@ -1330,16 +1331,16 @@
                return (MkFeedbackCtl class_id id len)
  
 data KbdFeedbackCtl = MkKbdFeedbackCtl{class_id_KbdFeedbackCtl ::
-                                       CARD8,
-                                       id_KbdFeedbackCtl :: CARD8, len_KbdFeedbackCtl :: CARD16,
+                                       Word8,
+                                       id_KbdFeedbackCtl :: Word8, len_KbdFeedbackCtl :: Word16,
                                        key_KbdFeedbackCtl :: KeyCode,
-                                       auto_repeat_mode_KbdFeedbackCtl :: CARD8,
-                                       key_click_percent_KbdFeedbackCtl :: INT8,
-                                       bell_percent_KbdFeedbackCtl :: INT8,
-                                       bell_pitch_KbdFeedbackCtl :: INT16,
-                                       bell_duration_KbdFeedbackCtl :: INT16,
-                                       led_mask_KbdFeedbackCtl :: CARD32,
-                                       led_values_KbdFeedbackCtl :: CARD32}
+                                       auto_repeat_mode_KbdFeedbackCtl :: Word8,
+                                       key_click_percent_KbdFeedbackCtl :: Int8,
+                                       bell_percent_KbdFeedbackCtl :: Int8,
+                                       bell_pitch_KbdFeedbackCtl :: Int16,
+                                       bell_duration_KbdFeedbackCtl :: Int16,
+                                       led_mask_KbdFeedbackCtl :: Word32,
+                                       led_values_KbdFeedbackCtl :: Word32}
                     deriving (Show, Typeable)
  
 instance Serialize KbdFeedbackCtl where
@@ -1390,10 +1391,10 @@
                     led_values)
  
 data PtrFeedbackCtl = MkPtrFeedbackCtl{class_id_PtrFeedbackCtl ::
-                                       CARD8,
-                                       id_PtrFeedbackCtl :: CARD8, len_PtrFeedbackCtl :: CARD16,
-                                       num_PtrFeedbackCtl :: INT16, denom_PtrFeedbackCtl :: INT16,
-                                       threshold_PtrFeedbackCtl :: INT16}
+                                       Word8,
+                                       id_PtrFeedbackCtl :: Word8, len_PtrFeedbackCtl :: Word16,
+                                       num_PtrFeedbackCtl :: Int16, denom_PtrFeedbackCtl :: Int16,
+                                       threshold_PtrFeedbackCtl :: Int16}
                     deriving (Show, Typeable)
  
 instance Serialize PtrFeedbackCtl where
@@ -1425,10 +1426,10 @@
                return (MkPtrFeedbackCtl class_id id len num denom threshold)
  
 data IntegerFeedbackCtl = MkIntegerFeedbackCtl{class_id_IntegerFeedbackCtl
-                                               :: CARD8,
-                                               id_IntegerFeedbackCtl :: CARD8,
-                                               len_IntegerFeedbackCtl :: CARD16,
-                                               int_to_display_IntegerFeedbackCtl :: INT32}
+                                               :: Word8,
+                                               id_IntegerFeedbackCtl :: Word8,
+                                               len_IntegerFeedbackCtl :: Word16,
+                                               int_to_display_IntegerFeedbackCtl :: Int32}
                         deriving (Show, Typeable)
  
 instance Serialize IntegerFeedbackCtl where
@@ -1452,10 +1453,10 @@
                return (MkIntegerFeedbackCtl class_id id len int_to_display)
  
 data StringFeedbackCtl = MkStringFeedbackCtl{class_id_StringFeedbackCtl
-                                             :: CARD8,
-                                             id_StringFeedbackCtl :: CARD8,
-                                             len_StringFeedbackCtl :: CARD16,
-                                             num_keysyms_StringFeedbackCtl :: CARD16,
+                                             :: Word8,
+                                             id_StringFeedbackCtl :: Word8,
+                                             len_StringFeedbackCtl :: Word16,
+                                             num_keysyms_StringFeedbackCtl :: Word16,
                                              keysyms_StringFeedbackCtl :: [KEYSYM]}
                        deriving (Show, Typeable)
  
@@ -1486,11 +1487,11 @@
                return (MkStringFeedbackCtl class_id id len num_keysyms keysyms)
  
 data BellFeedbackCtl = MkBellFeedbackCtl{class_id_BellFeedbackCtl
-                                         :: CARD8,
-                                         id_BellFeedbackCtl :: CARD8, len_BellFeedbackCtl :: CARD16,
-                                         percent_BellFeedbackCtl :: INT8,
-                                         pitch_BellFeedbackCtl :: INT16,
-                                         duration_BellFeedbackCtl :: INT16}
+                                         :: Word8,
+                                         id_BellFeedbackCtl :: Word8, len_BellFeedbackCtl :: Word16,
+                                         percent_BellFeedbackCtl :: Int8,
+                                         pitch_BellFeedbackCtl :: Int16,
+                                         duration_BellFeedbackCtl :: Int16}
                      deriving (Show, Typeable)
  
 instance Serialize BellFeedbackCtl where
@@ -1522,10 +1523,10 @@
                return (MkBellFeedbackCtl class_id id len percent pitch duration)
  
 data LedFeedbackCtl = MkLedFeedbackCtl{class_id_LedFeedbackCtl ::
-                                       CARD8,
-                                       id_LedFeedbackCtl :: CARD8, len_LedFeedbackCtl :: CARD16,
-                                       led_mask_LedFeedbackCtl :: CARD32,
-                                       led_values_LedFeedbackCtl :: CARD32}
+                                       Word8,
+                                       id_LedFeedbackCtl :: Word8, len_LedFeedbackCtl :: Word16,
+                                       led_mask_LedFeedbackCtl :: Word32,
+                                       led_values_LedFeedbackCtl :: Word32}
                     deriving (Show, Typeable)
  
 instance Serialize LedFeedbackCtl where
@@ -1551,9 +1552,9 @@
                return (MkLedFeedbackCtl class_id id len led_mask led_values)
  
 data GetDeviceKeyMapping = MkGetDeviceKeyMapping{device_id_GetDeviceKeyMapping
-                                                 :: CARD8,
+                                                 :: Word8,
                                                  first_keycode_GetDeviceKeyMapping :: KeyCode,
-                                                 count_GetDeviceKeyMapping :: CARD8}
+                                                 count_GetDeviceKeyMapping :: Word8}
                          deriving (Show, Typeable)
  
 instance ExtensionRequest GetDeviceKeyMapping where
@@ -1565,14 +1566,14 @@
                      = 4 + size (device_id_GetDeviceKeyMapping x) +
                          size (first_keycode_GetDeviceKeyMapping x)
                          + size (count_GetDeviceKeyMapping x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_GetDeviceKeyMapping x)
                serialize (first_keycode_GetDeviceKeyMapping x)
                serialize (count_GetDeviceKeyMapping x)
                putSkip (requiredPadding size__)
  
 data GetDeviceKeyMappingReply = MkGetDeviceKeyMappingReply{keysyms_per_keycode_GetDeviceKeyMappingReply
-                                                           :: CARD8,
+                                                           :: Word8,
                                                            keysyms_GetDeviceKeyMappingReply ::
                                                            [KEYSYM]}
                               deriving (Show, Typeable)
@@ -1590,13 +1591,13 @@
                return (MkGetDeviceKeyMappingReply keysyms_per_keycode keysyms)
  
 data ChangeDeviceKeyMapping = MkChangeDeviceKeyMapping{device_id_ChangeDeviceKeyMapping
-                                                       :: CARD8,
+                                                       :: Word8,
                                                        first_keycode_ChangeDeviceKeyMapping ::
                                                        KeyCode,
                                                        keysyms_per_keycode_ChangeDeviceKeyMapping ::
-                                                       CARD8,
+                                                       Word8,
                                                        keycode_count_ChangeDeviceKeyMapping ::
-                                                       CARD8,
+                                                       Word8,
                                                        keysyms_ChangeDeviceKeyMapping :: [KEYSYM]}
                             deriving (Show, Typeable)
  
@@ -1611,7 +1612,7 @@
                          + size (keysyms_per_keycode_ChangeDeviceKeyMapping x)
                          + size (keycode_count_ChangeDeviceKeyMapping x)
                          + sum (map size (keysyms_ChangeDeviceKeyMapping x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_ChangeDeviceKeyMapping x)
                serialize (first_keycode_ChangeDeviceKeyMapping x)
                serialize (keysyms_per_keycode_ChangeDeviceKeyMapping x)
@@ -1620,7 +1621,7 @@
                putSkip (requiredPadding size__)
  
 data GetDeviceModifierMapping = MkGetDeviceModifierMapping{device_id_GetDeviceModifierMapping
-                                                           :: CARD8}
+                                                           :: Word8}
                               deriving (Show, Typeable)
  
 instance ExtensionRequest GetDeviceModifierMapping where
@@ -1629,15 +1630,15 @@
           = do putWord8 extOpCode
                putWord8 26
                let size__ = 4 + size (device_id_GetDeviceModifierMapping x) + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_GetDeviceModifierMapping x)
                putSkip 3
                putSkip (requiredPadding size__)
  
 data GetDeviceModifierMappingReply = MkGetDeviceModifierMappingReply{keycodes_per_modifier_GetDeviceModifierMappingReply
-                                                                     :: CARD8,
+                                                                     :: Word8,
                                                                      keymaps_GetDeviceModifierMappingReply
-                                                                     :: [CARD8]}
+                                                                     :: [Word8]}
                                    deriving (Show, Typeable)
  
 instance Deserialize GetDeviceModifierMappingReply where
@@ -1655,11 +1656,11 @@
                  (MkGetDeviceModifierMappingReply keycodes_per_modifier keymaps)
  
 data SetDeviceModifierMapping = MkSetDeviceModifierMapping{device_id_SetDeviceModifierMapping
-                                                           :: CARD8,
+                                                           :: Word8,
                                                            keycodes_per_modifier_SetDeviceModifierMapping
-                                                           :: CARD8,
+                                                           :: Word8,
                                                            keymaps_SetDeviceModifierMapping ::
-                                                           [CARD8]}
+                                                           [Word8]}
                               deriving (Show, Typeable)
  
 instance ExtensionRequest SetDeviceModifierMapping where
@@ -1672,7 +1673,7 @@
                          size (keycodes_per_modifier_SetDeviceModifierMapping x)
                          + 1
                          + sum (map size (keymaps_SetDeviceModifierMapping x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_SetDeviceModifierMapping x)
                serialize (keycodes_per_modifier_SetDeviceModifierMapping x)
                putSkip 1
@@ -1680,7 +1681,7 @@
                putSkip (requiredPadding size__)
  
 data SetDeviceModifierMappingReply = MkSetDeviceModifierMappingReply{status_SetDeviceModifierMappingReply
-                                                                     :: CARD8}
+                                                                     :: Word8}
                                    deriving (Show, Typeable)
  
 instance Deserialize SetDeviceModifierMappingReply where
@@ -1695,7 +1696,7 @@
                return (MkSetDeviceModifierMappingReply status)
  
 data GetDeviceButtonMapping = MkGetDeviceButtonMapping{device_id_GetDeviceButtonMapping
-                                                       :: CARD8}
+                                                       :: Word8}
                             deriving (Show, Typeable)
  
 instance ExtensionRequest GetDeviceButtonMapping where
@@ -1704,15 +1705,15 @@
           = do putWord8 extOpCode
                putWord8 28
                let size__ = 4 + size (device_id_GetDeviceButtonMapping x) + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_GetDeviceButtonMapping x)
                putSkip 3
                putSkip (requiredPadding size__)
  
 data GetDeviceButtonMappingReply = MkGetDeviceButtonMappingReply{map_size_GetDeviceButtonMappingReply
-                                                                 :: CARD8,
+                                                                 :: Word8,
                                                                  map_GetDeviceButtonMappingReply ::
-                                                                 [CARD8]}
+                                                                 [Word8]}
                                  deriving (Show, Typeable)
  
 instance Deserialize GetDeviceButtonMappingReply where
@@ -1728,9 +1729,9 @@
                return (MkGetDeviceButtonMappingReply map_size map)
  
 data SetDeviceButtonMapping = MkSetDeviceButtonMapping{device_id_SetDeviceButtonMapping
-                                                       :: CARD8,
-                                                       map_size_SetDeviceButtonMapping :: CARD8,
-                                                       map_SetDeviceButtonMapping :: [CARD8]}
+                                                       :: Word8,
+                                                       map_size_SetDeviceButtonMapping :: Word8,
+                                                       map_SetDeviceButtonMapping :: [Word8]}
                             deriving (Show, Typeable)
  
 instance ExtensionRequest SetDeviceButtonMapping where
@@ -1743,7 +1744,7 @@
                          size (map_size_SetDeviceButtonMapping x)
                          + 2
                          + sum (map size (map_SetDeviceButtonMapping x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_SetDeviceButtonMapping x)
                serialize (map_size_SetDeviceButtonMapping x)
                putSkip 2
@@ -1751,7 +1752,7 @@
                putSkip (requiredPadding size__)
  
 data SetDeviceButtonMappingReply = MkSetDeviceButtonMappingReply{status_SetDeviceButtonMappingReply
-                                                                 :: CARD8}
+                                                                 :: Word8}
                                  deriving (Show, Typeable)
  
 instance Deserialize SetDeviceButtonMappingReply where
@@ -1766,7 +1767,7 @@
                return (MkSetDeviceButtonMappingReply status)
  
 data QueryDeviceState = MkQueryDeviceState{device_id_QueryDeviceState
-                                           :: CARD8}
+                                           :: Word8}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest QueryDeviceState where
@@ -1775,13 +1776,13 @@
           = do putWord8 extOpCode
                putWord8 30
                let size__ = 4 + size (device_id_QueryDeviceState x) + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_QueryDeviceState x)
                putSkip 3
                putSkip (requiredPadding size__)
  
 data QueryDeviceStateReply = MkQueryDeviceStateReply{num_classes_QueryDeviceStateReply
-                                                     :: CARD8}
+                                                     :: Word8}
                            deriving (Show, Typeable)
  
 instance Deserialize QueryDeviceStateReply where
@@ -1795,8 +1796,8 @@
                let _ = isCard32 length
                return (MkQueryDeviceStateReply num_classes)
  
-data InputState = MkInputState{class_id_InputState :: CARD8,
-                               len_InputState :: CARD8, num_items_InputState :: CARD8}
+data InputState = MkInputState{class_id_InputState :: Word8,
+                               len_InputState :: Word8, num_items_InputState :: Word8}
                 deriving (Show, Typeable)
  
 instance Serialize InputState where
@@ -1815,9 +1816,9 @@
                num_items <- deserialize
                return (MkInputState class_id len num_items)
  
-data KeyState = MkKeyState{class_id_KeyState :: CARD8,
-                           len_KeyState :: CARD8, num_keys_KeyState :: CARD8,
-                           keys_KeyState :: [CARD8]}
+data KeyState = MkKeyState{class_id_KeyState :: Word8,
+                           len_KeyState :: Word8, num_keys_KeyState :: Word8,
+                           keys_KeyState :: [Word8]}
               deriving (Show, Typeable)
  
 instance Serialize KeyState where
@@ -1842,9 +1843,9 @@
                keys <- deserializeList (fromIntegral 32)
                return (MkKeyState class_id len num_keys keys)
  
-data ButtonState = MkButtonState{class_id_ButtonState :: CARD8,
-                                 len_ButtonState :: CARD8, num_buttons_ButtonState :: CARD8,
-                                 buttons_ButtonState :: [CARD8]}
+data ButtonState = MkButtonState{class_id_ButtonState :: Word8,
+                                 len_ButtonState :: Word8, num_buttons_ButtonState :: Word8,
+                                 buttons_ButtonState :: [Word8]}
                  deriving (Show, Typeable)
  
 instance Serialize ButtonState where
@@ -1870,11 +1871,11 @@
                return (MkButtonState class_id len num_buttons buttons)
  
 data ValuatorState = MkValuatorState{class_id_ValuatorState ::
-                                     CARD8,
-                                     len_ValuatorState :: CARD8,
-                                     num_valuators_ValuatorState :: CARD8,
-                                     mode_ValuatorState :: CARD8,
-                                     valuators_ValuatorState :: [CARD32]}
+                                     Word8,
+                                     len_ValuatorState :: Word8,
+                                     num_valuators_ValuatorState :: Word8,
+                                     mode_ValuatorState :: Word8,
+                                     valuators_ValuatorState :: [Word32]}
                    deriving (Show, Typeable)
  
 instance Serialize ValuatorState where
@@ -1901,10 +1902,10 @@
  
 data SendExtensionEvent = MkSendExtensionEvent{destination_SendExtensionEvent
                                                :: WINDOW,
-                                               device_id_SendExtensionEvent :: CARD8,
-                                               propagate_SendExtensionEvent :: BOOL,
-                                               num_classes_SendExtensionEvent :: CARD16,
-                                               num_events_SendExtensionEvent :: CARD8,
+                                               device_id_SendExtensionEvent :: Word8,
+                                               propagate_SendExtensionEvent :: Bool,
+                                               num_classes_SendExtensionEvent :: Word16,
+                                               num_events_SendExtensionEvent :: Word8,
                                                events_SendExtensionEvent :: [CChar],
                                                classes_SendExtensionEvent :: [EventClass]}
                         deriving (Show, Typeable)
@@ -1923,7 +1924,7 @@
                          + 3
                          + sum (map size (events_SendExtensionEvent x))
                          + sum (map size (classes_SendExtensionEvent x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (destination_SendExtensionEvent x)
                serialize (device_id_SendExtensionEvent x)
                serialize (propagate_SendExtensionEvent x)
@@ -1934,9 +1935,9 @@
                serializeList (classes_SendExtensionEvent x)
                putSkip (requiredPadding size__)
  
-data DeviceBell = MkDeviceBell{device_id_DeviceBell :: CARD8,
-                               feedback_id_DeviceBell :: CARD8,
-                               feedback_class_DeviceBell :: CARD8, percent_DeviceBell :: INT8}
+data DeviceBell = MkDeviceBell{device_id_DeviceBell :: Word8,
+                               feedback_id_DeviceBell :: Word8,
+                               feedback_class_DeviceBell :: Word8, percent_DeviceBell :: Int8}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest DeviceBell where
@@ -1949,7 +1950,7 @@
                          size (feedback_id_DeviceBell x)
                          + size (feedback_class_DeviceBell x)
                          + size (percent_DeviceBell x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_DeviceBell x)
                serialize (feedback_id_DeviceBell x)
                serialize (feedback_class_DeviceBell x)
@@ -1957,10 +1958,10 @@
                putSkip (requiredPadding size__)
  
 data SetDeviceValuators = MkSetDeviceValuators{device_id_SetDeviceValuators
-                                               :: CARD8,
-                                               first_valuator_SetDeviceValuators :: CARD8,
-                                               num_valuators_SetDeviceValuators :: CARD8,
-                                               valuators_SetDeviceValuators :: [INT32]}
+                                               :: Word8,
+                                               first_valuator_SetDeviceValuators :: Word8,
+                                               num_valuators_SetDeviceValuators :: Word8,
+                                               valuators_SetDeviceValuators :: [Int32]}
                         deriving (Show, Typeable)
  
 instance ExtensionRequest SetDeviceValuators where
@@ -1974,7 +1975,7 @@
                          + size (num_valuators_SetDeviceValuators x)
                          + 1
                          + sum (map size (valuators_SetDeviceValuators x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_id_SetDeviceValuators x)
                serialize (first_valuator_SetDeviceValuators x)
                serialize (num_valuators_SetDeviceValuators x)
@@ -1983,7 +1984,7 @@
                putSkip (requiredPadding size__)
  
 data SetDeviceValuatorsReply = MkSetDeviceValuatorsReply{status_SetDeviceValuatorsReply
-                                                         :: CARD8}
+                                                         :: Word8}
                              deriving (Show, Typeable)
  
 instance Deserialize SetDeviceValuatorsReply where
@@ -1998,8 +1999,8 @@
                return (MkSetDeviceValuatorsReply status)
  
 data GetDeviceControl = MkGetDeviceControl{control_id_GetDeviceControl
-                                           :: CARD16,
-                                           device_id_GetDeviceControl :: CARD8}
+                                           :: Word16,
+                                           device_id_GetDeviceControl :: Word8}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest GetDeviceControl where
@@ -2011,14 +2012,14 @@
                      = 4 + size (control_id_GetDeviceControl x) +
                          size (device_id_GetDeviceControl x)
                          + 1
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (control_id_GetDeviceControl x)
                serialize (device_id_GetDeviceControl x)
                putSkip 1
                putSkip (requiredPadding size__)
  
 data GetDeviceControlReply = MkGetDeviceControlReply{status_GetDeviceControlReply
-                                                     :: CARD8}
+                                                     :: Word8}
                            deriving (Show, Typeable)
  
 instance Deserialize GetDeviceControlReply where
@@ -2032,8 +2033,8 @@
                let _ = isCard32 length
                return (MkGetDeviceControlReply status)
  
-data DeviceState = MkDeviceState{control_id_DeviceState :: CARD16,
-                                 len_DeviceState :: CARD16}
+data DeviceState = MkDeviceState{control_id_DeviceState :: Word16,
+                                 len_DeviceState :: Word16}
                  deriving (Show, Typeable)
  
 instance Serialize DeviceState where
@@ -2049,15 +2050,15 @@
                return (MkDeviceState control_id len)
  
 data DeviceResolutionState = MkDeviceResolutionState{control_id_DeviceResolutionState
-                                                     :: CARD16,
-                                                     len_DeviceResolutionState :: CARD16,
-                                                     num_valuators_DeviceResolutionState :: CARD32,
+                                                     :: Word16,
+                                                     len_DeviceResolutionState :: Word16,
+                                                     num_valuators_DeviceResolutionState :: Word32,
                                                      resolution_values_DeviceResolutionState ::
-                                                     [CARD32],
+                                                     [Word32],
                                                      resolution_min_DeviceResolutionState ::
-                                                     [CARD32],
+                                                     [Word32],
                                                      resolution_max_DeviceResolutionState ::
-                                                     [CARD32]}
+                                                     [Word32]}
                            deriving (Show, Typeable)
  
 instance Serialize DeviceResolutionState where
@@ -2091,16 +2092,16 @@
                     resolution_max)
  
 data DeviceAbsCalibState = MkDeviceAbsCalibState{control_id_DeviceAbsCalibState
-                                                 :: CARD16,
-                                                 len_DeviceAbsCalibState :: CARD16,
-                                                 min_x_DeviceAbsCalibState :: INT32,
-                                                 max_x_DeviceAbsCalibState :: INT32,
-                                                 min_y_DeviceAbsCalibState :: INT32,
-                                                 max_y_DeviceAbsCalibState :: INT32,
-                                                 flip_x_DeviceAbsCalibState :: CARD32,
-                                                 flip_y_DeviceAbsCalibState :: CARD32,
-                                                 rotation_DeviceAbsCalibState :: CARD32,
-                                                 button_threshold_DeviceAbsCalibState :: CARD32}
+                                                 :: Word16,
+                                                 len_DeviceAbsCalibState :: Word16,
+                                                 min_x_DeviceAbsCalibState :: Int32,
+                                                 max_x_DeviceAbsCalibState :: Int32,
+                                                 min_y_DeviceAbsCalibState :: Int32,
+                                                 max_y_DeviceAbsCalibState :: Int32,
+                                                 flip_x_DeviceAbsCalibState :: Word32,
+                                                 flip_y_DeviceAbsCalibState :: Word32,
+                                                 rotation_DeviceAbsCalibState :: Word32,
+                                                 button_threshold_DeviceAbsCalibState :: Word32}
                          deriving (Show, Typeable)
  
 instance Serialize DeviceAbsCalibState where
@@ -2147,14 +2148,14 @@
                     button_threshold)
  
 data DeviceAbsAreaState = MkDeviceAbsAreaState{control_id_DeviceAbsAreaState
-                                               :: CARD16,
-                                               len_DeviceAbsAreaState :: CARD16,
-                                               offset_x_DeviceAbsAreaState :: CARD32,
-                                               offset_y_DeviceAbsAreaState :: CARD32,
-                                               width_DeviceAbsAreaState :: CARD32,
-                                               height_DeviceAbsAreaState :: CARD32,
-                                               screen_DeviceAbsAreaState :: CARD32,
-                                               following_DeviceAbsAreaState :: CARD32}
+                                               :: Word16,
+                                               len_DeviceAbsAreaState :: Word16,
+                                               offset_x_DeviceAbsAreaState :: Word32,
+                                               offset_y_DeviceAbsAreaState :: Word32,
+                                               width_DeviceAbsAreaState :: Word32,
+                                               height_DeviceAbsAreaState :: Word32,
+                                               screen_DeviceAbsAreaState :: Word32,
+                                               following_DeviceAbsAreaState :: Word32}
                         deriving (Show, Typeable)
  
 instance Serialize DeviceAbsAreaState where
@@ -2193,10 +2194,10 @@
                     following)
  
 data DeviceCoreState = MkDeviceCoreState{control_id_DeviceCoreState
-                                         :: CARD16,
-                                         len_DeviceCoreState :: CARD16,
-                                         status_DeviceCoreState :: CARD8,
-                                         iscore_DeviceCoreState :: CARD8}
+                                         :: Word16,
+                                         len_DeviceCoreState :: Word16,
+                                         status_DeviceCoreState :: Word8,
+                                         iscore_DeviceCoreState :: Word8}
                      deriving (Show, Typeable)
  
 instance Serialize DeviceCoreState where
@@ -2223,9 +2224,9 @@
                return (MkDeviceCoreState control_id len status iscore)
  
 data DeviceEnableState = MkDeviceEnableState{control_id_DeviceEnableState
-                                             :: CARD16,
-                                             len_DeviceEnableState :: CARD16,
-                                             enable_DeviceEnableState :: CARD8}
+                                             :: Word16,
+                                             len_DeviceEnableState :: Word16,
+                                             enable_DeviceEnableState :: Word8}
                        deriving (Show, Typeable)
  
 instance Serialize DeviceEnableState where
@@ -2248,8 +2249,8 @@
                skip 3
                return (MkDeviceEnableState control_id len enable)
  
-data DeviceCtl = MkDeviceCtl{control_id_DeviceCtl :: CARD16,
-                             len_DeviceCtl :: CARD16}
+data DeviceCtl = MkDeviceCtl{control_id_DeviceCtl :: Word16,
+                             len_DeviceCtl :: Word16}
                deriving (Show, Typeable)
  
 instance Serialize DeviceCtl where
@@ -2265,11 +2266,11 @@
                return (MkDeviceCtl control_id len)
  
 data DeviceResolutionCtl = MkDeviceResolutionCtl{control_id_DeviceResolutionCtl
-                                                 :: CARD16,
-                                                 len_DeviceResolutionCtl :: CARD16,
-                                                 first_valuator_DeviceResolutionCtl :: CARD8,
-                                                 num_valuators_DeviceResolutionCtl :: CARD8,
-                                                 resolution_values_DeviceResolutionCtl :: [CARD32]}
+                                                 :: Word16,
+                                                 len_DeviceResolutionCtl :: Word16,
+                                                 first_valuator_DeviceResolutionCtl :: Word8,
+                                                 num_valuators_DeviceResolutionCtl :: Word8,
+                                                 resolution_values_DeviceResolutionCtl :: [Word32]}
                          deriving (Show, Typeable)
  
 instance Serialize DeviceResolutionCtl where
@@ -2298,16 +2299,16 @@
                     resolution_values)
  
 data DeviceAbsCalibCtl = MkDeviceAbsCalibCtl{control_id_DeviceAbsCalibCtl
-                                             :: CARD16,
-                                             len_DeviceAbsCalibCtl :: CARD16,
-                                             min_x_DeviceAbsCalibCtl :: INT32,
-                                             max_x_DeviceAbsCalibCtl :: INT32,
-                                             min_y_DeviceAbsCalibCtl :: INT32,
-                                             max_y_DeviceAbsCalibCtl :: INT32,
-                                             flip_x_DeviceAbsCalibCtl :: CARD32,
-                                             flip_y_DeviceAbsCalibCtl :: CARD32,
-                                             rotation_DeviceAbsCalibCtl :: CARD32,
-                                             button_threshold_DeviceAbsCalibCtl :: CARD32}
+                                             :: Word16,
+                                             len_DeviceAbsCalibCtl :: Word16,
+                                             min_x_DeviceAbsCalibCtl :: Int32,
+                                             max_x_DeviceAbsCalibCtl :: Int32,
+                                             min_y_DeviceAbsCalibCtl :: Int32,
+                                             max_y_DeviceAbsCalibCtl :: Int32,
+                                             flip_x_DeviceAbsCalibCtl :: Word32,
+                                             flip_y_DeviceAbsCalibCtl :: Word32,
+                                             rotation_DeviceAbsCalibCtl :: Word32,
+                                             button_threshold_DeviceAbsCalibCtl :: Word32}
                        deriving (Show, Typeable)
  
 instance Serialize DeviceAbsCalibCtl where
@@ -2353,14 +2354,14 @@
                     button_threshold)
  
 data DeviceAbsAreaCtrl = MkDeviceAbsAreaCtrl{control_id_DeviceAbsAreaCtrl
-                                             :: CARD16,
-                                             len_DeviceAbsAreaCtrl :: CARD16,
-                                             offset_x_DeviceAbsAreaCtrl :: CARD32,
-                                             offset_y_DeviceAbsAreaCtrl :: CARD32,
-                                             width_DeviceAbsAreaCtrl :: INT32,
-                                             height_DeviceAbsAreaCtrl :: INT32,
-                                             screen_DeviceAbsAreaCtrl :: INT32,
-                                             following_DeviceAbsAreaCtrl :: CARD32}
+                                             :: Word16,
+                                             len_DeviceAbsAreaCtrl :: Word16,
+                                             offset_x_DeviceAbsAreaCtrl :: Word32,
+                                             offset_y_DeviceAbsAreaCtrl :: Word32,
+                                             width_DeviceAbsAreaCtrl :: Int32,
+                                             height_DeviceAbsAreaCtrl :: Int32,
+                                             screen_DeviceAbsAreaCtrl :: Int32,
+                                             following_DeviceAbsAreaCtrl :: Word32}
                        deriving (Show, Typeable)
  
 instance Serialize DeviceAbsAreaCtrl where
@@ -2399,8 +2400,8 @@
                     following)
  
 data DeviceCoreCtrl = MkDeviceCoreCtrl{control_id_DeviceCoreCtrl ::
-                                       CARD16,
-                                       len_DeviceCoreCtrl :: CARD16, status_DeviceCoreCtrl :: CARD8}
+                                       Word16,
+                                       len_DeviceCoreCtrl :: Word16, status_DeviceCoreCtrl :: Word8}
                     deriving (Show, Typeable)
  
 instance Serialize DeviceCoreCtrl where
@@ -2423,9 +2424,9 @@
                return (MkDeviceCoreCtrl control_id len status)
  
 data DeviceEnableCtrl = MkDeviceEnableCtrl{control_id_DeviceEnableCtrl
-                                           :: CARD16,
-                                           len_DeviceEnableCtrl :: CARD16,
-                                           enable_DeviceEnableCtrl :: CARD8}
+                                           :: Word16,
+                                           len_DeviceEnableCtrl :: Word16,
+                                           enable_DeviceEnableCtrl :: Word8}
                       deriving (Show, Typeable)
  
 instance Serialize DeviceEnableCtrl where
@@ -2449,11 +2450,11 @@
                return (MkDeviceEnableCtrl control_id len enable)
  
 data DeviceValuator = MkDeviceValuator{device_id_DeviceValuator ::
-                                       CARD8,
-                                       device_state_DeviceValuator :: CARD16,
-                                       num_valuators_DeviceValuator :: CARD8,
-                                       first_valuator_DeviceValuator :: CARD8,
-                                       valuators_DeviceValuator :: [INT32]}
+                                       Word8,
+                                       device_state_DeviceValuator :: Word16,
+                                       num_valuators_DeviceValuator :: Word8,
+                                       first_valuator_DeviceValuator :: Word8,
+                                       valuators_DeviceValuator :: [Int32]}
                     deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event DeviceValuator
@@ -2473,18 +2474,18 @@
                     valuators)
  
 data DeviceKeyPress = MkDeviceKeyPress{detail_DeviceKeyPress ::
-                                       BYTE,
+                                       Word8,
                                        time_DeviceKeyPress :: TIMESTAMP,
                                        root_DeviceKeyPress :: WINDOW,
                                        event_DeviceKeyPress :: WINDOW,
                                        child_DeviceKeyPress :: WINDOW,
-                                       root_x_DeviceKeyPress :: INT16,
-                                       root_y_DeviceKeyPress :: INT16,
-                                       event_x_DeviceKeyPress :: INT16,
-                                       event_y_DeviceKeyPress :: INT16,
-                                       state_DeviceKeyPress :: CARD16,
-                                       same_screen_DeviceKeyPress :: BOOL,
-                                       device_id_DeviceKeyPress :: CARD8}
+                                       root_x_DeviceKeyPress :: Int16,
+                                       root_y_DeviceKeyPress :: Int16,
+                                       event_x_DeviceKeyPress :: Int16,
+                                       event_y_DeviceKeyPress :: Int16,
+                                       state_DeviceKeyPress :: Word16,
+                                       same_screen_DeviceKeyPress :: Bool,
+                                       device_id_DeviceKeyPress :: Word8}
                     deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event DeviceKeyPress
@@ -2514,18 +2515,18 @@
                     device_id)
  
 data DeviceKeyRelease = MkDeviceKeyRelease{detail_DeviceKeyRelease
-                                           :: BYTE,
+                                           :: Word8,
                                            time_DeviceKeyRelease :: TIMESTAMP,
                                            root_DeviceKeyRelease :: WINDOW,
                                            event_DeviceKeyRelease :: WINDOW,
                                            child_DeviceKeyRelease :: WINDOW,
-                                           root_x_DeviceKeyRelease :: INT16,
-                                           root_y_DeviceKeyRelease :: INT16,
-                                           event_x_DeviceKeyRelease :: INT16,
-                                           event_y_DeviceKeyRelease :: INT16,
-                                           state_DeviceKeyRelease :: CARD16,
-                                           same_screen_DeviceKeyRelease :: BOOL,
-                                           device_id_DeviceKeyRelease :: CARD8}
+                                           root_x_DeviceKeyRelease :: Int16,
+                                           root_y_DeviceKeyRelease :: Int16,
+                                           event_x_DeviceKeyRelease :: Int16,
+                                           event_y_DeviceKeyRelease :: Int16,
+                                           state_DeviceKeyRelease :: Word16,
+                                           same_screen_DeviceKeyRelease :: Bool,
+                                           device_id_DeviceKeyRelease :: Word8}
                       deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event DeviceKeyRelease
@@ -2555,18 +2556,18 @@
                     device_id)
  
 data DeviceButtonPress = MkDeviceButtonPress{detail_DeviceButtonPress
-                                             :: BYTE,
+                                             :: Word8,
                                              time_DeviceButtonPress :: TIMESTAMP,
                                              root_DeviceButtonPress :: WINDOW,
                                              event_DeviceButtonPress :: WINDOW,
                                              child_DeviceButtonPress :: WINDOW,
-                                             root_x_DeviceButtonPress :: INT16,
-                                             root_y_DeviceButtonPress :: INT16,
-                                             event_x_DeviceButtonPress :: INT16,
-                                             event_y_DeviceButtonPress :: INT16,
-                                             state_DeviceButtonPress :: CARD16,
-                                             same_screen_DeviceButtonPress :: BOOL,
-                                             device_id_DeviceButtonPress :: CARD8}
+                                             root_x_DeviceButtonPress :: Int16,
+                                             root_y_DeviceButtonPress :: Int16,
+                                             event_x_DeviceButtonPress :: Int16,
+                                             event_y_DeviceButtonPress :: Int16,
+                                             state_DeviceButtonPress :: Word16,
+                                             same_screen_DeviceButtonPress :: Bool,
+                                             device_id_DeviceButtonPress :: Word8}
                        deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event DeviceButtonPress
@@ -2596,18 +2597,18 @@
                     device_id)
  
 data DeviceButtonRelease = MkDeviceButtonRelease{detail_DeviceButtonRelease
-                                                 :: BYTE,
+                                                 :: Word8,
                                                  time_DeviceButtonRelease :: TIMESTAMP,
                                                  root_DeviceButtonRelease :: WINDOW,
                                                  event_DeviceButtonRelease :: WINDOW,
                                                  child_DeviceButtonRelease :: WINDOW,
-                                                 root_x_DeviceButtonRelease :: INT16,
-                                                 root_y_DeviceButtonRelease :: INT16,
-                                                 event_x_DeviceButtonRelease :: INT16,
-                                                 event_y_DeviceButtonRelease :: INT16,
-                                                 state_DeviceButtonRelease :: CARD16,
-                                                 same_screen_DeviceButtonRelease :: BOOL,
-                                                 device_id_DeviceButtonRelease :: CARD8}
+                                                 root_x_DeviceButtonRelease :: Int16,
+                                                 root_y_DeviceButtonRelease :: Int16,
+                                                 event_x_DeviceButtonRelease :: Int16,
+                                                 event_y_DeviceButtonRelease :: Int16,
+                                                 state_DeviceButtonRelease :: Word16,
+                                                 same_screen_DeviceButtonRelease :: Bool,
+                                                 device_id_DeviceButtonRelease :: Word8}
                          deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event DeviceButtonRelease
@@ -2637,18 +2638,18 @@
                     device_id)
  
 data DeviceMotionNotify = MkDeviceMotionNotify{detail_DeviceMotionNotify
-                                               :: BYTE,
+                                               :: Word8,
                                                time_DeviceMotionNotify :: TIMESTAMP,
                                                root_DeviceMotionNotify :: WINDOW,
                                                event_DeviceMotionNotify :: WINDOW,
                                                child_DeviceMotionNotify :: WINDOW,
-                                               root_x_DeviceMotionNotify :: INT16,
-                                               root_y_DeviceMotionNotify :: INT16,
-                                               event_x_DeviceMotionNotify :: INT16,
-                                               event_y_DeviceMotionNotify :: INT16,
-                                               state_DeviceMotionNotify :: CARD16,
-                                               same_screen_DeviceMotionNotify :: BOOL,
-                                               device_id_DeviceMotionNotify :: CARD8}
+                                               root_x_DeviceMotionNotify :: Int16,
+                                               root_y_DeviceMotionNotify :: Int16,
+                                               event_x_DeviceMotionNotify :: Int16,
+                                               event_y_DeviceMotionNotify :: Int16,
+                                               state_DeviceMotionNotify :: Word16,
+                                               same_screen_DeviceMotionNotify :: Bool,
+                                               device_id_DeviceMotionNotify :: Word8}
                         deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event DeviceMotionNotify
@@ -2677,13 +2678,13 @@
                     same_screen
                     device_id)
  
-data ProximityIn = MkProximityIn{detail_ProximityIn :: BYTE,
+data ProximityIn = MkProximityIn{detail_ProximityIn :: Word8,
                                  time_ProximityIn :: TIMESTAMP, root_ProximityIn :: WINDOW,
                                  event_ProximityIn :: WINDOW, child_ProximityIn :: WINDOW,
-                                 root_x_ProximityIn :: INT16, root_y_ProximityIn :: INT16,
-                                 event_x_ProximityIn :: INT16, event_y_ProximityIn :: INT16,
-                                 state_ProximityIn :: CARD16, same_screen_ProximityIn :: BOOL,
-                                 device_id_ProximityIn :: CARD8}
+                                 root_x_ProximityIn :: Int16, root_y_ProximityIn :: Int16,
+                                 event_x_ProximityIn :: Int16, event_y_ProximityIn :: Int16,
+                                 state_ProximityIn :: Word16, same_screen_ProximityIn :: Bool,
+                                 device_id_ProximityIn :: Word8}
                  deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event ProximityIn
@@ -2711,13 +2712,13 @@
                     same_screen
                     device_id)
  
-data ProximityOut = MkProximityOut{detail_ProximityOut :: BYTE,
+data ProximityOut = MkProximityOut{detail_ProximityOut :: Word8,
                                    time_ProximityOut :: TIMESTAMP, root_ProximityOut :: WINDOW,
                                    event_ProximityOut :: WINDOW, child_ProximityOut :: WINDOW,
-                                   root_x_ProximityOut :: INT16, root_y_ProximityOut :: INT16,
-                                   event_x_ProximityOut :: INT16, event_y_ProximityOut :: INT16,
-                                   state_ProximityOut :: CARD16, same_screen_ProximityOut :: BOOL,
-                                   device_id_ProximityOut :: CARD8}
+                                   root_x_ProximityOut :: Int16, root_y_ProximityOut :: Int16,
+                                   event_x_ProximityOut :: Int16, event_y_ProximityOut :: Int16,
+                                   state_ProximityOut :: Word16, same_screen_ProximityOut :: Bool,
+                                   device_id_ProximityOut :: Word8}
                   deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event ProximityOut
@@ -2745,9 +2746,9 @@
                     same_screen
                     device_id)
  
-data FocusIn = MkFocusIn{detail_FocusIn :: BYTE,
+data FocusIn = MkFocusIn{detail_FocusIn :: Word8,
                          time_FocusIn :: TIMESTAMP, window_FocusIn :: WINDOW,
-                         mode_FocusIn :: BYTE, device_id_FocusIn :: CARD8}
+                         mode_FocusIn :: Word8, device_id_FocusIn :: Word8}
              deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event FocusIn
@@ -2764,13 +2765,13 @@
                skip 18
                return (MkFocusIn detail time window mode device_id)
  
-data FocusOut = MkFocusOut{detail_FocusOut :: BYTE,
+data FocusOut = MkFocusOut{detail_FocusOut :: Word8,
                            time_FocusOut :: TIMESTAMP, root_FocusOut :: WINDOW,
                            event_FocusOut :: WINDOW, child_FocusOut :: WINDOW,
-                           root_x_FocusOut :: INT16, root_y_FocusOut :: INT16,
-                           event_x_FocusOut :: INT16, event_y_FocusOut :: INT16,
-                           state_FocusOut :: CARD16, same_screen_FocusOut :: BOOL,
-                           device_id_FocusOut :: CARD8}
+                           root_x_FocusOut :: Int16, root_y_FocusOut :: Int16,
+                           event_x_FocusOut :: Int16, event_y_FocusOut :: Int16,
+                           state_FocusOut :: Word16, same_screen_FocusOut :: Bool,
+                           device_id_FocusOut :: Word8}
               deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event FocusOut
@@ -2799,15 +2800,15 @@
                     device_id)
  
 data DeviceStateNotify = MkDeviceStateNotify{device_id_DeviceStateNotify
-                                             :: BYTE,
+                                             :: Word8,
                                              time_DeviceStateNotify :: TIMESTAMP,
-                                             num_keys_DeviceStateNotify :: CARD8,
-                                             num_buttons_DeviceStateNotify :: CARD8,
-                                             num_valuators_DeviceStateNotify :: CARD8,
-                                             classes_reported_DeviceStateNotify :: CARD8,
-                                             buttons_DeviceStateNotify :: [CARD8],
-                                             keys_DeviceStateNotify :: [CARD8],
-                                             valuators_DeviceStateNotify :: [CARD32]}
+                                             num_keys_DeviceStateNotify :: Word8,
+                                             num_buttons_DeviceStateNotify :: Word8,
+                                             num_valuators_DeviceStateNotify :: Word8,
+                                             classes_reported_DeviceStateNotify :: Word8,
+                                             buttons_DeviceStateNotify :: [Word8],
+                                             keys_DeviceStateNotify :: [Word8],
+                                             valuators_DeviceStateNotify :: [Word32]}
                        deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event DeviceStateNotify
@@ -2834,10 +2835,10 @@
                     valuators)
  
 data DeviceMappingNotify = MkDeviceMappingNotify{device_id_DeviceMappingNotify
-                                                 :: BYTE,
-                                                 request_DeviceMappingNotify :: CARD8,
+                                                 :: Word8,
+                                                 request_DeviceMappingNotify :: Word8,
                                                  first_keycode_DeviceMappingNotify :: KeyCode,
-                                                 count_DeviceMappingNotify :: CARD8,
+                                                 count_DeviceMappingNotify :: Word8,
                                                  time_DeviceMappingNotify :: TIMESTAMP}
                          deriving (Show, Typeable)
  
@@ -2858,9 +2859,9 @@
                  (MkDeviceMappingNotify device_id request first_keycode count time)
  
 data ChangeDeviceNotify = MkChangeDeviceNotify{device_id_ChangeDeviceNotify
-                                               :: BYTE,
+                                               :: Word8,
                                                time_ChangeDeviceNotify :: TIMESTAMP,
-                                               request_ChangeDeviceNotify :: CARD8}
+                                               request_ChangeDeviceNotify :: Word8}
                         deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event ChangeDeviceNotify
@@ -2876,8 +2877,8 @@
                return (MkChangeDeviceNotify device_id time request)
  
 data DeviceKeyStateNotify = MkDeviceKeyStateNotify{device_id_DeviceKeyStateNotify
-                                                   :: BYTE,
-                                                   keys_DeviceKeyStateNotify :: [CARD8]}
+                                                   :: Word8,
+                                                   keys_DeviceKeyStateNotify :: [Word8]}
                           deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event DeviceKeyStateNotify
@@ -2891,8 +2892,8 @@
                return (MkDeviceKeyStateNotify device_id keys)
  
 data DeviceButtonStateNotify = MkDeviceButtonStateNotify{device_id_DeviceButtonStateNotify
-                                                         :: BYTE,
-                                                         buttons_DeviceButtonStateNotify :: [CARD8]}
+                                                         :: Word8,
+                                                         buttons_DeviceButtonStateNotify :: [Word8]}
                              deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event DeviceButtonStateNotify
@@ -2907,9 +2908,9 @@
  
 data DevicePresenceNotify = MkDevicePresenceNotify{time_DevicePresenceNotify
                                                    :: TIMESTAMP,
-                                                   devchange_DevicePresenceNotify :: BYTE,
-                                                   device_id_DevicePresenceNotify :: BYTE,
-                                                   control_DevicePresenceNotify :: CARD16}
+                                                   devchange_DevicePresenceNotify :: Word8,
+                                                   device_id_DevicePresenceNotify :: Word8,
+                                                   control_DevicePresenceNotify :: Word16}
                           deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event DevicePresenceNotify
diff --git a/patched/Graphics/XHB/Gen/RandR.hs b/patched/Graphics/XHB/Gen/RandR.hs
--- a/patched/Graphics/XHB/Gen/RandR.hs
+++ b/patched/Graphics/XHB/Gen/RandR.hs
@@ -14,6 +14,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -25,28 +28,28 @@
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)
+                 Word32 -> Word32 -> IO (Receipt QueryVersionReply)
 queryVersion c major_version minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion major_version minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setScreenConfig ::
                   Graphics.XHB.Connection.Types.Connection ->
                     SetScreenConfig -> IO (Receipt SetScreenConfigReply)
 setScreenConfig c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 selectInput ::
               Graphics.XHB.Connection.Types.Connection ->
-                WINDOW -> CARD16 -> IO ()
+                WINDOW -> Word16 -> IO ()
 selectInput c window enable
   = do let req = MkSelectInput window enable
        putAction <- serializeExtensionRequest c req
@@ -57,22 +60,22 @@
                 Graphics.XHB.Connection.Types.Connection ->
                   WINDOW -> IO (Receipt GetScreenInfoReply)
 getScreenInfo c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetScreenInfo window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getScreenSizeRange ::
                      Graphics.XHB.Connection.Types.Connection ->
                        WINDOW -> IO (Receipt GetScreenSizeRangeReply)
 getScreenSizeRange c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetScreenSizeRange window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setScreenSize ::
@@ -86,44 +89,44 @@
                      Graphics.XHB.Connection.Types.Connection ->
                        WINDOW -> IO (Receipt GetScreenResourcesReply)
 getScreenResources c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetScreenResources window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getOutputInfo ::
                 Graphics.XHB.Connection.Types.Connection ->
                   OUTPUT -> TIMESTAMP -> IO (Receipt GetOutputInfoReply)
 getOutputInfo c output config_timestamp
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetOutputInfo output config_timestamp
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 listOutputProperties ::
                        Graphics.XHB.Connection.Types.Connection ->
                          OUTPUT -> IO (Receipt ListOutputPropertiesReply)
 listOutputProperties c output
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListOutputProperties output
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryOutputProperty ::
                       Graphics.XHB.Connection.Types.Connection ->
                         OUTPUT -> ATOM -> IO (Receipt QueryOutputPropertyReply)
 queryOutputProperty c output property
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryOutputProperty output property
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 configureOutputProperty ::
@@ -154,20 +157,21 @@
                     Graphics.XHB.Connection.Types.Connection ->
                       GetOutputProperty -> IO (Receipt GetOutputPropertyReply)
 getOutputProperty c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createMode ::
              Graphics.XHB.Connection.Types.Connection ->
-               CreateMode -> IO (Receipt CreateModeReply)
+               CreateMode -> IO (Receipt MODE)
 createMode c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (mode_CreateModeReply `fmap` deserialize))
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 destroyMode ::
@@ -198,43 +202,44 @@
               Graphics.XHB.Connection.Types.Connection ->
                 CRTC -> TIMESTAMP -> IO (Receipt GetCrtcInfoReply)
 getCrtcInfo c crtc config_timestamp
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetCrtcInfo crtc config_timestamp
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setCrtcConfig ::
                 Graphics.XHB.Connection.Types.Connection ->
                   SetCrtcConfig -> IO (Receipt SetCrtcConfigReply)
 setCrtcConfig c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getCrtcGammaSize ::
                    Graphics.XHB.Connection.Types.Connection ->
-                     CRTC -> IO (Receipt GetCrtcGammaSizeReply)
+                     CRTC -> IO (Receipt Word16)
 getCrtcGammaSize c crtc
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (size_GetCrtcGammaSizeReply `fmap` deserialize))
        let req = MkGetCrtcGammaSize crtc
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getCrtcGamma ::
                Graphics.XHB.Connection.Types.Connection ->
                  CRTC -> IO (Receipt GetCrtcGammaReply)
 getCrtcGamma c crtc
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetCrtcGamma crtc
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setCrtcGamma ::
diff --git a/patched/Graphics/XHB/Gen/RandR/Types.hs b/patched/Graphics/XHB/Gen/RandR/Types.hs
--- a/patched/Graphics/XHB/Gen/RandR/Types.hs
+++ b/patched/Graphics/XHB/Gen/RandR/Types.hs
@@ -21,6 +21,7 @@
         Notify(..),NotifyData(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -75,9 +76,9 @@
         fromBit 4 = RotationReflect_X
         fromBit 5 = RotationReflect_Y
  
-data ScreenSize = MkScreenSize{width_ScreenSize :: CARD16,
-                               height_ScreenSize :: CARD16, mwidth_ScreenSize :: CARD16,
-                               mheight_ScreenSize :: CARD16}
+data ScreenSize = MkScreenSize{width_ScreenSize :: Word16,
+                               height_ScreenSize :: Word16, mwidth_ScreenSize :: Word16,
+                               mheight_ScreenSize :: Word16}
                 deriving (Show, Typeable)
  
 instance Serialize ScreenSize where
@@ -99,8 +100,8 @@
                mheight <- deserialize
                return (MkScreenSize width height mwidth mheight)
  
-data RefreshRates = MkRefreshRates{nRates_RefreshRates :: CARD16,
-                                   rates_RefreshRates :: [CARD16]}
+data RefreshRates = MkRefreshRates{nRates_RefreshRates :: Word16,
+                                   rates_RefreshRates :: [Word16]}
                   deriving (Show, Typeable)
  
 instance Serialize RefreshRates where
@@ -118,8 +119,8 @@
                return (MkRefreshRates nRates rates)
  
 data QueryVersion = MkQueryVersion{major_version_QueryVersion ::
-                                   CARD32,
-                                   minor_version_QueryVersion :: CARD32}
+                                   Word32,
+                                   minor_version_QueryVersion :: Word32}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -130,14 +131,14 @@
                let size__
                      = 4 + size (major_version_QueryVersion x) +
                          size (minor_version_QueryVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (major_version_QueryVersion x)
                serialize (minor_version_QueryVersion x)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{major_version_QueryVersionReply
-                                             :: CARD32,
-                                             minor_version_QueryVersionReply :: CARD32}
+                                             :: Word32,
+                                             minor_version_QueryVersionReply :: Word32}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -156,9 +157,9 @@
                                          WINDOW,
                                          timestamp_SetScreenConfig :: TIMESTAMP,
                                          config_timestamp_SetScreenConfig :: TIMESTAMP,
-                                         sizeID_SetScreenConfig :: CARD16,
-                                         rotation_SetScreenConfig :: CARD16,
-                                         rate_SetScreenConfig :: CARD16}
+                                         sizeID_SetScreenConfig :: Word16,
+                                         rotation_SetScreenConfig :: Word16,
+                                         rate_SetScreenConfig :: Word16}
                      deriving (Show, Typeable)
  
 instance ExtensionRequest SetScreenConfig where
@@ -174,7 +175,7 @@
                          + size (rotation_SetScreenConfig x)
                          + size (rate_SetScreenConfig x)
                          + 2
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_SetScreenConfig x)
                serialize (timestamp_SetScreenConfig x)
                serialize (config_timestamp_SetScreenConfig x)
@@ -185,12 +186,12 @@
                putSkip (requiredPadding size__)
  
 data SetScreenConfigReply = MkSetScreenConfigReply{status_SetScreenConfigReply
-                                                   :: CARD8,
+                                                   :: Word8,
                                                    new_timestamp_SetScreenConfigReply :: TIMESTAMP,
                                                    config_timestamp_SetScreenConfigReply ::
                                                    TIMESTAMP,
                                                    root_SetScreenConfigReply :: WINDOW,
-                                                   subpixel_order_SetScreenConfigReply :: CARD16}
+                                                   subpixel_order_SetScreenConfigReply :: Word16}
                           deriving (Show, Typeable)
  
 instance Deserialize SetScreenConfigReply where
@@ -225,7 +226,7 @@
         fromValue 3 = SetConfigFailed
  
 data SelectInput = MkSelectInput{window_SelectInput :: WINDOW,
-                                 enable_SelectInput :: CARD16}
+                                 enable_SelectInput :: Word16}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest SelectInput where
@@ -235,7 +236,7 @@
                putWord8 4
                let size__
                      = 4 + size (window_SelectInput x) + size (enable_SelectInput x) + 2
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_SelectInput x)
                serialize (enable_SelectInput x)
                putSkip 2
@@ -251,20 +252,20 @@
           = do putWord8 extOpCode
                putWord8 5
                let size__ = 4 + size (window_GetScreenInfo x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetScreenInfo x)
                putSkip (requiredPadding size__)
  
 data GetScreenInfoReply = MkGetScreenInfoReply{rotations_GetScreenInfoReply
-                                               :: CARD8,
+                                               :: Word8,
                                                root_GetScreenInfoReply :: WINDOW,
                                                timestamp_GetScreenInfoReply :: TIMESTAMP,
                                                config_timestamp_GetScreenInfoReply :: TIMESTAMP,
-                                               nSizes_GetScreenInfoReply :: CARD16,
-                                               sizeID_GetScreenInfoReply :: CARD16,
-                                               rotation_GetScreenInfoReply :: CARD16,
-                                               rate_GetScreenInfoReply :: CARD16,
-                                               nInfo_GetScreenInfoReply :: CARD16,
+                                               nSizes_GetScreenInfoReply :: Word16,
+                                               sizeID_GetScreenInfoReply :: Word16,
+                                               rotation_GetScreenInfoReply :: Word16,
+                                               rate_GetScreenInfoReply :: Word16,
+                                               nInfo_GetScreenInfoReply :: Word16,
                                                sizes_GetScreenInfoReply :: [ScreenSize],
                                                rates_GetScreenInfoReply :: [RefreshRates]}
                         deriving (Show, Typeable)
@@ -308,18 +309,18 @@
           = do putWord8 extOpCode
                putWord8 6
                let size__ = 4 + size (window_GetScreenSizeRange x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetScreenSizeRange x)
                putSkip (requiredPadding size__)
  
 data GetScreenSizeRangeReply = MkGetScreenSizeRangeReply{min_width_GetScreenSizeRangeReply
-                                                         :: CARD16,
+                                                         :: Word16,
                                                          min_height_GetScreenSizeRangeReply ::
-                                                         CARD16,
+                                                         Word16,
                                                          max_width_GetScreenSizeRangeReply ::
-                                                         CARD16,
+                                                         Word16,
                                                          max_height_GetScreenSizeRangeReply ::
-                                                         CARD16}
+                                                         Word16}
                              deriving (Show, Typeable)
  
 instance Deserialize GetScreenSizeRangeReply where
@@ -340,9 +341,9 @@
  
 data SetScreenSize = MkSetScreenSize{window_SetScreenSize ::
                                      WINDOW,
-                                     width_SetScreenSize :: CARD16, height_SetScreenSize :: CARD16,
-                                     mm_width_SetScreenSize :: CARD32,
-                                     mm_height_SetScreenSize :: CARD32}
+                                     width_SetScreenSize :: Word16, height_SetScreenSize :: Word16,
+                                     mm_width_SetScreenSize :: Word32,
+                                     mm_height_SetScreenSize :: Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest SetScreenSize where
@@ -355,7 +356,7 @@
                          + size (height_SetScreenSize x)
                          + size (mm_width_SetScreenSize x)
                          + size (mm_height_SetScreenSize x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_SetScreenSize x)
                serialize (width_SetScreenSize x)
                serialize (height_SetScreenSize x)
@@ -408,13 +409,13 @@
         fromBit 12 = ModeFlagDoubleClock
         fromBit 13 = ModeFlagHalveClock
  
-data ModeInfo = MkModeInfo{id_ModeInfo :: CARD32,
-                           width_ModeInfo :: CARD16, height_ModeInfo :: CARD16,
-                           dot_clock_ModeInfo :: CARD32, hsync_start_ModeInfo :: CARD16,
-                           hsync_end_ModeInfo :: CARD16, htotal_ModeInfo :: CARD16,
-                           hskew_ModeInfo :: CARD16, vsync_start_ModeInfo :: CARD16,
-                           vsync_end_ModeInfo :: CARD16, vtotal_ModeInfo :: CARD16,
-                           name_len_ModeInfo :: CARD16, mode_flags_ModeInfo :: CARD32}
+data ModeInfo = MkModeInfo{id_ModeInfo :: Word32,
+                           width_ModeInfo :: Word16, height_ModeInfo :: Word16,
+                           dot_clock_ModeInfo :: Word32, hsync_start_ModeInfo :: Word16,
+                           hsync_end_ModeInfo :: Word16, htotal_ModeInfo :: Word16,
+                           hskew_ModeInfo :: Word16, vsync_start_ModeInfo :: Word16,
+                           vsync_end_ModeInfo :: Word16, vtotal_ModeInfo :: Word16,
+                           name_len_ModeInfo :: Word16, mode_flags_ModeInfo :: Word32}
               deriving (Show, Typeable)
  
 instance Serialize ModeInfo where
@@ -480,7 +481,7 @@
           = do putWord8 extOpCode
                putWord8 8
                let size__ = 4 + size (window_GetScreenResources x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetScreenResources x)
                putSkip (requiredPadding size__)
  
@@ -489,19 +490,19 @@
                                                          config_timestamp_GetScreenResourcesReply ::
                                                          TIMESTAMP,
                                                          num_crtcs_GetScreenResourcesReply ::
-                                                         CARD16,
+                                                         Word16,
                                                          num_outputs_GetScreenResourcesReply ::
-                                                         CARD16,
+                                                         Word16,
                                                          num_modes_GetScreenResourcesReply ::
-                                                         CARD16,
+                                                         Word16,
                                                          names_len_GetScreenResourcesReply ::
-                                                         CARD16,
+                                                         Word16,
                                                          crtcs_GetScreenResourcesReply :: [CRTC],
                                                          outputs_GetScreenResourcesReply ::
                                                          [OUTPUT],
                                                          modes_GetScreenResourcesReply ::
                                                          [ModeInfo],
-                                                         names_GetScreenResourcesReply :: [BYTE]}
+                                                         names_GetScreenResourcesReply :: [Word8]}
                              deriving (Show, Typeable)
  
 instance Deserialize GetScreenResourcesReply where
@@ -557,28 +558,28 @@
                let size__
                      = 4 + size (output_GetOutputInfo x) +
                          size (config_timestamp_GetOutputInfo x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (output_GetOutputInfo x)
                serialize (config_timestamp_GetOutputInfo x)
                putSkip (requiredPadding size__)
  
 data GetOutputInfoReply = MkGetOutputInfoReply{status_GetOutputInfoReply
-                                               :: CARD8,
+                                               :: Word8,
                                                timestamp_GetOutputInfoReply :: TIMESTAMP,
                                                crtc_GetOutputInfoReply :: CRTC,
-                                               mm_width_GetOutputInfoReply :: CARD32,
-                                               mm_height_GetOutputInfoReply :: CARD32,
-                                               connection_GetOutputInfoReply :: CARD8,
-                                               subpixel_order_GetOutputInfoReply :: CARD8,
-                                               num_crtcs_GetOutputInfoReply :: CARD16,
-                                               num_modes_GetOutputInfoReply :: CARD16,
-                                               num_preferred_GetOutputInfoReply :: CARD16,
-                                               num_clones_GetOutputInfoReply :: CARD16,
-                                               name_len_GetOutputInfoReply :: CARD16,
+                                               mm_width_GetOutputInfoReply :: Word32,
+                                               mm_height_GetOutputInfoReply :: Word32,
+                                               connection_GetOutputInfoReply :: Word8,
+                                               subpixel_order_GetOutputInfoReply :: Word8,
+                                               num_crtcs_GetOutputInfoReply :: Word16,
+                                               num_modes_GetOutputInfoReply :: Word16,
+                                               num_preferred_GetOutputInfoReply :: Word16,
+                                               num_clones_GetOutputInfoReply :: Word16,
+                                               name_len_GetOutputInfoReply :: Word16,
                                                crtcs_GetOutputInfoReply :: [CRTC],
                                                modes_GetOutputInfoReply :: [MODE],
                                                clones_GetOutputInfoReply :: [OUTPUT],
-                                               name_GetOutputInfoReply :: [BYTE]}
+                                               name_GetOutputInfoReply :: [Word8]}
                         deriving (Show, Typeable)
  
 instance Deserialize GetOutputInfoReply where
@@ -627,12 +628,12 @@
           = do putWord8 extOpCode
                putWord8 10
                let size__ = 4 + size (output_ListOutputProperties x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (output_ListOutputProperties x)
                putSkip (requiredPadding size__)
  
 data ListOutputPropertiesReply = MkListOutputPropertiesReply{num_atoms_ListOutputPropertiesReply
-                                                             :: CARD16,
+                                                             :: Word16,
                                                              atoms_ListOutputPropertiesReply ::
                                                              [ATOM]}
                                deriving (Show, Typeable)
@@ -662,18 +663,18 @@
                let size__
                      = 4 + size (output_QueryOutputProperty x) +
                          size (property_QueryOutputProperty x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (output_QueryOutputProperty x)
                serialize (property_QueryOutputProperty x)
                putSkip (requiredPadding size__)
  
 data QueryOutputPropertyReply = MkQueryOutputPropertyReply{pending_QueryOutputPropertyReply
-                                                           :: BOOL,
-                                                           range_QueryOutputPropertyReply :: BOOL,
+                                                           :: Bool,
+                                                           range_QueryOutputPropertyReply :: Bool,
                                                            immutable_QueryOutputPropertyReply ::
-                                                           BOOL,
+                                                           Bool,
                                                            validValues_QueryOutputPropertyReply ::
-                                                           [INT32]}
+                                                           [Int32]}
                               deriving (Show, Typeable)
  
 instance Deserialize QueryOutputPropertyReply where
@@ -694,9 +695,9 @@
 data ConfigureOutputProperty = MkConfigureOutputProperty{output_ConfigureOutputProperty
                                                          :: OUTPUT,
                                                          property_ConfigureOutputProperty :: ATOM,
-                                                         pending_ConfigureOutputProperty :: BOOL,
-                                                         range_ConfigureOutputProperty :: BOOL,
-                                                         values_ConfigureOutputProperty :: [INT32]}
+                                                         pending_ConfigureOutputProperty :: Bool,
+                                                         range_ConfigureOutputProperty :: Bool,
+                                                         values_ConfigureOutputProperty :: [Int32]}
                              deriving (Show, Typeable)
  
 instance ExtensionRequest ConfigureOutputProperty where
@@ -711,7 +712,7 @@
                          + size (range_ConfigureOutputProperty x)
                          + 2
                          + sum (map size (values_ConfigureOutputProperty x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (output_ConfigureOutputProperty x)
                serialize (property_ConfigureOutputProperty x)
                serialize (pending_ConfigureOutputProperty x)
@@ -724,9 +725,9 @@
                                                    :: OUTPUT,
                                                    property_ChangeOutputProperty :: ATOM,
                                                    type_ChangeOutputProperty :: ATOM,
-                                                   format_ChangeOutputProperty :: CARD8,
-                                                   mode_ChangeOutputProperty :: CARD8,
-                                                   num_units_ChangeOutputProperty :: CARD32,
+                                                   format_ChangeOutputProperty :: Word8,
+                                                   mode_ChangeOutputProperty :: Word8,
+                                                   num_units_ChangeOutputProperty :: Word32,
                                                    data_ChangeOutputProperty :: [Word8]}
                           deriving (Show, Typeable)
  
@@ -744,7 +745,7 @@
                          + 2
                          + size (num_units_ChangeOutputProperty x)
                          + sum (map size (data_ChangeOutputProperty x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (output_ChangeOutputProperty x)
                serialize (property_ChangeOutputProperty x)
                serialize (type_ChangeOutputProperty x)
@@ -768,7 +769,7 @@
                let size__
                      = 4 + size (output_DeleteOutputProperty x) +
                          size (property_DeleteOutputProperty x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (output_DeleteOutputProperty x)
                serialize (property_DeleteOutputProperty x)
                putSkip (requiredPadding size__)
@@ -777,10 +778,10 @@
                                              :: OUTPUT,
                                              property_GetOutputProperty :: ATOM,
                                              type_GetOutputProperty :: ATOM,
-                                             long_offset_GetOutputProperty :: CARD32,
-                                             long_length_GetOutputProperty :: CARD32,
-                                             delete_GetOutputProperty :: BOOL,
-                                             pending_GetOutputProperty :: BOOL}
+                                             long_offset_GetOutputProperty :: Word32,
+                                             long_length_GetOutputProperty :: Word32,
+                                             delete_GetOutputProperty :: Bool,
+                                             pending_GetOutputProperty :: Bool}
                        deriving (Show, Typeable)
  
 instance ExtensionRequest GetOutputProperty where
@@ -797,7 +798,7 @@
                          + size (delete_GetOutputProperty x)
                          + size (pending_GetOutputProperty x)
                          + 2
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (output_GetOutputProperty x)
                serialize (property_GetOutputProperty x)
                serialize (type_GetOutputProperty x)
@@ -809,11 +810,11 @@
                putSkip (requiredPadding size__)
  
 data GetOutputPropertyReply = MkGetOutputPropertyReply{format_GetOutputPropertyReply
-                                                       :: CARD8,
+                                                       :: Word8,
                                                        type_GetOutputPropertyReply :: ATOM,
-                                                       bytes_after_GetOutputPropertyReply :: CARD32,
-                                                       num_items_GetOutputPropertyReply :: CARD32,
-                                                       data_GetOutputPropertyReply :: [BYTE]}
+                                                       bytes_after_GetOutputPropertyReply :: Word32,
+                                                       num_items_GetOutputPropertyReply :: Word32,
+                                                       data_GetOutputPropertyReply :: [Word8]}
                             deriving (Show, Typeable)
  
 instance Deserialize GetOutputPropertyReply where
@@ -845,7 +846,7 @@
                let size__
                      = 4 + size (window_CreateMode x) + size (mode_info_CreateMode x) +
                          sum (map size (name_CreateMode x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_CreateMode x)
                serialize (mode_info_CreateMode x)
                serializeList (name_CreateMode x)
@@ -875,7 +876,7 @@
           = do putWord8 extOpCode
                putWord8 17
                let size__ = 4 + size (mode_DestroyMode x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (mode_DestroyMode x)
                putSkip (requiredPadding size__)
  
@@ -891,7 +892,7 @@
                putWord8 18
                let size__
                      = 4 + size (output_AddOutputMode x) + size (mode_AddOutputMode x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (output_AddOutputMode x)
                serialize (mode_AddOutputMode x)
                putSkip (requiredPadding size__)
@@ -909,7 +910,7 @@
                let size__
                      = 4 + size (output_DeleteOutputMode x) +
                          size (mode_DeleteOutputMode x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (output_DeleteOutputMode x)
                serialize (mode_DeleteOutputMode x)
                putSkip (requiredPadding size__)
@@ -926,22 +927,22 @@
                let size__
                      = 4 + size (crtc_GetCrtcInfo x) +
                          size (config_timestamp_GetCrtcInfo x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (crtc_GetCrtcInfo x)
                serialize (config_timestamp_GetCrtcInfo x)
                putSkip (requiredPadding size__)
  
 data GetCrtcInfoReply = MkGetCrtcInfoReply{status_GetCrtcInfoReply
-                                           :: CARD8,
+                                           :: Word8,
                                            timestamp_GetCrtcInfoReply :: TIMESTAMP,
-                                           x_GetCrtcInfoReply :: INT16, y_GetCrtcInfoReply :: INT16,
-                                           width_GetCrtcInfoReply :: CARD16,
-                                           height_GetCrtcInfoReply :: CARD16,
+                                           x_GetCrtcInfoReply :: Int16, y_GetCrtcInfoReply :: Int16,
+                                           width_GetCrtcInfoReply :: Word16,
+                                           height_GetCrtcInfoReply :: Word16,
                                            mode_GetCrtcInfoReply :: MODE,
-                                           rotation_GetCrtcInfoReply :: CARD16,
-                                           rotations_GetCrtcInfoReply :: CARD16,
-                                           num_outputs_GetCrtcInfoReply :: CARD16,
-                                           num_possible_outputs_GetCrtcInfoReply :: CARD16,
+                                           rotation_GetCrtcInfoReply :: Word16,
+                                           rotations_GetCrtcInfoReply :: Word16,
+                                           num_outputs_GetCrtcInfoReply :: Word16,
+                                           num_possible_outputs_GetCrtcInfoReply :: Word16,
                                            outputs_GetCrtcInfoReply :: [OUTPUT],
                                            possible_GetCrtcInfoReply :: [OUTPUT]}
                       deriving (Show, Typeable)
@@ -976,8 +977,8 @@
 data SetCrtcConfig = MkSetCrtcConfig{crtc_SetCrtcConfig :: CRTC,
                                      timestamp_SetCrtcConfig :: TIMESTAMP,
                                      config_timestamp_SetCrtcConfig :: TIMESTAMP,
-                                     x_SetCrtcConfig :: INT16, y_SetCrtcConfig :: INT16,
-                                     mode_SetCrtcConfig :: MODE, rotation_SetCrtcConfig :: CARD16,
+                                     x_SetCrtcConfig :: Int16, y_SetCrtcConfig :: Int16,
+                                     mode_SetCrtcConfig :: MODE, rotation_SetCrtcConfig :: Word16,
                                      outputs_SetCrtcConfig :: [OUTPUT]}
                    deriving (Show, Typeable)
  
@@ -996,7 +997,7 @@
                          + size (rotation_SetCrtcConfig x)
                          + 2
                          + sum (map size (outputs_SetCrtcConfig x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (crtc_SetCrtcConfig x)
                serialize (timestamp_SetCrtcConfig x)
                serialize (config_timestamp_SetCrtcConfig x)
@@ -1009,7 +1010,7 @@
                putSkip (requiredPadding size__)
  
 data SetCrtcConfigReply = MkSetCrtcConfigReply{status_SetCrtcConfigReply
-                                               :: CARD8,
+                                               :: Word8,
                                                timestamp_SetCrtcConfigReply :: TIMESTAMP}
                         deriving (Show, Typeable)
  
@@ -1034,12 +1035,12 @@
           = do putWord8 extOpCode
                putWord8 22
                let size__ = 4 + size (crtc_GetCrtcGammaSize x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (crtc_GetCrtcGammaSize x)
                putSkip (requiredPadding size__)
  
 data GetCrtcGammaSizeReply = MkGetCrtcGammaSizeReply{size_GetCrtcGammaSizeReply
-                                                     :: CARD16}
+                                                     :: Word16}
                            deriving (Show, Typeable)
  
 instance Deserialize GetCrtcGammaSizeReply where
@@ -1062,15 +1063,15 @@
           = do putWord8 extOpCode
                putWord8 23
                let size__ = 4 + size (crtc_GetCrtcGamma x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (crtc_GetCrtcGamma x)
                putSkip (requiredPadding size__)
  
 data GetCrtcGammaReply = MkGetCrtcGammaReply{size_GetCrtcGammaReply
-                                             :: CARD16,
-                                             red_GetCrtcGammaReply :: [CARD16],
-                                             green_GetCrtcGammaReply :: [CARD16],
-                                             blue_GetCrtcGammaReply :: [CARD16]}
+                                             :: Word16,
+                                             red_GetCrtcGammaReply :: [Word16],
+                                             green_GetCrtcGammaReply :: [Word16],
+                                             blue_GetCrtcGammaReply :: [Word16]}
                        deriving (Show, Typeable)
  
 instance Deserialize GetCrtcGammaReply where
@@ -1088,8 +1089,8 @@
                return (MkGetCrtcGammaReply size red green blue)
  
 data SetCrtcGamma = MkSetCrtcGamma{crtc_SetCrtcGamma :: CRTC,
-                                   size_SetCrtcGamma :: CARD16, red_SetCrtcGamma :: [CARD16],
-                                   green_SetCrtcGamma :: [CARD16], blue_SetCrtcGamma :: [CARD16]}
+                                   size_SetCrtcGamma :: Word16, red_SetCrtcGamma :: [Word16],
+                                   green_SetCrtcGamma :: [Word16], blue_SetCrtcGamma :: [Word16]}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest SetCrtcGamma where
@@ -1102,7 +1103,7 @@
                          sum (map size (red_SetCrtcGamma x))
                          + sum (map size (green_SetCrtcGamma x))
                          + sum (map size (blue_SetCrtcGamma x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (crtc_SetCrtcGamma x)
                serialize (size_SetCrtcGamma x)
                putSkip 2
@@ -1127,17 +1128,17 @@
         fromBit 3 = NotifyMaskOutputProperty
  
 data ScreenChangeNotify = MkScreenChangeNotify{rotation_ScreenChangeNotify
-                                               :: CARD8,
+                                               :: Word8,
                                                timestamp_ScreenChangeNotify :: TIMESTAMP,
                                                config_timestamp_ScreenChangeNotify :: TIMESTAMP,
                                                root_ScreenChangeNotify :: WINDOW,
                                                request_window_ScreenChangeNotify :: WINDOW,
-                                               sizeID_ScreenChangeNotify :: CARD16,
-                                               subpixel_order_ScreenChangeNotify :: CARD16,
-                                               width_ScreenChangeNotify :: CARD16,
-                                               height_ScreenChangeNotify :: CARD16,
-                                               mwidth_ScreenChangeNotify :: CARD16,
-                                               mheight_ScreenChangeNotify :: CARD16}
+                                               sizeID_ScreenChangeNotify :: Word16,
+                                               subpixel_order_ScreenChangeNotify :: Word16,
+                                               width_ScreenChangeNotify :: Word16,
+                                               height_ScreenChangeNotify :: Word16,
+                                               mwidth_ScreenChangeNotify :: Word16,
+                                               mheight_ScreenChangeNotify :: Word16}
                         deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event ScreenChangeNotify
@@ -1181,9 +1182,9 @@
  
 data CrtcChange = MkCrtcChange{timestamp_CrtcChange :: TIMESTAMP,
                                window_CrtcChange :: WINDOW, crtc_CrtcChange :: CRTC,
-                               mode_CrtcChange :: MODE, rotation_CrtcChange :: CARD16,
-                               x_CrtcChange :: INT16, y_CrtcChange :: INT16,
-                               width_CrtcChange :: CARD16, height_CrtcChange :: CARD16}
+                               mode_CrtcChange :: MODE, rotation_CrtcChange :: Word16,
+                               x_CrtcChange :: Int16, y_CrtcChange :: Int16,
+                               width_CrtcChange :: Word16, height_CrtcChange :: Word16}
                 deriving (Show, Typeable)
  
 instance Serialize CrtcChange where
@@ -1229,9 +1230,9 @@
                                    config_timestamp_OutputChange :: TIMESTAMP,
                                    window_OutputChange :: WINDOW, output_OutputChange :: OUTPUT,
                                    crtc_OutputChange :: CRTC, mode_OutputChange :: MODE,
-                                   rotation_OutputChange :: CARD16,
-                                   connection_OutputChange :: CARD8,
-                                   subpixel_order_OutputChange :: CARD8}
+                                   rotation_OutputChange :: Word16,
+                                   connection_OutputChange :: Word8,
+                                   subpixel_order_OutputChange :: Word8}
                   deriving (Show, Typeable)
  
 instance Serialize OutputChange where
@@ -1277,7 +1278,7 @@
                                        WINDOW,
                                        output_OutputProperty :: OUTPUT, atom_OutputProperty :: ATOM,
                                        timestamp_OutputProperty :: TIMESTAMP,
-                                       status_OutputProperty :: CARD8}
+                                       status_OutputProperty :: Word8}
                     deriving (Show, Typeable)
  
 instance Serialize OutputProperty where
@@ -1304,7 +1305,8 @@
                status <- deserialize
                skip 11
                return (MkOutputProperty window output atom timestamp status)
- 
+
+
 data NotifyData = NotifyDataCrtcChange CrtcChange
                 | NotifyDataOutputChange OutputChange
                 | NotifyDataOutputProperty OutputProperty
@@ -1324,12 +1326,13 @@
 deserializeNotifyData NotifyOutputChange = NotifyDataOutputChange `liftM` deserialize
 deserializeNotifyData NotifyOutputProperty = NotifyDataOutputProperty `liftM` deserialize
 
-subCodeToNotifyEnum :: CARD8 -> NotifyEnum
+subCodeToNotifyEnum :: Word8 -> NotifyEnum
 subCodeToNotifyEnum 0 = NotifyCrtcChange
 subCodeToNotifyEnum 1 = NotifyOutputChange
 subCodeToNotifyEnum 2 = NotifyOutputProperty
 
-data Notify = MkNotify{subCode_Notify :: CARD8,
+
+data Notify = MkNotify{subCode_Notify :: Word8,
                        u_Notify :: NotifyData}
             deriving (Show, Typeable)
  
diff --git a/patched/Graphics/XHB/Gen/Record.hs b/patched/Graphics/XHB/Gen/Record.hs
--- a/patched/Graphics/XHB/Gen/Record.hs
+++ b/patched/Graphics/XHB/Gen/Record.hs
@@ -9,6 +9,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
  
@@ -17,13 +20,13 @@
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD16 -> CARD16 -> IO (Receipt QueryVersionReply)
+                 Word16 -> Word16 -> IO (Receipt QueryVersionReply)
 queryVersion c major_version minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion major_version minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createContext ::
@@ -54,11 +57,11 @@
                Graphics.XHB.Gen.Record.Types.CONTEXT ->
                  IO (Receipt GetContextReply)
 getContext c context
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetContext context
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 enableContext ::
@@ -66,11 +69,11 @@
                   Graphics.XHB.Gen.Record.Types.CONTEXT ->
                     IO (Receipt EnableContextReply)
 enableContext c context
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkEnableContext context
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 disableContext ::
diff --git a/patched/Graphics/XHB/Gen/Record/Types.hs b/patched/Graphics/XHB/Gen/Record/Types.hs
--- a/patched/Graphics/XHB/Gen/Record/Types.hs
+++ b/patched/Graphics/XHB/Gen/Record/Types.hs
@@ -8,6 +8,7 @@
         DisableContext(..), FreeContext(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -30,7 +31,7 @@
 newtype CONTEXT = MkCONTEXT Xid
                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
  
-data Range8 = MkRange8{first_Range8 :: CARD8, last_Range8 :: CARD8}
+data Range8 = MkRange8{first_Range8 :: Word8, last_Range8 :: Word8}
             deriving (Show, Typeable)
  
 instance Serialize Range8 where
@@ -45,8 +46,8 @@
                last <- deserialize
                return (MkRange8 first last)
  
-data Range16 = MkRange16{first_Range16 :: CARD16,
-                         last_Range16 :: CARD16}
+data Range16 = MkRange16{first_Range16 :: Word16,
+                         last_Range16 :: Word16}
              deriving (Show, Typeable)
  
 instance Serialize Range16 where
@@ -81,7 +82,7 @@
                      core_replies_Range :: Range8, ext_requests_Range :: ExtRange,
                      ext_replies_Range :: ExtRange, delivered_events_Range :: Range8,
                      device_events_Range :: Range8, errors_Range :: Range8,
-                     client_started_Range :: BOOL, client_died_Range :: BOOL}
+                     client_started_Range :: Bool, client_died_Range :: Bool}
            deriving (Show, Typeable)
  
 instance Serialize Range where
@@ -124,7 +125,7 @@
                     client_started
                     client_died)
  
-type ElementHeader = CARD8
+type ElementHeader = Word8
  
 data HType = HTypeFromServerTime
            | HTypeFromClientTime
@@ -138,7 +139,7 @@
         fromBit 1 = HTypeFromClientTime
         fromBit 2 = HTypeFromClientSequence
  
-type ClientSpec = CARD32
+type ClientSpec = Word32
  
 data CS = CSCurrentClients
         | CSFutureClients
@@ -154,7 +155,7 @@
  
 data ClientInfo = MkClientInfo{client_resource_ClientInfo ::
                                ClientSpec,
-                               num_ranges_ClientInfo :: CARD32, ranges_ClientInfo :: [Range]}
+                               num_ranges_ClientInfo :: Word32, ranges_ClientInfo :: [Range]}
                 deriving (Show, Typeable)
  
 instance Serialize ClientInfo where
@@ -174,7 +175,7 @@
                ranges <- deserializeList (fromIntegral num_ranges)
                return (MkClientInfo client_resource num_ranges ranges)
  
-data BadContext = MkBadContext{invalid_record_BadContext :: CARD32}
+data BadContext = MkBadContext{invalid_record_BadContext :: Word32}
                 deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadContext
@@ -186,8 +187,8 @@
                return (MkBadContext invalid_record)
  
 data QueryVersion = MkQueryVersion{major_version_QueryVersion ::
-                                   CARD16,
-                                   minor_version_QueryVersion :: CARD16}
+                                   Word16,
+                                   minor_version_QueryVersion :: Word16}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -198,14 +199,14 @@
                let size__
                      = 4 + size (major_version_QueryVersion x) +
                          size (minor_version_QueryVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (major_version_QueryVersion x)
                serialize (minor_version_QueryVersion x)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{major_version_QueryVersionReply
-                                             :: CARD16,
-                                             minor_version_QueryVersionReply :: CARD16}
+                                             :: Word16,
+                                             minor_version_QueryVersionReply :: Word16}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -222,8 +223,8 @@
 data CreateContext = MkCreateContext{context_CreateContext ::
                                      Graphics.XHB.Gen.Record.Types.CONTEXT,
                                      element_header_CreateContext :: ElementHeader,
-                                     num_client_specs_CreateContext :: CARD32,
-                                     num_ranges_CreateContext :: CARD32,
+                                     num_client_specs_CreateContext :: Word32,
+                                     num_ranges_CreateContext :: Word32,
                                      client_specs_CreateContext :: [ClientSpec],
                                      ranges_CreateContext :: [Range]}
                    deriving (Show, Typeable)
@@ -241,7 +242,7 @@
                          + size (num_ranges_CreateContext x)
                          + sum (map size (client_specs_CreateContext x))
                          + sum (map size (ranges_CreateContext x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_CreateContext x)
                serialize (element_header_CreateContext x)
                putSkip 3
@@ -254,8 +255,8 @@
 data RegisterClients = MkRegisterClients{context_RegisterClients ::
                                          Graphics.XHB.Gen.Record.Types.CONTEXT,
                                          element_header_RegisterClients :: ElementHeader,
-                                         num_client_specs_RegisterClients :: CARD32,
-                                         num_ranges_RegisterClients :: CARD32,
+                                         num_client_specs_RegisterClients :: Word32,
+                                         num_ranges_RegisterClients :: Word32,
                                          client_specs_RegisterClients :: [ClientSpec],
                                          ranges_RegisterClients :: [Range]}
                      deriving (Show, Typeable)
@@ -273,7 +274,7 @@
                          + size (num_ranges_RegisterClients x)
                          + sum (map size (client_specs_RegisterClients x))
                          + sum (map size (ranges_RegisterClients x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_RegisterClients x)
                serialize (element_header_RegisterClients x)
                putSkip 3
@@ -285,7 +286,7 @@
  
 data UnregisterClients = MkUnregisterClients{context_UnregisterClients
                                              :: Graphics.XHB.Gen.Record.Types.CONTEXT,
-                                             num_client_specs_UnregisterClients :: CARD32,
+                                             num_client_specs_UnregisterClients :: Word32,
                                              client_specs_UnregisterClients :: [ClientSpec]}
                        deriving (Show, Typeable)
  
@@ -298,7 +299,7 @@
                      = 4 + size (context_UnregisterClients x) +
                          size (num_client_specs_UnregisterClients x)
                          + sum (map size (client_specs_UnregisterClients x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_UnregisterClients x)
                serialize (num_client_specs_UnregisterClients x)
                serializeList (client_specs_UnregisterClients x)
@@ -314,14 +315,14 @@
           = do putWord8 extOpCode
                putWord8 4
                let size__ = 4 + size (context_GetContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_GetContext x)
                putSkip (requiredPadding size__)
  
 data GetContextReply = MkGetContextReply{enabled_GetContextReply ::
-                                         BOOL,
+                                         Bool,
                                          element_header_GetContextReply :: ElementHeader,
-                                         num_intercepted_clients_GetContextReply :: CARD32,
+                                         num_intercepted_clients_GetContextReply :: Word32,
                                          intercepted_clients_GetContextReply :: [ClientInfo]}
                      deriving (Show, Typeable)
  
@@ -352,18 +353,18 @@
           = do putWord8 extOpCode
                putWord8 5
                let size__ = 4 + size (context_EnableContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_EnableContext x)
                putSkip (requiredPadding size__)
  
 data EnableContextReply = MkEnableContextReply{category_EnableContextReply
-                                               :: CARD8,
+                                               :: Word8,
                                                element_header_EnableContextReply :: ElementHeader,
-                                               client_swapped_EnableContextReply :: BOOL,
-                                               xid_base_EnableContextReply :: CARD32,
-                                               server_time_EnableContextReply :: CARD32,
-                                               rec_sequence_num_EnableContextReply :: CARD32,
-                                               data_EnableContextReply :: [BYTE]}
+                                               client_swapped_EnableContextReply :: Bool,
+                                               xid_base_EnableContextReply :: Word32,
+                                               server_time_EnableContextReply :: Word32,
+                                               rec_sequence_num_EnableContextReply :: Word32,
+                                               data_EnableContextReply :: [Word8]}
                         deriving (Show, Typeable)
  
 instance Deserialize EnableContextReply where
@@ -398,7 +399,7 @@
           = do putWord8 extOpCode
                putWord8 6
                let size__ = 4 + size (context_DisableContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_DisableContext x)
                putSkip (requiredPadding size__)
  
@@ -412,6 +413,6 @@
           = do putWord8 extOpCode
                putWord8 7
                let size__ = 4 + size (context_FreeContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_FreeContext x)
                putSkip (requiredPadding size__)
diff --git a/patched/Graphics/XHB/Gen/Render.hs b/patched/Graphics/XHB/Gen/Render.hs
--- a/patched/Graphics/XHB/Gen/Render.hs
+++ b/patched/Graphics/XHB/Gen/Render.hs
@@ -15,6 +15,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -26,35 +29,35 @@
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)
+                 Word32 -> Word32 -> IO (Receipt QueryVersionReply)
 queryVersion c client_major_version client_minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion client_major_version client_minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryPictFormats ::
                    Graphics.XHB.Connection.Types.Connection ->
                      IO (Receipt QueryPictFormatsReply)
 queryPictFormats c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryPictFormats
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryPictIndexValues ::
                        Graphics.XHB.Connection.Types.Connection ->
                          PICTFORMAT -> IO (Receipt QueryPictIndexValuesReply)
 queryPictIndexValues c format
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryPictIndexValues format
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createPicture ::
@@ -66,7 +69,7 @@
  
 changePicture ::
                 Graphics.XHB.Connection.Types.Connection ->
-                  PICTURE -> ValueParam CARD32 -> IO ()
+                  PICTURE -> ValueParam Word32 -> IO ()
 changePicture c picture value
   = do let req = MkChangePicture picture value
        putAction <- serializeExtensionRequest c req
@@ -217,11 +220,11 @@
                Graphics.XHB.Connection.Types.Connection ->
                  DRAWABLE -> IO (Receipt QueryFiltersReply)
 queryFilters c drawable
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryFilters drawable
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setPictureFilter ::
diff --git a/patched/Graphics/XHB/Gen/Render/Types.hs b/patched/Graphics/XHB/Gen/Render/Types.hs
--- a/patched/Graphics/XHB/Gen/Render/Types.hs
+++ b/patched/Graphics/XHB/Gen/Render/Types.hs
@@ -21,6 +21,7 @@
         CreateConicalGradient(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -263,7 +264,7 @@
         fromValue 2 = RepeatPad
         fromValue 3 = RepeatReflect
  
-type GLYPH = CARD32
+type GLYPH = Word32
  
 newtype GLYPHSET = MkGLYPHSET Xid
                    deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
@@ -274,17 +275,17 @@
 newtype PICTFORMAT = MkPICTFORMAT Xid
                      deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
  
-type FIXED = INT32
+type FIXED = Int32
  
 data DIRECTFORMAT = MkDIRECTFORMAT{red_shift_DIRECTFORMAT ::
-                                   CARD16,
-                                   red_mask_DIRECTFORMAT :: CARD16,
-                                   green_shift_DIRECTFORMAT :: CARD16,
-                                   green_mask_DIRECTFORMAT :: CARD16,
-                                   blue_shift_DIRECTFORMAT :: CARD16,
-                                   blue_mask_DIRECTFORMAT :: CARD16,
-                                   alpha_shift_DIRECTFORMAT :: CARD16,
-                                   alpha_mask_DIRECTFORMAT :: CARD16}
+                                   Word16,
+                                   red_mask_DIRECTFORMAT :: Word16,
+                                   green_shift_DIRECTFORMAT :: Word16,
+                                   green_mask_DIRECTFORMAT :: Word16,
+                                   blue_shift_DIRECTFORMAT :: Word16,
+                                   blue_mask_DIRECTFORMAT :: Word16,
+                                   alpha_shift_DIRECTFORMAT :: Word16,
+                                   alpha_mask_DIRECTFORMAT :: Word16}
                   deriving (Show, Typeable)
  
 instance Serialize DIRECTFORMAT where
@@ -324,7 +325,7 @@
                     alpha_mask)
  
 data PICTFORMINFO = MkPICTFORMINFO{id_PICTFORMINFO :: PICTFORMAT,
-                                   type_PICTFORMINFO :: CARD8, depth_PICTFORMINFO :: CARD8,
+                                   type_PICTFORMINFO :: Word8, depth_PICTFORMINFO :: Word8,
                                    direct_PICTFORMINFO :: DIRECTFORMAT,
                                    colormap_PICTFORMINFO :: COLORMAP}
                   deriving (Show, Typeable)
@@ -370,8 +371,8 @@
                format <- deserialize
                return (MkPICTVISUAL visual format)
  
-data PICTDEPTH = MkPICTDEPTH{depth_PICTDEPTH :: CARD8,
-                             num_visuals_PICTDEPTH :: CARD16, visuals_PICTDEPTH :: [PICTVISUAL]}
+data PICTDEPTH = MkPICTDEPTH{depth_PICTDEPTH :: Word8,
+                             num_visuals_PICTDEPTH :: Word16, visuals_PICTDEPTH :: [PICTVISUAL]}
                deriving (Show, Typeable)
  
 instance Serialize PICTDEPTH where
@@ -394,7 +395,7 @@
                visuals <- deserializeList (fromIntegral num_visuals)
                return (MkPICTDEPTH depth num_visuals visuals)
  
-data PICTSCREEN = MkPICTSCREEN{num_depths_PICTSCREEN :: CARD32,
+data PICTSCREEN = MkPICTSCREEN{num_depths_PICTSCREEN :: Word32,
                                fallback_PICTSCREEN :: PICTFORMAT,
                                depths_PICTSCREEN :: [PICTDEPTH]}
                 deriving (Show, Typeable)
@@ -415,9 +416,9 @@
                depths <- deserializeList (fromIntegral num_depths)
                return (MkPICTSCREEN num_depths fallback depths)
  
-data INDEXVALUE = MkINDEXVALUE{pixel_INDEXVALUE :: CARD32,
-                               red_INDEXVALUE :: CARD16, green_INDEXVALUE :: CARD16,
-                               blue_INDEXVALUE :: CARD16, alpha_INDEXVALUE :: CARD16}
+data INDEXVALUE = MkINDEXVALUE{pixel_INDEXVALUE :: Word32,
+                               red_INDEXVALUE :: Word16, green_INDEXVALUE :: Word16,
+                               blue_INDEXVALUE :: Word16, alpha_INDEXVALUE :: Word16}
                 deriving (Show, Typeable)
  
 instance Serialize INDEXVALUE where
@@ -442,8 +443,8 @@
                alpha <- deserialize
                return (MkINDEXVALUE pixel red green blue alpha)
  
-data COLOR = MkCOLOR{red_COLOR :: CARD16, green_COLOR :: CARD16,
-                     blue_COLOR :: CARD16, alpha_COLOR :: CARD16}
+data COLOR = MkCOLOR{red_COLOR :: Word16, green_COLOR :: Word16,
+                     blue_COLOR :: Word16, alpha_COLOR :: Word16}
            deriving (Show, Typeable)
  
 instance Serialize COLOR where
@@ -540,10 +541,10 @@
                right <- deserialize
                return (MkTRAPEZOID top bottom left right)
  
-data GLYPHINFO = MkGLYPHINFO{width_GLYPHINFO :: CARD16,
-                             height_GLYPHINFO :: CARD16, x_GLYPHINFO :: INT16,
-                             y_GLYPHINFO :: INT16, x_off_GLYPHINFO :: INT16,
-                             y_off_GLYPHINFO :: INT16}
+data GLYPHINFO = MkGLYPHINFO{width_GLYPHINFO :: Word16,
+                             height_GLYPHINFO :: Word16, x_GLYPHINFO :: Int16,
+                             y_GLYPHINFO :: Int16, x_off_GLYPHINFO :: Int16,
+                             y_off_GLYPHINFO :: Int16}
                deriving (Show, Typeable)
  
 instance Serialize GLYPHINFO where
@@ -572,8 +573,8 @@
                return (MkGLYPHINFO width height x y x_off y_off)
  
 data QueryVersion = MkQueryVersion{client_major_version_QueryVersion
-                                   :: CARD32,
-                                   client_minor_version_QueryVersion :: CARD32}
+                                   :: Word32,
+                                   client_minor_version_QueryVersion :: Word32}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -584,14 +585,14 @@
                let size__
                      = 4 + size (client_major_version_QueryVersion x) +
                          size (client_minor_version_QueryVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (client_major_version_QueryVersion x)
                serialize (client_minor_version_QueryVersion x)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{major_version_QueryVersionReply
-                                             :: CARD32,
-                                             minor_version_QueryVersionReply :: CARD32}
+                                             :: Word32,
+                                             minor_version_QueryVersionReply :: Word32}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -615,19 +616,19 @@
           = do putWord8 extOpCode
                putWord8 1
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data QueryPictFormatsReply = MkQueryPictFormatsReply{num_formats_QueryPictFormatsReply
-                                                     :: CARD32,
-                                                     num_screens_QueryPictFormatsReply :: CARD32,
-                                                     num_depths_QueryPictFormatsReply :: CARD32,
-                                                     num_visuals_QueryPictFormatsReply :: CARD32,
-                                                     num_subpixel_QueryPictFormatsReply :: CARD32,
+                                                     :: Word32,
+                                                     num_screens_QueryPictFormatsReply :: Word32,
+                                                     num_depths_QueryPictFormatsReply :: Word32,
+                                                     num_visuals_QueryPictFormatsReply :: Word32,
+                                                     num_subpixel_QueryPictFormatsReply :: Word32,
                                                      formats_QueryPictFormatsReply ::
                                                      [PICTFORMINFO],
                                                      screens_QueryPictFormatsReply :: [PICTSCREEN],
-                                                     subpixels_QueryPictFormatsReply :: [CARD32]}
+                                                     subpixels_QueryPictFormatsReply :: [Word32]}
                            deriving (Show, Typeable)
  
 instance Deserialize QueryPictFormatsReply where
@@ -664,12 +665,12 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4 + size (format_QueryPictIndexValues x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (format_QueryPictIndexValues x)
                putSkip (requiredPadding size__)
  
 data QueryPictIndexValuesReply = MkQueryPictIndexValuesReply{num_values_QueryPictIndexValuesReply
-                                                             :: CARD32,
+                                                             :: Word32,
                                                              values_QueryPictIndexValuesReply ::
                                                              [INDEXVALUE]}
                                deriving (Show, Typeable)
@@ -689,7 +690,7 @@
 data CreatePicture = MkCreatePicture{pid_CreatePicture :: PICTURE,
                                      drawable_CreatePicture :: DRAWABLE,
                                      format_CreatePicture :: PICTFORMAT,
-                                     value_CreatePicture :: ValueParam CARD32}
+                                     value_CreatePicture :: ValueParam Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest CreatePicture where
@@ -701,7 +702,7 @@
                      = 4 + size (pid_CreatePicture x) + size (drawable_CreatePicture x)
                          + size (format_CreatePicture x)
                          + size (value_CreatePicture x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (pid_CreatePicture x)
                serialize (drawable_CreatePicture x)
                serialize (format_CreatePicture x)
@@ -710,7 +711,7 @@
  
 data ChangePicture = MkChangePicture{picture_ChangePicture ::
                                      PICTURE,
-                                     value_ChangePicture :: ValueParam CARD32}
+                                     value_ChangePicture :: ValueParam Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest ChangePicture where
@@ -720,7 +721,7 @@
                putWord8 5
                let size__
                      = 4 + size (picture_ChangePicture x) + size (value_ChangePicture x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (picture_ChangePicture x)
                serialize (value_ChangePicture x)
                putSkip (requiredPadding size__)
@@ -728,9 +729,9 @@
 data SetPictureClipRectangles = MkSetPictureClipRectangles{picture_SetPictureClipRectangles
                                                            :: PICTURE,
                                                            clip_x_origin_SetPictureClipRectangles ::
-                                                           INT16,
+                                                           Int16,
                                                            clip_y_origin_SetPictureClipRectangles ::
-                                                           INT16,
+                                                           Int16,
                                                            rectangles_SetPictureClipRectangles ::
                                                            [RECTANGLE]}
                               deriving (Show, Typeable)
@@ -745,7 +746,7 @@
                          size (clip_x_origin_SetPictureClipRectangles x)
                          + size (clip_y_origin_SetPictureClipRectangles x)
                          + sum (map size (rectangles_SetPictureClipRectangles x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (picture_SetPictureClipRectangles x)
                serialize (clip_x_origin_SetPictureClipRectangles x)
                serialize (clip_y_origin_SetPictureClipRectangles x)
@@ -761,17 +762,17 @@
           = do putWord8 extOpCode
                putWord8 7
                let size__ = 4 + size (picture_FreePicture x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (picture_FreePicture x)
                putSkip (requiredPadding size__)
  
-data Composite = MkComposite{op_Composite :: CARD8,
+data Composite = MkComposite{op_Composite :: Word8,
                              src_Composite :: PICTURE, mask_Composite :: PICTURE,
-                             dst_Composite :: PICTURE, src_x_Composite :: INT16,
-                             src_y_Composite :: INT16, mask_x_Composite :: INT16,
-                             mask_y_Composite :: INT16, dst_x_Composite :: INT16,
-                             dst_y_Composite :: INT16, width_Composite :: CARD16,
-                             height_Composite :: CARD16}
+                             dst_Composite :: PICTURE, src_x_Composite :: Int16,
+                             src_y_Composite :: Int16, mask_x_Composite :: Int16,
+                             mask_y_Composite :: Int16, dst_x_Composite :: Int16,
+                             dst_y_Composite :: Int16, width_Composite :: Word16,
+                             height_Composite :: Word16}
                deriving (Show, Typeable)
  
 instance ExtensionRequest Composite where
@@ -791,7 +792,7 @@
                          + size (dst_y_Composite x)
                          + size (width_Composite x)
                          + size (height_Composite x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (op_Composite x)
                putSkip 3
                serialize (src_Composite x)
@@ -807,10 +808,10 @@
                serialize (height_Composite x)
                putSkip (requiredPadding size__)
  
-data Trapezoids = MkTrapezoids{op_Trapezoids :: CARD8,
+data Trapezoids = MkTrapezoids{op_Trapezoids :: Word8,
                                src_Trapezoids :: PICTURE, dst_Trapezoids :: PICTURE,
-                               mask_format_Trapezoids :: PICTFORMAT, src_x_Trapezoids :: INT16,
-                               src_y_Trapezoids :: INT16, traps_Trapezoids :: [TRAPEZOID]}
+                               mask_format_Trapezoids :: PICTFORMAT, src_x_Trapezoids :: Int16,
+                               src_y_Trapezoids :: Int16, traps_Trapezoids :: [TRAPEZOID]}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest Trapezoids where
@@ -825,7 +826,7 @@
                          + size (src_x_Trapezoids x)
                          + size (src_y_Trapezoids x)
                          + sum (map size (traps_Trapezoids x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (op_Trapezoids x)
                putSkip 3
                serialize (src_Trapezoids x)
@@ -836,10 +837,10 @@
                serializeList (traps_Trapezoids x)
                putSkip (requiredPadding size__)
  
-data Triangles = MkTriangles{op_Triangles :: CARD8,
+data Triangles = MkTriangles{op_Triangles :: Word8,
                              src_Triangles :: PICTURE, dst_Triangles :: PICTURE,
-                             mask_format_Triangles :: PICTFORMAT, src_x_Triangles :: INT16,
-                             src_y_Triangles :: INT16, triangles_Triangles :: [TRIANGLE]}
+                             mask_format_Triangles :: PICTFORMAT, src_x_Triangles :: Int16,
+                             src_y_Triangles :: Int16, triangles_Triangles :: [TRIANGLE]}
                deriving (Show, Typeable)
  
 instance ExtensionRequest Triangles where
@@ -854,7 +855,7 @@
                          + size (src_x_Triangles x)
                          + size (src_y_Triangles x)
                          + sum (map size (triangles_Triangles x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (op_Triangles x)
                putSkip 3
                serialize (src_Triangles x)
@@ -865,10 +866,10 @@
                serializeList (triangles_Triangles x)
                putSkip (requiredPadding size__)
  
-data TriStrip = MkTriStrip{op_TriStrip :: CARD8,
+data TriStrip = MkTriStrip{op_TriStrip :: Word8,
                            src_TriStrip :: PICTURE, dst_TriStrip :: PICTURE,
-                           mask_format_TriStrip :: PICTFORMAT, src_x_TriStrip :: INT16,
-                           src_y_TriStrip :: INT16, points_TriStrip :: [POINTFIX]}
+                           mask_format_TriStrip :: PICTFORMAT, src_x_TriStrip :: Int16,
+                           src_y_TriStrip :: Int16, points_TriStrip :: [POINTFIX]}
               deriving (Show, Typeable)
  
 instance ExtensionRequest TriStrip where
@@ -883,7 +884,7 @@
                          + size (src_x_TriStrip x)
                          + size (src_y_TriStrip x)
                          + sum (map size (points_TriStrip x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (op_TriStrip x)
                putSkip 3
                serialize (src_TriStrip x)
@@ -894,9 +895,9 @@
                serializeList (points_TriStrip x)
                putSkip (requiredPadding size__)
  
-data TriFan = MkTriFan{op_TriFan :: CARD8, src_TriFan :: PICTURE,
+data TriFan = MkTriFan{op_TriFan :: Word8, src_TriFan :: PICTURE,
                        dst_TriFan :: PICTURE, mask_format_TriFan :: PICTFORMAT,
-                       src_x_TriFan :: INT16, src_y_TriFan :: INT16,
+                       src_x_TriFan :: Int16, src_y_TriFan :: Int16,
                        points_TriFan :: [POINTFIX]}
             deriving (Show, Typeable)
  
@@ -912,7 +913,7 @@
                          + size (src_x_TriFan x)
                          + size (src_y_TriFan x)
                          + sum (map size (points_TriFan x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (op_TriFan x)
                putSkip 3
                serialize (src_TriFan x)
@@ -935,7 +936,7 @@
                putWord8 17
                let size__
                      = 4 + size (gsid_CreateGlyphSet x) + size (format_CreateGlyphSet x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (gsid_CreateGlyphSet x)
                serialize (format_CreateGlyphSet x)
                putSkip (requiredPadding size__)
@@ -953,7 +954,7 @@
                let size__
                      = 4 + size (gsid_ReferenceGlyphSet x) +
                          size (existing_ReferenceGlyphSet x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (gsid_ReferenceGlyphSet x)
                serialize (existing_ReferenceGlyphSet x)
                putSkip (requiredPadding size__)
@@ -968,13 +969,13 @@
           = do putWord8 extOpCode
                putWord8 19
                let size__ = 4 + size (glyphset_FreeGlyphSet x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (glyphset_FreeGlyphSet x)
                putSkip (requiredPadding size__)
  
 data AddGlyphs = MkAddGlyphs{glyphset_AddGlyphs :: GLYPHSET,
-                             glyphs_len_AddGlyphs :: CARD32, glyphids_AddGlyphs :: [CARD32],
-                             glyphs_AddGlyphs :: [GLYPHINFO], data_AddGlyphs :: [BYTE]}
+                             glyphs_len_AddGlyphs :: Word32, glyphids_AddGlyphs :: [Word32],
+                             glyphs_AddGlyphs :: [GLYPHINFO], data_AddGlyphs :: [Word8]}
                deriving (Show, Typeable)
  
 instance ExtensionRequest AddGlyphs where
@@ -987,7 +988,7 @@
                          sum (map size (glyphids_AddGlyphs x))
                          + sum (map size (glyphs_AddGlyphs x))
                          + sum (map size (data_AddGlyphs x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (glyphset_AddGlyphs x)
                serialize (glyphs_len_AddGlyphs x)
                serializeList (glyphids_AddGlyphs x)
@@ -1007,20 +1008,20 @@
                let size__
                      = 4 + size (glyphset_FreeGlyphs x) +
                          sum (map size (glyphs_FreeGlyphs x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (glyphset_FreeGlyphs x)
                serializeList (glyphs_FreeGlyphs x)
                putSkip (requiredPadding size__)
  
 data CompositeGlyphs8 = MkCompositeGlyphs8{op_CompositeGlyphs8 ::
-                                           CARD8,
+                                           Word8,
                                            src_CompositeGlyphs8 :: PICTURE,
                                            dst_CompositeGlyphs8 :: PICTURE,
                                            mask_format_CompositeGlyphs8 :: PICTFORMAT,
                                            glyphset_CompositeGlyphs8 :: GLYPHSET,
-                                           src_x_CompositeGlyphs8 :: INT16,
-                                           src_y_CompositeGlyphs8 :: INT16,
-                                           glyphcmds_CompositeGlyphs8 :: [BYTE]}
+                                           src_x_CompositeGlyphs8 :: Int16,
+                                           src_y_CompositeGlyphs8 :: Int16,
+                                           glyphcmds_CompositeGlyphs8 :: [Word8]}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest CompositeGlyphs8 where
@@ -1037,7 +1038,7 @@
                          + size (src_x_CompositeGlyphs8 x)
                          + size (src_y_CompositeGlyphs8 x)
                          + sum (map size (glyphcmds_CompositeGlyphs8 x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (op_CompositeGlyphs8 x)
                putSkip 3
                serialize (src_CompositeGlyphs8 x)
@@ -1050,14 +1051,14 @@
                putSkip (requiredPadding size__)
  
 data CompositeGlyphs16 = MkCompositeGlyphs16{op_CompositeGlyphs16
-                                             :: CARD8,
+                                             :: Word8,
                                              src_CompositeGlyphs16 :: PICTURE,
                                              dst_CompositeGlyphs16 :: PICTURE,
                                              mask_format_CompositeGlyphs16 :: PICTFORMAT,
                                              glyphset_CompositeGlyphs16 :: GLYPHSET,
-                                             src_x_CompositeGlyphs16 :: INT16,
-                                             src_y_CompositeGlyphs16 :: INT16,
-                                             glyphcmds_CompositeGlyphs16 :: [BYTE]}
+                                             src_x_CompositeGlyphs16 :: Int16,
+                                             src_y_CompositeGlyphs16 :: Int16,
+                                             glyphcmds_CompositeGlyphs16 :: [Word8]}
                        deriving (Show, Typeable)
  
 instance ExtensionRequest CompositeGlyphs16 where
@@ -1074,7 +1075,7 @@
                          + size (src_x_CompositeGlyphs16 x)
                          + size (src_y_CompositeGlyphs16 x)
                          + sum (map size (glyphcmds_CompositeGlyphs16 x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (op_CompositeGlyphs16 x)
                putSkip 3
                serialize (src_CompositeGlyphs16 x)
@@ -1087,14 +1088,14 @@
                putSkip (requiredPadding size__)
  
 data CompositeGlyphs32 = MkCompositeGlyphs32{op_CompositeGlyphs32
-                                             :: CARD8,
+                                             :: Word8,
                                              src_CompositeGlyphs32 :: PICTURE,
                                              dst_CompositeGlyphs32 :: PICTURE,
                                              mask_format_CompositeGlyphs32 :: PICTFORMAT,
                                              glyphset_CompositeGlyphs32 :: GLYPHSET,
-                                             src_x_CompositeGlyphs32 :: INT16,
-                                             src_y_CompositeGlyphs32 :: INT16,
-                                             glyphcmds_CompositeGlyphs32 :: [BYTE]}
+                                             src_x_CompositeGlyphs32 :: Int16,
+                                             src_y_CompositeGlyphs32 :: Int16,
+                                             glyphcmds_CompositeGlyphs32 :: [Word8]}
                        deriving (Show, Typeable)
  
 instance ExtensionRequest CompositeGlyphs32 where
@@ -1111,7 +1112,7 @@
                          + size (src_x_CompositeGlyphs32 x)
                          + size (src_y_CompositeGlyphs32 x)
                          + sum (map size (glyphcmds_CompositeGlyphs32 x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (op_CompositeGlyphs32 x)
                putSkip 3
                serialize (src_CompositeGlyphs32 x)
@@ -1123,7 +1124,7 @@
                serializeList (glyphcmds_CompositeGlyphs32 x)
                putSkip (requiredPadding size__)
  
-data FillRectangles = MkFillRectangles{op_FillRectangles :: CARD8,
+data FillRectangles = MkFillRectangles{op_FillRectangles :: Word8,
                                        dst_FillRectangles :: PICTURE, color_FillRectangles :: COLOR,
                                        rects_FillRectangles :: [RECTANGLE]}
                     deriving (Show, Typeable)
@@ -1137,7 +1138,7 @@
                      = 4 + size (op_FillRectangles x) + 3 + size (dst_FillRectangles x)
                          + size (color_FillRectangles x)
                          + sum (map size (rects_FillRectangles x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (op_FillRectangles x)
                putSkip 3
                serialize (dst_FillRectangles x)
@@ -1146,8 +1147,8 @@
                putSkip (requiredPadding size__)
  
 data CreateCursor = MkCreateCursor{cid_CreateCursor :: CURSOR,
-                                   source_CreateCursor :: PICTURE, x_CreateCursor :: CARD16,
-                                   y_CreateCursor :: CARD16}
+                                   source_CreateCursor :: PICTURE, x_CreateCursor :: Word16,
+                                   y_CreateCursor :: Word16}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest CreateCursor where
@@ -1159,7 +1160,7 @@
                      = 4 + size (cid_CreateCursor x) + size (source_CreateCursor x) +
                          size (x_CreateCursor x)
                          + size (y_CreateCursor x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (cid_CreateCursor x)
                serialize (source_CreateCursor x)
                serialize (x_CreateCursor x)
@@ -1224,7 +1225,7 @@
                let size__
                      = 4 + size (picture_SetPictureTransform x) +
                          size (transform_SetPictureTransform x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (picture_SetPictureTransform x)
                serialize (transform_SetPictureTransform x)
                putSkip (requiredPadding size__)
@@ -1239,14 +1240,14 @@
           = do putWord8 extOpCode
                putWord8 29
                let size__ = 4 + size (drawable_QueryFilters x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_QueryFilters x)
                putSkip (requiredPadding size__)
  
 data QueryFiltersReply = MkQueryFiltersReply{num_aliases_QueryFiltersReply
-                                             :: CARD32,
-                                             num_filters_QueryFiltersReply :: CARD32,
-                                             aliases_QueryFiltersReply :: [CARD16],
+                                             :: Word32,
+                                             num_filters_QueryFiltersReply :: Word32,
+                                             aliases_QueryFiltersReply :: [Word16],
                                              filters_QueryFiltersReply :: [STR]}
                        deriving (Show, Typeable)
  
@@ -1267,7 +1268,7 @@
  
 data SetPictureFilter = MkSetPictureFilter{picture_SetPictureFilter
                                            :: PICTURE,
-                                           filter_len_SetPictureFilter :: CARD16,
+                                           filter_len_SetPictureFilter :: Word16,
                                            filter_SetPictureFilter :: [CChar],
                                            values_SetPictureFilter :: [FIXED]}
                       deriving (Show, Typeable)
@@ -1283,7 +1284,7 @@
                          + 2
                          + sum (map size (filter_SetPictureFilter x))
                          + sum (map size (values_SetPictureFilter x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (picture_SetPictureFilter x)
                serialize (filter_len_SetPictureFilter x)
                putSkip 2
@@ -1293,7 +1294,7 @@
  
 data ANIMCURSORELT = MkANIMCURSORELT{cursor_ANIMCURSORELT ::
                                      CURSOR,
-                                     delay_ANIMCURSORELT :: CARD32}
+                                     delay_ANIMCURSORELT :: Word32}
                    deriving (Show, Typeable)
  
 instance Serialize ANIMCURSORELT where
@@ -1322,7 +1323,7 @@
                let size__
                      = 4 + size (cid_CreateAnimCursor x) +
                          sum (map size (cursors_CreateAnimCursor x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (cid_CreateAnimCursor x)
                serializeList (cursors_CreateAnimCursor x)
                putSkip (requiredPadding size__)
@@ -1362,7 +1363,7 @@
                return (MkTRAP top bot)
  
 data AddTraps = MkAddTraps{picture_AddTraps :: PICTURE,
-                           x_off_AddTraps :: INT16, y_off_AddTraps :: INT16,
+                           x_off_AddTraps :: Int16, y_off_AddTraps :: Int16,
                            traps_AddTraps :: [TRAP]}
               deriving (Show, Typeable)
  
@@ -1375,7 +1376,7 @@
                      = 4 + size (picture_AddTraps x) + size (x_off_AddTraps x) +
                          size (y_off_AddTraps x)
                          + sum (map size (traps_AddTraps x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (picture_AddTraps x)
                serialize (x_off_AddTraps x)
                serialize (y_off_AddTraps x)
@@ -1395,7 +1396,7 @@
                let size__
                      = 4 + size (picture_CreateSolidFill x) +
                          size (color_CreateSolidFill x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (picture_CreateSolidFill x)
                serialize (color_CreateSolidFill x)
                putSkip (requiredPadding size__)
@@ -1404,7 +1405,7 @@
                                                    :: PICTURE,
                                                    p1_CreateLinearGradient :: POINTFIX,
                                                    p2_CreateLinearGradient :: POINTFIX,
-                                                   num_stops_CreateLinearGradient :: CARD32,
+                                                   num_stops_CreateLinearGradient :: Word32,
                                                    stops_CreateLinearGradient :: [FIXED],
                                                    colors_CreateLinearGradient :: [COLOR]}
                           deriving (Show, Typeable)
@@ -1421,7 +1422,7 @@
                          + size (num_stops_CreateLinearGradient x)
                          + sum (map size (stops_CreateLinearGradient x))
                          + sum (map size (colors_CreateLinearGradient x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (picture_CreateLinearGradient x)
                serialize (p1_CreateLinearGradient x)
                serialize (p2_CreateLinearGradient x)
@@ -1436,7 +1437,7 @@
                                                    outer_CreateRadialGradient :: POINTFIX,
                                                    inner_radius_CreateRadialGradient :: FIXED,
                                                    outer_radius_CreateRadialGradient :: FIXED,
-                                                   num_stops_CreateRadialGradient :: CARD32,
+                                                   num_stops_CreateRadialGradient :: Word32,
                                                    stops_CreateRadialGradient :: [FIXED],
                                                    colors_CreateRadialGradient :: [COLOR]}
                           deriving (Show, Typeable)
@@ -1455,7 +1456,7 @@
                          + size (num_stops_CreateRadialGradient x)
                          + sum (map size (stops_CreateRadialGradient x))
                          + sum (map size (colors_CreateRadialGradient x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (picture_CreateRadialGradient x)
                serialize (inner_CreateRadialGradient x)
                serialize (outer_CreateRadialGradient x)
@@ -1470,7 +1471,7 @@
                                                      :: PICTURE,
                                                      center_CreateConicalGradient :: POINTFIX,
                                                      angle_CreateConicalGradient :: FIXED,
-                                                     num_stops_CreateConicalGradient :: CARD32,
+                                                     num_stops_CreateConicalGradient :: Word32,
                                                      stops_CreateConicalGradient :: [FIXED],
                                                      colors_CreateConicalGradient :: [COLOR]}
                            deriving (Show, Typeable)
@@ -1487,7 +1488,7 @@
                          + size (num_stops_CreateConicalGradient x)
                          + sum (map size (stops_CreateConicalGradient x))
                          + sum (map size (colors_CreateConicalGradient x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (picture_CreateConicalGradient x)
                serialize (center_CreateConicalGradient x)
                serialize (angle_CreateConicalGradient x)
diff --git a/patched/Graphics/XHB/Gen/Res.hs b/patched/Graphics/XHB/Gen/Res.hs
--- a/patched/Graphics/XHB/Gen/Res.hs
+++ b/patched/Graphics/XHB/Gen/Res.hs
@@ -8,6 +8,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -19,44 +22,44 @@
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD8 -> CARD8 -> IO (Receipt QueryVersionReply)
+                 Word8 -> Word8 -> IO (Receipt QueryVersionReply)
 queryVersion c client_major client_minor
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion client_major client_minor
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryClients ::
                Graphics.XHB.Connection.Types.Connection ->
                  IO (Receipt QueryClientsReply)
 queryClients c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryClients
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryClientResources ::
                        Graphics.XHB.Connection.Types.Connection ->
-                         CARD32 -> IO (Receipt QueryClientResourcesReply)
+                         Word32 -> IO (Receipt QueryClientResourcesReply)
 queryClientResources c xid
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryClientResources xid
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryClientPixmapBytes ::
                          Graphics.XHB.Connection.Types.Connection ->
-                           CARD32 -> IO (Receipt QueryClientPixmapBytesReply)
+                           Word32 -> IO (Receipt QueryClientPixmapBytesReply)
 queryClientPixmapBytes c xid
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryClientPixmapBytes xid
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/Res/Types.hs b/patched/Graphics/XHB/Gen/Res/Types.hs
--- a/patched/Graphics/XHB/Gen/Res/Types.hs
+++ b/patched/Graphics/XHB/Gen/Res/Types.hs
@@ -6,6 +6,7 @@
         QueryClientPixmapBytesReply(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -26,8 +27,8 @@
 deserializeEvent :: Word8 -> Maybe (Get SomeEvent)
 deserializeEvent _ = Nothing
  
-data Client = MkClient{resource_base_Client :: CARD32,
-                       resource_mask_Client :: CARD32}
+data Client = MkClient{resource_base_Client :: Word32,
+                       resource_mask_Client :: Word32}
             deriving (Show, Typeable)
  
 instance Serialize Client where
@@ -44,7 +45,7 @@
                return (MkClient resource_base resource_mask)
  
 data Type = MkType{resource_type_Type :: ATOM,
-                   count_Type :: CARD32}
+                   count_Type :: Word32}
           deriving (Show, Typeable)
  
 instance Serialize Type where
@@ -60,8 +61,8 @@
                return (MkType resource_type count)
  
 data QueryVersion = MkQueryVersion{client_major_QueryVersion ::
-                                   CARD8,
-                                   client_minor_QueryVersion :: CARD8}
+                                   Word8,
+                                   client_minor_QueryVersion :: Word8}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -72,14 +73,14 @@
                let size__
                      = 4 + size (client_major_QueryVersion x) +
                          size (client_minor_QueryVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (client_major_QueryVersion x)
                serialize (client_minor_QueryVersion x)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{server_major_QueryVersionReply
-                                             :: CARD16,
-                                             server_minor_QueryVersionReply :: CARD16}
+                                             :: Word16,
+                                             server_minor_QueryVersionReply :: Word16}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -102,11 +103,11 @@
           = do putWord8 extOpCode
                putWord8 1
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data QueryClientsReply = MkQueryClientsReply{num_clients_QueryClientsReply
-                                             :: CARD32,
+                                             :: Word32,
                                              clients_QueryClientsReply :: [Client]}
                        deriving (Show, Typeable)
  
@@ -123,7 +124,7 @@
                return (MkQueryClientsReply num_clients clients)
  
 data QueryClientResources = MkQueryClientResources{xid_QueryClientResources
-                                                   :: CARD32}
+                                                   :: Word32}
                           deriving (Show, Typeable)
  
 instance ExtensionRequest QueryClientResources where
@@ -132,12 +133,12 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4 + size (xid_QueryClientResources x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (xid_QueryClientResources x)
                putSkip (requiredPadding size__)
  
 data QueryClientResourcesReply = MkQueryClientResourcesReply{num_types_QueryClientResourcesReply
-                                                             :: CARD32,
+                                                             :: Word32,
                                                              types_QueryClientResourcesReply ::
                                                              [Type]}
                                deriving (Show, Typeable)
@@ -155,7 +156,7 @@
                return (MkQueryClientResourcesReply num_types types)
  
 data QueryClientPixmapBytes = MkQueryClientPixmapBytes{xid_QueryClientPixmapBytes
-                                                       :: CARD32}
+                                                       :: Word32}
                             deriving (Show, Typeable)
  
 instance ExtensionRequest QueryClientPixmapBytes where
@@ -164,14 +165,14 @@
           = do putWord8 extOpCode
                putWord8 3
                let size__ = 4 + size (xid_QueryClientPixmapBytes x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (xid_QueryClientPixmapBytes x)
                putSkip (requiredPadding size__)
  
 data QueryClientPixmapBytesReply = MkQueryClientPixmapBytesReply{bytes_QueryClientPixmapBytesReply
-                                                                 :: CARD32,
+                                                                 :: Word32,
                                                                  bytes_overflow_QueryClientPixmapBytesReply
-                                                                 :: CARD32}
+                                                                 :: Word32}
                                  deriving (Show, Typeable)
  
 instance Deserialize QueryClientPixmapBytesReply where
diff --git a/patched/Graphics/XHB/Gen/SELinux.hs b/patched/Graphics/XHB/Gen/SELinux.hs
--- a/patched/Graphics/XHB/Gen/SELinux.hs
+++ b/patched/Graphics/XHB/Gen/SELinux.hs
@@ -16,6 +16,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -28,18 +31,18 @@
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD8 -> CARD8 -> IO (Receipt QueryVersionReply)
+                 Word8 -> Word8 -> IO (Receipt QueryVersionReply)
 queryVersion c client_major client_minor
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion client_major client_minor
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setDeviceCreateContext ::
                          Graphics.XHB.Connection.Types.Connection ->
-                           CARD32 -> [CChar] -> IO ()
+                           Word32 -> [CChar] -> IO ()
 setDeviceCreateContext c context_len context
   = do let req = MkSetDeviceCreateContext context_len context
        putAction <- serializeExtensionRequest c req
@@ -50,11 +53,11 @@
                          Graphics.XHB.Connection.Types.Connection ->
                            IO (Receipt GetDeviceCreateContextReply)
 getDeviceCreateContext c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetDeviceCreateContext
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setDeviceContext ::
@@ -67,18 +70,18 @@
  
 getDeviceContext ::
                    Graphics.XHB.Connection.Types.Connection ->
-                     CARD32 -> IO (Receipt GetDeviceContextReply)
+                     Word32 -> IO (Receipt GetDeviceContextReply)
 getDeviceContext c device
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetDeviceContext device
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setWindowCreateContext ::
                          Graphics.XHB.Connection.Types.Connection ->
-                           CARD32 -> [CChar] -> IO ()
+                           Word32 -> [CChar] -> IO ()
 setWindowCreateContext c context_len context
   = do let req = MkSetWindowCreateContext context_len context
        putAction <- serializeExtensionRequest c req
@@ -89,27 +92,27 @@
                          Graphics.XHB.Connection.Types.Connection ->
                            IO (Receipt GetWindowCreateContextReply)
 getWindowCreateContext c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetWindowCreateContext
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getWindowContext ::
                    Graphics.XHB.Connection.Types.Connection ->
                      WINDOW -> IO (Receipt GetWindowContextReply)
 getWindowContext c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetWindowContext window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setPropertyCreateContext ::
                            Graphics.XHB.Connection.Types.Connection ->
-                             CARD32 -> [CChar] -> IO ()
+                             Word32 -> [CChar] -> IO ()
 setPropertyCreateContext c context_len context
   = do let req = MkSetPropertyCreateContext context_len context
        putAction <- serializeExtensionRequest c req
@@ -120,16 +123,16 @@
                            Graphics.XHB.Connection.Types.Connection ->
                              IO (Receipt GetPropertyCreateContextReply)
 getPropertyCreateContext c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetPropertyCreateContext
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setPropertyUseContext ::
                         Graphics.XHB.Connection.Types.Connection ->
-                          CARD32 -> [CChar] -> IO ()
+                          Word32 -> [CChar] -> IO ()
 setPropertyUseContext c context_len context
   = do let req = MkSetPropertyUseContext context_len context
        putAction <- serializeExtensionRequest c req
@@ -140,49 +143,49 @@
                         Graphics.XHB.Connection.Types.Connection ->
                           IO (Receipt GetPropertyUseContextReply)
 getPropertyUseContext c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetPropertyUseContext
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getPropertyContext ::
                      Graphics.XHB.Connection.Types.Connection ->
                        WINDOW -> ATOM -> IO (Receipt GetPropertyContextReply)
 getPropertyContext c window property
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetPropertyContext window property
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getPropertyDataContext ::
                          Graphics.XHB.Connection.Types.Connection ->
                            WINDOW -> ATOM -> IO (Receipt GetPropertyDataContextReply)
 getPropertyDataContext c window property
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetPropertyDataContext window property
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 listProperties ::
                  Graphics.XHB.Connection.Types.Connection ->
                    WINDOW -> IO (Receipt ListPropertiesReply)
 listProperties c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListProperties window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setSelectionCreateContext ::
                             Graphics.XHB.Connection.Types.Connection ->
-                              CARD32 -> [CChar] -> IO ()
+                              Word32 -> [CChar] -> IO ()
 setSelectionCreateContext c context_len context
   = do let req = MkSetSelectionCreateContext context_len context
        putAction <- serializeExtensionRequest c req
@@ -193,16 +196,16 @@
                             Graphics.XHB.Connection.Types.Connection ->
                               IO (Receipt GetSelectionCreateContextReply)
 getSelectionCreateContext c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetSelectionCreateContext
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setSelectionUseContext ::
                          Graphics.XHB.Connection.Types.Connection ->
-                           CARD32 -> [CChar] -> IO ()
+                           Word32 -> [CChar] -> IO ()
 setSelectionUseContext c context_len context
   = do let req = MkSetSelectionUseContext context_len context
        putAction <- serializeExtensionRequest c req
@@ -213,53 +216,53 @@
                          Graphics.XHB.Connection.Types.Connection ->
                            IO (Receipt GetSelectionUseContextReply)
 getSelectionUseContext c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetSelectionUseContext
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getSelectionContext ::
                       Graphics.XHB.Connection.Types.Connection ->
                         ATOM -> IO (Receipt GetSelectionContextReply)
 getSelectionContext c selection
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetSelectionContext selection
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getSelectionDataContext ::
                           Graphics.XHB.Connection.Types.Connection ->
                             ATOM -> IO (Receipt GetSelectionDataContextReply)
 getSelectionDataContext c selection
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetSelectionDataContext selection
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 listSelections ::
                  Graphics.XHB.Connection.Types.Connection ->
                    IO (Receipt ListSelectionsReply)
 listSelections c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListSelections
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getClientContext ::
                    Graphics.XHB.Connection.Types.Connection ->
-                     CARD32 -> IO (Receipt GetClientContextReply)
+                     Word32 -> IO (Receipt GetClientContextReply)
 getClientContext c resource
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetClientContext resource
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/SELinux/Types.hs b/patched/Graphics/XHB/Gen/SELinux/Types.hs
--- a/patched/Graphics/XHB/Gen/SELinux/Types.hs
+++ b/patched/Graphics/XHB/Gen/SELinux/Types.hs
@@ -21,6 +21,7 @@
         GetClientContextReply(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -43,8 +44,8 @@
 deserializeEvent _ = Nothing
  
 data QueryVersion = MkQueryVersion{client_major_QueryVersion ::
-                                   CARD8,
-                                   client_minor_QueryVersion :: CARD8}
+                                   Word8,
+                                   client_minor_QueryVersion :: Word8}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -55,14 +56,14 @@
                let size__
                      = 4 + size (client_major_QueryVersion x) +
                          size (client_minor_QueryVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (client_major_QueryVersion x)
                serialize (client_minor_QueryVersion x)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{server_major_QueryVersionReply
-                                             :: CARD16,
-                                             server_minor_QueryVersionReply :: CARD16}
+                                             :: Word16,
+                                             server_minor_QueryVersionReply :: Word16}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -77,7 +78,7 @@
                return (MkQueryVersionReply server_major server_minor)
  
 data SetDeviceCreateContext = MkSetDeviceCreateContext{context_len_SetDeviceCreateContext
-                                                       :: CARD32,
+                                                       :: Word32,
                                                        context_SetDeviceCreateContext :: [CChar]}
                             deriving (Show, Typeable)
  
@@ -89,7 +90,7 @@
                let size__
                      = 4 + size (context_len_SetDeviceCreateContext x) +
                          sum (map size (context_SetDeviceCreateContext x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_len_SetDeviceCreateContext x)
                serializeList (context_SetDeviceCreateContext x)
                putSkip (requiredPadding size__)
@@ -103,11 +104,11 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data GetDeviceCreateContextReply = MkGetDeviceCreateContextReply{context_len_GetDeviceCreateContextReply
-                                                                 :: CARD32,
+                                                                 :: Word32,
                                                                  context_GetDeviceCreateContextReply
                                                                  :: [CChar]}
                                  deriving (Show, Typeable)
@@ -125,8 +126,8 @@
                return (MkGetDeviceCreateContextReply context_len context)
  
 data SetDeviceContext = MkSetDeviceContext{device_SetDeviceContext
-                                           :: CARD32,
-                                           context_len_SetDeviceContext :: CARD32,
+                                           :: Word32,
+                                           context_len_SetDeviceContext :: Word32,
                                            context_SetDeviceContext :: [CChar]}
                       deriving (Show, Typeable)
  
@@ -139,14 +140,14 @@
                      = 4 + size (device_SetDeviceContext x) +
                          size (context_len_SetDeviceContext x)
                          + sum (map size (context_SetDeviceContext x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_SetDeviceContext x)
                serialize (context_len_SetDeviceContext x)
                serializeList (context_SetDeviceContext x)
                putSkip (requiredPadding size__)
  
 data GetDeviceContext = MkGetDeviceContext{device_GetDeviceContext
-                                           :: CARD32}
+                                           :: Word32}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest GetDeviceContext where
@@ -155,12 +156,12 @@
           = do putWord8 extOpCode
                putWord8 4
                let size__ = 4 + size (device_GetDeviceContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (device_GetDeviceContext x)
                putSkip (requiredPadding size__)
  
 data GetDeviceContextReply = MkGetDeviceContextReply{context_len_GetDeviceContextReply
-                                                     :: CARD32,
+                                                     :: Word32,
                                                      context_GetDeviceContextReply :: [CChar]}
                            deriving (Show, Typeable)
  
@@ -177,7 +178,7 @@
                return (MkGetDeviceContextReply context_len context)
  
 data SetWindowCreateContext = MkSetWindowCreateContext{context_len_SetWindowCreateContext
-                                                       :: CARD32,
+                                                       :: Word32,
                                                        context_SetWindowCreateContext :: [CChar]}
                             deriving (Show, Typeable)
  
@@ -189,7 +190,7 @@
                let size__
                      = 4 + size (context_len_SetWindowCreateContext x) +
                          sum (map size (context_SetWindowCreateContext x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_len_SetWindowCreateContext x)
                serializeList (context_SetWindowCreateContext x)
                putSkip (requiredPadding size__)
@@ -203,11 +204,11 @@
           = do putWord8 extOpCode
                putWord8 6
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data GetWindowCreateContextReply = MkGetWindowCreateContextReply{context_len_GetWindowCreateContextReply
-                                                                 :: CARD32,
+                                                                 :: Word32,
                                                                  context_GetWindowCreateContextReply
                                                                  :: [CChar]}
                                  deriving (Show, Typeable)
@@ -234,12 +235,12 @@
           = do putWord8 extOpCode
                putWord8 7
                let size__ = 4 + size (window_GetWindowContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetWindowContext x)
                putSkip (requiredPadding size__)
  
 data GetWindowContextReply = MkGetWindowContextReply{context_len_GetWindowContextReply
-                                                     :: CARD32,
+                                                     :: Word32,
                                                      context_GetWindowContextReply :: [CChar]}
                            deriving (Show, Typeable)
  
@@ -256,8 +257,8 @@
                return (MkGetWindowContextReply context_len context)
  
 data ListItem = MkListItem{name_ListItem :: ATOM,
-                           object_context_len_ListItem :: CARD32,
-                           data_context_len_ListItem :: CARD32,
+                           object_context_len_ListItem :: Word32,
+                           data_context_len_ListItem :: Word32,
                            object_context_ListItem :: [CChar],
                            data_context_ListItem :: [CChar]}
               deriving (Show, Typeable)
@@ -287,7 +288,7 @@
                     data_context)
  
 data SetPropertyCreateContext = MkSetPropertyCreateContext{context_len_SetPropertyCreateContext
-                                                           :: CARD32,
+                                                           :: Word32,
                                                            context_SetPropertyCreateContext ::
                                                            [CChar]}
                               deriving (Show, Typeable)
@@ -300,7 +301,7 @@
                let size__
                      = 4 + size (context_len_SetPropertyCreateContext x) +
                          sum (map size (context_SetPropertyCreateContext x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_len_SetPropertyCreateContext x)
                serializeList (context_SetPropertyCreateContext x)
                putSkip (requiredPadding size__)
@@ -314,11 +315,11 @@
           = do putWord8 extOpCode
                putWord8 9
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data GetPropertyCreateContextReply = MkGetPropertyCreateContextReply{context_len_GetPropertyCreateContextReply
-                                                                     :: CARD32,
+                                                                     :: Word32,
                                                                      context_GetPropertyCreateContextReply
                                                                      :: [CChar]}
                                    deriving (Show, Typeable)
@@ -336,7 +337,7 @@
                return (MkGetPropertyCreateContextReply context_len context)
  
 data SetPropertyUseContext = MkSetPropertyUseContext{context_len_SetPropertyUseContext
-                                                     :: CARD32,
+                                                     :: Word32,
                                                      context_SetPropertyUseContext :: [CChar]}
                            deriving (Show, Typeable)
  
@@ -348,7 +349,7 @@
                let size__
                      = 4 + size (context_len_SetPropertyUseContext x) +
                          sum (map size (context_SetPropertyUseContext x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_len_SetPropertyUseContext x)
                serializeList (context_SetPropertyUseContext x)
                putSkip (requiredPadding size__)
@@ -362,11 +363,11 @@
           = do putWord8 extOpCode
                putWord8 11
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data GetPropertyUseContextReply = MkGetPropertyUseContextReply{context_len_GetPropertyUseContextReply
-                                                               :: CARD32,
+                                                               :: Word32,
                                                                context_GetPropertyUseContextReply ::
                                                                [CChar]}
                                 deriving (Show, Typeable)
@@ -396,13 +397,13 @@
                let size__
                      = 4 + size (window_GetPropertyContext x) +
                          size (property_GetPropertyContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetPropertyContext x)
                serialize (property_GetPropertyContext x)
                putSkip (requiredPadding size__)
  
 data GetPropertyContextReply = MkGetPropertyContextReply{context_len_GetPropertyContextReply
-                                                         :: CARD32,
+                                                         :: Word32,
                                                          context_GetPropertyContextReply :: [CChar]}
                              deriving (Show, Typeable)
  
@@ -431,13 +432,13 @@
                let size__
                      = 4 + size (window_GetPropertyDataContext x) +
                          size (property_GetPropertyDataContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetPropertyDataContext x)
                serialize (property_GetPropertyDataContext x)
                putSkip (requiredPadding size__)
  
 data GetPropertyDataContextReply = MkGetPropertyDataContextReply{context_len_GetPropertyDataContextReply
-                                                                 :: CARD32,
+                                                                 :: Word32,
                                                                  context_GetPropertyDataContextReply
                                                                  :: [CChar]}
                                  deriving (Show, Typeable)
@@ -464,12 +465,12 @@
           = do putWord8 extOpCode
                putWord8 14
                let size__ = 4 + size (window_ListProperties x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_ListProperties x)
                putSkip (requiredPadding size__)
  
 data ListPropertiesReply = MkListPropertiesReply{properties_len_ListPropertiesReply
-                                                 :: CARD32,
+                                                 :: Word32,
                                                  properties_ListPropertiesReply :: [ListItem]}
                          deriving (Show, Typeable)
  
@@ -486,7 +487,7 @@
                return (MkListPropertiesReply properties_len properties)
  
 data SetSelectionCreateContext = MkSetSelectionCreateContext{context_len_SetSelectionCreateContext
-                                                             :: CARD32,
+                                                             :: Word32,
                                                              context_SetSelectionCreateContext ::
                                                              [CChar]}
                                deriving (Show, Typeable)
@@ -499,7 +500,7 @@
                let size__
                      = 4 + size (context_len_SetSelectionCreateContext x) +
                          sum (map size (context_SetSelectionCreateContext x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_len_SetSelectionCreateContext x)
                serializeList (context_SetSelectionCreateContext x)
                putSkip (requiredPadding size__)
@@ -513,11 +514,11 @@
           = do putWord8 extOpCode
                putWord8 16
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data GetSelectionCreateContextReply = MkGetSelectionCreateContextReply{context_len_GetSelectionCreateContextReply
-                                                                       :: CARD32,
+                                                                       :: Word32,
                                                                        context_GetSelectionCreateContextReply
                                                                        :: [CChar]}
                                     deriving (Show, Typeable)
@@ -535,7 +536,7 @@
                return (MkGetSelectionCreateContextReply context_len context)
  
 data SetSelectionUseContext = MkSetSelectionUseContext{context_len_SetSelectionUseContext
-                                                       :: CARD32,
+                                                       :: Word32,
                                                        context_SetSelectionUseContext :: [CChar]}
                             deriving (Show, Typeable)
  
@@ -547,7 +548,7 @@
                let size__
                      = 4 + size (context_len_SetSelectionUseContext x) +
                          sum (map size (context_SetSelectionUseContext x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_len_SetSelectionUseContext x)
                serializeList (context_SetSelectionUseContext x)
                putSkip (requiredPadding size__)
@@ -561,11 +562,11 @@
           = do putWord8 extOpCode
                putWord8 18
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data GetSelectionUseContextReply = MkGetSelectionUseContextReply{context_len_GetSelectionUseContextReply
-                                                                 :: CARD32,
+                                                                 :: Word32,
                                                                  context_GetSelectionUseContextReply
                                                                  :: [CChar]}
                                  deriving (Show, Typeable)
@@ -592,12 +593,12 @@
           = do putWord8 extOpCode
                putWord8 19
                let size__ = 4 + size (selection_GetSelectionContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (selection_GetSelectionContext x)
                putSkip (requiredPadding size__)
  
 data GetSelectionContextReply = MkGetSelectionContextReply{context_len_GetSelectionContextReply
-                                                           :: CARD32,
+                                                           :: Word32,
                                                            context_GetSelectionContextReply ::
                                                            [CChar]}
                               deriving (Show, Typeable)
@@ -624,12 +625,12 @@
           = do putWord8 extOpCode
                putWord8 20
                let size__ = 4 + size (selection_GetSelectionDataContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (selection_GetSelectionDataContext x)
                putSkip (requiredPadding size__)
  
 data GetSelectionDataContextReply = MkGetSelectionDataContextReply{context_len_GetSelectionDataContextReply
-                                                                   :: CARD32,
+                                                                   :: Word32,
                                                                    context_GetSelectionDataContextReply
                                                                    :: [CChar]}
                                   deriving (Show, Typeable)
@@ -655,11 +656,11 @@
           = do putWord8 extOpCode
                putWord8 21
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data ListSelectionsReply = MkListSelectionsReply{selections_len_ListSelectionsReply
-                                                 :: CARD32,
+                                                 :: Word32,
                                                  selections_ListSelectionsReply :: [ListItem]}
                          deriving (Show, Typeable)
  
@@ -676,7 +677,7 @@
                return (MkListSelectionsReply selections_len selections)
  
 data GetClientContext = MkGetClientContext{resource_GetClientContext
-                                           :: CARD32}
+                                           :: Word32}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest GetClientContext where
@@ -685,12 +686,12 @@
           = do putWord8 extOpCode
                putWord8 22
                let size__ = 4 + size (resource_GetClientContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (resource_GetClientContext x)
                putSkip (requiredPadding size__)
  
 data GetClientContextReply = MkGetClientContextReply{context_len_GetClientContextReply
-                                                     :: CARD32,
+                                                     :: Word32,
                                                      context_GetClientContextReply :: [CChar]}
                            deriving (Show, Typeable)
  
diff --git a/patched/Graphics/XHB/Gen/ScreenSaver.hs b/patched/Graphics/XHB/Gen/ScreenSaver.hs
--- a/patched/Graphics/XHB/Gen/ScreenSaver.hs
+++ b/patched/Graphics/XHB/Gen/ScreenSaver.hs
@@ -9,6 +9,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -20,29 +23,29 @@
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD8 -> CARD8 -> IO (Receipt QueryVersionReply)
+                 Word8 -> Word8 -> IO (Receipt QueryVersionReply)
 queryVersion c client_major_version client_minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion client_major_version client_minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryInfo ::
             Graphics.XHB.Connection.Types.Connection ->
               DRAWABLE -> IO (Receipt QueryInfoReply)
 queryInfo c drawable
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryInfo drawable
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 selectInput ::
               Graphics.XHB.Connection.Types.Connection ->
-                DRAWABLE -> CARD32 -> IO ()
+                DRAWABLE -> Word32 -> IO ()
 selectInput c drawable event_mask
   = do let req = MkSelectInput drawable event_mask
        putAction <- serializeExtensionRequest c req
@@ -65,7 +68,7 @@
        sendRequest c chunk
  
 suspend ::
-          Graphics.XHB.Connection.Types.Connection -> BOOL -> IO ()
+          Graphics.XHB.Connection.Types.Connection -> Bool -> IO ()
 suspend c suspend
   = do let req = MkSuspend suspend
        putAction <- serializeExtensionRequest c req
diff --git a/patched/Graphics/XHB/Gen/ScreenSaver/Types.hs b/patched/Graphics/XHB/Gen/ScreenSaver/Types.hs
--- a/patched/Graphics/XHB/Gen/ScreenSaver/Types.hs
+++ b/patched/Graphics/XHB/Gen/ScreenSaver/Types.hs
@@ -5,6 +5,7 @@
         UnsetAttributes(..), Suspend(..), Notify(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -64,8 +65,8 @@
         fromValue 3 = StateDisabled
  
 data QueryVersion = MkQueryVersion{client_major_version_QueryVersion
-                                   :: CARD8,
-                                   client_minor_version_QueryVersion :: CARD8}
+                                   :: Word8,
+                                   client_minor_version_QueryVersion :: Word8}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -77,15 +78,15 @@
                      = 4 + size (client_major_version_QueryVersion x) +
                          size (client_minor_version_QueryVersion x)
                          + 2
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (client_major_version_QueryVersion x)
                serialize (client_minor_version_QueryVersion x)
                putSkip 2
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{server_major_version_QueryVersionReply
-                                             :: CARD16,
-                                             server_minor_version_QueryVersionReply :: CARD16}
+                                             :: Word16,
+                                             server_minor_version_QueryVersionReply :: Word16}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -110,17 +111,17 @@
           = do putWord8 extOpCode
                putWord8 1
                let size__ = 4 + size (drawable_QueryInfo x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_QueryInfo x)
                putSkip (requiredPadding size__)
  
 data QueryInfoReply = MkQueryInfoReply{state_QueryInfoReply ::
-                                       CARD8,
+                                       Word8,
                                        saver_window_QueryInfoReply :: WINDOW,
-                                       ms_until_server_QueryInfoReply :: CARD32,
-                                       ms_since_user_input_QueryInfoReply :: CARD32,
-                                       event_mask_QueryInfoReply :: CARD32,
-                                       kind_QueryInfoReply :: BYTE}
+                                       ms_until_server_QueryInfoReply :: Word32,
+                                       ms_since_user_input_QueryInfoReply :: Word32,
+                                       event_mask_QueryInfoReply :: Word32,
+                                       kind_QueryInfoReply :: Word8}
                     deriving (Show, Typeable)
  
 instance Deserialize QueryInfoReply where
@@ -143,7 +144,7 @@
                     kind)
  
 data SelectInput = MkSelectInput{drawable_SelectInput :: DRAWABLE,
-                                 event_mask_SelectInput :: CARD32}
+                                 event_mask_SelectInput :: Word32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest SelectInput where
@@ -154,19 +155,19 @@
                let size__
                      = 4 + size (drawable_SelectInput x) +
                          size (event_mask_SelectInput x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_SelectInput x)
                serialize (event_mask_SelectInput x)
                putSkip (requiredPadding size__)
  
 data SetAttributes = MkSetAttributes{drawable_SetAttributes ::
                                      DRAWABLE,
-                                     x_SetAttributes :: INT16, y_SetAttributes :: INT16,
-                                     width_SetAttributes :: CARD16, height_SetAttributes :: CARD16,
-                                     border_width_SetAttributes :: CARD16,
-                                     class_SetAttributes :: BYTE, depth_SetAttributes :: CARD8,
+                                     x_SetAttributes :: Int16, y_SetAttributes :: Int16,
+                                     width_SetAttributes :: Word16, height_SetAttributes :: Word16,
+                                     border_width_SetAttributes :: Word16,
+                                     class_SetAttributes :: Word8, depth_SetAttributes :: Word8,
                                      visual_SetAttributes :: VISUALID,
-                                     value_SetAttributes :: ValueParam CARD32}
+                                     value_SetAttributes :: ValueParam Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest SetAttributes where
@@ -184,7 +185,7 @@
                          + size (depth_SetAttributes x)
                          + size (visual_SetAttributes x)
                          + size (value_SetAttributes x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_SetAttributes x)
                serialize (x_SetAttributes x)
                serialize (y_SetAttributes x)
@@ -207,11 +208,11 @@
           = do putWord8 extOpCode
                putWord8 4
                let size__ = 4 + size (drawable_UnsetAttributes x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_UnsetAttributes x)
                putSkip (requiredPadding size__)
  
-data Suspend = MkSuspend{suspend_Suspend :: BOOL}
+data Suspend = MkSuspend{suspend_Suspend :: Bool}
              deriving (Show, Typeable)
  
 instance ExtensionRequest Suspend where
@@ -220,15 +221,15 @@
           = do putWord8 extOpCode
                putWord8 5
                let size__ = 4 + size (suspend_Suspend x) + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (suspend_Suspend x)
                putSkip 3
                putSkip (requiredPadding size__)
  
-data Notify = MkNotify{code_Notify :: CARD8, state_Notify :: BYTE,
-                       sequence_number_Notify :: CARD16, time_Notify :: TIMESTAMP,
+data Notify = MkNotify{code_Notify :: Word8, state_Notify :: Word8,
+                       sequence_number_Notify :: Word16, time_Notify :: TIMESTAMP,
                        root_Notify :: WINDOW, window_Notify :: WINDOW,
-                       kind_Notify :: BYTE, forced_Notify :: BOOL}
+                       kind_Notify :: Word8, forced_Notify :: Bool}
             deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event Notify
diff --git a/patched/Graphics/XHB/Gen/Shape.hs b/patched/Graphics/XHB/Gen/Shape.hs
--- a/patched/Graphics/XHB/Gen/Shape.hs
+++ b/patched/Graphics/XHB/Gen/Shape.hs
@@ -9,6 +9,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -22,11 +25,11 @@
                Graphics.XHB.Connection.Types.Connection ->
                  IO (Receipt QueryVersionReply)
 queryVersion c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 rectangles ::
@@ -60,15 +63,15 @@
                Graphics.XHB.Connection.Types.Connection ->
                  WINDOW -> IO (Receipt QueryExtentsReply)
 queryExtents c destination_window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryExtents destination_window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 selectInput ::
-              Graphics.XHB.Connection.Types.Connection -> WINDOW -> BOOL -> IO ()
+              Graphics.XHB.Connection.Types.Connection -> WINDOW -> Bool -> IO ()
 selectInput c destination_window enable
   = do let req = MkSelectInput destination_window enable
        putAction <- serializeExtensionRequest c req
@@ -77,22 +80,23 @@
  
 inputSelected ::
                 Graphics.XHB.Connection.Types.Connection ->
-                  WINDOW -> IO (Receipt InputSelectedReply)
+                  WINDOW -> IO (Receipt Bool)
 inputSelected c destination_window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (enabled_InputSelectedReply `fmap` deserialize))
        let req = MkInputSelected destination_window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getRectangles ::
                 Graphics.XHB.Connection.Types.Connection ->
                   WINDOW -> KIND -> IO (Receipt GetRectanglesReply)
 getRectangles c window source_kind
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetRectangles window source_kind
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/Shape/Types.hs b/patched/Graphics/XHB/Gen/Shape/Types.hs
--- a/patched/Graphics/XHB/Gen/Shape/Types.hs
+++ b/patched/Graphics/XHB/Gen/Shape/Types.hs
@@ -7,6 +7,7 @@
         GetRectanglesReply(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -29,9 +30,9 @@
   = return (liftM toEvent (deserialize :: Get Notify))
 deserializeEvent _ = Nothing
  
-type OP = CARD8
+type OP = Word8
  
-type KIND = CARD8
+type KIND = Word8
  
 data SO = SOSet
         | SOUnion
@@ -64,10 +65,10 @@
         fromValue 2 = SKInput
  
 data Notify = MkNotify{shape_kind_Notify :: KIND,
-                       affected_window_Notify :: WINDOW, extents_x_Notify :: INT16,
-                       extents_y_Notify :: INT16, extents_width_Notify :: CARD16,
-                       extents_height_Notify :: CARD16, server_time_Notify :: TIMESTAMP,
-                       shaped_Notify :: BOOL}
+                       affected_window_Notify :: WINDOW, extents_x_Notify :: Int16,
+                       extents_y_Notify :: Int16, extents_width_Notify :: Word16,
+                       extents_height_Notify :: Word16, server_time_Notify :: TIMESTAMP,
+                       shaped_Notify :: Bool}
             deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event Notify
@@ -101,12 +102,12 @@
           = do putWord8 extOpCode
                putWord8 0
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{major_version_QueryVersionReply
-                                             :: CARD16,
-                                             minor_version_QueryVersionReply :: CARD16}
+                                             :: Word16,
+                                             minor_version_QueryVersionReply :: Word16}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -121,9 +122,9 @@
                return (MkQueryVersionReply major_version minor_version)
  
 data Rectangles = MkRectangles{operation_Rectangles :: OP,
-                               destination_kind_Rectangles :: KIND, ordering_Rectangles :: BYTE,
+                               destination_kind_Rectangles :: KIND, ordering_Rectangles :: Word8,
                                destination_window_Rectangles :: WINDOW,
-                               x_offset_Rectangles :: INT16, y_offset_Rectangles :: INT16,
+                               x_offset_Rectangles :: Int16, y_offset_Rectangles :: Int16,
                                rectangles_Rectangles :: [RECTANGLE]}
                 deriving (Show, Typeable)
  
@@ -141,7 +142,7 @@
                          + size (x_offset_Rectangles x)
                          + size (y_offset_Rectangles x)
                          + sum (map size (rectangles_Rectangles x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (operation_Rectangles x)
                serialize (destination_kind_Rectangles x)
                serialize (ordering_Rectangles x)
@@ -154,7 +155,7 @@
  
 data Mask = MkMask{operation_Mask :: OP,
                    destination_kind_Mask :: KIND, destination_window_Mask :: WINDOW,
-                   x_offset_Mask :: INT16, y_offset_Mask :: INT16,
+                   x_offset_Mask :: Int16, y_offset_Mask :: Int16,
                    source_bitmap_Mask :: PIXMAP}
           deriving (Show, Typeable)
  
@@ -169,7 +170,7 @@
                          + size (x_offset_Mask x)
                          + size (y_offset_Mask x)
                          + size (source_bitmap_Mask x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (operation_Mask x)
                serialize (destination_kind_Mask x)
                putSkip 2
@@ -181,8 +182,8 @@
  
 data Combine = MkCombine{operation_Combine :: OP,
                          destination_kind_Combine :: KIND, source_kind_Combine :: KIND,
-                         destination_window_Combine :: WINDOW, x_offset_Combine :: INT16,
-                         y_offset_Combine :: INT16, source_window_Combine :: WINDOW}
+                         destination_window_Combine :: WINDOW, x_offset_Combine :: Int16,
+                         y_offset_Combine :: Int16, source_window_Combine :: WINDOW}
              deriving (Show, Typeable)
  
 instance ExtensionRequest Combine where
@@ -199,7 +200,7 @@
                          + size (x_offset_Combine x)
                          + size (y_offset_Combine x)
                          + size (source_window_Combine x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (operation_Combine x)
                serialize (destination_kind_Combine x)
                serialize (source_kind_Combine x)
@@ -211,8 +212,8 @@
                putSkip (requiredPadding size__)
  
 data Offset = MkOffset{destination_kind_Offset :: KIND,
-                       destination_window_Offset :: WINDOW, x_offset_Offset :: INT16,
-                       y_offset_Offset :: INT16}
+                       destination_window_Offset :: WINDOW, x_offset_Offset :: Int16,
+                       y_offset_Offset :: Int16}
             deriving (Show, Typeable)
  
 instance ExtensionRequest Offset where
@@ -225,7 +226,7 @@
                          size (destination_window_Offset x)
                          + size (x_offset_Offset x)
                          + size (y_offset_Offset x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (destination_kind_Offset x)
                putSkip 3
                serialize (destination_window_Offset x)
@@ -243,23 +244,23 @@
           = do putWord8 extOpCode
                putWord8 5
                let size__ = 4 + size (destination_window_QueryExtents x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (destination_window_QueryExtents x)
                putSkip (requiredPadding size__)
  
 data QueryExtentsReply = MkQueryExtentsReply{bounding_shaped_QueryExtentsReply
-                                             :: BOOL,
-                                             clip_shaped_QueryExtentsReply :: BOOL,
-                                             bounding_shape_extents_x_QueryExtentsReply :: INT16,
-                                             bounding_shape_extents_y_QueryExtentsReply :: INT16,
+                                             :: Bool,
+                                             clip_shaped_QueryExtentsReply :: Bool,
+                                             bounding_shape_extents_x_QueryExtentsReply :: Int16,
+                                             bounding_shape_extents_y_QueryExtentsReply :: Int16,
                                              bounding_shape_extents_width_QueryExtentsReply ::
-                                             CARD16,
+                                             Word16,
                                              bounding_shape_extents_height_QueryExtentsReply ::
-                                             CARD16,
-                                             clip_shape_extents_x_QueryExtentsReply :: INT16,
-                                             clip_shape_extents_y_QueryExtentsReply :: INT16,
-                                             clip_shape_extents_width_QueryExtentsReply :: CARD16,
-                                             clip_shape_extents_height_QueryExtentsReply :: CARD16}
+                                             Word16,
+                                             clip_shape_extents_x_QueryExtentsReply :: Int16,
+                                             clip_shape_extents_y_QueryExtentsReply :: Int16,
+                                             clip_shape_extents_width_QueryExtentsReply :: Word16,
+                                             clip_shape_extents_height_QueryExtentsReply :: Word16}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryExtentsReply where
@@ -293,7 +294,7 @@
  
 data SelectInput = MkSelectInput{destination_window_SelectInput ::
                                  WINDOW,
-                                 enable_SelectInput :: BOOL}
+                                 enable_SelectInput :: Bool}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest SelectInput where
@@ -305,7 +306,7 @@
                      = 4 + size (destination_window_SelectInput x) +
                          size (enable_SelectInput x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (destination_window_SelectInput x)
                serialize (enable_SelectInput x)
                putSkip 3
@@ -321,12 +322,12 @@
           = do putWord8 extOpCode
                putWord8 7
                let size__ = 4 + size (destination_window_InputSelected x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (destination_window_InputSelected x)
                putSkip (requiredPadding size__)
  
 data InputSelectedReply = MkInputSelectedReply{enabled_InputSelectedReply
-                                               :: BOOL}
+                                               :: Bool}
                         deriving (Show, Typeable)
  
 instance Deserialize InputSelectedReply where
@@ -352,15 +353,15 @@
                      = 4 + size (window_GetRectangles x) +
                          size (source_kind_GetRectangles x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetRectangles x)
                serialize (source_kind_GetRectangles x)
                putSkip 3
                putSkip (requiredPadding size__)
  
 data GetRectanglesReply = MkGetRectanglesReply{ordering_GetRectanglesReply
-                                               :: BYTE,
-                                               rectangles_len_GetRectanglesReply :: CARD32,
+                                               :: Word8,
+                                               rectangles_len_GetRectanglesReply :: Word32,
                                                rectangles_GetRectanglesReply :: [RECTANGLE]}
                         deriving (Show, Typeable)
  
diff --git a/patched/Graphics/XHB/Gen/Shm.hs b/patched/Graphics/XHB/Gen/Shm.hs
--- a/patched/Graphics/XHB/Gen/Shm.hs
+++ b/patched/Graphics/XHB/Gen/Shm.hs
@@ -8,6 +8,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -22,11 +25,11 @@
                Graphics.XHB.Connection.Types.Connection ->
                  IO (Receipt QueryVersionReply)
 queryVersion c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 attach ::
@@ -54,10 +57,10 @@
            Graphics.XHB.Connection.Types.Connection ->
              GetImage -> IO (Receipt GetImageReply)
 getImage c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createPixmap ::
diff --git a/patched/Graphics/XHB/Gen/Shm/Types.hs b/patched/Graphics/XHB/Gen/Shm/Types.hs
--- a/patched/Graphics/XHB/Gen/Shm/Types.hs
+++ b/patched/Graphics/XHB/Gen/Shm/Types.hs
@@ -5,6 +5,7 @@
         CreatePixmap(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -34,8 +35,8 @@
               deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
  
 data Completion = MkCompletion{drawable_Completion :: DRAWABLE,
-                               shmseg_Completion :: SEG, minor_event_Completion :: CARD16,
-                               major_event_Completion :: BYTE, offset_Completion :: CARD32}
+                               shmseg_Completion :: SEG, minor_event_Completion :: Word16,
+                               major_event_Completion :: Word8, offset_Completion :: Word32}
                 deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event Completion
@@ -54,8 +55,8 @@
                return
                  (MkCompletion drawable shmseg minor_event major_event offset)
  
-data BadSeg = MkBadSeg{bad_value_BadSeg :: CARD32,
-                       minor_opcode_BadSeg :: CARD16, major_opcode_BadSeg :: CARD8}
+data BadSeg = MkBadSeg{bad_value_BadSeg :: Word32,
+                       minor_opcode_BadSeg :: Word16, major_opcode_BadSeg :: Word8}
             deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error BadSeg
@@ -78,16 +79,16 @@
           = do putWord8 extOpCode
                putWord8 0
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{shared_pixmaps_QueryVersionReply
-                                             :: BOOL,
-                                             major_version_QueryVersionReply :: CARD16,
-                                             minor_version_QueryVersionReply :: CARD16,
-                                             uid_QueryVersionReply :: CARD16,
-                                             gid_QueryVersionReply :: CARD16,
-                                             pixmap_format_QueryVersionReply :: CARD8}
+                                             :: Bool,
+                                             major_version_QueryVersionReply :: Word16,
+                                             minor_version_QueryVersionReply :: Word16,
+                                             uid_QueryVersionReply :: Word16,
+                                             gid_QueryVersionReply :: Word16,
+                                             pixmap_format_QueryVersionReply :: Word8}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -109,7 +110,7 @@
                     pixmap_format)
  
 data Attach = MkAttach{shmseg_Attach :: SEG,
-                       shmid_Attach :: CARD32, read_only_Attach :: BOOL}
+                       shmid_Attach :: Word32, read_only_Attach :: Bool}
             deriving (Show, Typeable)
  
 instance ExtensionRequest Attach where
@@ -121,7 +122,7 @@
                      = 4 + size (shmseg_Attach x) + size (shmid_Attach x) +
                          size (read_only_Attach x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (shmseg_Attach x)
                serialize (shmid_Attach x)
                serialize (read_only_Attach x)
@@ -137,18 +138,18 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4 + size (shmseg_Detach x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (shmseg_Detach x)
                putSkip (requiredPadding size__)
  
 data PutImage = MkPutImage{drawable_PutImage :: DRAWABLE,
-                           gc_PutImage :: GCONTEXT, total_width_PutImage :: CARD16,
-                           total_height_PutImage :: CARD16, src_x_PutImage :: CARD16,
-                           src_y_PutImage :: CARD16, src_width_PutImage :: CARD16,
-                           src_height_PutImage :: CARD16, dst_x_PutImage :: INT16,
-                           dst_y_PutImage :: INT16, depth_PutImage :: CARD8,
-                           format_PutImage :: CARD8, send_event_PutImage :: CARD8,
-                           shmseg_PutImage :: SEG, offset_PutImage :: CARD32}
+                           gc_PutImage :: GCONTEXT, total_width_PutImage :: Word16,
+                           total_height_PutImage :: Word16, src_x_PutImage :: Word16,
+                           src_y_PutImage :: Word16, src_width_PutImage :: Word16,
+                           src_height_PutImage :: Word16, dst_x_PutImage :: Int16,
+                           dst_y_PutImage :: Int16, depth_PutImage :: Word8,
+                           format_PutImage :: Word8, send_event_PutImage :: Word8,
+                           shmseg_PutImage :: SEG, offset_PutImage :: Word32}
               deriving (Show, Typeable)
  
 instance ExtensionRequest PutImage where
@@ -172,7 +173,7 @@
                          + 1
                          + size (shmseg_PutImage x)
                          + size (offset_PutImage x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_PutImage x)
                serialize (gc_PutImage x)
                serialize (total_width_PutImage x)
@@ -192,10 +193,10 @@
                putSkip (requiredPadding size__)
  
 data GetImage = MkGetImage{drawable_GetImage :: DRAWABLE,
-                           x_GetImage :: INT16, y_GetImage :: INT16, width_GetImage :: CARD16,
-                           height_GetImage :: CARD16, plane_mask_GetImage :: CARD32,
-                           format_GetImage :: CARD8, shmseg_GetImage :: SEG,
-                           offset_GetImage :: CARD32}
+                           x_GetImage :: Int16, y_GetImage :: Int16, width_GetImage :: Word16,
+                           height_GetImage :: Word16, plane_mask_GetImage :: Word32,
+                           format_GetImage :: Word8, shmseg_GetImage :: SEG,
+                           offset_GetImage :: Word32}
               deriving (Show, Typeable)
  
 instance ExtensionRequest GetImage where
@@ -213,7 +214,7 @@
                          + 3
                          + size (shmseg_GetImage x)
                          + size (offset_GetImage x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_GetImage x)
                serialize (x_GetImage x)
                serialize (y_GetImage x)
@@ -226,8 +227,8 @@
                serialize (offset_GetImage x)
                putSkip (requiredPadding size__)
  
-data GetImageReply = MkGetImageReply{depth_GetImageReply :: CARD8,
-                                     visual_GetImageReply :: VISUALID, size_GetImageReply :: CARD32}
+data GetImageReply = MkGetImageReply{depth_GetImageReply :: Word8,
+                                     visual_GetImageReply :: VISUALID, size_GetImageReply :: Word32}
                    deriving (Show, Typeable)
  
 instance Deserialize GetImageReply where
@@ -242,9 +243,9 @@
                return (MkGetImageReply depth visual size)
  
 data CreatePixmap = MkCreatePixmap{pid_CreatePixmap :: PIXMAP,
-                                   drawable_CreatePixmap :: DRAWABLE, width_CreatePixmap :: CARD16,
-                                   height_CreatePixmap :: CARD16, depth_CreatePixmap :: CARD8,
-                                   shmseg_CreatePixmap :: SEG, offset_CreatePixmap :: CARD32}
+                                   drawable_CreatePixmap :: DRAWABLE, width_CreatePixmap :: Word16,
+                                   height_CreatePixmap :: Word16, depth_CreatePixmap :: Word8,
+                                   shmseg_CreatePixmap :: SEG, offset_CreatePixmap :: Word32}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest CreatePixmap where
@@ -260,7 +261,7 @@
                          + 3
                          + size (shmseg_CreatePixmap x)
                          + size (offset_CreatePixmap x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (pid_CreatePixmap x)
                serialize (drawable_CreatePixmap x)
                serialize (width_CreatePixmap x)
diff --git a/patched/Graphics/XHB/Gen/Sync.hs b/patched/Graphics/XHB/Gen/Sync.hs
--- a/patched/Graphics/XHB/Gen/Sync.hs
+++ b/patched/Graphics/XHB/Gen/Sync.hs
@@ -10,6 +10,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -21,24 +24,24 @@
  
 initialize ::
              Graphics.XHB.Connection.Types.Connection ->
-               CARD8 -> CARD8 -> IO (Receipt InitializeReply)
+               Word8 -> Word8 -> IO (Receipt InitializeReply)
 initialize c desired_major_version desired_minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkInitialize desired_major_version desired_minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 listSystemCounters ::
                      Graphics.XHB.Connection.Types.Connection ->
                        IO (Receipt ListSystemCountersReply)
 listSystemCounters c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListSystemCounters
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createCounter ::
@@ -60,13 +63,14 @@
  
 queryCounter ::
                Graphics.XHB.Connection.Types.Connection ->
-                 COUNTER -> IO (Receipt QueryCounterReply)
+                 COUNTER -> IO (Receipt INT64)
 queryCounter c counter
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (counter_value_QueryCounterReply `fmap` deserialize))
        let req = MkQueryCounter counter
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 await ::
@@ -98,7 +102,7 @@
  
 createAlarm ::
               Graphics.XHB.Connection.Types.Connection ->
-                ALARM -> ValueParam CARD32 -> IO ()
+                ALARM -> ValueParam Word32 -> IO ()
 createAlarm c id value
   = do let req = MkCreateAlarm id value
        putAction <- serializeExtensionRequest c req
@@ -107,7 +111,7 @@
  
 changeAlarm ::
               Graphics.XHB.Connection.Types.Connection ->
-                ALARM -> ValueParam CARD32 -> IO ()
+                ALARM -> ValueParam Word32 -> IO ()
 changeAlarm c id value
   = do let req = MkChangeAlarm id value
        putAction <- serializeExtensionRequest c req
@@ -126,16 +130,16 @@
              Graphics.XHB.Connection.Types.Connection ->
                ALARM -> IO (Receipt QueryAlarmReply)
 queryAlarm c alarm
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryAlarm alarm
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setPriority ::
               Graphics.XHB.Connection.Types.Connection ->
-                CARD32 -> INT32 -> IO ()
+                Word32 -> Int32 -> IO ()
 setPriority c id priority
   = do let req = MkSetPriority id priority
        putAction <- serializeExtensionRequest c req
@@ -144,11 +148,12 @@
  
 getPriority ::
               Graphics.XHB.Connection.Types.Connection ->
-                CARD32 -> IO (Receipt GetPriorityReply)
+                Word32 -> IO (Receipt Int32)
 getPriority c id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (priority_GetPriorityReply `fmap` deserialize))
        let req = MkGetPriority id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/Sync/Types.hs b/patched/Graphics/XHB/Gen/Sync/Types.hs
--- a/patched/Graphics/XHB/Gen/Sync/Types.hs
+++ b/patched/Graphics/XHB/Gen/Sync/Types.hs
@@ -12,6 +12,7 @@
         AlarmNotify(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -103,7 +104,7 @@
         fromBit 4 = CADelta
         fromBit 5 = CAEvents
  
-data INT64 = MkINT64{hi_INT64 :: INT32, lo_INT64 :: CARD32}
+data INT64 = MkINT64{hi_INT64 :: Int32, lo_INT64 :: Word32}
            deriving (Show, Typeable)
  
 instance Serialize INT64 where
@@ -121,7 +122,7 @@
 data SYSTEMCOUNTER = MkSYSTEMCOUNTER{counter_SYSTEMCOUNTER ::
                                      COUNTER,
                                      resolution_SYSTEMCOUNTER :: INT64,
-                                     name_len_SYSTEMCOUNTER :: CARD16,
+                                     name_len_SYSTEMCOUNTER :: Word16,
                                      name_SYSTEMCOUNTER :: [CChar]}
                    deriving (Show, Typeable)
  
@@ -146,8 +147,8 @@
                return (MkSYSTEMCOUNTER counter resolution name_len name)
  
 data TRIGGER = MkTRIGGER{counter_TRIGGER :: COUNTER,
-                         wait_type_TRIGGER :: CARD32, wait_value_TRIGGER :: INT64,
-                         test_type_TRIGGER :: CARD32}
+                         wait_type_TRIGGER :: Word32, wait_value_TRIGGER :: INT64,
+                         test_type_TRIGGER :: Word32}
              deriving (Show, Typeable)
  
 instance Serialize TRIGGER where
@@ -188,8 +189,8 @@
                event_threshold <- deserialize
                return (MkWAITCONDITION trigger event_threshold)
  
-data Counter = MkCounter{bad_counter_Counter :: CARD32,
-                         minor_opcode_Counter :: CARD16, major_opcode_Counter :: CARD8}
+data Counter = MkCounter{bad_counter_Counter :: Word32,
+                         minor_opcode_Counter :: Word16, major_opcode_Counter :: Word8}
              deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error Counter
@@ -202,8 +203,8 @@
                major_opcode <- deserialize
                return (MkCounter bad_counter minor_opcode major_opcode)
  
-data Alarm = MkAlarm{bad_alarm_Alarm :: CARD32,
-                     minor_opcode_Alarm :: CARD16, major_opcode_Alarm :: CARD8}
+data Alarm = MkAlarm{bad_alarm_Alarm :: Word32,
+                     minor_opcode_Alarm :: Word16, major_opcode_Alarm :: Word8}
            deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Error Alarm
@@ -217,8 +218,8 @@
                return (MkAlarm bad_alarm minor_opcode major_opcode)
  
 data Initialize = MkInitialize{desired_major_version_Initialize ::
-                               CARD8,
-                               desired_minor_version_Initialize :: CARD8}
+                               Word8,
+                               desired_minor_version_Initialize :: Word8}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest Initialize where
@@ -229,14 +230,14 @@
                let size__
                      = 4 + size (desired_major_version_Initialize x) +
                          size (desired_minor_version_Initialize x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (desired_major_version_Initialize x)
                serialize (desired_minor_version_Initialize x)
                putSkip (requiredPadding size__)
  
 data InitializeReply = MkInitializeReply{major_version_InitializeReply
-                                         :: CARD8,
-                                         minor_version_InitializeReply :: CARD8}
+                                         :: Word8,
+                                         minor_version_InitializeReply :: Word8}
                      deriving (Show, Typeable)
  
 instance Deserialize InitializeReply where
@@ -260,11 +261,11 @@
           = do putWord8 extOpCode
                putWord8 1
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data ListSystemCountersReply = MkListSystemCountersReply{counters_len_ListSystemCountersReply
-                                                         :: CARD32,
+                                                         :: Word32,
                                                          counters_ListSystemCountersReply ::
                                                          [SYSTEMCOUNTER]}
                              deriving (Show, Typeable)
@@ -293,7 +294,7 @@
                let size__
                      = 4 + size (id_CreateCounter x) +
                          size (initial_value_CreateCounter x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (id_CreateCounter x)
                serialize (initial_value_CreateCounter x)
                putSkip (requiredPadding size__)
@@ -308,7 +309,7 @@
           = do putWord8 extOpCode
                putWord8 6
                let size__ = 4 + size (counter_DestroyCounter x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (counter_DestroyCounter x)
                putSkip (requiredPadding size__)
  
@@ -321,7 +322,7 @@
           = do putWord8 extOpCode
                putWord8 5
                let size__ = 4 + size (counter_QueryCounter x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (counter_QueryCounter x)
                putSkip (requiredPadding size__)
  
@@ -348,7 +349,7 @@
           = do putWord8 extOpCode
                putWord8 7
                let size__ = 4 + sum (map size (wait_list_Await x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serializeList (wait_list_Await x)
                putSkip (requiredPadding size__)
  
@@ -365,7 +366,7 @@
                let size__
                      = 4 + size (counter_ChangeCounter x) +
                          size (amount_ChangeCounter x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (counter_ChangeCounter x)
                serialize (amount_ChangeCounter x)
                putSkip (requiredPadding size__)
@@ -381,13 +382,13 @@
                putWord8 3
                let size__
                      = 4 + size (counter_SetCounter x) + size (value_SetCounter x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (counter_SetCounter x)
                serialize (value_SetCounter x)
                putSkip (requiredPadding size__)
  
 data CreateAlarm = MkCreateAlarm{id_CreateAlarm :: ALARM,
-                                 value_CreateAlarm :: ValueParam CARD32}
+                                 value_CreateAlarm :: ValueParam Word32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest CreateAlarm where
@@ -397,13 +398,13 @@
                putWord8 8
                let size__
                      = 4 + size (id_CreateAlarm x) + size (value_CreateAlarm x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (id_CreateAlarm x)
                serialize (value_CreateAlarm x)
                putSkip (requiredPadding size__)
  
 data ChangeAlarm = MkChangeAlarm{id_ChangeAlarm :: ALARM,
-                                 value_ChangeAlarm :: ValueParam CARD32}
+                                 value_ChangeAlarm :: ValueParam Word32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest ChangeAlarm where
@@ -413,7 +414,7 @@
                putWord8 9
                let size__
                      = 4 + size (id_ChangeAlarm x) + size (value_ChangeAlarm x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (id_ChangeAlarm x)
                serialize (value_ChangeAlarm x)
                putSkip (requiredPadding size__)
@@ -427,7 +428,7 @@
           = do putWord8 extOpCode
                putWord8 11
                let size__ = 4 + size (alarm_DestroyAlarm x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (alarm_DestroyAlarm x)
                putSkip (requiredPadding size__)
  
@@ -440,15 +441,15 @@
           = do putWord8 extOpCode
                putWord8 10
                let size__ = 4 + size (alarm_QueryAlarm x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (alarm_QueryAlarm x)
                putSkip (requiredPadding size__)
  
 data QueryAlarmReply = MkQueryAlarmReply{trigger_QueryAlarmReply ::
                                          TRIGGER,
                                          delta_QueryAlarmReply :: INT64,
-                                         events_QueryAlarmReply :: BOOL,
-                                         state_QueryAlarmReply :: CARD8}
+                                         events_QueryAlarmReply :: Bool,
+                                         state_QueryAlarmReply :: Word8}
                      deriving (Show, Typeable)
  
 instance Deserialize QueryAlarmReply where
@@ -465,8 +466,8 @@
                let _ = isCard32 length
                return (MkQueryAlarmReply trigger delta events state)
  
-data SetPriority = MkSetPriority{id_SetPriority :: CARD32,
-                                 priority_SetPriority :: INT32}
+data SetPriority = MkSetPriority{id_SetPriority :: Word32,
+                                 priority_SetPriority :: Int32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest SetPriority where
@@ -476,12 +477,12 @@
                putWord8 12
                let size__
                      = 4 + size (id_SetPriority x) + size (priority_SetPriority x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (id_SetPriority x)
                serialize (priority_SetPriority x)
                putSkip (requiredPadding size__)
  
-data GetPriority = MkGetPriority{id_GetPriority :: CARD32}
+data GetPriority = MkGetPriority{id_GetPriority :: Word32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest GetPriority where
@@ -490,12 +491,12 @@
           = do putWord8 extOpCode
                putWord8 13
                let size__ = 4 + size (id_GetPriority x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (id_GetPriority x)
                putSkip (requiredPadding size__)
  
 data GetPriorityReply = MkGetPriorityReply{priority_GetPriorityReply
-                                           :: INT32}
+                                           :: Int32}
                       deriving (Show, Typeable)
  
 instance Deserialize GetPriorityReply where
@@ -508,12 +509,12 @@
                let _ = isCard32 length
                return (MkGetPriorityReply priority)
  
-data CounterNotify = MkCounterNotify{kind_CounterNotify :: CARD8,
+data CounterNotify = MkCounterNotify{kind_CounterNotify :: Word8,
                                      counter_CounterNotify :: COUNTER,
                                      wait_value_CounterNotify :: INT64,
                                      counter_value_CounterNotify :: INT64,
                                      timestamp_CounterNotify :: TIMESTAMP,
-                                     count_CounterNotify :: CARD16, destroyed_CounterNotify :: BOOL}
+                                     count_CounterNotify :: Word16, destroyed_CounterNotify :: Bool}
                    deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event CounterNotify
@@ -535,7 +536,7 @@
                     count
                     destroyed)
  
-data AlarmNotify = MkAlarmNotify{kind_AlarmNotify :: CARD8,
+data AlarmNotify = MkAlarmNotify{kind_AlarmNotify :: Word8,
                                  alarm_AlarmNotify :: ALARM, counter_value_AlarmNotify :: INT64,
                                  alarm_value_AlarmNotify :: INT64,
                                  timestamp_AlarmNotify :: TIMESTAMP}
diff --git a/patched/Graphics/XHB/Gen/Test.hs b/patched/Graphics/XHB/Gen/Test.hs
--- a/patched/Graphics/XHB/Gen/Test.hs
+++ b/patched/Graphics/XHB/Gen/Test.hs
@@ -8,6 +8,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -19,24 +22,25 @@
  
 getVersion ::
              Graphics.XHB.Connection.Types.Connection ->
-               CARD8 -> CARD16 -> IO (Receipt GetVersionReply)
+               Word8 -> Word16 -> IO (Receipt GetVersionReply)
 getVersion c major_version minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetVersion major_version minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 compareCursor ::
                 Graphics.XHB.Connection.Types.Connection ->
-                  WINDOW -> CURSOR -> IO (Receipt CompareCursorReply)
+                  WINDOW -> CURSOR -> IO (Receipt Bool)
 compareCursor c window cursor
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (same_CompareCursorReply `fmap` deserialize))
        let req = MkCompareCursor window cursor
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 fakeInput ::
@@ -47,7 +51,7 @@
        sendRequest c chunk
  
 grabControl ::
-              Graphics.XHB.Connection.Types.Connection -> BOOL -> IO ()
+              Graphics.XHB.Connection.Types.Connection -> Bool -> IO ()
 grabControl c impervious
   = do let req = MkGrabControl impervious
        putAction <- serializeExtensionRequest c req
diff --git a/patched/Graphics/XHB/Gen/Test/Types.hs b/patched/Graphics/XHB/Gen/Test/Types.hs
--- a/patched/Graphics/XHB/Gen/Test/Types.hs
+++ b/patched/Graphics/XHB/Gen/Test/Types.hs
@@ -4,6 +4,7 @@
         CompareCursorReply(..), FakeInput(..), GrabControl(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -24,8 +25,8 @@
 deserializeEvent :: Word8 -> Maybe (Get SomeEvent)
 deserializeEvent _ = Nothing
  
-data GetVersion = MkGetVersion{major_version_GetVersion :: CARD8,
-                               minor_version_GetVersion :: CARD16}
+data GetVersion = MkGetVersion{major_version_GetVersion :: Word8,
+                               minor_version_GetVersion :: Word16}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest GetVersion where
@@ -36,15 +37,15 @@
                let size__
                      = 4 + size (major_version_GetVersion x) + 1 +
                          size (minor_version_GetVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (major_version_GetVersion x)
                putSkip 1
                serialize (minor_version_GetVersion x)
                putSkip (requiredPadding size__)
  
 data GetVersionReply = MkGetVersionReply{major_version_GetVersionReply
-                                         :: CARD8,
-                                         minor_version_GetVersionReply :: CARD16}
+                                         :: Word8,
+                                         minor_version_GetVersionReply :: Word16}
                      deriving (Show, Typeable)
  
 instance Deserialize GetVersionReply where
@@ -78,13 +79,13 @@
                putWord8 1
                let size__
                      = 4 + size (window_CompareCursor x) + size (cursor_CompareCursor x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_CompareCursor x)
                serialize (cursor_CompareCursor x)
                putSkip (requiredPadding size__)
  
 data CompareCursorReply = MkCompareCursorReply{same_CompareCursorReply
-                                               :: BOOL}
+                                               :: Bool}
                         deriving (Show, Typeable)
  
 instance Deserialize CompareCursorReply where
@@ -96,10 +97,10 @@
                let _ = isCard32 length
                return (MkCompareCursorReply same)
  
-data FakeInput = MkFakeInput{type_FakeInput :: BYTE,
-                             detail_FakeInput :: BYTE, time_FakeInput :: CARD32,
-                             window_FakeInput :: WINDOW, rootX_FakeInput :: CARD16,
-                             rootY_FakeInput :: CARD16, deviceid_FakeInput :: CARD8}
+data FakeInput = MkFakeInput{type_FakeInput :: Word8,
+                             detail_FakeInput :: Word8, time_FakeInput :: Word32,
+                             window_FakeInput :: WINDOW, rootX_FakeInput :: Word16,
+                             rootY_FakeInput :: Word16, deviceid_FakeInput :: Word8}
                deriving (Show, Typeable)
  
 instance ExtensionRequest FakeInput where
@@ -116,7 +117,7 @@
                          + size (rootY_FakeInput x)
                          + 7
                          + size (deviceid_FakeInput x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (type_FakeInput x)
                serialize (detail_FakeInput x)
                putSkip 2
@@ -129,7 +130,7 @@
                serialize (deviceid_FakeInput x)
                putSkip (requiredPadding size__)
  
-data GrabControl = MkGrabControl{impervious_GrabControl :: BOOL}
+data GrabControl = MkGrabControl{impervious_GrabControl :: Bool}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest GrabControl where
@@ -138,7 +139,7 @@
           = do putWord8 extOpCode
                putWord8 3
                let size__ = 4 + size (impervious_GrabControl x) + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (impervious_GrabControl x)
                putSkip 3
                putSkip (requiredPadding size__)
diff --git a/patched/Graphics/XHB/Gen/XCMisc.hs b/patched/Graphics/XHB/Gen/XCMisc.hs
--- a/patched/Graphics/XHB/Gen/XCMisc.hs
+++ b/patched/Graphics/XHB/Gen/XCMisc.hs
@@ -8,6 +8,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
  
@@ -16,33 +19,33 @@
  
 getVersion ::
              Graphics.XHB.Connection.Types.Connection ->
-               CARD16 -> CARD16 -> IO (Receipt GetVersionReply)
+               Word16 -> Word16 -> IO (Receipt GetVersionReply)
 getVersion c client_major_version client_minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetVersion client_major_version client_minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getXIDRange ::
               Graphics.XHB.Connection.Types.Connection ->
                 IO (Receipt GetXIDRangeReply)
 getXIDRange c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetXIDRange
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getXIDList ::
              Graphics.XHB.Connection.Types.Connection ->
-               CARD32 -> IO (Receipt GetXIDListReply)
+               Word32 -> IO (Receipt GetXIDListReply)
 getXIDList c count
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetXIDList count
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/XCMisc/Types.hs b/patched/Graphics/XHB/Gen/XCMisc/Types.hs
--- a/patched/Graphics/XHB/Gen/XCMisc/Types.hs
+++ b/patched/Graphics/XHB/Gen/XCMisc/Types.hs
@@ -4,6 +4,7 @@
         GetXIDList(..), GetXIDListReply(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -22,8 +23,8 @@
 deserializeEvent _ = Nothing
  
 data GetVersion = MkGetVersion{client_major_version_GetVersion ::
-                               CARD16,
-                               client_minor_version_GetVersion :: CARD16}
+                               Word16,
+                               client_minor_version_GetVersion :: Word16}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest GetVersion where
@@ -34,14 +35,14 @@
                let size__
                      = 4 + size (client_major_version_GetVersion x) +
                          size (client_minor_version_GetVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (client_major_version_GetVersion x)
                serialize (client_minor_version_GetVersion x)
                putSkip (requiredPadding size__)
  
 data GetVersionReply = MkGetVersionReply{server_major_version_GetVersionReply
-                                         :: CARD16,
-                                         server_minor_version_GetVersionReply :: CARD16}
+                                         :: Word16,
+                                         server_minor_version_GetVersionReply :: Word16}
                      deriving (Show, Typeable)
  
 instance Deserialize GetVersionReply where
@@ -65,12 +66,12 @@
           = do putWord8 extOpCode
                putWord8 1
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data GetXIDRangeReply = MkGetXIDRangeReply{start_id_GetXIDRangeReply
-                                           :: CARD32,
-                                           count_GetXIDRangeReply :: CARD32}
+                                           :: Word32,
+                                           count_GetXIDRangeReply :: Word32}
                       deriving (Show, Typeable)
  
 instance Deserialize GetXIDRangeReply where
@@ -84,7 +85,7 @@
                let _ = isCard32 length
                return (MkGetXIDRangeReply start_id count)
  
-data GetXIDList = MkGetXIDList{count_GetXIDList :: CARD32}
+data GetXIDList = MkGetXIDList{count_GetXIDList :: Word32}
                 deriving (Show, Typeable)
  
 instance ExtensionRequest GetXIDList where
@@ -93,13 +94,13 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4 + size (count_GetXIDList x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (count_GetXIDList x)
                putSkip (requiredPadding size__)
  
 data GetXIDListReply = MkGetXIDListReply{ids_len_GetXIDListReply ::
-                                         CARD32,
-                                         ids_GetXIDListReply :: [CARD32]}
+                                         Word32,
+                                         ids_GetXIDListReply :: [Word32]}
                      deriving (Show, Typeable)
  
 instance Deserialize GetXIDListReply where
diff --git a/patched/Graphics/XHB/Gen/XF86Dri.hs b/patched/Graphics/XHB/Gen/XF86Dri.hs
--- a/patched/Graphics/XHB/Gen/XF86Dri.hs
+++ b/patched/Graphics/XHB/Gen/XF86Dri.hs
@@ -11,6 +11,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
  
@@ -21,37 +24,39 @@
                Graphics.XHB.Connection.Types.Connection ->
                  IO (Receipt QueryVersionReply)
 queryVersion c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryDirectRenderingCapable ::
                               Graphics.XHB.Connection.Types.Connection ->
-                                CARD32 -> IO (Receipt QueryDirectRenderingCapableReply)
+                                Word32 -> IO (Receipt Bool)
 queryDirectRenderingCapable c screen
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet
+                                   (is_capable_QueryDirectRenderingCapableReply `fmap` deserialize))
        let req = MkQueryDirectRenderingCapable screen
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 openConnection ::
                  Graphics.XHB.Connection.Types.Connection ->
-                   CARD32 -> IO (Receipt OpenConnectionReply)
+                   Word32 -> IO (Receipt OpenConnectionReply)
 openConnection c screen
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkOpenConnection screen
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 closeConnection ::
-                  Graphics.XHB.Connection.Types.Connection -> CARD32 -> IO ()
+                  Graphics.XHB.Connection.Types.Connection -> Word32 -> IO ()
 closeConnection c screen
   = do let req = MkCloseConnection screen
        putAction <- serializeExtensionRequest c req
@@ -60,28 +65,29 @@
  
 getClientDriverName ::
                       Graphics.XHB.Connection.Types.Connection ->
-                        CARD32 -> IO (Receipt GetClientDriverNameReply)
+                        Word32 -> IO (Receipt GetClientDriverNameReply)
 getClientDriverName c screen
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetClientDriverName screen
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createContext ::
                 Graphics.XHB.Connection.Types.Connection ->
-                  CreateContext -> IO (Receipt CreateContextReply)
+                  CreateContext -> IO (Receipt Word32)
 createContext c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (hw_context_CreateContextReply `fmap` deserialize))
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 destroyContext ::
                  Graphics.XHB.Connection.Types.Connection ->
-                   CARD32 -> CARD32 -> IO ()
+                   Word32 -> Word32 -> IO ()
 destroyContext c screen context
   = do let req = MkDestroyContext screen context
        putAction <- serializeExtensionRequest c req
@@ -90,18 +96,20 @@
  
 createDrawable ::
                  Graphics.XHB.Connection.Types.Connection ->
-                   CARD32 -> CARD32 -> IO (Receipt CreateDrawableReply)
+                   Word32 -> Word32 -> IO (Receipt Word32)
 createDrawable c screen drawable
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet
+                                   (hw_drawable_handle_CreateDrawableReply `fmap` deserialize))
        let req = MkCreateDrawable screen drawable
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 destroyDrawable ::
                   Graphics.XHB.Connection.Types.Connection ->
-                    CARD32 -> CARD32 -> IO ()
+                    Word32 -> Word32 -> IO ()
 destroyDrawable c screen drawable
   = do let req = MkDestroyDrawable screen drawable
        putAction <- serializeExtensionRequest c req
@@ -110,33 +118,34 @@
  
 getDrawableInfo ::
                   Graphics.XHB.Connection.Types.Connection ->
-                    CARD32 -> CARD32 -> IO (Receipt GetDrawableInfoReply)
+                    Word32 -> Word32 -> IO (Receipt GetDrawableInfoReply)
 getDrawableInfo c screen drawable
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetDrawableInfo screen drawable
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getDeviceInfo ::
                 Graphics.XHB.Connection.Types.Connection ->
-                  CARD32 -> IO (Receipt GetDeviceInfoReply)
+                  Word32 -> IO (Receipt GetDeviceInfoReply)
 getDeviceInfo c screen
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetDeviceInfo screen
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 authConnection ::
                  Graphics.XHB.Connection.Types.Connection ->
-                   CARD32 -> CARD32 -> IO (Receipt AuthConnectionReply)
+                   Word32 -> Word32 -> IO (Receipt Word32)
 authConnection c screen magic
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (authenticated_AuthConnectionReply `fmap` deserialize))
        let req = MkAuthConnection screen magic
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/XF86Dri/Types.hs b/patched/Graphics/XHB/Gen/XF86Dri/Types.hs
--- a/patched/Graphics/XHB/Gen/XF86Dri/Types.hs
+++ b/patched/Graphics/XHB/Gen/XF86Dri/Types.hs
@@ -12,6 +12,7 @@
         AuthConnectionReply(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -29,9 +30,9 @@
 deserializeEvent :: Word8 -> Maybe (Get SomeEvent)
 deserializeEvent _ = Nothing
  
-data DrmClipRect = MkDrmClipRect{x1_DrmClipRect :: INT16,
-                                 y1_DrmClipRect :: INT16, x2_DrmClipRect :: INT16,
-                                 x3_DrmClipRect :: INT16}
+data DrmClipRect = MkDrmClipRect{x1_DrmClipRect :: Int16,
+                                 y1_DrmClipRect :: Int16, x2_DrmClipRect :: Int16,
+                                 x3_DrmClipRect :: Int16}
                  deriving (Show, Typeable)
  
 instance Serialize DrmClipRect where
@@ -62,13 +63,13 @@
           = do putWord8 extOpCode
                putWord8 0
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{dri_major_version_QueryVersionReply
-                                             :: CARD16,
-                                             dri_minor_version_QueryVersionReply :: CARD16,
-                                             dri_minor_patch_QueryVersionReply :: CARD32}
+                                             :: Word16,
+                                             dri_minor_version_QueryVersionReply :: Word16,
+                                             dri_minor_patch_QueryVersionReply :: Word32}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -86,7 +87,7 @@
                     dri_minor_patch)
  
 data QueryDirectRenderingCapable = MkQueryDirectRenderingCapable{screen_QueryDirectRenderingCapable
-                                                                 :: CARD32}
+                                                                 :: Word32}
                                  deriving (Show, Typeable)
  
 instance ExtensionRequest QueryDirectRenderingCapable where
@@ -95,12 +96,12 @@
           = do putWord8 extOpCode
                putWord8 1
                let size__ = 4 + size (screen_QueryDirectRenderingCapable x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_QueryDirectRenderingCapable x)
                putSkip (requiredPadding size__)
  
 data QueryDirectRenderingCapableReply = MkQueryDirectRenderingCapableReply{is_capable_QueryDirectRenderingCapableReply
-                                                                           :: BOOL}
+                                                                           :: Bool}
                                       deriving (Show, Typeable)
  
 instance Deserialize QueryDirectRenderingCapableReply where
@@ -114,7 +115,7 @@
                return (MkQueryDirectRenderingCapableReply is_capable)
  
 data OpenConnection = MkOpenConnection{screen_OpenConnection ::
-                                       CARD32}
+                                       Word32}
                     deriving (Show, Typeable)
  
 instance ExtensionRequest OpenConnection where
@@ -123,16 +124,16 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4 + size (screen_OpenConnection x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_OpenConnection x)
                putSkip (requiredPadding size__)
  
 data OpenConnectionReply = MkOpenConnectionReply{drm_client_key_low_OpenConnectionReply
-                                                 :: CARD32,
-                                                 drm_client_key_high_OpenConnectionReply :: CARD32,
-                                                 sarea_handle_low_OpenConnectionReply :: CARD32,
-                                                 sarea_handle_high_OpenConnectionReply :: CARD32,
-                                                 bus_id_len_OpenConnectionReply :: CARD32,
+                                                 :: Word32,
+                                                 drm_client_key_high_OpenConnectionReply :: Word32,
+                                                 sarea_handle_low_OpenConnectionReply :: Word32,
+                                                 sarea_handle_high_OpenConnectionReply :: Word32,
+                                                 bus_id_len_OpenConnectionReply :: Word32,
                                                  bus_id_OpenConnectionReply :: [CChar]}
                          deriving (Show, Typeable)
  
@@ -158,7 +159,7 @@
                     bus_id)
  
 data CloseConnection = MkCloseConnection{screen_CloseConnection ::
-                                         CARD32}
+                                         Word32}
                      deriving (Show, Typeable)
  
 instance ExtensionRequest CloseConnection where
@@ -167,12 +168,12 @@
           = do putWord8 extOpCode
                putWord8 3
                let size__ = 4 + size (screen_CloseConnection x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_CloseConnection x)
                putSkip (requiredPadding size__)
  
 data GetClientDriverName = MkGetClientDriverName{screen_GetClientDriverName
-                                                 :: CARD32}
+                                                 :: Word32}
                          deriving (Show, Typeable)
  
 instance ExtensionRequest GetClientDriverName where
@@ -181,18 +182,18 @@
           = do putWord8 extOpCode
                putWord8 4
                let size__ = 4 + size (screen_GetClientDriverName x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_GetClientDriverName x)
                putSkip (requiredPadding size__)
  
 data GetClientDriverNameReply = MkGetClientDriverNameReply{client_driver_major_version_GetClientDriverNameReply
-                                                           :: CARD32,
+                                                           :: Word32,
                                                            client_driver_minor_version_GetClientDriverNameReply
-                                                           :: CARD32,
+                                                           :: Word32,
                                                            client_driver_patch_version_GetClientDriverNameReply
-                                                           :: CARD32,
+                                                           :: Word32,
                                                            client_driver_name_len_GetClientDriverNameReply
-                                                           :: CARD32,
+                                                           :: Word32,
                                                            client_driver_name_GetClientDriverNameReply
                                                            :: [CChar]}
                               deriving (Show, Typeable)
@@ -219,9 +220,9 @@
                     client_driver_name)
  
 data CreateContext = MkCreateContext{visual_CreateContext ::
-                                     CARD32,
-                                     screen_CreateContext :: CARD32,
-                                     context_CreateContext :: CARD32}
+                                     Word32,
+                                     screen_CreateContext :: Word32,
+                                     context_CreateContext :: Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest CreateContext where
@@ -232,14 +233,14 @@
                let size__
                      = 4 + size (visual_CreateContext x) + size (screen_CreateContext x)
                          + size (context_CreateContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (visual_CreateContext x)
                serialize (screen_CreateContext x)
                serialize (context_CreateContext x)
                putSkip (requiredPadding size__)
  
 data CreateContextReply = MkCreateContextReply{hw_context_CreateContextReply
-                                               :: CARD32}
+                                               :: Word32}
                         deriving (Show, Typeable)
  
 instance Deserialize CreateContextReply where
@@ -253,8 +254,8 @@
                return (MkCreateContextReply hw_context)
  
 data DestroyContext = MkDestroyContext{screen_DestroyContext ::
-                                       CARD32,
-                                       context_DestroyContext :: CARD32}
+                                       Word32,
+                                       context_DestroyContext :: Word32}
                     deriving (Show, Typeable)
  
 instance ExtensionRequest DestroyContext where
@@ -265,14 +266,14 @@
                let size__
                      = 4 + size (screen_DestroyContext x) +
                          size (context_DestroyContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_DestroyContext x)
                serialize (context_DestroyContext x)
                putSkip (requiredPadding size__)
  
 data CreateDrawable = MkCreateDrawable{screen_CreateDrawable ::
-                                       CARD32,
-                                       drawable_CreateDrawable :: CARD32}
+                                       Word32,
+                                       drawable_CreateDrawable :: Word32}
                     deriving (Show, Typeable)
  
 instance ExtensionRequest CreateDrawable where
@@ -283,13 +284,13 @@
                let size__
                      = 4 + size (screen_CreateDrawable x) +
                          size (drawable_CreateDrawable x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_CreateDrawable x)
                serialize (drawable_CreateDrawable x)
                putSkip (requiredPadding size__)
  
 data CreateDrawableReply = MkCreateDrawableReply{hw_drawable_handle_CreateDrawableReply
-                                                 :: CARD32}
+                                                 :: Word32}
                          deriving (Show, Typeable)
  
 instance Deserialize CreateDrawableReply where
@@ -303,8 +304,8 @@
                return (MkCreateDrawableReply hw_drawable_handle)
  
 data DestroyDrawable = MkDestroyDrawable{screen_DestroyDrawable ::
-                                         CARD32,
-                                         drawable_DestroyDrawable :: CARD32}
+                                         Word32,
+                                         drawable_DestroyDrawable :: Word32}
                      deriving (Show, Typeable)
  
 instance ExtensionRequest DestroyDrawable where
@@ -315,14 +316,14 @@
                let size__
                      = 4 + size (screen_DestroyDrawable x) +
                          size (drawable_DestroyDrawable x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_DestroyDrawable x)
                serialize (drawable_DestroyDrawable x)
                putSkip (requiredPadding size__)
  
 data GetDrawableInfo = MkGetDrawableInfo{screen_GetDrawableInfo ::
-                                         CARD32,
-                                         drawable_GetDrawableInfo :: CARD32}
+                                         Word32,
+                                         drawable_GetDrawableInfo :: Word32}
                      deriving (Show, Typeable)
  
 instance ExtensionRequest GetDrawableInfo where
@@ -333,20 +334,20 @@
                let size__
                      = 4 + size (screen_GetDrawableInfo x) +
                          size (drawable_GetDrawableInfo x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_GetDrawableInfo x)
                serialize (drawable_GetDrawableInfo x)
                putSkip (requiredPadding size__)
  
 data GetDrawableInfoReply = MkGetDrawableInfoReply{drawable_table_index_GetDrawableInfoReply
-                                                   :: CARD32,
+                                                   :: Word32,
                                                    drawable_table_stamp_GetDrawableInfoReply ::
-                                                   CARD32,
-                                                   drawable_origin_X_GetDrawableInfoReply :: INT16,
-                                                   drawable_origin_Y_GetDrawableInfoReply :: INT16,
-                                                   drawable_size_W_GetDrawableInfoReply :: INT16,
-                                                   drawable_size_H_GetDrawableInfoReply :: INT16,
-                                                   num_clip_rects_GetDrawableInfoReply :: CARD32,
+                                                   Word32,
+                                                   drawable_origin_X_GetDrawableInfoReply :: Int16,
+                                                   drawable_origin_Y_GetDrawableInfoReply :: Int16,
+                                                   drawable_size_W_GetDrawableInfoReply :: Int16,
+                                                   drawable_size_H_GetDrawableInfoReply :: Int16,
+                                                   num_clip_rects_GetDrawableInfoReply :: Word32,
                                                    clip_rects_GetDrawableInfoReply :: [DrmClipRect]}
                           deriving (Show, Typeable)
  
@@ -376,7 +377,7 @@
                     clip_rects)
  
 data GetDeviceInfo = MkGetDeviceInfo{screen_GetDeviceInfo ::
-                                     CARD32}
+                                     Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest GetDeviceInfo where
@@ -385,19 +386,19 @@
           = do putWord8 extOpCode
                putWord8 10
                let size__ = 4 + size (screen_GetDeviceInfo x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_GetDeviceInfo x)
                putSkip (requiredPadding size__)
  
 data GetDeviceInfoReply = MkGetDeviceInfoReply{framebuffer_handle_low_GetDeviceInfoReply
-                                               :: CARD32,
-                                               framebuffer_handle_high_GetDeviceInfoReply :: CARD32,
+                                               :: Word32,
+                                               framebuffer_handle_high_GetDeviceInfoReply :: Word32,
                                                framebuffer_origin_offset_GetDeviceInfoReply ::
-                                               CARD32,
-                                               framebuffer_size_GetDeviceInfoReply :: CARD32,
-                                               framebuffer_stride_GetDeviceInfoReply :: CARD32,
-                                               device_private_size_GetDeviceInfoReply :: CARD32,
-                                               device_private_GetDeviceInfoReply :: [CARD32]}
+                                               Word32,
+                                               framebuffer_size_GetDeviceInfoReply :: Word32,
+                                               framebuffer_stride_GetDeviceInfoReply :: Word32,
+                                               device_private_size_GetDeviceInfoReply :: Word32,
+                                               device_private_GetDeviceInfoReply :: [Word32]}
                         deriving (Show, Typeable)
  
 instance Deserialize GetDeviceInfoReply where
@@ -425,8 +426,8 @@
                     device_private)
  
 data AuthConnection = MkAuthConnection{screen_AuthConnection ::
-                                       CARD32,
-                                       magic_AuthConnection :: CARD32}
+                                       Word32,
+                                       magic_AuthConnection :: Word32}
                     deriving (Show, Typeable)
  
 instance ExtensionRequest AuthConnection where
@@ -437,13 +438,13 @@
                let size__
                      = 4 + size (screen_AuthConnection x) +
                          size (magic_AuthConnection x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_AuthConnection x)
                serialize (magic_AuthConnection x)
                putSkip (requiredPadding size__)
  
 data AuthConnectionReply = MkAuthConnectionReply{authenticated_AuthConnectionReply
-                                                 :: CARD32}
+                                                 :: Word32}
                          deriving (Show, Typeable)
  
 instance Deserialize AuthConnectionReply where
diff --git a/patched/Graphics/XHB/Gen/XFixes.hs b/patched/Graphics/XHB/Gen/XFixes.hs
--- a/patched/Graphics/XHB/Gen/XFixes.hs
+++ b/patched/Graphics/XHB/Gen/XFixes.hs
@@ -16,6 +16,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -36,13 +39,13 @@
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)
+                 Word32 -> Word32 -> IO (Receipt QueryVersionReply)
 queryVersion c client_major_version client_minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion client_major_version client_minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 changeSaveSet ::
@@ -62,7 +65,7 @@
  
 selectCursorInput ::
                     Graphics.XHB.Connection.Types.Connection ->
-                      WINDOW -> CARD32 -> IO ()
+                      WINDOW -> Word32 -> IO ()
 selectCursorInput c window event_mask
   = do let req = MkSelectCursorInput window event_mask
        putAction <- serializeExtensionRequest c req
@@ -73,11 +76,11 @@
                  Graphics.XHB.Connection.Types.Connection ->
                    IO (Receipt GetCursorImageReply)
 getCursorImage c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetCursorImage
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createRegion ::
@@ -200,11 +203,11 @@
               Graphics.XHB.Connection.Types.Connection ->
                 REGION -> IO (Receipt FetchRegionReply)
 fetchRegion c region
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkFetchRegion region
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setGCClipRegion ::
@@ -242,22 +245,22 @@
                 Graphics.XHB.Connection.Types.Connection ->
                   CURSOR -> IO (Receipt GetCursorNameReply)
 getCursorName c cursor
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetCursorName cursor
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getCursorImageAndName ::
                         Graphics.XHB.Connection.Types.Connection ->
                           IO (Receipt GetCursorImageAndNameReply)
 getCursorImageAndName c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetCursorImageAndName
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 changeCursor ::
diff --git a/patched/Graphics/XHB/Gen/XFixes/Types.hs b/patched/Graphics/XHB/Gen/XFixes/Types.hs
--- a/patched/Graphics/XHB/Gen/XFixes/Types.hs
+++ b/patched/Graphics/XHB/Gen/XFixes/Types.hs
@@ -19,6 +19,7 @@
         HideCursor(..), ShowCursor(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -53,8 +54,8 @@
 deserializeEvent _ = Nothing
  
 data QueryVersion = MkQueryVersion{client_major_version_QueryVersion
-                                   :: CARD32,
-                                   client_minor_version_QueryVersion :: CARD32}
+                                   :: Word32,
+                                   client_minor_version_QueryVersion :: Word32}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -65,14 +66,14 @@
                let size__
                      = 4 + size (client_major_version_QueryVersion x) +
                          size (client_minor_version_QueryVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (client_major_version_QueryVersion x)
                serialize (client_minor_version_QueryVersion x)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{major_version_QueryVersionReply
-                                             :: CARD32,
-                                             minor_version_QueryVersionReply :: CARD32}
+                                             :: Word32,
+                                             minor_version_QueryVersionReply :: Word32}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -114,8 +115,8 @@
         fromValue 0 = SaveSetMappingMap
         fromValue 1 = SaveSetMappingUnmap
  
-data ChangeSaveSet = MkChangeSaveSet{mode_ChangeSaveSet :: BYTE,
-                                     target_ChangeSaveSet :: BYTE, map_ChangeSaveSet :: BYTE,
+data ChangeSaveSet = MkChangeSaveSet{mode_ChangeSaveSet :: Word8,
+                                     target_ChangeSaveSet :: Word8, map_ChangeSaveSet :: Word8,
                                      window_ChangeSaveSet :: WINDOW}
                    deriving (Show, Typeable)
  
@@ -129,7 +130,7 @@
                          size (map_ChangeSaveSet x)
                          + 1
                          + size (window_ChangeSaveSet x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (mode_ChangeSaveSet x)
                serialize (target_ChangeSaveSet x)
                serialize (map_ChangeSaveSet x)
@@ -162,7 +163,7 @@
         fromBit 2 = SelectionEventMaskSelectionClientClose
  
 data SelectionNotify = MkSelectionNotify{subtype_SelectionNotify ::
-                                         CARD8,
+                                         Word8,
                                          window_SelectionNotify :: WINDOW,
                                          owner_SelectionNotify :: WINDOW,
                                          selection_SelectionNotify :: ATOM,
@@ -190,7 +191,7 @@
 data SelectSelectionInput = MkSelectSelectionInput{window_SelectSelectionInput
                                                    :: WINDOW,
                                                    selection_SelectSelectionInput :: ATOM,
-                                                   event_mask_SelectSelectionInput :: CARD32}
+                                                   event_mask_SelectSelectionInput :: Word32}
                           deriving (Show, Typeable)
  
 instance ExtensionRequest SelectSelectionInput where
@@ -202,7 +203,7 @@
                      = 4 + size (window_SelectSelectionInput x) +
                          size (selection_SelectSelectionInput x)
                          + size (event_mask_SelectSelectionInput x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_SelectSelectionInput x)
                serialize (selection_SelectSelectionInput x)
                serialize (event_mask_SelectSelectionInput x)
@@ -220,9 +221,9 @@
         toBit CursorNotifyMaskDisplayCursor{} = 0
         fromBit 0 = CursorNotifyMaskDisplayCursor
  
-data CursorNotify = MkCursorNotify{subtype_CursorNotify :: CARD8,
+data CursorNotify = MkCursorNotify{subtype_CursorNotify :: Word8,
                                    window_CursorNotify :: WINDOW,
-                                   cursor_serial_CursorNotify :: CARD32,
+                                   cursor_serial_CursorNotify :: Word32,
                                    timestamp_CursorNotify :: TIMESTAMP, name_CursorNotify :: ATOM}
                   deriving (Show, Typeable)
  
@@ -242,7 +243,7 @@
  
 data SelectCursorInput = MkSelectCursorInput{window_SelectCursorInput
                                              :: WINDOW,
-                                             event_mask_SelectCursorInput :: CARD32}
+                                             event_mask_SelectCursorInput :: Word32}
                        deriving (Show, Typeable)
  
 instance ExtensionRequest SelectCursorInput where
@@ -253,7 +254,7 @@
                let size__
                      = 4 + size (window_SelectCursorInput x) +
                          size (event_mask_SelectCursorInput x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_SelectCursorInput x)
                serialize (event_mask_SelectCursorInput x)
                putSkip (requiredPadding size__)
@@ -267,18 +268,18 @@
           = do putWord8 extOpCode
                putWord8 4
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data GetCursorImageReply = MkGetCursorImageReply{x_GetCursorImageReply
-                                                 :: INT16,
-                                                 y_GetCursorImageReply :: INT16,
-                                                 width_GetCursorImageReply :: CARD16,
-                                                 height_GetCursorImageReply :: CARD16,
-                                                 xhot_GetCursorImageReply :: CARD16,
-                                                 yhot_GetCursorImageReply :: CARD16,
-                                                 cursor_serial_GetCursorImageReply :: CARD32,
-                                                 cursor_image_GetCursorImageReply :: [CARD32]}
+                                                 :: Int16,
+                                                 y_GetCursorImageReply :: Int16,
+                                                 width_GetCursorImageReply :: Word16,
+                                                 height_GetCursorImageReply :: Word16,
+                                                 xhot_GetCursorImageReply :: Word16,
+                                                 yhot_GetCursorImageReply :: Word16,
+                                                 cursor_serial_GetCursorImageReply :: Word32,
+                                                 cursor_image_GetCursorImageReply :: [Word32]}
                          deriving (Show, Typeable)
  
 instance Deserialize GetCursorImageReply where
@@ -317,7 +318,7 @@
                let size__
                      = 4 + size (region_CreateRegion x) +
                          sum (map size (rectangles_CreateRegion x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (region_CreateRegion x)
                serializeList (rectangles_CreateRegion x)
                putSkip (requiredPadding size__)
@@ -335,7 +336,7 @@
                let size__
                      = 4 + size (region_CreateRegionFromBitmap x) +
                          size (bitmap_CreateRegionFromBitmap x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (region_CreateRegionFromBitmap x)
                serialize (bitmap_CreateRegionFromBitmap x)
                putSkip (requiredPadding size__)
@@ -357,7 +358,7 @@
                          size (window_CreateRegionFromWindow x)
                          + size (kind_CreateRegionFromWindow x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (region_CreateRegionFromWindow x)
                serialize (window_CreateRegionFromWindow x)
                serialize (kind_CreateRegionFromWindow x)
@@ -377,7 +378,7 @@
                let size__
                      = 4 + size (region_CreateRegionFromGC x) +
                          size (gc_CreateRegionFromGC x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (region_CreateRegionFromGC x)
                serialize (gc_CreateRegionFromGC x)
                putSkip (requiredPadding size__)
@@ -395,7 +396,7 @@
                let size__
                      = 4 + size (region_CreateRegionFromPicture x) +
                          size (picture_CreateRegionFromPicture x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (region_CreateRegionFromPicture x)
                serialize (picture_CreateRegionFromPicture x)
                putSkip (requiredPadding size__)
@@ -410,7 +411,7 @@
           = do putWord8 extOpCode
                putWord8 10
                let size__ = 4 + size (region_DestroyRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (region_DestroyRegion x)
                putSkip (requiredPadding size__)
  
@@ -426,7 +427,7 @@
                let size__
                      = 4 + size (region_SetRegion x) +
                          sum (map size (rectangles_SetRegion x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (region_SetRegion x)
                serializeList (rectangles_SetRegion x)
                putSkip (requiredPadding size__)
@@ -442,7 +443,7 @@
                putWord8 12
                let size__
                      = 4 + size (source_CopyRegion x) + size (destination_CopyRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (source_CopyRegion x)
                serialize (destination_CopyRegion x)
                putSkip (requiredPadding size__)
@@ -459,7 +460,7 @@
                let size__
                      = 4 + size (source1_UnionRegion x) + size (source2_UnionRegion x) +
                          size (destination_UnionRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (source1_UnionRegion x)
                serialize (source2_UnionRegion x)
                serialize (destination_UnionRegion x)
@@ -480,7 +481,7 @@
                      = 4 + size (source1_IntersectRegion x) +
                          size (source2_IntersectRegion x)
                          + size (destination_IntersectRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (source1_IntersectRegion x)
                serialize (source2_IntersectRegion x)
                serialize (destination_IntersectRegion x)
@@ -501,7 +502,7 @@
                      = 4 + size (source1_SubtractRegion x) +
                          size (source2_SubtractRegion x)
                          + size (destination_SubtractRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (source1_SubtractRegion x)
                serialize (source2_SubtractRegion x)
                serialize (destination_SubtractRegion x)
@@ -520,7 +521,7 @@
                let size__
                      = 4 + size (source_InvertRegion x) + size (bounds_InvertRegion x) +
                          size (destination_InvertRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (source_InvertRegion x)
                serialize (bounds_InvertRegion x)
                serialize (destination_InvertRegion x)
@@ -528,7 +529,7 @@
  
 data TranslateRegion = MkTranslateRegion{region_TranslateRegion ::
                                          REGION,
-                                         dx_TranslateRegion :: INT16, dy_TranslateRegion :: INT16}
+                                         dx_TranslateRegion :: Int16, dy_TranslateRegion :: Int16}
                      deriving (Show, Typeable)
  
 instance ExtensionRequest TranslateRegion where
@@ -539,7 +540,7 @@
                let size__
                      = 4 + size (region_TranslateRegion x) + size (dx_TranslateRegion x)
                          + size (dy_TranslateRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (region_TranslateRegion x)
                serialize (dx_TranslateRegion x)
                serialize (dy_TranslateRegion x)
@@ -558,7 +559,7 @@
                let size__
                      = 4 + size (source_RegionExtents x) +
                          size (destination_RegionExtents x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (source_RegionExtents x)
                serialize (destination_RegionExtents x)
                putSkip (requiredPadding size__)
@@ -572,7 +573,7 @@
           = do putWord8 extOpCode
                putWord8 19
                let size__ = 4 + size (region_FetchRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (region_FetchRegion x)
                putSkip (requiredPadding size__)
  
@@ -596,8 +597,8 @@
 data SetGCClipRegion = MkSetGCClipRegion{gc_SetGCClipRegion ::
                                          GCONTEXT,
                                          region_SetGCClipRegion :: REGION,
-                                         x_origin_SetGCClipRegion :: INT16,
-                                         y_origin_SetGCClipRegion :: INT16}
+                                         x_origin_SetGCClipRegion :: Int16,
+                                         y_origin_SetGCClipRegion :: Int16}
                      deriving (Show, Typeable)
  
 instance ExtensionRequest SetGCClipRegion where
@@ -609,7 +610,7 @@
                      = 4 + size (gc_SetGCClipRegion x) + size (region_SetGCClipRegion x)
                          + size (x_origin_SetGCClipRegion x)
                          + size (y_origin_SetGCClipRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (gc_SetGCClipRegion x)
                serialize (region_SetGCClipRegion x)
                serialize (x_origin_SetGCClipRegion x)
@@ -620,8 +621,8 @@
                                                    :: WINDOW,
                                                    dest_kind_SetWindowShapeRegion ::
                                                    Graphics.XHB.Gen.Shape.Types.KIND,
-                                                   x_offset_SetWindowShapeRegion :: INT16,
-                                                   y_offset_SetWindowShapeRegion :: INT16,
+                                                   x_offset_SetWindowShapeRegion :: Int16,
+                                                   y_offset_SetWindowShapeRegion :: Int16,
                                                    region_SetWindowShapeRegion :: REGION}
                           deriving (Show, Typeable)
  
@@ -637,7 +638,7 @@
                          + size (x_offset_SetWindowShapeRegion x)
                          + size (y_offset_SetWindowShapeRegion x)
                          + size (region_SetWindowShapeRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (dest_SetWindowShapeRegion x)
                serialize (dest_kind_SetWindowShapeRegion x)
                putSkip 3
@@ -649,8 +650,8 @@
 data SetPictureClipRegion = MkSetPictureClipRegion{picture_SetPictureClipRegion
                                                    :: PICTURE,
                                                    region_SetPictureClipRegion :: REGION,
-                                                   x_origin_SetPictureClipRegion :: INT16,
-                                                   y_origin_SetPictureClipRegion :: INT16}
+                                                   x_origin_SetPictureClipRegion :: Int16,
+                                                   y_origin_SetPictureClipRegion :: Int16}
                           deriving (Show, Typeable)
  
 instance ExtensionRequest SetPictureClipRegion where
@@ -663,7 +664,7 @@
                          size (region_SetPictureClipRegion x)
                          + size (x_origin_SetPictureClipRegion x)
                          + size (y_origin_SetPictureClipRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (picture_SetPictureClipRegion x)
                serialize (region_SetPictureClipRegion x)
                serialize (x_origin_SetPictureClipRegion x)
@@ -672,7 +673,7 @@
  
 data SetCursorName = MkSetCursorName{cursor_SetCursorName ::
                                      CURSOR,
-                                     nbytes_SetCursorName :: CARD16, name_SetCursorName :: [CChar]}
+                                     nbytes_SetCursorName :: Word16, name_SetCursorName :: [CChar]}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest SetCursorName where
@@ -684,7 +685,7 @@
                      = 4 + size (cursor_SetCursorName x) + size (nbytes_SetCursorName x)
                          + 2
                          + sum (map size (name_SetCursorName x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (cursor_SetCursorName x)
                serialize (nbytes_SetCursorName x)
                putSkip 2
@@ -701,13 +702,13 @@
           = do putWord8 extOpCode
                putWord8 24
                let size__ = 4 + size (cursor_GetCursorName x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (cursor_GetCursorName x)
                putSkip (requiredPadding size__)
  
 data GetCursorNameReply = MkGetCursorNameReply{atom_GetCursorNameReply
                                                :: ATOM,
-                                               nbytes_GetCursorNameReply :: CARD16,
+                                               nbytes_GetCursorNameReply :: Word16,
                                                name_GetCursorNameReply :: [CChar]}
                         deriving (Show, Typeable)
  
@@ -733,31 +734,31 @@
           = do putWord8 extOpCode
                putWord8 25
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data GetCursorImageAndNameReply = MkGetCursorImageAndNameReply{x_GetCursorImageAndNameReply
-                                                               :: INT16,
+                                                               :: Int16,
                                                                y_GetCursorImageAndNameReply ::
-                                                               INT16,
+                                                               Int16,
                                                                width_GetCursorImageAndNameReply ::
-                                                               CARD16,
+                                                               Word16,
                                                                height_GetCursorImageAndNameReply ::
-                                                               CARD16,
+                                                               Word16,
                                                                xhot_GetCursorImageAndNameReply ::
-                                                               CARD16,
+                                                               Word16,
                                                                yhot_GetCursorImageAndNameReply ::
-                                                               CARD16,
+                                                               Word16,
                                                                cursor_serial_GetCursorImageAndNameReply
-                                                               :: CARD32,
+                                                               :: Word32,
                                                                cursor_atom_GetCursorImageAndNameReply
                                                                :: ATOM,
                                                                nbytes_GetCursorImageAndNameReply ::
-                                                               CARD16,
+                                                               Word16,
                                                                name_GetCursorImageAndNameReply ::
                                                                [CChar],
                                                                cursor_image_GetCursorImageAndNameReply
-                                                               :: [CARD32]}
+                                                               :: [Word32]}
                                 deriving (Show, Typeable)
  
 instance Deserialize GetCursorImageAndNameReply where
@@ -800,14 +801,14 @@
                let size__
                      = 4 + size (source_ChangeCursor x) +
                          size (destination_ChangeCursor x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (source_ChangeCursor x)
                serialize (destination_ChangeCursor x)
                putSkip (requiredPadding size__)
  
 data ChangeCursorByName = MkChangeCursorByName{src_ChangeCursorByName
                                                :: CURSOR,
-                                               nbytes_ChangeCursorByName :: CARD16,
+                                               nbytes_ChangeCursorByName :: Word16,
                                                name_ChangeCursorByName :: [CChar]}
                         deriving (Show, Typeable)
  
@@ -821,7 +822,7 @@
                          size (nbytes_ChangeCursorByName x)
                          + 2
                          + sum (map size (name_ChangeCursorByName x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (src_ChangeCursorByName x)
                serialize (nbytes_ChangeCursorByName x)
                putSkip 2
@@ -829,9 +830,9 @@
                putSkip (requiredPadding size__)
  
 data ExpandRegion = MkExpandRegion{source_ExpandRegion :: REGION,
-                                   destination_ExpandRegion :: REGION, left_ExpandRegion :: CARD16,
-                                   right_ExpandRegion :: CARD16, top_ExpandRegion :: CARD16,
-                                   bottom_ExpandRegion :: CARD16}
+                                   destination_ExpandRegion :: REGION, left_ExpandRegion :: Word16,
+                                   right_ExpandRegion :: Word16, top_ExpandRegion :: Word16,
+                                   bottom_ExpandRegion :: Word16}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest ExpandRegion where
@@ -846,7 +847,7 @@
                          + size (right_ExpandRegion x)
                          + size (top_ExpandRegion x)
                          + size (bottom_ExpandRegion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (source_ExpandRegion x)
                serialize (destination_ExpandRegion x)
                serialize (left_ExpandRegion x)
@@ -864,7 +865,7 @@
           = do putWord8 extOpCode
                putWord8 29
                let size__ = 4 + size (window_HideCursor x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_HideCursor x)
                putSkip (requiredPadding size__)
  
@@ -877,6 +878,6 @@
           = do putWord8 extOpCode
                putWord8 30
                let size__ = 4 + size (window_ShowCursor x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_ShowCursor x)
                putSkip (requiredPadding size__)
diff --git a/patched/Graphics/XHB/Gen/XPrint.hs b/patched/Graphics/XHB/Gen/XPrint.hs
--- a/patched/Graphics/XHB/Gen/XPrint.hs
+++ b/patched/Graphics/XHB/Gen/XPrint.hs
@@ -14,6 +14,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -27,21 +30,21 @@
                     Graphics.XHB.Connection.Types.Connection ->
                       IO (Receipt PrintQueryVersionReply)
 printQueryVersion c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkPrintQueryVersion
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 printGetPrinterList ::
                       Graphics.XHB.Connection.Types.Connection ->
                         PrintGetPrinterList -> IO (Receipt PrintGetPrinterListReply)
 printGetPrinterList c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createContext ::
@@ -52,7 +55,7 @@
        sendRequest c chunk
  
 printSetContext ::
-                  Graphics.XHB.Connection.Types.Connection -> CARD32 -> IO ()
+                  Graphics.XHB.Connection.Types.Connection -> Word32 -> IO ()
 printSetContext c context
   = do let req = MkPrintSetContext context
        putAction <- serializeExtensionRequest c req
@@ -60,18 +63,18 @@
        sendRequest c chunk
  
 printGetContext ::
-                  Graphics.XHB.Connection.Types.Connection ->
-                    IO (Receipt PrintGetContextReply)
+                  Graphics.XHB.Connection.Types.Connection -> IO (Receipt Word32)
 printGetContext c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (context_PrintGetContextReply `fmap` deserialize))
        let req = MkPrintGetContext
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 printDestroyContext ::
-                      Graphics.XHB.Connection.Types.Connection -> CARD32 -> IO ()
+                      Graphics.XHB.Connection.Types.Connection -> Word32 -> IO ()
 printDestroyContext c context
   = do let req = MkPrintDestroyContext context
        putAction <- serializeExtensionRequest c req
@@ -79,18 +82,18 @@
        sendRequest c chunk
  
 printGetScreenOfContext ::
-                          Graphics.XHB.Connection.Types.Connection ->
-                            IO (Receipt PrintGetScreenOfContextReply)
+                          Graphics.XHB.Connection.Types.Connection -> IO (Receipt WINDOW)
 printGetScreenOfContext c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (root_PrintGetScreenOfContextReply `fmap` deserialize))
        let req = MkPrintGetScreenOfContext
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 printStartJob ::
-                Graphics.XHB.Connection.Types.Connection -> CARD8 -> IO ()
+                Graphics.XHB.Connection.Types.Connection -> Word8 -> IO ()
 printStartJob c output_mode
   = do let req = MkPrintStartJob output_mode
        putAction <- serializeExtensionRequest c req
@@ -98,7 +101,7 @@
        sendRequest c chunk
  
 printEndJob ::
-              Graphics.XHB.Connection.Types.Connection -> BOOL -> IO ()
+              Graphics.XHB.Connection.Types.Connection -> Bool -> IO ()
 printEndJob c cancel
   = do let req = MkPrintEndJob cancel
        putAction <- serializeExtensionRequest c req
@@ -106,7 +109,7 @@
        sendRequest c chunk
  
 printStartDoc ::
-                Graphics.XHB.Connection.Types.Connection -> CARD8 -> IO ()
+                Graphics.XHB.Connection.Types.Connection -> Word8 -> IO ()
 printStartDoc c driver_mode
   = do let req = MkPrintStartDoc driver_mode
        putAction <- serializeExtensionRequest c req
@@ -114,7 +117,7 @@
        sendRequest c chunk
  
 printEndDoc ::
-              Graphics.XHB.Connection.Types.Connection -> BOOL -> IO ()
+              Graphics.XHB.Connection.Types.Connection -> Bool -> IO ()
 printEndDoc c cancel
   = do let req = MkPrintEndDoc cancel
        putAction <- serializeExtensionRequest c req
@@ -131,13 +134,13 @@
  
 printGetDocumentData ::
                        Graphics.XHB.Connection.Types.Connection ->
-                         PCONTEXT -> CARD32 -> IO (Receipt PrintGetDocumentDataReply)
+                         PCONTEXT -> Word32 -> IO (Receipt PrintGetDocumentDataReply)
 printGetDocumentData c context max_bytes
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkPrintGetDocumentData context max_bytes
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 printStartPage ::
@@ -149,7 +152,7 @@
        sendRequest c chunk
  
 printEndPage ::
-               Graphics.XHB.Connection.Types.Connection -> BOOL -> IO ()
+               Graphics.XHB.Connection.Types.Connection -> Bool -> IO ()
 printEndPage c cancel
   = do let req = MkPrintEndPage cancel
        putAction <- serializeExtensionRequest c req
@@ -158,7 +161,7 @@
  
 printSelectInput ::
                    Graphics.XHB.Connection.Types.Connection ->
-                     PCONTEXT -> ValueParam CARD32 -> IO ()
+                     PCONTEXT -> ValueParam Word32 -> IO ()
 printSelectInput c context event
   = do let req = MkPrintSelectInput context event
        putAction <- serializeExtensionRequest c req
@@ -169,32 +172,32 @@
                      Graphics.XHB.Connection.Types.Connection ->
                        PCONTEXT -> IO (Receipt PrintInputSelectedReply)
 printInputSelected c context
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkPrintInputSelected context
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 printGetAttributes ::
                      Graphics.XHB.Connection.Types.Connection ->
-                       PCONTEXT -> CARD8 -> IO (Receipt PrintGetAttributesReply)
+                       PCONTEXT -> Word8 -> IO (Receipt PrintGetAttributesReply)
 printGetAttributes c context pool
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkPrintGetAttributes context pool
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 printGetOneAttributes ::
                         Graphics.XHB.Connection.Types.Connection ->
                           PrintGetOneAttributes -> IO (Receipt PrintGetOneAttributesReply)
 printGetOneAttributes c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 printSetAttributes ::
@@ -209,42 +212,45 @@
                          Graphics.XHB.Connection.Types.Connection ->
                            PCONTEXT -> IO (Receipt PrintGetPageDimensionsReply)
 printGetPageDimensions c context
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkPrintGetPageDimensions context
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 printQueryScreens ::
                     Graphics.XHB.Connection.Types.Connection ->
                       IO (Receipt PrintQueryScreensReply)
 printQueryScreens c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkPrintQueryScreens
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 printSetImageResolution ::
                           Graphics.XHB.Connection.Types.Connection ->
-                            PCONTEXT -> CARD16 -> IO (Receipt PrintSetImageResolutionReply)
+                            PCONTEXT -> Word16 -> IO (Receipt PrintSetImageResolutionReply)
 printSetImageResolution c context image_resolution
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkPrintSetImageResolution context image_resolution
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 printGetImageResolution ::
                           Graphics.XHB.Connection.Types.Connection ->
-                            PCONTEXT -> IO (Receipt PrintGetImageResolutionReply)
+                            PCONTEXT -> IO (Receipt Word16)
 printGetImageResolution c context
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet
+                                   (image_resolution_PrintGetImageResolutionReply `fmap`
+                                      deserialize))
        let req = MkPrintGetImageResolution context
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/XPrint/Types.hs b/patched/Graphics/XHB/Gen/XPrint/Types.hs
--- a/patched/Graphics/XHB/Gen/XPrint/Types.hs
+++ b/patched/Graphics/XHB/Gen/XPrint/Types.hs
@@ -20,6 +20,7 @@
         PrintGetImageResolutionReply(..), Notify(..), AttributNotify(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -46,8 +47,8 @@
  
 type STRING8 = CChar
  
-data PRINTER = MkPRINTER{nameLen_PRINTER :: CARD32,
-                         name_PRINTER :: [STRING8], descLen_PRINTER :: CARD32,
+data PRINTER = MkPRINTER{nameLen_PRINTER :: Word32,
+                         name_PRINTER :: [STRING8], descLen_PRINTER :: Word32,
                          description_PRINTER :: [STRING8]}
              deriving (Show, Typeable)
  
@@ -145,13 +146,13 @@
           = do putWord8 extOpCode
                putWord8 0
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data PrintQueryVersionReply = MkPrintQueryVersionReply{major_version_PrintQueryVersionReply
-                                                       :: CARD16,
+                                                       :: Word16,
                                                        minor_version_PrintQueryVersionReply ::
-                                                       CARD16}
+                                                       Word16}
                             deriving (Show, Typeable)
  
 instance Deserialize PrintQueryVersionReply where
@@ -166,8 +167,8 @@
                return (MkPrintQueryVersionReply major_version minor_version)
  
 data PrintGetPrinterList = MkPrintGetPrinterList{printerNameLen_PrintGetPrinterList
-                                                 :: CARD32,
-                                                 localeLen_PrintGetPrinterList :: CARD32,
+                                                 :: Word32,
+                                                 localeLen_PrintGetPrinterList :: Word32,
                                                  printer_name_PrintGetPrinterList :: [STRING8],
                                                  locale_PrintGetPrinterList :: [STRING8]}
                          deriving (Show, Typeable)
@@ -182,7 +183,7 @@
                          size (localeLen_PrintGetPrinterList x)
                          + sum (map size (printer_name_PrintGetPrinterList x))
                          + sum (map size (locale_PrintGetPrinterList x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (printerNameLen_PrintGetPrinterList x)
                serialize (localeLen_PrintGetPrinterList x)
                serializeList (printer_name_PrintGetPrinterList x)
@@ -190,7 +191,7 @@
                putSkip (requiredPadding size__)
  
 data PrintGetPrinterListReply = MkPrintGetPrinterListReply{listCount_PrintGetPrinterListReply
-                                                           :: CARD32,
+                                                           :: Word32,
                                                            printers_PrintGetPrinterListReply ::
                                                            [PRINTER]}
                               deriving (Show, Typeable)
@@ -208,9 +209,9 @@
                return (MkPrintGetPrinterListReply listCount printers)
  
 data CreateContext = MkCreateContext{context_id_CreateContext ::
-                                     CARD32,
-                                     printerNameLen_CreateContext :: CARD32,
-                                     localeLen_CreateContext :: CARD32,
+                                     Word32,
+                                     printerNameLen_CreateContext :: Word32,
+                                     localeLen_CreateContext :: Word32,
                                      printerName_CreateContext :: [STRING8],
                                      locale_CreateContext :: [STRING8]}
                    deriving (Show, Typeable)
@@ -226,7 +227,7 @@
                          + size (localeLen_CreateContext x)
                          + sum (map size (printerName_CreateContext x))
                          + sum (map size (locale_CreateContext x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_id_CreateContext x)
                serialize (printerNameLen_CreateContext x)
                serialize (localeLen_CreateContext x)
@@ -235,7 +236,7 @@
                putSkip (requiredPadding size__)
  
 data PrintSetContext = MkPrintSetContext{context_PrintSetContext ::
-                                         CARD32}
+                                         Word32}
                      deriving (Show, Typeable)
  
 instance ExtensionRequest PrintSetContext where
@@ -244,7 +245,7 @@
           = do putWord8 extOpCode
                putWord8 3
                let size__ = 4 + size (context_PrintSetContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_PrintSetContext x)
                putSkip (requiredPadding size__)
  
@@ -257,11 +258,11 @@
           = do putWord8 extOpCode
                putWord8 4
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data PrintGetContextReply = MkPrintGetContextReply{context_PrintGetContextReply
-                                                   :: CARD32}
+                                                   :: Word32}
                           deriving (Show, Typeable)
  
 instance Deserialize PrintGetContextReply where
@@ -275,7 +276,7 @@
                return (MkPrintGetContextReply context)
  
 data PrintDestroyContext = MkPrintDestroyContext{context_PrintDestroyContext
-                                                 :: CARD32}
+                                                 :: Word32}
                          deriving (Show, Typeable)
  
 instance ExtensionRequest PrintDestroyContext where
@@ -284,7 +285,7 @@
           = do putWord8 extOpCode
                putWord8 5
                let size__ = 4 + size (context_PrintDestroyContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_PrintDestroyContext x)
                putSkip (requiredPadding size__)
  
@@ -297,7 +298,7 @@
           = do putWord8 extOpCode
                putWord8 6
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data PrintGetScreenOfContextReply = MkPrintGetScreenOfContextReply{root_PrintGetScreenOfContextReply
@@ -315,7 +316,7 @@
                return (MkPrintGetScreenOfContextReply root)
  
 data PrintStartJob = MkPrintStartJob{output_mode_PrintStartJob ::
-                                     CARD8}
+                                     Word8}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest PrintStartJob where
@@ -324,11 +325,11 @@
           = do putWord8 extOpCode
                putWord8 7
                let size__ = 4 + size (output_mode_PrintStartJob x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (output_mode_PrintStartJob x)
                putSkip (requiredPadding size__)
  
-data PrintEndJob = MkPrintEndJob{cancel_PrintEndJob :: BOOL}
+data PrintEndJob = MkPrintEndJob{cancel_PrintEndJob :: Bool}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest PrintEndJob where
@@ -337,12 +338,12 @@
           = do putWord8 extOpCode
                putWord8 8
                let size__ = 4 + size (cancel_PrintEndJob x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (cancel_PrintEndJob x)
                putSkip (requiredPadding size__)
  
 data PrintStartDoc = MkPrintStartDoc{driver_mode_PrintStartDoc ::
-                                     CARD8}
+                                     Word8}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest PrintStartDoc where
@@ -351,11 +352,11 @@
           = do putWord8 extOpCode
                putWord8 9
                let size__ = 4 + size (driver_mode_PrintStartDoc x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (driver_mode_PrintStartDoc x)
                putSkip (requiredPadding size__)
  
-data PrintEndDoc = MkPrintEndDoc{cancel_PrintEndDoc :: BOOL}
+data PrintEndDoc = MkPrintEndDoc{cancel_PrintEndDoc :: Bool}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest PrintEndDoc where
@@ -364,16 +365,16 @@
           = do putWord8 extOpCode
                putWord8 10
                let size__ = 4 + size (cancel_PrintEndDoc x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (cancel_PrintEndDoc x)
                putSkip (requiredPadding size__)
  
 data PrintPutDocumentData = MkPrintPutDocumentData{drawable_PrintPutDocumentData
                                                    :: DRAWABLE,
-                                                   len_data_PrintPutDocumentData :: CARD32,
-                                                   len_fmt_PrintPutDocumentData :: CARD16,
-                                                   len_options_PrintPutDocumentData :: CARD16,
-                                                   data_PrintPutDocumentData :: [BYTE],
+                                                   len_data_PrintPutDocumentData :: Word32,
+                                                   len_fmt_PrintPutDocumentData :: Word16,
+                                                   len_options_PrintPutDocumentData :: Word16,
+                                                   data_PrintPutDocumentData :: [Word8],
                                                    doc_format_PrintPutDocumentData :: [STRING8],
                                                    options_PrintPutDocumentData :: [STRING8]}
                           deriving (Show, Typeable)
@@ -391,7 +392,7 @@
                          + sum (map size (data_PrintPutDocumentData x))
                          + sum (map size (doc_format_PrintPutDocumentData x))
                          + sum (map size (options_PrintPutDocumentData x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_PrintPutDocumentData x)
                serialize (len_data_PrintPutDocumentData x)
                serialize (len_fmt_PrintPutDocumentData x)
@@ -403,7 +404,7 @@
  
 data PrintGetDocumentData = MkPrintGetDocumentData{context_PrintGetDocumentData
                                                    :: PCONTEXT,
-                                                   max_bytes_PrintGetDocumentData :: CARD32}
+                                                   max_bytes_PrintGetDocumentData :: Word32}
                           deriving (Show, Typeable)
  
 instance ExtensionRequest PrintGetDocumentData where
@@ -414,19 +415,19 @@
                let size__
                      = 4 + size (context_PrintGetDocumentData x) +
                          size (max_bytes_PrintGetDocumentData x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_PrintGetDocumentData x)
                serialize (max_bytes_PrintGetDocumentData x)
                putSkip (requiredPadding size__)
  
 data PrintGetDocumentDataReply = MkPrintGetDocumentDataReply{status_code_PrintGetDocumentDataReply
-                                                             :: CARD32,
+                                                             :: Word32,
                                                              finished_flag_PrintGetDocumentDataReply
-                                                             :: CARD32,
+                                                             :: Word32,
                                                              dataLen_PrintGetDocumentDataReply ::
-                                                             CARD32,
+                                                             Word32,
                                                              data_PrintGetDocumentDataReply ::
-                                                             [BYTE]}
+                                                             [Word8]}
                                deriving (Show, Typeable)
  
 instance Deserialize PrintGetDocumentDataReply where
@@ -455,11 +456,11 @@
           = do putWord8 extOpCode
                putWord8 13
                let size__ = 4 + size (window_PrintStartPage x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_PrintStartPage x)
                putSkip (requiredPadding size__)
  
-data PrintEndPage = MkPrintEndPage{cancel_PrintEndPage :: BOOL}
+data PrintEndPage = MkPrintEndPage{cancel_PrintEndPage :: Bool}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest PrintEndPage where
@@ -468,14 +469,14 @@
           = do putWord8 extOpCode
                putWord8 14
                let size__ = 4 + size (cancel_PrintEndPage x) + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (cancel_PrintEndPage x)
                putSkip 3
                putSkip (requiredPadding size__)
  
 data PrintSelectInput = MkPrintSelectInput{context_PrintSelectInput
                                            :: PCONTEXT,
-                                           event_PrintSelectInput :: ValueParam CARD32}
+                                           event_PrintSelectInput :: ValueParam Word32}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest PrintSelectInput where
@@ -486,7 +487,7 @@
                let size__
                      = 4 + size (context_PrintSelectInput x) +
                          size (event_PrintSelectInput x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_PrintSelectInput x)
                serialize (event_PrintSelectInput x)
                putSkip (requiredPadding size__)
@@ -501,14 +502,14 @@
           = do putWord8 extOpCode
                putWord8 16
                let size__ = 4 + size (context_PrintInputSelected x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_PrintInputSelected x)
                putSkip (requiredPadding size__)
  
 data PrintInputSelectedReply = MkPrintInputSelectedReply{event_PrintInputSelectedReply
-                                                         :: ValueParam CARD32,
+                                                         :: ValueParam Word32,
                                                          all_events_PrintInputSelectedReply ::
-                                                         ValueParam CARD32}
+                                                         ValueParam Word32}
                              deriving (Show, Typeable)
  
 instance Deserialize PrintInputSelectedReply where
@@ -524,7 +525,7 @@
  
 data PrintGetAttributes = MkPrintGetAttributes{context_PrintGetAttributes
                                                :: PCONTEXT,
-                                               pool_PrintGetAttributes :: CARD8}
+                                               pool_PrintGetAttributes :: Word8}
                         deriving (Show, Typeable)
  
 instance ExtensionRequest PrintGetAttributes where
@@ -536,14 +537,14 @@
                      = 4 + size (context_PrintGetAttributes x) +
                          size (pool_PrintGetAttributes x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_PrintGetAttributes x)
                serialize (pool_PrintGetAttributes x)
                putSkip 3
                putSkip (requiredPadding size__)
  
 data PrintGetAttributesReply = MkPrintGetAttributesReply{stringLen_PrintGetAttributesReply
-                                                         :: CARD32,
+                                                         :: Word32,
                                                          attributes_PrintGetAttributesReply ::
                                                          STRING8}
                              deriving (Show, Typeable)
@@ -562,8 +563,8 @@
  
 data PrintGetOneAttributes = MkPrintGetOneAttributes{context_PrintGetOneAttributes
                                                      :: PCONTEXT,
-                                                     nameLen_PrintGetOneAttributes :: CARD32,
-                                                     pool_PrintGetOneAttributes :: CARD8,
+                                                     nameLen_PrintGetOneAttributes :: Word32,
+                                                     pool_PrintGetOneAttributes :: Word8,
                                                      name_PrintGetOneAttributes :: [STRING8]}
                            deriving (Show, Typeable)
  
@@ -578,7 +579,7 @@
                          + size (pool_PrintGetOneAttributes x)
                          + 3
                          + sum (map size (name_PrintGetOneAttributes x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_PrintGetOneAttributes x)
                serialize (nameLen_PrintGetOneAttributes x)
                serialize (pool_PrintGetOneAttributes x)
@@ -587,7 +588,7 @@
                putSkip (requiredPadding size__)
  
 data PrintGetOneAttributesReply = MkPrintGetOneAttributesReply{valueLen_PrintGetOneAttributesReply
-                                                               :: CARD32,
+                                                               :: Word32,
                                                                value_PrintGetOneAttributesReply ::
                                                                [STRING8]}
                                 deriving (Show, Typeable)
@@ -606,9 +607,9 @@
  
 data PrintSetAttributes = MkPrintSetAttributes{context_PrintSetAttributes
                                                :: PCONTEXT,
-                                               stringLen_PrintSetAttributes :: CARD32,
-                                               pool_PrintSetAttributes :: CARD8,
-                                               rule_PrintSetAttributes :: CARD8,
+                                               stringLen_PrintSetAttributes :: Word32,
+                                               pool_PrintSetAttributes :: Word8,
+                                               rule_PrintSetAttributes :: Word8,
                                                attributes_PrintSetAttributes :: [STRING8]}
                         deriving (Show, Typeable)
  
@@ -624,7 +625,7 @@
                          + size (rule_PrintSetAttributes x)
                          + 2
                          + sum (map size (attributes_PrintSetAttributes x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_PrintSetAttributes x)
                serialize (stringLen_PrintSetAttributes x)
                serialize (pool_PrintSetAttributes x)
@@ -643,22 +644,22 @@
           = do putWord8 extOpCode
                putWord8 21
                let size__ = 4 + size (context_PrintGetPageDimensions x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_PrintGetPageDimensions x)
                putSkip (requiredPadding size__)
  
 data PrintGetPageDimensionsReply = MkPrintGetPageDimensionsReply{width_PrintGetPageDimensionsReply
-                                                                 :: CARD16,
+                                                                 :: Word16,
                                                                  height_PrintGetPageDimensionsReply
-                                                                 :: CARD16,
+                                                                 :: Word16,
                                                                  offset_x_PrintGetPageDimensionsReply
-                                                                 :: CARD16,
+                                                                 :: Word16,
                                                                  offset_y_PrintGetPageDimensionsReply
-                                                                 :: CARD16,
+                                                                 :: Word16,
                                                                  reproducible_width_PrintGetPageDimensionsReply
-                                                                 :: CARD16,
+                                                                 :: Word16,
                                                                  reproducible_height_PrintGetPageDimensionsReply
-                                                                 :: CARD16}
+                                                                 :: Word16}
                                  deriving (Show, Typeable)
  
 instance Deserialize PrintGetPageDimensionsReply where
@@ -688,11 +689,11 @@
           = do putWord8 extOpCode
                putWord8 22
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data PrintQueryScreensReply = MkPrintQueryScreensReply{listCount_PrintQueryScreensReply
-                                                       :: CARD32,
+                                                       :: Word32,
                                                        roots_PrintQueryScreensReply :: [WINDOW]}
                             deriving (Show, Typeable)
  
@@ -711,7 +712,7 @@
 data PrintSetImageResolution = MkPrintSetImageResolution{context_PrintSetImageResolution
                                                          :: PCONTEXT,
                                                          image_resolution_PrintSetImageResolution ::
-                                                         CARD16}
+                                                         Word16}
                              deriving (Show, Typeable)
  
 instance ExtensionRequest PrintSetImageResolution where
@@ -722,15 +723,15 @@
                let size__
                      = 4 + size (context_PrintSetImageResolution x) +
                          size (image_resolution_PrintSetImageResolution x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_PrintSetImageResolution x)
                serialize (image_resolution_PrintSetImageResolution x)
                putSkip (requiredPadding size__)
  
 data PrintSetImageResolutionReply = MkPrintSetImageResolutionReply{status_PrintSetImageResolutionReply
-                                                                   :: BOOL,
+                                                                   :: Bool,
                                                                    previous_resolutions_PrintSetImageResolutionReply
-                                                                   :: CARD16}
+                                                                   :: Word16}
                                   deriving (Show, Typeable)
  
 instance Deserialize PrintSetImageResolutionReply where
@@ -753,12 +754,12 @@
           = do putWord8 extOpCode
                putWord8 24
                let size__ = 4 + size (context_PrintGetImageResolution x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_PrintGetImageResolution x)
                putSkip (requiredPadding size__)
  
 data PrintGetImageResolutionReply = MkPrintGetImageResolutionReply{image_resolution_PrintGetImageResolutionReply
-                                                                   :: CARD16}
+                                                                   :: Word16}
                                   deriving (Show, Typeable)
  
 instance Deserialize PrintGetImageResolutionReply where
@@ -771,8 +772,8 @@
                let _ = isCard32 length
                return (MkPrintGetImageResolutionReply image_resolution)
  
-data Notify = MkNotify{detail_Notify :: CARD8,
-                       context_Notify :: PCONTEXT, cancel_Notify :: BOOL}
+data Notify = MkNotify{detail_Notify :: Word8,
+                       context_Notify :: PCONTEXT, cancel_Notify :: Bool}
             deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event Notify
@@ -787,7 +788,7 @@
                return (MkNotify detail context cancel)
  
 data AttributNotify = MkAttributNotify{detail_AttributNotify ::
-                                       CARD8,
+                                       Word8,
                                        context_AttributNotify :: PCONTEXT}
                     deriving (Show, Typeable)
  
diff --git a/patched/Graphics/XHB/Gen/Xevie.hs b/patched/Graphics/XHB/Gen/Xevie.hs
--- a/patched/Graphics/XHB/Gen/Xevie.hs
+++ b/patched/Graphics/XHB/Gen/Xevie.hs
@@ -8,6 +8,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
  
@@ -16,55 +19,55 @@
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD16 -> CARD16 -> IO (Receipt QueryVersionReply)
+                 Word16 -> Word16 -> IO (Receipt QueryVersionReply)
 queryVersion c client_major_version client_minor_version
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion client_major_version client_minor_version
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 start ::
         Graphics.XHB.Connection.Types.Connection ->
-          CARD32 -> IO (Receipt StartReply)
+          Word32 -> IO (Receipt StartReply)
 start c screen
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkStart screen
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 end ::
       Graphics.XHB.Connection.Types.Connection ->
-        CARD32 -> IO (Receipt EndReply)
+        Word32 -> IO (Receipt EndReply)
 end c cmap
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkEnd cmap
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 send ::
        Graphics.XHB.Connection.Types.Connection ->
-         Event -> CARD32 -> IO (Receipt SendReply)
+         Event -> Word32 -> IO (Receipt SendReply)
 send c event data_type
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkSend event data_type
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 selectInput ::
               Graphics.XHB.Connection.Types.Connection ->
-                CARD32 -> IO (Receipt SelectInputReply)
+                Word32 -> IO (Receipt SelectInputReply)
 selectInput c event_mask
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkSelectInput event_mask
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/Xevie/Types.hs b/patched/Graphics/XHB/Gen/Xevie/Types.hs
--- a/patched/Graphics/XHB/Gen/Xevie/Types.hs
+++ b/patched/Graphics/XHB/Gen/Xevie/Types.hs
@@ -5,6 +5,7 @@
         SelectInput(..), SelectInputReply(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -23,8 +24,8 @@
 deserializeEvent _ = Nothing
  
 data QueryVersion = MkQueryVersion{client_major_version_QueryVersion
-                                   :: CARD16,
-                                   client_minor_version_QueryVersion :: CARD16}
+                                   :: Word16,
+                                   client_minor_version_QueryVersion :: Word16}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -35,14 +36,14 @@
                let size__
                      = 4 + size (client_major_version_QueryVersion x) +
                          size (client_minor_version_QueryVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (client_major_version_QueryVersion x)
                serialize (client_minor_version_QueryVersion x)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{server_major_version_QueryVersionReply
-                                             :: CARD16,
-                                             server_minor_version_QueryVersionReply :: CARD16}
+                                             :: Word16,
+                                             server_minor_version_QueryVersionReply :: Word16}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -58,7 +59,7 @@
                return
                  (MkQueryVersionReply server_major_version server_minor_version)
  
-data Start = MkStart{screen_Start :: CARD32}
+data Start = MkStart{screen_Start :: Word32}
            deriving (Show, Typeable)
  
 instance ExtensionRequest Start where
@@ -67,7 +68,7 @@
           = do putWord8 extOpCode
                putWord8 1
                let size__ = 4 + size (screen_Start x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (screen_Start x)
                putSkip (requiredPadding size__)
  
@@ -84,7 +85,7 @@
                let _ = isCard32 length
                return (MkStartReply)
  
-data End = MkEnd{cmap_End :: CARD32}
+data End = MkEnd{cmap_End :: Word32}
          deriving (Show, Typeable)
  
 instance ExtensionRequest End where
@@ -93,7 +94,7 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4 + size (cmap_End x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (cmap_End x)
                putSkip (requiredPadding size__)
  
@@ -131,7 +132,7 @@
           = do skip 32
                return (MkEvent)
  
-data Send = MkSend{event_Send :: Event, data_type_Send :: CARD32}
+data Send = MkSend{event_Send :: Event, data_type_Send :: Word32}
           deriving (Show, Typeable)
  
 instance ExtensionRequest Send where
@@ -140,7 +141,7 @@
           = do putWord8 extOpCode
                putWord8 3
                let size__ = 4 + size (event_Send x) + size (data_type_Send x) + 64
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (event_Send x)
                serialize (data_type_Send x)
                putSkip 64
@@ -159,7 +160,7 @@
                let _ = isCard32 length
                return (MkSendReply)
  
-data SelectInput = MkSelectInput{event_mask_SelectInput :: CARD32}
+data SelectInput = MkSelectInput{event_mask_SelectInput :: Word32}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest SelectInput where
@@ -168,7 +169,7 @@
           = do putWord8 extOpCode
                putWord8 4
                let size__ = 4 + size (event_mask_SelectInput x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (event_mask_SelectInput x)
                putSkip (requiredPadding size__)
  
diff --git a/patched/Graphics/XHB/Gen/Xinerama.hs b/patched/Graphics/XHB/Gen/Xinerama.hs
--- a/patched/Graphics/XHB/Gen/Xinerama.hs
+++ b/patched/Graphics/XHB/Gen/Xinerama.hs
@@ -8,6 +8,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -19,66 +22,66 @@
  
 queryVersion ::
                Graphics.XHB.Connection.Types.Connection ->
-                 CARD8 -> CARD8 -> IO (Receipt QueryVersionReply)
+                 Word8 -> Word8 -> IO (Receipt QueryVersionReply)
 queryVersion c major minor
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion major minor
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getState ::
            Graphics.XHB.Connection.Types.Connection ->
              WINDOW -> IO (Receipt GetStateReply)
 getState c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetState window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getScreenCount ::
                  Graphics.XHB.Connection.Types.Connection ->
                    WINDOW -> IO (Receipt GetScreenCountReply)
 getScreenCount c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetScreenCount window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getScreenSize ::
                 Graphics.XHB.Connection.Types.Connection ->
-                  WINDOW -> CARD32 -> IO (Receipt GetScreenSizeReply)
+                  WINDOW -> Word32 -> IO (Receipt GetScreenSizeReply)
 getScreenSize c window screen
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetScreenSize window screen
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 isActive ::
-           Graphics.XHB.Connection.Types.Connection ->
-             IO (Receipt IsActiveReply)
+           Graphics.XHB.Connection.Types.Connection -> IO (Receipt Word32)
 isActive c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (state_IsActiveReply `fmap` deserialize))
        let req = MkIsActive
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryScreens ::
                Graphics.XHB.Connection.Types.Connection ->
                  IO (Receipt QueryScreensReply)
 queryScreens c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryScreens
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/Xinerama/Types.hs b/patched/Graphics/XHB/Gen/Xinerama/Types.hs
--- a/patched/Graphics/XHB/Gen/Xinerama/Types.hs
+++ b/patched/Graphics/XHB/Gen/Xinerama/Types.hs
@@ -6,6 +6,7 @@
         IsActiveReply(..), QueryScreens(..), QueryScreensReply(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -26,9 +27,9 @@
 deserializeEvent :: Word8 -> Maybe (Get SomeEvent)
 deserializeEvent _ = Nothing
  
-data ScreenInfo = MkScreenInfo{x_org_ScreenInfo :: INT16,
-                               y_org_ScreenInfo :: INT16, width_ScreenInfo :: CARD16,
-                               height_ScreenInfo :: CARD16}
+data ScreenInfo = MkScreenInfo{x_org_ScreenInfo :: Int16,
+                               y_org_ScreenInfo :: Int16, width_ScreenInfo :: Word16,
+                               height_ScreenInfo :: Word16}
                 deriving (Show, Typeable)
  
 instance Serialize ScreenInfo where
@@ -50,8 +51,8 @@
                height <- deserialize
                return (MkScreenInfo x_org y_org width height)
  
-data QueryVersion = MkQueryVersion{major_QueryVersion :: CARD8,
-                                   minor_QueryVersion :: CARD8}
+data QueryVersion = MkQueryVersion{major_QueryVersion :: Word8,
+                                   minor_QueryVersion :: Word8}
                   deriving (Show, Typeable)
  
 instance ExtensionRequest QueryVersion where
@@ -61,14 +62,14 @@
                putWord8 0
                let size__
                      = 4 + size (major_QueryVersion x) + size (minor_QueryVersion x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (major_QueryVersion x)
                serialize (minor_QueryVersion x)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{major_QueryVersionReply
-                                             :: CARD16,
-                                             minor_QueryVersionReply :: CARD16}
+                                             :: Word16,
+                                             minor_QueryVersionReply :: Word16}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -91,11 +92,11 @@
           = do putWord8 extOpCode
                putWord8 1
                let size__ = 4 + size (window_GetState x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetState x)
                putSkip (requiredPadding size__)
  
-data GetStateReply = MkGetStateReply{state_GetStateReply :: BYTE,
+data GetStateReply = MkGetStateReply{state_GetStateReply :: Word8,
                                      window_GetStateReply :: WINDOW}
                    deriving (Show, Typeable)
  
@@ -119,12 +120,12 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4 + size (window_GetScreenCount x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetScreenCount x)
                putSkip (requiredPadding size__)
  
 data GetScreenCountReply = MkGetScreenCountReply{screen_count_GetScreenCountReply
-                                                 :: BYTE,
+                                                 :: Word8,
                                                  window_GetScreenCountReply :: WINDOW}
                          deriving (Show, Typeable)
  
@@ -140,7 +141,7 @@
  
 data GetScreenSize = MkGetScreenSize{window_GetScreenSize ::
                                      WINDOW,
-                                     screen_GetScreenSize :: CARD32}
+                                     screen_GetScreenSize :: Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest GetScreenSize where
@@ -150,16 +151,16 @@
                putWord8 3
                let size__
                      = 4 + size (window_GetScreenSize x) + size (screen_GetScreenSize x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_GetScreenSize x)
                serialize (screen_GetScreenSize x)
                putSkip (requiredPadding size__)
  
 data GetScreenSizeReply = MkGetScreenSizeReply{width_GetScreenSizeReply
-                                               :: CARD32,
-                                               height_GetScreenSizeReply :: CARD32,
+                                               :: Word32,
+                                               height_GetScreenSizeReply :: Word32,
                                                window_GetScreenSizeReply :: WINDOW,
-                                               screen_GetScreenSizeReply :: CARD32}
+                                               screen_GetScreenSizeReply :: Word32}
                         deriving (Show, Typeable)
  
 instance Deserialize GetScreenSizeReply where
@@ -184,10 +185,10 @@
           = do putWord8 extOpCode
                putWord8 4
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
-data IsActiveReply = MkIsActiveReply{state_IsActiveReply :: CARD32}
+data IsActiveReply = MkIsActiveReply{state_IsActiveReply :: Word32}
                    deriving (Show, Typeable)
  
 instance Deserialize IsActiveReply where
@@ -209,11 +210,11 @@
           = do putWord8 extOpCode
                putWord8 5
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data QueryScreensReply = MkQueryScreensReply{number_QueryScreensReply
-                                             :: CARD32,
+                                             :: Word32,
                                              screen_info_QueryScreensReply :: [ScreenInfo]}
                        deriving (Show, Typeable)
  
diff --git a/patched/Graphics/XHB/Gen/Xproto.hs b/patched/Graphics/XHB/Gen/Xproto.hs
--- a/patched/Graphics/XHB/Gen/Xproto.hs
+++ b/patched/Graphics/XHB/Gen/Xproto.hs
@@ -36,6 +36,9 @@
 import Data.Binary.Put
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import qualified Graphics.XHB.Connection.Types
  
 createWindow ::
@@ -46,7 +49,7 @@
  
 changeWindowAttributes ::
                          Graphics.XHB.Connection.Types.Connection ->
-                           WINDOW -> ValueParam CARD32 -> IO ()
+                           WINDOW -> ValueParam Word32 -> IO ()
 changeWindowAttributes c window value
   = do let req = MkChangeWindowAttributes window value
        let chunk = runPut (serialize req)
@@ -56,10 +59,10 @@
                       Graphics.XHB.Connection.Types.Connection ->
                         WINDOW -> IO (Receipt GetWindowAttributesReply)
 getWindowAttributes c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetWindowAttributes window
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 destroyWindow ::
@@ -77,7 +80,8 @@
        sendRequest c chunk
  
 changeSaveSet ::
-                Graphics.XHB.Connection.Types.Connection -> BYTE -> WINDOW -> IO ()
+                Graphics.XHB.Connection.Types.Connection ->
+                  Word8 -> WINDOW -> IO ()
 changeSaveSet c mode window
   = do let req = MkChangeSaveSet mode window
        let chunk = runPut (serialize req)
@@ -119,7 +123,7 @@
  
 configureWindow ::
                   Graphics.XHB.Connection.Types.Connection ->
-                    WINDOW -> ValueParam CARD16 -> IO ()
+                    WINDOW -> ValueParam Word16 -> IO ()
 configureWindow c window value
   = do let req = MkConfigureWindow window value
        let chunk = runPut (serialize req)
@@ -127,7 +131,7 @@
  
 circulateWindow ::
                   Graphics.XHB.Connection.Types.Connection ->
-                    CARD8 -> WINDOW -> IO ()
+                    Word8 -> WINDOW -> IO ()
 circulateWindow c direction window
   = do let req = MkCirculateWindow direction window
        let chunk = runPut (serialize req)
@@ -137,39 +141,40 @@
               Graphics.XHB.Connection.Types.Connection ->
                 DRAWABLE -> IO (Receipt GetGeometryReply)
 getGeometry c drawable
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetGeometry drawable
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryTree ::
             Graphics.XHB.Connection.Types.Connection ->
               WINDOW -> IO (Receipt QueryTreeReply)
 queryTree c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryTree window
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 internAtom ::
              Graphics.XHB.Connection.Types.Connection ->
-               InternAtom -> IO (Receipt InternAtomReply)
+               InternAtom -> IO (Receipt ATOM)
 internAtom c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (atom_InternAtomReply `fmap` deserialize))
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getAtomName ::
               Graphics.XHB.Connection.Types.Connection ->
                 ATOM -> IO (Receipt GetAtomNameReply)
 getAtomName c atom
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetAtomName atom
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 changeProperty ::
@@ -189,19 +194,19 @@
               Graphics.XHB.Connection.Types.Connection ->
                 GetProperty -> IO (Receipt GetPropertyReply)
 getProperty c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 listProperties ::
                  Graphics.XHB.Connection.Types.Connection ->
                    WINDOW -> IO (Receipt ListPropertiesReply)
 listProperties c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListProperties window
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setSelectionOwner ::
@@ -213,12 +218,13 @@
  
 getSelectionOwner ::
                     Graphics.XHB.Connection.Types.Connection ->
-                      ATOM -> IO (Receipt GetSelectionOwnerReply)
+                      ATOM -> IO (Receipt WINDOW)
 getSelectionOwner c selection
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (owner_GetSelectionOwnerReply `fmap` deserialize))
        let req = MkGetSelectionOwner selection
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 convertSelection ::
@@ -236,11 +242,12 @@
  
 grabPointer ::
               Graphics.XHB.Connection.Types.Connection ->
-                GrabPointer -> IO (Receipt GrabPointerReply)
+                GrabPointer -> IO (Receipt Word8)
 grabPointer c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_GrabPointerReply `fmap` deserialize))
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 ungrabPointer ::
@@ -271,11 +278,12 @@
  
 grabKeyboard ::
                Graphics.XHB.Connection.Types.Connection ->
-                 GrabKeyboard -> IO (Receipt GrabKeyboardReply)
+                 GrabKeyboard -> IO (Receipt Word8)
 grabKeyboard c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_GrabKeyboardReply `fmap` deserialize))
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 ungrabKeyboard ::
@@ -299,7 +307,7 @@
  
 allowEvents ::
               Graphics.XHB.Connection.Types.Connection ->
-                CARD8 -> TIMESTAMP -> IO ()
+                Word8 -> TIMESTAMP -> IO ()
 allowEvents c mode time
   = do let req = MkAllowEvents mode time
        let chunk = runPut (serialize req)
@@ -309,28 +317,28 @@
                Graphics.XHB.Connection.Types.Connection ->
                  WINDOW -> IO (Receipt QueryPointerReply)
 queryPointer c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryPointer window
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getMotionEvents ::
                   Graphics.XHB.Connection.Types.Connection ->
                     GetMotionEvents -> IO (Receipt GetMotionEventsReply)
 getMotionEvents c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 translateCoordinates ::
                        Graphics.XHB.Connection.Types.Connection ->
                          TranslateCoordinates -> IO (Receipt TranslateCoordinatesReply)
 translateCoordinates c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 warpPointer ::
@@ -349,20 +357,20 @@
                 Graphics.XHB.Connection.Types.Connection ->
                   IO (Receipt GetInputFocusReply)
 getInputFocus c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetInputFocus
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryKeymap ::
-              Graphics.XHB.Connection.Types.Connection ->
-                IO (Receipt QueryKeymapReply)
+              Graphics.XHB.Connection.Types.Connection -> IO (Receipt [Word8])
 queryKeymap c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (keys_QueryKeymapReply `fmap` deserialize))
        let req = MkQueryKeymap
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 openFont ::
@@ -382,43 +390,43 @@
             Graphics.XHB.Connection.Types.Connection ->
               FONTABLE -> IO (Receipt QueryFontReply)
 queryFont c font
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryFont font
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryTextExtents ::
                    Graphics.XHB.Connection.Types.Connection ->
                      FONTABLE -> [CHAR2B] -> IO (Receipt QueryTextExtentsReply)
 queryTextExtents c font string
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryTextExtents font string
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 listFonts ::
             Graphics.XHB.Connection.Types.Connection ->
               ListFonts -> IO (Receipt ListFontsReply)
 listFonts c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 listFontsWithInfo ::
                     Graphics.XHB.Connection.Types.Connection ->
                       ListFontsWithInfo -> IO (Receipt ListFontsWithInfoReply)
 listFontsWithInfo c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setFontPath ::
               Graphics.XHB.Connection.Types.Connection ->
-                CARD16 -> [CChar] -> IO ()
+                Word16 -> [CChar] -> IO ()
 setFontPath c font_qty path
   = do let req = MkSetFontPath font_qty path
        let chunk = runPut (serialize req)
@@ -428,10 +436,10 @@
               Graphics.XHB.Connection.Types.Connection ->
                 IO (Receipt GetFontPathReply)
 getFontPath c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetFontPath
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createPixmap ::
@@ -455,7 +463,7 @@
  
 changeGC ::
            Graphics.XHB.Connection.Types.Connection ->
-             GCONTEXT -> ValueParam CARD32 -> IO ()
+             GCONTEXT -> ValueParam Word32 -> IO ()
 changeGC c gc value
   = do let req = MkChangeGC gc value
        let chunk = runPut (serialize req)
@@ -564,9 +572,9 @@
            Graphics.XHB.Connection.Types.Connection ->
              GetImage -> IO (Receipt GetImageReply)
 getImage c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 polyText8 ::
@@ -632,46 +640,46 @@
                          Graphics.XHB.Connection.Types.Connection ->
                            WINDOW -> IO (Receipt ListInstalledColormapsReply)
 listInstalledColormaps c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListInstalledColormaps window
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 allocColor ::
              Graphics.XHB.Connection.Types.Connection ->
                AllocColor -> IO (Receipt AllocColorReply)
 allocColor c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 allocNamedColor ::
                   Graphics.XHB.Connection.Types.Connection ->
                     AllocNamedColor -> IO (Receipt AllocNamedColorReply)
 allocNamedColor c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 allocColorCells ::
                   Graphics.XHB.Connection.Types.Connection ->
                     AllocColorCells -> IO (Receipt AllocColorCellsReply)
 allocColorCells c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 allocColorPlanes ::
                    Graphics.XHB.Connection.Types.Connection ->
                      AllocColorPlanes -> IO (Receipt AllocColorPlanesReply)
 allocColorPlanes c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 freeColors ::
@@ -697,21 +705,21 @@
  
 queryColors ::
               Graphics.XHB.Connection.Types.Connection ->
-                COLORMAP -> [CARD32] -> IO (Receipt QueryColorsReply)
+                COLORMAP -> [Word32] -> IO (Receipt QueryColorsReply)
 queryColors c cmap pixels
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryColors cmap pixels
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 lookupColor ::
               Graphics.XHB.Connection.Types.Connection ->
                 LookupColor -> IO (Receipt LookupColorReply)
 lookupColor c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createCursor ::
@@ -744,29 +752,29 @@
                 Graphics.XHB.Connection.Types.Connection ->
                   QueryBestSize -> IO (Receipt QueryBestSizeReply)
 queryBestSize c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryExtension ::
                  Graphics.XHB.Connection.Types.Connection ->
-                   CARD16 -> [CChar] -> IO (Receipt QueryExtensionReply)
+                   Word16 -> [CChar] -> IO (Receipt QueryExtensionReply)
 queryExtension c name_len name
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryExtension name_len name
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 listExtensions ::
                  Graphics.XHB.Connection.Types.Connection ->
                    IO (Receipt ListExtensionsReply)
 listExtensions c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListExtensions
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 changeKeyboardMapping ::
@@ -778,17 +786,17 @@
  
 getKeyboardMapping ::
                      Graphics.XHB.Connection.Types.Connection ->
-                       KEYCODE -> CARD8 -> IO (Receipt GetKeyboardMappingReply)
+                       KEYCODE -> Word8 -> IO (Receipt GetKeyboardMappingReply)
 getKeyboardMapping c first_keycode count
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetKeyboardMapping first_keycode count
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 changeKeyboardControl ::
                         Graphics.XHB.Connection.Types.Connection ->
-                          ValueParam CARD32 -> IO ()
+                          ValueParam Word32 -> IO ()
 changeKeyboardControl c value
   = do let req = MkChangeKeyboardControl value
        let chunk = runPut (serialize req)
@@ -798,13 +806,13 @@
                      Graphics.XHB.Connection.Types.Connection ->
                        IO (Receipt GetKeyboardControlReply)
 getKeyboardControl c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetKeyboardControl
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
-bell :: Graphics.XHB.Connection.Types.Connection -> INT8 -> IO ()
+bell :: Graphics.XHB.Connection.Types.Connection -> Int8 -> IO ()
 bell c percent
   = do let req = MkBell percent
        let chunk = runPut (serialize req)
@@ -821,10 +829,10 @@
                     Graphics.XHB.Connection.Types.Connection ->
                       IO (Receipt GetPointerControlReply)
 getPointerControl c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetPointerControl
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setScreenSaver ::
@@ -837,10 +845,10 @@
                  Graphics.XHB.Connection.Types.Connection ->
                    IO (Receipt GetScreenSaverReply)
 getScreenSaver c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetScreenSaver
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 changeHosts ::
@@ -853,28 +861,28 @@
             Graphics.XHB.Connection.Types.Connection ->
               IO (Receipt ListHostsReply)
 listHosts c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListHosts
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setAccessControl ::
-                   Graphics.XHB.Connection.Types.Connection -> CARD8 -> IO ()
+                   Graphics.XHB.Connection.Types.Connection -> Word8 -> IO ()
 setAccessControl c mode
   = do let req = MkSetAccessControl mode
        let chunk = runPut (serialize req)
        sendRequest c chunk
  
 setCloseDownMode ::
-                   Graphics.XHB.Connection.Types.Connection -> CARD8 -> IO ()
+                   Graphics.XHB.Connection.Types.Connection -> Word8 -> IO ()
 setCloseDownMode c mode
   = do let req = MkSetCloseDownMode mode
        let chunk = runPut (serialize req)
        sendRequest c chunk
  
 killClient ::
-             Graphics.XHB.Connection.Types.Connection -> CARD32 -> IO ()
+             Graphics.XHB.Connection.Types.Connection -> Word32 -> IO ()
 killClient c resource
   = do let req = MkKillClient resource
        let chunk = runPut (serialize req)
@@ -888,7 +896,7 @@
        sendRequest c chunk
  
 forceScreenSaver ::
-                   Graphics.XHB.Connection.Types.Connection -> CARD8 -> IO ()
+                   Graphics.XHB.Connection.Types.Connection -> Word8 -> IO ()
 forceScreenSaver c mode
   = do let req = MkForceScreenSaver mode
        let chunk = runPut (serialize req)
@@ -896,40 +904,42 @@
  
 setPointerMapping ::
                     Graphics.XHB.Connection.Types.Connection ->
-                      CARD8 -> [CARD8] -> IO (Receipt SetPointerMappingReply)
+                      Word8 -> [Word8] -> IO (Receipt Word8)
 setPointerMapping c map_len map
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_SetPointerMappingReply `fmap` deserialize))
        let req = MkSetPointerMapping map_len map
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getPointerMapping ::
                     Graphics.XHB.Connection.Types.Connection ->
                       IO (Receipt GetPointerMappingReply)
 getPointerMapping c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetPointerMapping
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setModifierMapping ::
                      Graphics.XHB.Connection.Types.Connection ->
-                       CARD8 -> [KEYCODE] -> IO (Receipt SetModifierMappingReply)
+                       Word8 -> [KEYCODE] -> IO (Receipt Word8)
 setModifierMapping c keycodes_per_modifier keycodes
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (status_SetModifierMappingReply `fmap` deserialize))
        let req = MkSetModifierMapping keycodes_per_modifier keycodes
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 getModifierMapping ::
                      Graphics.XHB.Connection.Types.Connection ->
                        IO (Receipt GetModifierMappingReply)
 getModifierMapping c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkGetModifierMapping
        let chunk = runPut (serialize req)
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/Xproto/Types.hs b/patched/Graphics/XHB/Gen/Xproto/Types.hs
--- a/patched/Graphics/XHB/Gen/Xproto/Types.hs
+++ b/patched/Graphics/XHB/Gen/Xproto/Types.hs
@@ -94,6041 +94,6046 @@
         GetModifierMappingReply(..))
        where
 import Data.Word
-import Foreign.C.Types
-import Data.Bits
-import Data.Binary.Put
-import Data.Binary.Get
-import Data.Typeable
-import Control.Monad
-import Control.Exception
-import Data.List
-import Graphics.XHB.Shared hiding (Event, Error)
-import qualified Graphics.XHB.Shared
- 
-deserializeError :: Word8 -> Maybe (Get SomeError)
-deserializeError 1
-  = return (liftM toError (deserialize :: Get Request))
-deserializeError 2
-  = return (liftM toError (deserialize :: Get Value))
-deserializeError 3
-  = return (liftM toError (deserialize :: Get Window))
-deserializeError 4
-  = return (liftM toError (deserialize :: Get Pixmap))
-deserializeError 5
-  = return (liftM toError (deserialize :: Get Atom))
-deserializeError 6
-  = return (liftM toError (deserialize :: Get Cursor))
-deserializeError 7
-  = return (liftM toError (deserialize :: Get Font))
-deserializeError 8
-  = return (liftM toError (deserialize :: Get Match))
-deserializeError 9
-  = return (liftM toError (deserialize :: Get Drawable))
-deserializeError 10
-  = return (liftM toError (deserialize :: Get Access))
-deserializeError 11
-  = return (liftM toError (deserialize :: Get Alloc))
-deserializeError 12
-  = return (liftM toError (deserialize :: Get Colormap))
-deserializeError 13
-  = return (liftM toError (deserialize :: Get GContext))
-deserializeError 14
-  = return (liftM toError (deserialize :: Get IDChoice))
-deserializeError 15
-  = return (liftM toError (deserialize :: Get Name))
-deserializeError 16
-  = return (liftM toError (deserialize :: Get Length))
-deserializeError 17
-  = return (liftM toError (deserialize :: Get Implementation))
-deserializeError _ = Nothing
- 
-deserializeEvent :: Word8 -> Maybe (Get SomeEvent)
-deserializeEvent 2
-  = return (liftM toEvent (deserialize :: Get KeyPress))
-deserializeEvent 3
-  = return (liftM toEvent (deserialize :: Get KeyRelease))
-deserializeEvent 4
-  = return (liftM toEvent (deserialize :: Get ButtonPress))
-deserializeEvent 5
-  = return (liftM toEvent (deserialize :: Get ButtonRelease))
-deserializeEvent 6
-  = return (liftM toEvent (deserialize :: Get MotionNotify))
-deserializeEvent 7
-  = return (liftM toEvent (deserialize :: Get EnterNotify))
-deserializeEvent 8
-  = return (liftM toEvent (deserialize :: Get LeaveNotify))
-deserializeEvent 9
-  = return (liftM toEvent (deserialize :: Get FocusIn))
-deserializeEvent 10
-  = return (liftM toEvent (deserialize :: Get FocusOut))
-deserializeEvent 11
-  = return (liftM toEvent (deserialize :: Get KeymapNotify))
-deserializeEvent 12
-  = return (liftM toEvent (deserialize :: Get Expose))
-deserializeEvent 13
-  = return (liftM toEvent (deserialize :: Get GraphicsExposure))
-deserializeEvent 14
-  = return (liftM toEvent (deserialize :: Get NoExposure))
-deserializeEvent 15
-  = return (liftM toEvent (deserialize :: Get VisibilityNotify))
-deserializeEvent 16
-  = return (liftM toEvent (deserialize :: Get CreateNotify))
-deserializeEvent 17
-  = return (liftM toEvent (deserialize :: Get DestroyNotify))
-deserializeEvent 18
-  = return (liftM toEvent (deserialize :: Get UnmapNotify))
-deserializeEvent 19
-  = return (liftM toEvent (deserialize :: Get MapNotify))
-deserializeEvent 20
-  = return (liftM toEvent (deserialize :: Get MapRequest))
-deserializeEvent 21
-  = return (liftM toEvent (deserialize :: Get ReparentNotify))
-deserializeEvent 22
-  = return (liftM toEvent (deserialize :: Get ConfigureNotify))
-deserializeEvent 23
-  = return (liftM toEvent (deserialize :: Get ConfigureRequest))
-deserializeEvent 24
-  = return (liftM toEvent (deserialize :: Get GravityNotify))
-deserializeEvent 25
-  = return (liftM toEvent (deserialize :: Get ResizeRequest))
-deserializeEvent 26
-  = return (liftM toEvent (deserialize :: Get CirculateNotify))
-deserializeEvent 27
-  = return (liftM toEvent (deserialize :: Get CirculateRequest))
-deserializeEvent 28
-  = return (liftM toEvent (deserialize :: Get PropertyNotify))
-deserializeEvent 29
-  = return (liftM toEvent (deserialize :: Get SelectionClear))
-deserializeEvent 30
-  = return (liftM toEvent (deserialize :: Get SelectionRequest))
-deserializeEvent 31
-  = return (liftM toEvent (deserialize :: Get SelectionNotify))
-deserializeEvent 32
-  = return (liftM toEvent (deserialize :: Get ColormapNotify))
-deserializeEvent 33
-  = return (liftM toEvent (deserialize :: Get ClientMessage))
-deserializeEvent 34
-  = return (liftM toEvent (deserialize :: Get MappingNotify))
-deserializeEvent _ = Nothing
- 
-data CHAR2B = MkCHAR2B{byte1_CHAR2B :: CARD8,
-                       byte2_CHAR2B :: CARD8}
-            deriving (Show, Typeable)
- 
-instance Serialize CHAR2B where
-        serialize x
-          = do serialize (byte1_CHAR2B x)
-               serialize (byte2_CHAR2B x)
-        size x = size (byte1_CHAR2B x) + size (byte2_CHAR2B x)
- 
-instance Deserialize CHAR2B where
-        deserialize
-          = do byte1 <- deserialize
-               byte2 <- deserialize
-               return (MkCHAR2B byte1 byte2)
- 
-newtype WINDOW = MkWINDOW Xid
-                 deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
- 
-newtype PIXMAP = MkPIXMAP Xid
-                 deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
- 
-newtype CURSOR = MkCURSOR Xid
-                 deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
- 
-newtype FONT = MkFONT Xid
-               deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
- 
-newtype GCONTEXT = MkGCONTEXT Xid
-                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
- 
-newtype COLORMAP = MkCOLORMAP Xid
-                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
- 
-newtype ATOM = MkATOM Xid
-               deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
- 
-newtype DRAWABLE = MkDRAWABLE Xid
-                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
- 
-newtype FONTABLE = MkFONTABLE Xid
-                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
- 
-type VISUALID = CARD32
- 
-type TIMESTAMP = CARD32
- 
-type KEYSYM = CARD32
- 
-type KEYCODE = CARD8
- 
-type BUTTON = CARD8
- 
-data POINT = MkPOINT{x_POINT :: INT16, y_POINT :: INT16}
-           deriving (Show, Typeable)
- 
-instance Serialize POINT where
-        serialize x
-          = do serialize (x_POINT x)
-               serialize (y_POINT x)
-        size x = size (x_POINT x) + size (y_POINT x)
- 
-instance Deserialize POINT where
-        deserialize
-          = do x <- deserialize
-               y <- deserialize
-               return (MkPOINT x y)
- 
-data RECTANGLE = MkRECTANGLE{x_RECTANGLE :: INT16,
-                             y_RECTANGLE :: INT16, width_RECTANGLE :: CARD16,
-                             height_RECTANGLE :: CARD16}
-               deriving (Show, Typeable)
- 
-instance Serialize RECTANGLE where
-        serialize x
-          = do serialize (x_RECTANGLE x)
-               serialize (y_RECTANGLE x)
-               serialize (width_RECTANGLE x)
-               serialize (height_RECTANGLE x)
-        size x
-          = size (x_RECTANGLE x) + size (y_RECTANGLE x) +
-              size (width_RECTANGLE x)
-              + size (height_RECTANGLE x)
- 
-instance Deserialize RECTANGLE where
-        deserialize
-          = do x <- deserialize
-               y <- deserialize
-               width <- deserialize
-               height <- deserialize
-               return (MkRECTANGLE x y width height)
- 
-data ARC = MkARC{x_ARC :: INT16, y_ARC :: INT16,
-                 width_ARC :: CARD16, height_ARC :: CARD16, angle1_ARC :: INT16,
-                 angle2_ARC :: INT16}
-         deriving (Show, Typeable)
- 
-instance Serialize ARC where
-        serialize x
-          = do serialize (x_ARC x)
-               serialize (y_ARC x)
-               serialize (width_ARC x)
-               serialize (height_ARC x)
-               serialize (angle1_ARC x)
-               serialize (angle2_ARC x)
-        size x
-          = size (x_ARC x) + size (y_ARC x) + size (width_ARC x) +
-              size (height_ARC x)
-              + size (angle1_ARC x)
-              + size (angle2_ARC x)
- 
-instance Deserialize ARC where
-        deserialize
-          = do x <- deserialize
-               y <- deserialize
-               width <- deserialize
-               height <- deserialize
-               angle1 <- deserialize
-               angle2 <- deserialize
-               return (MkARC x y width height angle1 angle2)
- 
-data FORMAT = MkFORMAT{depth_FORMAT :: CARD8,
-                       bits_per_pixel_FORMAT :: CARD8, scanline_pad_FORMAT :: CARD8}
-            deriving (Show, Typeable)
- 
-instance Serialize FORMAT where
-        serialize x
-          = do serialize (depth_FORMAT x)
-               serialize (bits_per_pixel_FORMAT x)
-               serialize (scanline_pad_FORMAT x)
-               putSkip 5
-        size x
-          = size (depth_FORMAT x) + size (bits_per_pixel_FORMAT x) +
-              size (scanline_pad_FORMAT x)
-              + 5
- 
-instance Deserialize FORMAT where
-        deserialize
-          = do depth <- deserialize
-               bits_per_pixel <- deserialize
-               scanline_pad <- deserialize
-               skip 5
-               return (MkFORMAT depth bits_per_pixel scanline_pad)
- 
-data VisualClass = VisualClassStaticGray
-                 | VisualClassGrayScale
-                 | VisualClassStaticColor
-                 | VisualClassPseudoColor
-                 | VisualClassTrueColor
-                 | VisualClassDirectColor
- 
-instance SimpleEnum VisualClass where
-        toValue VisualClassStaticGray{} = 0
-        toValue VisualClassGrayScale{} = 1
-        toValue VisualClassStaticColor{} = 2
-        toValue VisualClassPseudoColor{} = 3
-        toValue VisualClassTrueColor{} = 4
-        toValue VisualClassDirectColor{} = 5
-        fromValue 0 = VisualClassStaticGray
-        fromValue 1 = VisualClassGrayScale
-        fromValue 2 = VisualClassStaticColor
-        fromValue 3 = VisualClassPseudoColor
-        fromValue 4 = VisualClassTrueColor
-        fromValue 5 = VisualClassDirectColor
- 
-data VISUALTYPE = MkVISUALTYPE{visual_id_VISUALTYPE :: VISUALID,
-                               class_VISUALTYPE :: CARD8, bits_per_rgb_value_VISUALTYPE :: CARD8,
-                               colormap_entries_VISUALTYPE :: CARD16,
-                               red_mask_VISUALTYPE :: CARD32, green_mask_VISUALTYPE :: CARD32,
-                               blue_mask_VISUALTYPE :: CARD32}
-                deriving (Show, Typeable)
- 
-instance Serialize VISUALTYPE where
-        serialize x
-          = do serialize (visual_id_VISUALTYPE x)
-               serialize (class_VISUALTYPE x)
-               serialize (bits_per_rgb_value_VISUALTYPE x)
-               serialize (colormap_entries_VISUALTYPE x)
-               serialize (red_mask_VISUALTYPE x)
-               serialize (green_mask_VISUALTYPE x)
-               serialize (blue_mask_VISUALTYPE x)
-               putSkip 4
-        size x
-          = size (visual_id_VISUALTYPE x) + size (class_VISUALTYPE x) +
-              size (bits_per_rgb_value_VISUALTYPE x)
-              + size (colormap_entries_VISUALTYPE x)
-              + size (red_mask_VISUALTYPE x)
-              + size (green_mask_VISUALTYPE x)
-              + size (blue_mask_VISUALTYPE x)
-              + 4
- 
-instance Deserialize VISUALTYPE where
-        deserialize
-          = do visual_id <- deserialize
-               class_ <- deserialize
-               bits_per_rgb_value <- deserialize
-               colormap_entries <- deserialize
-               red_mask <- deserialize
-               green_mask <- deserialize
-               blue_mask <- deserialize
-               skip 4
-               return
-                 (MkVISUALTYPE visual_id class_ bits_per_rgb_value colormap_entries
-                    red_mask
-                    green_mask
-                    blue_mask)
- 
-data DEPTH = MkDEPTH{depth_DEPTH :: CARD8,
-                     visuals_len_DEPTH :: CARD16, visuals_DEPTH :: [VISUALTYPE]}
-           deriving (Show, Typeable)
- 
-instance Serialize DEPTH where
-        serialize x
-          = do serialize (depth_DEPTH x)
-               putSkip 1
-               serialize (visuals_len_DEPTH x)
-               putSkip 4
-               serializeList (visuals_DEPTH x)
-        size x
-          = size (depth_DEPTH x) + 1 + size (visuals_len_DEPTH x) + 4 +
-              sum (map size (visuals_DEPTH x))
- 
-instance Deserialize DEPTH where
-        deserialize
-          = do depth <- deserialize
-               skip 1
-               visuals_len <- deserialize
-               skip 4
-               visuals <- deserializeList (fromIntegral visuals_len)
-               return (MkDEPTH depth visuals_len visuals)
- 
-data SCREEN = MkSCREEN{root_SCREEN :: WINDOW,
-                       default_colormap_SCREEN :: COLORMAP, white_pixel_SCREEN :: CARD32,
-                       black_pixel_SCREEN :: CARD32, current_input_masks_SCREEN :: CARD32,
-                       width_in_pixels_SCREEN :: CARD16,
-                       height_in_pixels_SCREEN :: CARD16,
-                       width_in_millimeters_SCREEN :: CARD16,
-                       height_in_millimeters_SCREEN :: CARD16,
-                       min_installed_maps_SCREEN :: CARD16,
-                       max_installed_maps_SCREEN :: CARD16,
-                       root_visual_SCREEN :: VISUALID, backing_stores_SCREEN :: BYTE,
-                       save_unders_SCREEN :: BOOL, root_depth_SCREEN :: CARD8,
-                       allowed_depths_len_SCREEN :: CARD8,
-                       allowed_depths_SCREEN :: [DEPTH]}
-            deriving (Show, Typeable)
- 
-instance Serialize SCREEN where
-        serialize x
-          = do serialize (root_SCREEN x)
-               serialize (default_colormap_SCREEN x)
-               serialize (white_pixel_SCREEN x)
-               serialize (black_pixel_SCREEN x)
-               serialize (current_input_masks_SCREEN x)
-               serialize (width_in_pixels_SCREEN x)
-               serialize (height_in_pixels_SCREEN x)
-               serialize (width_in_millimeters_SCREEN x)
-               serialize (height_in_millimeters_SCREEN x)
-               serialize (min_installed_maps_SCREEN x)
-               serialize (max_installed_maps_SCREEN x)
-               serialize (root_visual_SCREEN x)
-               serialize (backing_stores_SCREEN x)
-               serialize (save_unders_SCREEN x)
-               serialize (root_depth_SCREEN x)
-               serialize (allowed_depths_len_SCREEN x)
-               serializeList (allowed_depths_SCREEN x)
-        size x
-          = size (root_SCREEN x) + size (default_colormap_SCREEN x) +
-              size (white_pixel_SCREEN x)
-              + size (black_pixel_SCREEN x)
-              + size (current_input_masks_SCREEN x)
-              + size (width_in_pixels_SCREEN x)
-              + size (height_in_pixels_SCREEN x)
-              + size (width_in_millimeters_SCREEN x)
-              + size (height_in_millimeters_SCREEN x)
-              + size (min_installed_maps_SCREEN x)
-              + size (max_installed_maps_SCREEN x)
-              + size (root_visual_SCREEN x)
-              + size (backing_stores_SCREEN x)
-              + size (save_unders_SCREEN x)
-              + size (root_depth_SCREEN x)
-              + size (allowed_depths_len_SCREEN x)
-              + sum (map size (allowed_depths_SCREEN x))
- 
-instance Deserialize SCREEN where
-        deserialize
-          = do root <- deserialize
-               default_colormap <- deserialize
-               white_pixel <- deserialize
-               black_pixel <- deserialize
-               current_input_masks <- deserialize
-               width_in_pixels <- deserialize
-               height_in_pixels <- deserialize
-               width_in_millimeters <- deserialize
-               height_in_millimeters <- deserialize
-               min_installed_maps <- deserialize
-               max_installed_maps <- deserialize
-               root_visual <- deserialize
-               backing_stores <- deserialize
-               save_unders <- deserialize
-               root_depth <- deserialize
-               allowed_depths_len <- deserialize
-               allowed_depths <- deserializeList (fromIntegral allowed_depths_len)
-               return
-                 (MkSCREEN root default_colormap white_pixel black_pixel
-                    current_input_masks
-                    width_in_pixels
-                    height_in_pixels
-                    width_in_millimeters
-                    height_in_millimeters
-                    min_installed_maps
-                    max_installed_maps
-                    root_visual
-                    backing_stores
-                    save_unders
-                    root_depth
-                    allowed_depths_len
-                    allowed_depths)
- 
-data SetupRequest = MkSetupRequest{byte_order_SetupRequest ::
-                                   CARD8,
-                                   protocol_major_version_SetupRequest :: CARD16,
-                                   protocol_minor_version_SetupRequest :: CARD16,
-                                   authorization_protocol_name_len_SetupRequest :: CARD16,
-                                   authorization_protocol_data_len_SetupRequest :: CARD16,
-                                   authorization_protocol_name_SetupRequest :: [CChar],
-                                   authorization_protocol_data_SetupRequest :: [CChar]}
-                  deriving (Show, Typeable)
- 
-instance Serialize SetupRequest where
-        serialize x
-          = do serialize (byte_order_SetupRequest x)
-               putSkip 1
-               serialize (protocol_major_version_SetupRequest x)
-               serialize (protocol_minor_version_SetupRequest x)
-               serialize (authorization_protocol_name_len_SetupRequest x)
-               serialize (authorization_protocol_data_len_SetupRequest x)
-               putSkip 2
-               serializeList (authorization_protocol_name_SetupRequest x)
-               serializeList (authorization_protocol_data_SetupRequest x)
-        size x
-          = size (byte_order_SetupRequest x) + 1 +
-              size (protocol_major_version_SetupRequest x)
-              + size (protocol_minor_version_SetupRequest x)
-              + size (authorization_protocol_name_len_SetupRequest x)
-              + size (authorization_protocol_data_len_SetupRequest x)
-              + 2
-              + sum (map size (authorization_protocol_name_SetupRequest x))
-              + sum (map size (authorization_protocol_data_SetupRequest x))
- 
-instance Deserialize SetupRequest where
-        deserialize
-          = do byte_order <- deserialize
-               skip 1
-               protocol_major_version <- deserialize
-               protocol_minor_version <- deserialize
-               authorization_protocol_name_len <- deserialize
-               authorization_protocol_data_len <- deserialize
-               skip 2
-               authorization_protocol_name <- deserializeList
-                                                (fromIntegral authorization_protocol_name_len)
-               authorization_protocol_data <- deserializeList
-                                                (fromIntegral authorization_protocol_data_len)
-               return
-                 (MkSetupRequest byte_order protocol_major_version
-                    protocol_minor_version
-                    authorization_protocol_name_len
-                    authorization_protocol_data_len
-                    authorization_protocol_name
-                    authorization_protocol_data)
- 
-data SetupFailed = MkSetupFailed{status_SetupFailed :: CARD8,
-                                 reason_len_SetupFailed :: CARD8,
-                                 protocol_major_version_SetupFailed :: CARD16,
-                                 protocol_minor_version_SetupFailed :: CARD16,
-                                 length_SetupFailed :: CARD16, reason_SetupFailed :: [CChar]}
-                 deriving (Show, Typeable)
- 
-instance Serialize SetupFailed where
-        serialize x
-          = do serialize (status_SetupFailed x)
-               serialize (reason_len_SetupFailed x)
-               serialize (protocol_major_version_SetupFailed x)
-               serialize (protocol_minor_version_SetupFailed x)
-               serialize (length_SetupFailed x)
-               serializeList (reason_SetupFailed x)
-        size x
-          = size (status_SetupFailed x) + size (reason_len_SetupFailed x) +
-              size (protocol_major_version_SetupFailed x)
-              + size (protocol_minor_version_SetupFailed x)
-              + size (length_SetupFailed x)
-              + sum (map size (reason_SetupFailed x))
- 
-instance Deserialize SetupFailed where
-        deserialize
-          = do status <- deserialize
-               reason_len <- deserialize
-               protocol_major_version <- deserialize
-               protocol_minor_version <- deserialize
-               length <- deserialize
-               reason <- deserializeList (fromIntegral reason_len)
-               return
-                 (MkSetupFailed status reason_len protocol_major_version
-                    protocol_minor_version
-                    length
-                    reason)
- 
-data SetupAuthenticate = MkSetupAuthenticate{status_SetupAuthenticate
-                                             :: CARD8,
-                                             length_SetupAuthenticate :: CARD16,
-                                             reason_SetupAuthenticate :: [CChar]}
-                       deriving (Show, Typeable)
- 
-instance Serialize SetupAuthenticate where
-        serialize x
-          = do serialize (status_SetupAuthenticate x)
-               putSkip 5
-               serialize (length_SetupAuthenticate x)
-               serializeList (reason_SetupAuthenticate x)
-        size x
-          = size (status_SetupAuthenticate x) + 5 +
-              size (length_SetupAuthenticate x)
-              + sum (map size (reason_SetupAuthenticate x))
- 
-instance Deserialize SetupAuthenticate where
-        deserialize
-          = do status <- deserialize
-               skip 5
-               length <- deserialize
-               reason <- deserializeList
-                           (fromIntegral (fromIntegral (length * 4)))
-               return (MkSetupAuthenticate status length reason)
- 
-data ImageOrder = ImageOrderLSBFirst
-                | ImageOrderMSBFirst
- 
-instance SimpleEnum ImageOrder where
-        toValue ImageOrderLSBFirst{} = 0
-        toValue ImageOrderMSBFirst{} = 1
-        fromValue 0 = ImageOrderLSBFirst
-        fromValue 1 = ImageOrderMSBFirst
- 
-data Setup = MkSetup{status_Setup :: CARD8,
-                     protocol_major_version_Setup :: CARD16,
-                     protocol_minor_version_Setup :: CARD16, length_Setup :: CARD16,
-                     release_number_Setup :: CARD32, resource_id_base_Setup :: CARD32,
-                     resource_id_mask_Setup :: CARD32,
-                     motion_buffer_size_Setup :: CARD32, vendor_len_Setup :: CARD16,
-                     maximum_request_length_Setup :: CARD16, roots_len_Setup :: CARD8,
-                     pixmap_formats_len_Setup :: CARD8, image_byte_order_Setup :: CARD8,
-                     bitmap_format_bit_order_Setup :: CARD8,
-                     bitmap_format_scanline_unit_Setup :: CARD8,
-                     bitmap_format_scanline_pad_Setup :: CARD8,
-                     min_keycode_Setup :: KEYCODE, max_keycode_Setup :: KEYCODE,
-                     vendor_Setup :: [CChar], pixmap_formats_Setup :: [FORMAT],
-                     roots_Setup :: [SCREEN]}
-           deriving (Show, Typeable)
- 
-instance Serialize Setup where
-        serialize x
-          = do serialize (status_Setup x)
-               putSkip 1
-               serialize (protocol_major_version_Setup x)
-               serialize (protocol_minor_version_Setup x)
-               serialize (length_Setup x)
-               serialize (release_number_Setup x)
-               serialize (resource_id_base_Setup x)
-               serialize (resource_id_mask_Setup x)
-               serialize (motion_buffer_size_Setup x)
-               serialize (vendor_len_Setup x)
-               serialize (maximum_request_length_Setup x)
-               serialize (roots_len_Setup x)
-               serialize (pixmap_formats_len_Setup x)
-               serialize (image_byte_order_Setup x)
-               serialize (bitmap_format_bit_order_Setup x)
-               serialize (bitmap_format_scanline_unit_Setup x)
-               serialize (bitmap_format_scanline_pad_Setup x)
-               serialize (min_keycode_Setup x)
-               serialize (max_keycode_Setup x)
-               putSkip 4
-               serializeList (vendor_Setup x)
-               serializeList (pixmap_formats_Setup x)
-               serializeList (roots_Setup x)
-        size x
-          = size (status_Setup x) + 1 + size (protocol_major_version_Setup x)
-              + size (protocol_minor_version_Setup x)
-              + size (length_Setup x)
-              + size (release_number_Setup x)
-              + size (resource_id_base_Setup x)
-              + size (resource_id_mask_Setup x)
-              + size (motion_buffer_size_Setup x)
-              + size (vendor_len_Setup x)
-              + size (maximum_request_length_Setup x)
-              + size (roots_len_Setup x)
-              + size (pixmap_formats_len_Setup x)
-              + size (image_byte_order_Setup x)
-              + size (bitmap_format_bit_order_Setup x)
-              + size (bitmap_format_scanline_unit_Setup x)
-              + size (bitmap_format_scanline_pad_Setup x)
-              + size (min_keycode_Setup x)
-              + size (max_keycode_Setup x)
-              + 4
-              + sum (map size (vendor_Setup x))
-              + sum (map size (pixmap_formats_Setup x))
-              + sum (map size (roots_Setup x))
- 
-instance Deserialize Setup where
-        deserialize
-          = do status <- deserialize
-               skip 1
-               protocol_major_version <- deserialize
-               protocol_minor_version <- deserialize
-               length <- deserialize
-               release_number <- deserialize
-               resource_id_base <- deserialize
-               resource_id_mask <- deserialize
-               motion_buffer_size <- deserialize
-               vendor_len <- deserialize
-               maximum_request_length <- deserialize
-               roots_len <- deserialize
-               pixmap_formats_len <- deserialize
-               image_byte_order <- deserialize
-               bitmap_format_bit_order <- deserialize
-               bitmap_format_scanline_unit <- deserialize
-               bitmap_format_scanline_pad <- deserialize
-               min_keycode <- deserialize
-               max_keycode <- deserialize
-               skip 4
-               vendor <- deserializeList (fromIntegral vendor_len)
-               pixmap_formats <- deserializeList (fromIntegral pixmap_formats_len)
-               roots <- deserializeList (fromIntegral roots_len)
-               return
-                 (MkSetup status protocol_major_version protocol_minor_version
-                    length
-                    release_number
-                    resource_id_base
-                    resource_id_mask
-                    motion_buffer_size
-                    vendor_len
-                    maximum_request_length
-                    roots_len
-                    pixmap_formats_len
-                    image_byte_order
-                    bitmap_format_bit_order
-                    bitmap_format_scanline_unit
-                    bitmap_format_scanline_pad
-                    min_keycode
-                    max_keycode
-                    vendor
-                    pixmap_formats
-                    roots)
- 
-data ModMask = ModMaskShift
-             | ModMaskLock
-             | ModMaskControl
-             | ModMask1
-             | ModMask2
-             | ModMask3
-             | ModMask4
-             | ModMask5
- 
-instance BitEnum ModMask where
-        toBit ModMaskShift{} = 0
-        toBit ModMaskLock{} = 1
-        toBit ModMaskControl{} = 2
-        toBit ModMask1{} = 3
-        toBit ModMask2{} = 4
-        toBit ModMask3{} = 5
-        toBit ModMask4{} = 6
-        toBit ModMask5{} = 7
-        fromBit 0 = ModMaskShift
-        fromBit 1 = ModMaskLock
-        fromBit 2 = ModMaskControl
-        fromBit 3 = ModMask1
-        fromBit 4 = ModMask2
-        fromBit 5 = ModMask3
-        fromBit 6 = ModMask4
-        fromBit 7 = ModMask5
- 
-data KeyPress = MkKeyPress{detail_KeyPress :: KEYCODE,
-                           time_KeyPress :: TIMESTAMP, root_KeyPress :: WINDOW,
-                           event_KeyPress :: WINDOW, child_KeyPress :: WINDOW,
-                           root_x_KeyPress :: INT16, root_y_KeyPress :: INT16,
-                           event_x_KeyPress :: INT16, event_y_KeyPress :: INT16,
-                           state_KeyPress :: CARD16, same_screen_KeyPress :: BOOL}
-              deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event KeyPress
- 
-instance Deserialize KeyPress where
-        deserialize
-          = do skip 1
-               detail <- deserialize
-               skip 2
-               time <- deserialize
-               root <- deserialize
-               event <- deserialize
-               child <- deserialize
-               root_x <- deserialize
-               root_y <- deserialize
-               event_x <- deserialize
-               event_y <- deserialize
-               state <- deserialize
-               same_screen <- deserialize
-               skip 1
-               return
-                 (MkKeyPress detail time root event child root_x root_y event_x
-                    event_y
-                    state
-                    same_screen)
- 
-data KeyRelease = MkKeyRelease{detail_KeyRelease :: KEYCODE,
-                               time_KeyRelease :: TIMESTAMP, root_KeyRelease :: WINDOW,
-                               event_KeyRelease :: WINDOW, child_KeyRelease :: WINDOW,
-                               root_x_KeyRelease :: INT16, root_y_KeyRelease :: INT16,
-                               event_x_KeyRelease :: INT16, event_y_KeyRelease :: INT16,
-                               state_KeyRelease :: CARD16, same_screen_KeyRelease :: BOOL}
-                deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event KeyRelease
- 
-instance Deserialize KeyRelease where
-        deserialize
-          = do skip 1
-               detail <- deserialize
-               skip 2
-               time <- deserialize
-               root <- deserialize
-               event <- deserialize
-               child <- deserialize
-               root_x <- deserialize
-               root_y <- deserialize
-               event_x <- deserialize
-               event_y <- deserialize
-               state <- deserialize
-               same_screen <- deserialize
-               skip 1
-               return
-                 (MkKeyRelease detail time root event child root_x root_y event_x
-                    event_y
-                    state
-                    same_screen)
- 
-data ButtonMask = ButtonMask1
-                | ButtonMask2
-                | ButtonMask3
-                | ButtonMask4
-                | ButtonMask5
-                | ButtonMaskAny
- 
-instance BitEnum ButtonMask where
-        toBit ButtonMask1{} = 8
-        toBit ButtonMask2{} = 9
-        toBit ButtonMask3{} = 10
-        toBit ButtonMask4{} = 11
-        toBit ButtonMask5{} = 12
-        toBit ButtonMaskAny{} = 15
-        fromBit 8 = ButtonMask1
-        fromBit 9 = ButtonMask2
-        fromBit 10 = ButtonMask3
-        fromBit 11 = ButtonMask4
-        fromBit 12 = ButtonMask5
-        fromBit 15 = ButtonMaskAny
- 
-data ButtonPress = MkButtonPress{detail_ButtonPress :: BUTTON,
-                                 time_ButtonPress :: TIMESTAMP, root_ButtonPress :: WINDOW,
-                                 event_ButtonPress :: WINDOW, child_ButtonPress :: WINDOW,
-                                 root_x_ButtonPress :: INT16, root_y_ButtonPress :: INT16,
-                                 event_x_ButtonPress :: INT16, event_y_ButtonPress :: INT16,
-                                 state_ButtonPress :: CARD16, same_screen_ButtonPress :: BOOL}
-                 deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event ButtonPress
- 
-instance Deserialize ButtonPress where
-        deserialize
-          = do skip 1
-               detail <- deserialize
-               skip 2
-               time <- deserialize
-               root <- deserialize
-               event <- deserialize
-               child <- deserialize
-               root_x <- deserialize
-               root_y <- deserialize
-               event_x <- deserialize
-               event_y <- deserialize
-               state <- deserialize
-               same_screen <- deserialize
-               skip 1
-               return
-                 (MkButtonPress detail time root event child root_x root_y event_x
-                    event_y
-                    state
-                    same_screen)
- 
-data ButtonRelease = MkButtonRelease{detail_ButtonRelease ::
-                                     BUTTON,
-                                     time_ButtonRelease :: TIMESTAMP, root_ButtonRelease :: WINDOW,
-                                     event_ButtonRelease :: WINDOW, child_ButtonRelease :: WINDOW,
-                                     root_x_ButtonRelease :: INT16, root_y_ButtonRelease :: INT16,
-                                     event_x_ButtonRelease :: INT16, event_y_ButtonRelease :: INT16,
-                                     state_ButtonRelease :: CARD16,
-                                     same_screen_ButtonRelease :: BOOL}
-                   deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event ButtonRelease
- 
-instance Deserialize ButtonRelease where
-        deserialize
-          = do skip 1
-               detail <- deserialize
-               skip 2
-               time <- deserialize
-               root <- deserialize
-               event <- deserialize
-               child <- deserialize
-               root_x <- deserialize
-               root_y <- deserialize
-               event_x <- deserialize
-               event_y <- deserialize
-               state <- deserialize
-               same_screen <- deserialize
-               skip 1
-               return
-                 (MkButtonRelease detail time root event child root_x root_y event_x
-                    event_y
-                    state
-                    same_screen)
- 
-data Motion = MotionNormal
-            | MotionHint
- 
-instance SimpleEnum Motion where
-        toValue MotionNormal{} = 0
-        toValue MotionHint{} = 1
-        fromValue 0 = MotionNormal
-        fromValue 1 = MotionHint
- 
-data MotionNotify = MkMotionNotify{detail_MotionNotify :: BYTE,
-                                   time_MotionNotify :: TIMESTAMP, root_MotionNotify :: WINDOW,
-                                   event_MotionNotify :: WINDOW, child_MotionNotify :: WINDOW,
-                                   root_x_MotionNotify :: INT16, root_y_MotionNotify :: INT16,
-                                   event_x_MotionNotify :: INT16, event_y_MotionNotify :: INT16,
-                                   state_MotionNotify :: CARD16, same_screen_MotionNotify :: BOOL}
-                  deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event MotionNotify
- 
-instance Deserialize MotionNotify where
-        deserialize
-          = do skip 1
-               detail <- deserialize
-               skip 2
-               time <- deserialize
-               root <- deserialize
-               event <- deserialize
-               child <- deserialize
-               root_x <- deserialize
-               root_y <- deserialize
-               event_x <- deserialize
-               event_y <- deserialize
-               state <- deserialize
-               same_screen <- deserialize
-               skip 1
-               return
-                 (MkMotionNotify detail time root event child root_x root_y event_x
-                    event_y
-                    state
-                    same_screen)
- 
-data NotifyDetail = NotifyDetailAncestor
-                  | NotifyDetailVirtual
-                  | NotifyDetailInferior
-                  | NotifyDetailNonlinear
-                  | NotifyDetailNonlinearVirtual
-                  | NotifyDetailPointer
-                  | NotifyDetailPointerRoot
-                  | NotifyDetailNone
- 
-instance SimpleEnum NotifyDetail where
-        toValue NotifyDetailAncestor{} = 0
-        toValue NotifyDetailVirtual{} = 1
-        toValue NotifyDetailInferior{} = 2
-        toValue NotifyDetailNonlinear{} = 3
-        toValue NotifyDetailNonlinearVirtual{} = 4
-        toValue NotifyDetailPointer{} = 5
-        toValue NotifyDetailPointerRoot{} = 6
-        toValue NotifyDetailNone{} = 7
-        fromValue 0 = NotifyDetailAncestor
-        fromValue 1 = NotifyDetailVirtual
-        fromValue 2 = NotifyDetailInferior
-        fromValue 3 = NotifyDetailNonlinear
-        fromValue 4 = NotifyDetailNonlinearVirtual
-        fromValue 5 = NotifyDetailPointer
-        fromValue 6 = NotifyDetailPointerRoot
-        fromValue 7 = NotifyDetailNone
- 
-data NotifyMode = NotifyModeNormal
-                | NotifyModeGrab
-                | NotifyModeUngrab
-                | NotifyModeWhileGrabbed
- 
-instance SimpleEnum NotifyMode where
-        toValue NotifyModeNormal{} = 0
-        toValue NotifyModeGrab{} = 1
-        toValue NotifyModeUngrab{} = 2
-        toValue NotifyModeWhileGrabbed{} = 3
-        fromValue 0 = NotifyModeNormal
-        fromValue 1 = NotifyModeGrab
-        fromValue 2 = NotifyModeUngrab
-        fromValue 3 = NotifyModeWhileGrabbed
- 
-data EnterNotify = MkEnterNotify{detail_EnterNotify :: BYTE,
-                                 time_EnterNotify :: TIMESTAMP, root_EnterNotify :: WINDOW,
-                                 event_EnterNotify :: WINDOW, child_EnterNotify :: WINDOW,
-                                 root_x_EnterNotify :: INT16, root_y_EnterNotify :: INT16,
-                                 event_x_EnterNotify :: INT16, event_y_EnterNotify :: INT16,
-                                 state_EnterNotify :: CARD16, mode_EnterNotify :: BYTE,
-                                 same_screen_focus_EnterNotify :: BYTE}
-                 deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event EnterNotify
- 
-instance Deserialize EnterNotify where
-        deserialize
-          = do skip 1
-               detail <- deserialize
-               skip 2
-               time <- deserialize
-               root <- deserialize
-               event <- deserialize
-               child <- deserialize
-               root_x <- deserialize
-               root_y <- deserialize
-               event_x <- deserialize
-               event_y <- deserialize
-               state <- deserialize
-               mode <- deserialize
-               same_screen_focus <- deserialize
-               return
-                 (MkEnterNotify detail time root event child root_x root_y event_x
-                    event_y
-                    state
-                    mode
-                    same_screen_focus)
- 
-data LeaveNotify = MkLeaveNotify{detail_LeaveNotify :: BYTE,
-                                 time_LeaveNotify :: TIMESTAMP, root_LeaveNotify :: WINDOW,
-                                 event_LeaveNotify :: WINDOW, child_LeaveNotify :: WINDOW,
-                                 root_x_LeaveNotify :: INT16, root_y_LeaveNotify :: INT16,
-                                 event_x_LeaveNotify :: INT16, event_y_LeaveNotify :: INT16,
-                                 state_LeaveNotify :: CARD16, mode_LeaveNotify :: BYTE,
-                                 same_screen_focus_LeaveNotify :: BYTE}
-                 deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event LeaveNotify
- 
-instance Deserialize LeaveNotify where
-        deserialize
-          = do skip 1
-               detail <- deserialize
-               skip 2
-               time <- deserialize
-               root <- deserialize
-               event <- deserialize
-               child <- deserialize
-               root_x <- deserialize
-               root_y <- deserialize
-               event_x <- deserialize
-               event_y <- deserialize
-               state <- deserialize
-               mode <- deserialize
-               same_screen_focus <- deserialize
-               return
-                 (MkLeaveNotify detail time root event child root_x root_y event_x
-                    event_y
-                    state
-                    mode
-                    same_screen_focus)
- 
-data FocusIn = MkFocusIn{detail_FocusIn :: BYTE,
-                         event_FocusIn :: WINDOW, mode_FocusIn :: BYTE}
-             deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event FocusIn
- 
-instance Deserialize FocusIn where
-        deserialize
-          = do skip 1
-               detail <- deserialize
-               skip 2
-               event <- deserialize
-               mode <- deserialize
-               skip 3
-               return (MkFocusIn detail event mode)
- 
-data FocusOut = MkFocusOut{detail_FocusOut :: BYTE,
-                           event_FocusOut :: WINDOW, mode_FocusOut :: BYTE}
-              deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event FocusOut
- 
-instance Deserialize FocusOut where
-        deserialize
-          = do skip 1
-               detail <- deserialize
-               skip 2
-               event <- deserialize
-               mode <- deserialize
-               skip 3
-               return (MkFocusOut detail event mode)
- 
-data KeymapNotify = MkKeymapNotify{keys_KeymapNotify :: [CARD8]}
-                  deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event KeymapNotify
- 
-instance Deserialize KeymapNotify where
-        deserialize
-          = do skip 1
-               keys <- deserializeList (fromIntegral 31)
-               return (MkKeymapNotify keys)
- 
-data Expose = MkExpose{window_Expose :: WINDOW, x_Expose :: CARD16,
-                       y_Expose :: CARD16, width_Expose :: CARD16,
-                       height_Expose :: CARD16, count_Expose :: CARD16}
-            deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event Expose
- 
-instance Deserialize Expose where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               window <- deserialize
-               x <- deserialize
-               y <- deserialize
-               width <- deserialize
-               height <- deserialize
-               count <- deserialize
-               skip 2
-               return (MkExpose window x y width height count)
- 
-data GraphicsExposure = MkGraphicsExposure{drawable_GraphicsExposure
-                                           :: DRAWABLE,
-                                           x_GraphicsExposure :: CARD16,
-                                           y_GraphicsExposure :: CARD16,
-                                           width_GraphicsExposure :: CARD16,
-                                           height_GraphicsExposure :: CARD16,
-                                           minor_opcode_GraphicsExposure :: CARD16,
-                                           count_GraphicsExposure :: CARD16,
-                                           major_opcode_GraphicsExposure :: CARD8}
-                      deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event GraphicsExposure
- 
-instance Deserialize GraphicsExposure where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               drawable <- deserialize
-               x <- deserialize
-               y <- deserialize
-               width <- deserialize
-               height <- deserialize
-               minor_opcode <- deserialize
-               count <- deserialize
-               major_opcode <- deserialize
-               skip 3
-               return
-                 (MkGraphicsExposure drawable x y width height minor_opcode count
-                    major_opcode)
- 
-data NoExposure = MkNoExposure{drawable_NoExposure :: DRAWABLE,
-                               minor_opcode_NoExposure :: CARD16,
-                               major_opcode_NoExposure :: CARD8}
-                deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event NoExposure
- 
-instance Deserialize NoExposure where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               drawable <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkNoExposure drawable minor_opcode major_opcode)
- 
-data Visibility = VisibilityUnobscured
-                | VisibilityPartiallyObscured
-                | VisibilityFullyObscured
- 
-instance SimpleEnum Visibility where
-        toValue VisibilityUnobscured{} = 0
-        toValue VisibilityPartiallyObscured{} = 1
-        toValue VisibilityFullyObscured{} = 2
-        fromValue 0 = VisibilityUnobscured
-        fromValue 1 = VisibilityPartiallyObscured
-        fromValue 2 = VisibilityFullyObscured
- 
-data VisibilityNotify = MkVisibilityNotify{window_VisibilityNotify
-                                           :: WINDOW,
-                                           state_VisibilityNotify :: BYTE}
-                      deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event VisibilityNotify
- 
-instance Deserialize VisibilityNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               window <- deserialize
-               state <- deserialize
-               skip 3
-               return (MkVisibilityNotify window state)
- 
-data CreateNotify = MkCreateNotify{parent_CreateNotify :: WINDOW,
-                                   window_CreateNotify :: WINDOW, x_CreateNotify :: INT16,
-                                   y_CreateNotify :: INT16, width_CreateNotify :: CARD16,
-                                   height_CreateNotify :: CARD16,
-                                   border_width_CreateNotify :: CARD16,
-                                   override_redirect_CreateNotify :: BOOL}
-                  deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event CreateNotify
- 
-instance Deserialize CreateNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               parent <- deserialize
-               window <- deserialize
-               x <- deserialize
-               y <- deserialize
-               width <- deserialize
-               height <- deserialize
-               border_width <- deserialize
-               override_redirect <- deserialize
-               skip 1
-               return
-                 (MkCreateNotify parent window x y width height border_width
-                    override_redirect)
- 
-data DestroyNotify = MkDestroyNotify{event_DestroyNotify :: WINDOW,
-                                     window_DestroyNotify :: WINDOW}
-                   deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event DestroyNotify
- 
-instance Deserialize DestroyNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               event <- deserialize
-               window <- deserialize
-               return (MkDestroyNotify event window)
- 
-data UnmapNotify = MkUnmapNotify{event_UnmapNotify :: WINDOW,
-                                 window_UnmapNotify :: WINDOW, from_configure_UnmapNotify :: BOOL}
-                 deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event UnmapNotify
- 
-instance Deserialize UnmapNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               event <- deserialize
-               window <- deserialize
-               from_configure <- deserialize
-               skip 3
-               return (MkUnmapNotify event window from_configure)
- 
-data MapNotify = MkMapNotify{event_MapNotify :: WINDOW,
-                             window_MapNotify :: WINDOW, override_redirect_MapNotify :: BOOL}
-               deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event MapNotify
- 
-instance Deserialize MapNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               event <- deserialize
-               window <- deserialize
-               override_redirect <- deserialize
-               skip 3
-               return (MkMapNotify event window override_redirect)
- 
-data MapRequest = MkMapRequest{parent_MapRequest :: WINDOW,
-                               window_MapRequest :: WINDOW}
-                deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event MapRequest
- 
-instance Deserialize MapRequest where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               parent <- deserialize
-               window <- deserialize
-               return (MkMapRequest parent window)
- 
-data ReparentNotify = MkReparentNotify{event_ReparentNotify ::
-                                       WINDOW,
-                                       window_ReparentNotify :: WINDOW,
-                                       parent_ReparentNotify :: WINDOW, x_ReparentNotify :: INT16,
-                                       y_ReparentNotify :: INT16,
-                                       override_redirect_ReparentNotify :: BOOL}
-                    deriving (Show, Typeable)
-
- 
-data ClientMessageData = ClientData8  [CARD8]  -- ^length 20
-                       | ClientData16 [CARD16] -- ^length 10
-                       | ClientData32 [CARD32] -- ^length 5
-                   deriving (Show, Typeable)
-
- 
-data ClientMessageDataType = CDType8
-                           | CDType16
-                           | CDType32
- 
-clientMessageDataType :: ClientMessageData -> ClientMessageDataType
-clientMessageDataType ClientData8{}  = CDType8
-clientMessageDataType ClientData16{} = CDType16
-clientMessageDataType ClientData32{} = CDType32
- 
-instance Serialize ClientMessageData where
-    serialize (ClientData8 xs) = assert (length xs == 20) $
-                                    serializeList xs
-    serialize (ClientData16 xs) = assert (length xs == 10) $
-                                     serializeList xs
-    serialize (ClientData32 xs) = assert (length xs == 5) $
-                                     serializeList xs
-    size cd = assert
-         (case cd of
-            ClientData8  xs -> length xs == 20
-            ClientData16 xs -> length xs == 10
-            ClientData32 xs -> length xs == 5)
-         20
-
-deserializeClientData :: ClientMessageDataType -> Get ClientMessageData
-deserializeClientData CDType8
-    = ClientData8 `liftM` deserializeList 20
-deserializeClientData CDType16
-    = ClientData16 `liftM` deserializeList 10
-deserializeClientData CDType32
-    = ClientData32 `liftM` deserializeList 5
- 
-clientDataFormatToType :: CARD8 -> ClientMessageDataType
-clientDataFormatToType 8 = CDType8
-clientDataFormatToType 16 = CDType16
-clientDataFormatToType 32 = CDType32
-clientDataFormatToType _ = CDType8 -- should we throw an error here?
-
- 
-instance Graphics.XHB.Shared.Event ReparentNotify
- 
-instance Deserialize ReparentNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               event <- deserialize
-               window <- deserialize
-               parent <- deserialize
-               x <- deserialize
-               y <- deserialize
-               override_redirect <- deserialize
-               skip 3
-               return (MkReparentNotify event window parent x y override_redirect)
- 
-data ConfigureNotify = MkConfigureNotify{event_ConfigureNotify ::
-                                         WINDOW,
-                                         window_ConfigureNotify :: WINDOW,
-                                         above_sibling_ConfigureNotify :: WINDOW,
-                                         x_ConfigureNotify :: INT16, y_ConfigureNotify :: INT16,
-                                         width_ConfigureNotify :: CARD16,
-                                         height_ConfigureNotify :: CARD16,
-                                         border_width_ConfigureNotify :: CARD16,
-                                         override_redirect_ConfigureNotify :: BOOL}
-                     deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event ConfigureNotify
- 
-instance Deserialize ConfigureNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               event <- deserialize
-               window <- deserialize
-               above_sibling <- deserialize
-               x <- deserialize
-               y <- deserialize
-               width <- deserialize
-               height <- deserialize
-               border_width <- deserialize
-               override_redirect <- deserialize
-               skip 1
-               return
-                 (MkConfigureNotify event window above_sibling x y width height
-                    border_width
-                    override_redirect)
- 
-data ConfigureRequest = MkConfigureRequest{stack_mode_ConfigureRequest
-                                           :: BYTE,
-                                           parent_ConfigureRequest :: WINDOW,
-                                           window_ConfigureRequest :: WINDOW,
-                                           sibling_ConfigureRequest :: WINDOW,
-                                           x_ConfigureRequest :: INT16, y_ConfigureRequest :: INT16,
-                                           width_ConfigureRequest :: CARD16,
-                                           height_ConfigureRequest :: CARD16,
-                                           border_width_ConfigureRequest :: CARD16,
-                                           value_mask_ConfigureRequest :: CARD16}
-                      deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event ConfigureRequest
- 
-instance Deserialize ConfigureRequest where
-        deserialize
-          = do skip 1
-               stack_mode <- deserialize
-               skip 2
-               parent <- deserialize
-               window <- deserialize
-               sibling <- deserialize
-               x <- deserialize
-               y <- deserialize
-               width <- deserialize
-               height <- deserialize
-               border_width <- deserialize
-               value_mask <- deserialize
-               return
-                 (MkConfigureRequest stack_mode parent window sibling x y width
-                    height
-                    border_width
-                    value_mask)
- 
-data GravityNotify = MkGravityNotify{event_GravityNotify :: WINDOW,
-                                     window_GravityNotify :: WINDOW, x_GravityNotify :: INT16,
-                                     y_GravityNotify :: INT16}
-                   deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event GravityNotify
- 
-instance Deserialize GravityNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               event <- deserialize
-               window <- deserialize
-               x <- deserialize
-               y <- deserialize
-               return (MkGravityNotify event window x y)
- 
-data ResizeRequest = MkResizeRequest{window_ResizeRequest ::
-                                     WINDOW,
-                                     width_ResizeRequest :: CARD16, height_ResizeRequest :: CARD16}
-                   deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event ResizeRequest
- 
-instance Deserialize ResizeRequest where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               window <- deserialize
-               width <- deserialize
-               height <- deserialize
-               return (MkResizeRequest window width height)
- 
-data Place = PlaceOnTop
-           | PlaceOnBottom
- 
-instance SimpleEnum Place where
-        toValue PlaceOnTop{} = 0
-        toValue PlaceOnBottom{} = 1
-        fromValue 0 = PlaceOnTop
-        fromValue 1 = PlaceOnBottom
- 
-data CirculateNotify = MkCirculateNotify{event_CirculateNotify ::
-                                         WINDOW,
-                                         window_CirculateNotify :: WINDOW,
-                                         place_CirculateNotify :: BYTE}
-                     deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event CirculateNotify
- 
-instance Deserialize CirculateNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               event <- deserialize
-               window <- deserialize
-               skip 4
-               place <- deserialize
-               skip 3
-               return (MkCirculateNotify event window place)
- 
-data CirculateRequest = MkCirculateRequest{event_CirculateRequest
-                                           :: WINDOW,
-                                           window_CirculateRequest :: WINDOW,
-                                           place_CirculateRequest :: BYTE}
-                      deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event CirculateRequest
- 
-instance Deserialize CirculateRequest where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               event <- deserialize
-               window <- deserialize
-               skip 4
-               place <- deserialize
-               skip 3
-               return (MkCirculateRequest event window place)
- 
-data Property = PropertyNewValue
-              | PropertyDelete
- 
-instance SimpleEnum Property where
-        toValue PropertyNewValue{} = 0
-        toValue PropertyDelete{} = 1
-        fromValue 0 = PropertyNewValue
-        fromValue 1 = PropertyDelete
- 
-data PropertyNotify = MkPropertyNotify{window_PropertyNotify ::
-                                       WINDOW,
-                                       atom_PropertyNotify :: ATOM,
-                                       time_PropertyNotify :: TIMESTAMP,
-                                       state_PropertyNotify :: BYTE}
-                    deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event PropertyNotify
- 
-instance Deserialize PropertyNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               window <- deserialize
-               atom <- deserialize
-               time <- deserialize
-               state <- deserialize
-               skip 3
-               return (MkPropertyNotify window atom time state)
- 
-data SelectionClear = MkSelectionClear{time_SelectionClear ::
-                                       TIMESTAMP,
-                                       owner_SelectionClear :: WINDOW,
-                                       selection_SelectionClear :: ATOM}
-                    deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event SelectionClear
- 
-instance Deserialize SelectionClear where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               time <- deserialize
-               owner <- deserialize
-               selection <- deserialize
-               return (MkSelectionClear time owner selection)
- 
-data SelectionRequest = MkSelectionRequest{time_SelectionRequest ::
-                                           TIMESTAMP,
-                                           owner_SelectionRequest :: WINDOW,
-                                           requestor_SelectionRequest :: WINDOW,
-                                           selection_SelectionRequest :: ATOM,
-                                           target_SelectionRequest :: ATOM,
-                                           property_SelectionRequest :: ATOM}
-                      deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event SelectionRequest
- 
-instance Deserialize SelectionRequest where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               time <- deserialize
-               owner <- deserialize
-               requestor <- deserialize
-               selection <- deserialize
-               target <- deserialize
-               property <- deserialize
-               return
-                 (MkSelectionRequest time owner requestor selection target property)
- 
-data SelectionNotify = MkSelectionNotify{time_SelectionNotify ::
-                                         TIMESTAMP,
-                                         requestor_SelectionNotify :: WINDOW,
-                                         selection_SelectionNotify :: ATOM,
-                                         target_SelectionNotify :: ATOM,
-                                         property_SelectionNotify :: ATOM}
-                     deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event SelectionNotify
- 
-instance Deserialize SelectionNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               time <- deserialize
-               requestor <- deserialize
-               selection <- deserialize
-               target <- deserialize
-               property <- deserialize
-               return (MkSelectionNotify time requestor selection target property)
- 
-data ColormapState = ColormapStateUninstalled
-                   | ColormapStateInstalled
- 
-instance SimpleEnum ColormapState where
-        toValue ColormapStateUninstalled{} = 0
-        toValue ColormapStateInstalled{} = 1
-        fromValue 0 = ColormapStateUninstalled
-        fromValue 1 = ColormapStateInstalled
- 
-data ColormapNotify = MkColormapNotify{window_ColormapNotify ::
-                                       WINDOW,
-                                       colormap_ColormapNotify :: COLORMAP,
-                                       new_ColormapNotify :: BOOL, state_ColormapNotify :: BYTE}
-                    deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event ColormapNotify
- 
-instance Deserialize ColormapNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               window <- deserialize
-               colormap <- deserialize
-               new <- deserialize
-               state <- deserialize
-               skip 2
-               return (MkColormapNotify window colormap new state)
- 
-data ClientMessage = MkClientMessage{format_ClientMessage :: CARD8,
-                                     window_ClientMessage :: WINDOW, type_ClientMessage :: ATOM,
-                                     data_ClientMessage :: ClientMessageData}
-                   deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event ClientMessage
- 
-instance Deserialize ClientMessage where
-        deserialize
-          = do skip 1
-               format <- deserialize
-               skip 2
-               window <- deserialize
-               type_ <- deserialize
-               data_ <- deserializeClientData (clientDataFormatToType format)
-               return (MkClientMessage format window type_ data_)
- 
-data Mapping = MappingModifier
-             | MappingKeyboard
-             | MappingPointer
- 
-instance SimpleEnum Mapping where
-        toValue MappingModifier{} = 0
-        toValue MappingKeyboard{} = 1
-        toValue MappingPointer{} = 2
-        fromValue 0 = MappingModifier
-        fromValue 1 = MappingKeyboard
-        fromValue 2 = MappingPointer
- 
-data MappingNotify = MkMappingNotify{request_MappingNotify :: BYTE,
-                                     first_keycode_MappingNotify :: KEYCODE,
-                                     count_MappingNotify :: CARD8}
-                   deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Event MappingNotify
- 
-instance Deserialize MappingNotify where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               request <- deserialize
-               first_keycode <- deserialize
-               count <- deserialize
-               skip 1
-               return (MkMappingNotify request first_keycode count)
- 
-data Request = MkRequest{bad_value_Request :: CARD32,
-                         minor_opcode_Request :: CARD16, major_opcode_Request :: CARD8}
-             deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Request
- 
-instance Deserialize Request where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkRequest bad_value minor_opcode major_opcode)
- 
-data Value = MkValue{bad_value_Value :: CARD32,
-                     minor_opcode_Value :: CARD16, major_opcode_Value :: CARD8}
-           deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Value
- 
-instance Deserialize Value where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkValue bad_value minor_opcode major_opcode)
- 
-data Window = MkWindow{bad_value_Window :: CARD32,
-                       minor_opcode_Window :: CARD16, major_opcode_Window :: CARD8}
-            deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Window
- 
-instance Deserialize Window where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkWindow bad_value minor_opcode major_opcode)
- 
-data Pixmap = MkPixmap{bad_value_Pixmap :: CARD32,
-                       minor_opcode_Pixmap :: CARD16, major_opcode_Pixmap :: CARD8}
-            deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Pixmap
- 
-instance Deserialize Pixmap where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkPixmap bad_value minor_opcode major_opcode)
- 
-data Atom = MkAtom{bad_value_Atom :: CARD32,
-                   minor_opcode_Atom :: CARD16, major_opcode_Atom :: CARD8}
-          deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Atom
- 
-instance Deserialize Atom where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkAtom bad_value minor_opcode major_opcode)
- 
-data Cursor = MkCursor{bad_value_Cursor :: CARD32,
-                       minor_opcode_Cursor :: CARD16, major_opcode_Cursor :: CARD8}
-            deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Cursor
- 
-instance Deserialize Cursor where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkCursor bad_value minor_opcode major_opcode)
- 
-data Font = MkFont{bad_value_Font :: CARD32,
-                   minor_opcode_Font :: CARD16, major_opcode_Font :: CARD8}
-          deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Font
- 
-instance Deserialize Font where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkFont bad_value minor_opcode major_opcode)
- 
-data Match = MkMatch{bad_value_Match :: CARD32,
-                     minor_opcode_Match :: CARD16, major_opcode_Match :: CARD8}
-           deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Match
- 
-instance Deserialize Match where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkMatch bad_value minor_opcode major_opcode)
- 
-data Drawable = MkDrawable{bad_value_Drawable :: CARD32,
-                           minor_opcode_Drawable :: CARD16, major_opcode_Drawable :: CARD8}
-              deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Drawable
- 
-instance Deserialize Drawable where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkDrawable bad_value minor_opcode major_opcode)
- 
-data Access = MkAccess{bad_value_Access :: CARD32,
-                       minor_opcode_Access :: CARD16, major_opcode_Access :: CARD8}
-            deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Access
- 
-instance Deserialize Access where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkAccess bad_value minor_opcode major_opcode)
- 
-data Alloc = MkAlloc{bad_value_Alloc :: CARD32,
-                     minor_opcode_Alloc :: CARD16, major_opcode_Alloc :: CARD8}
-           deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Alloc
- 
-instance Deserialize Alloc where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkAlloc bad_value minor_opcode major_opcode)
- 
-data Colormap = MkColormap{bad_value_Colormap :: CARD32,
-                           minor_opcode_Colormap :: CARD16, major_opcode_Colormap :: CARD8}
-              deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Colormap
- 
-instance Deserialize Colormap where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkColormap bad_value minor_opcode major_opcode)
- 
-data GContext = MkGContext{bad_value_GContext :: CARD32,
-                           minor_opcode_GContext :: CARD16, major_opcode_GContext :: CARD8}
-              deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error GContext
- 
-instance Deserialize GContext where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkGContext bad_value minor_opcode major_opcode)
- 
-data IDChoice = MkIDChoice{bad_value_IDChoice :: CARD32,
-                           minor_opcode_IDChoice :: CARD16, major_opcode_IDChoice :: CARD8}
-              deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error IDChoice
- 
-instance Deserialize IDChoice where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkIDChoice bad_value minor_opcode major_opcode)
- 
-data Name = MkName{bad_value_Name :: CARD32,
-                   minor_opcode_Name :: CARD16, major_opcode_Name :: CARD8}
-          deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Name
- 
-instance Deserialize Name where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkName bad_value minor_opcode major_opcode)
- 
-data Length = MkLength{bad_value_Length :: CARD32,
-                       minor_opcode_Length :: CARD16, major_opcode_Length :: CARD8}
-            deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Length
- 
-instance Deserialize Length where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkLength bad_value minor_opcode major_opcode)
- 
-data Implementation = MkImplementation{bad_value_Implementation ::
-                                       CARD32,
-                                       minor_opcode_Implementation :: CARD16,
-                                       major_opcode_Implementation :: CARD8}
-                    deriving (Show, Typeable)
- 
-instance Graphics.XHB.Shared.Error Implementation
- 
-instance Deserialize Implementation where
-        deserialize
-          = do skip 4
-               bad_value <- deserialize
-               minor_opcode <- deserialize
-               major_opcode <- deserialize
-               skip 1
-               return (MkImplementation bad_value minor_opcode major_opcode)
- 
-data WindowClass = WindowClassCopyFromParent
-                 | WindowClassInputOutput
-                 | WindowClassInputOnly
- 
-instance SimpleEnum WindowClass where
-        toValue WindowClassCopyFromParent{} = 0
-        toValue WindowClassInputOutput{} = 1
-        toValue WindowClassInputOnly{} = 2
-        fromValue 0 = WindowClassCopyFromParent
-        fromValue 1 = WindowClassInputOutput
-        fromValue 2 = WindowClassInputOnly
- 
-data CW = CWBackPixmap
-        | CWBackPixel
-        | CWBorderPixmap
-        | CWBorderPixel
-        | CWBitGravity
-        | CWWinGravity
-        | CWBackingStore
-        | CWBackingPlanes
-        | CWBackingPixel
-        | CWOverrideRedirect
-        | CWSaveUnder
-        | CWEventMask
-        | CWDontPropagate
-        | CWColormap
-        | CWCursor
- 
-instance BitEnum CW where
-        toBit CWBackPixmap{} = 0
-        toBit CWBackPixel{} = 1
-        toBit CWBorderPixmap{} = 2
-        toBit CWBorderPixel{} = 3
-        toBit CWBitGravity{} = 4
-        toBit CWWinGravity{} = 5
-        toBit CWBackingStore{} = 6
-        toBit CWBackingPlanes{} = 7
-        toBit CWBackingPixel{} = 8
-        toBit CWOverrideRedirect{} = 9
-        toBit CWSaveUnder{} = 10
-        toBit CWEventMask{} = 11
-        toBit CWDontPropagate{} = 12
-        toBit CWColormap{} = 13
-        toBit CWCursor{} = 14
-        fromBit 0 = CWBackPixmap
-        fromBit 1 = CWBackPixel
-        fromBit 2 = CWBorderPixmap
-        fromBit 3 = CWBorderPixel
-        fromBit 4 = CWBitGravity
-        fromBit 5 = CWWinGravity
-        fromBit 6 = CWBackingStore
-        fromBit 7 = CWBackingPlanes
-        fromBit 8 = CWBackingPixel
-        fromBit 9 = CWOverrideRedirect
-        fromBit 10 = CWSaveUnder
-        fromBit 11 = CWEventMask
-        fromBit 12 = CWDontPropagate
-        fromBit 13 = CWColormap
-        fromBit 14 = CWCursor
- 
-data BackPixmap = BackPixmapNone
-                | BackPixmapParentRelative
- 
-instance SimpleEnum BackPixmap where
-        toValue BackPixmapNone{} = 0
-        toValue BackPixmapParentRelative{} = 1
-        fromValue 0 = BackPixmapNone
-        fromValue 1 = BackPixmapParentRelative
- 
-data Gravity = GravityBitForget
-             | GravityWinUnmap
-             | GravityNorthWest
-             | GravityNorth
-             | GravityNorthEast
-             | GravityWest
-             | GravityCenter
-             | GravityEast
-             | GravitySouthWest
-             | GravitySouth
-             | GravitySouthEast
-             | GravityStatic
- 
-instance SimpleEnum Gravity where
-        toValue GravityBitForget{} = 0
-        toValue GravityWinUnmap{} = 0
-        toValue GravityNorthWest{} = 1
-        toValue GravityNorth{} = 2
-        toValue GravityNorthEast{} = 3
-        toValue GravityWest{} = 4
-        toValue GravityCenter{} = 5
-        toValue GravityEast{} = 6
-        toValue GravitySouthWest{} = 7
-        toValue GravitySouth{} = 8
-        toValue GravitySouthEast{} = 9
-        toValue GravityStatic{} = 10
-        fromValue 0 = GravityBitForget
-        fromValue 0 = GravityWinUnmap
-        fromValue 1 = GravityNorthWest
-        fromValue 2 = GravityNorth
-        fromValue 3 = GravityNorthEast
-        fromValue 4 = GravityWest
-        fromValue 5 = GravityCenter
-        fromValue 6 = GravityEast
-        fromValue 7 = GravitySouthWest
-        fromValue 8 = GravitySouth
-        fromValue 9 = GravitySouthEast
-        fromValue 10 = GravityStatic
- 
-data BackingStore = BackingStoreNotUseful
-                  | BackingStoreWhenMapped
-                  | BackingStoreAlways
- 
-instance SimpleEnum BackingStore where
-        toValue BackingStoreNotUseful{} = 0
-        toValue BackingStoreWhenMapped{} = 1
-        toValue BackingStoreAlways{} = 2
-        fromValue 0 = BackingStoreNotUseful
-        fromValue 1 = BackingStoreWhenMapped
-        fromValue 2 = BackingStoreAlways
- 
-data EventMask = EventMaskKeyPress
-               | EventMaskKeyRelease
-               | EventMaskButtonPress
-               | EventMaskButtonRelease
-               | EventMaskEnterWindow
-               | EventMaskLeaveWindow
-               | EventMaskPointerMotion
-               | EventMaskPointerMotionHint
-               | EventMaskButton1Motion
-               | EventMaskButton2Motion
-               | EventMaskButton3Motion
-               | EventMaskButton4Motion
-               | EventMaskButton5Motion
-               | EventMaskButtonMotion
-               | EventMaskKeymapState
-               | EventMaskExposure
-               | EventMaskVisibilityChange
-               | EventMaskStructureNotify
-               | EventMaskResizeRedirect
-               | EventMaskSubstructureNotify
-               | EventMaskSubstructureRedirect
-               | EventMaskFocusChange
-               | EventMaskPropertyChange
-               | EventMaskColorMapChange
-               | EventMaskOwnerGrabButton
- 
-instance BitEnum EventMask where
-        toBit EventMaskKeyPress{} = 0
-        toBit EventMaskKeyRelease{} = 1
-        toBit EventMaskButtonPress{} = 2
-        toBit EventMaskButtonRelease{} = 3
-        toBit EventMaskEnterWindow{} = 4
-        toBit EventMaskLeaveWindow{} = 5
-        toBit EventMaskPointerMotion{} = 6
-        toBit EventMaskPointerMotionHint{} = 7
-        toBit EventMaskButton1Motion{} = 8
-        toBit EventMaskButton2Motion{} = 9
-        toBit EventMaskButton3Motion{} = 10
-        toBit EventMaskButton4Motion{} = 11
-        toBit EventMaskButton5Motion{} = 12
-        toBit EventMaskButtonMotion{} = 13
-        toBit EventMaskKeymapState{} = 14
-        toBit EventMaskExposure{} = 15
-        toBit EventMaskVisibilityChange{} = 16
-        toBit EventMaskStructureNotify{} = 17
-        toBit EventMaskResizeRedirect{} = 18
-        toBit EventMaskSubstructureNotify{} = 19
-        toBit EventMaskSubstructureRedirect{} = 20
-        toBit EventMaskFocusChange{} = 21
-        toBit EventMaskPropertyChange{} = 22
-        toBit EventMaskColorMapChange{} = 23
-        toBit EventMaskOwnerGrabButton{} = 24
-        fromBit 0 = EventMaskKeyPress
-        fromBit 1 = EventMaskKeyRelease
-        fromBit 2 = EventMaskButtonPress
-        fromBit 3 = EventMaskButtonRelease
-        fromBit 4 = EventMaskEnterWindow
-        fromBit 5 = EventMaskLeaveWindow
-        fromBit 6 = EventMaskPointerMotion
-        fromBit 7 = EventMaskPointerMotionHint
-        fromBit 8 = EventMaskButton1Motion
-        fromBit 9 = EventMaskButton2Motion
-        fromBit 10 = EventMaskButton3Motion
-        fromBit 11 = EventMaskButton4Motion
-        fromBit 12 = EventMaskButton5Motion
-        fromBit 13 = EventMaskButtonMotion
-        fromBit 14 = EventMaskKeymapState
-        fromBit 15 = EventMaskExposure
-        fromBit 16 = EventMaskVisibilityChange
-        fromBit 17 = EventMaskStructureNotify
-        fromBit 18 = EventMaskResizeRedirect
-        fromBit 19 = EventMaskSubstructureNotify
-        fromBit 20 = EventMaskSubstructureRedirect
-        fromBit 21 = EventMaskFocusChange
-        fromBit 22 = EventMaskPropertyChange
-        fromBit 23 = EventMaskColorMapChange
-        fromBit 24 = EventMaskOwnerGrabButton
- 
-data CreateWindow = MkCreateWindow{depth_CreateWindow :: CARD8,
-                                   wid_CreateWindow :: WINDOW, parent_CreateWindow :: WINDOW,
-                                   x_CreateWindow :: INT16, y_CreateWindow :: INT16,
-                                   width_CreateWindow :: CARD16, height_CreateWindow :: CARD16,
-                                   border_width_CreateWindow :: CARD16,
-                                   class_CreateWindow :: CARD16, visual_CreateWindow :: VISUALID,
-                                   value_CreateWindow :: ValueParam CARD32}
-                  deriving (Show, Typeable)
- 
-instance Serialize CreateWindow where
-        serialize x
-          = do putWord8 1
-               serialize (depth_CreateWindow x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (wid_CreateWindow x)
-               serialize (parent_CreateWindow x)
-               serialize (x_CreateWindow x)
-               serialize (y_CreateWindow x)
-               serialize (width_CreateWindow x)
-               serialize (height_CreateWindow x)
-               serialize (border_width_CreateWindow x)
-               serialize (class_CreateWindow x)
-               serialize (visual_CreateWindow x)
-               serialize (value_CreateWindow x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (depth_CreateWindow x) + size (wid_CreateWindow x) +
-              size (parent_CreateWindow x)
-              + size (x_CreateWindow x)
-              + size (y_CreateWindow x)
-              + size (width_CreateWindow x)
-              + size (height_CreateWindow x)
-              + size (border_width_CreateWindow x)
-              + size (class_CreateWindow x)
-              + size (visual_CreateWindow x)
-              + size (value_CreateWindow x)
- 
-data ChangeWindowAttributes = MkChangeWindowAttributes{window_ChangeWindowAttributes
-                                                       :: WINDOW,
-                                                       value_ChangeWindowAttributes ::
-                                                       ValueParam CARD32}
-                            deriving (Show, Typeable)
- 
-instance Serialize ChangeWindowAttributes where
-        serialize x
-          = do putWord8 2
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_ChangeWindowAttributes x)
-               serialize (value_ChangeWindowAttributes x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (window_ChangeWindowAttributes x) +
-              size (value_ChangeWindowAttributes x)
- 
-data MapState = MapStateUnmapped
-              | MapStateUnviewable
-              | MapStateViewable
- 
-instance SimpleEnum MapState where
-        toValue MapStateUnmapped{} = 0
-        toValue MapStateUnviewable{} = 1
-        toValue MapStateViewable{} = 2
-        fromValue 0 = MapStateUnmapped
-        fromValue 1 = MapStateUnviewable
-        fromValue 2 = MapStateViewable
- 
-data GetWindowAttributes = MkGetWindowAttributes{window_GetWindowAttributes
-                                                 :: WINDOW}
-                         deriving (Show, Typeable)
- 
-instance Serialize GetWindowAttributes where
-        serialize x
-          = do putWord8 3
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_GetWindowAttributes x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (window_GetWindowAttributes x)
- 
-data GetWindowAttributesReply = MkGetWindowAttributesReply{backing_store_GetWindowAttributesReply
-                                                           :: CARD8,
-                                                           visual_GetWindowAttributesReply ::
-                                                           VISUALID,
-                                                           class_GetWindowAttributesReply :: CARD16,
-                                                           bit_gravity_GetWindowAttributesReply ::
-                                                           CARD8,
-                                                           win_gravity_GetWindowAttributesReply ::
-                                                           CARD8,
-                                                           backing_planes_GetWindowAttributesReply
-                                                           :: CARD32,
-                                                           backing_pixel_GetWindowAttributesReply ::
-                                                           CARD32,
-                                                           save_under_GetWindowAttributesReply ::
-                                                           BOOL,
-                                                           map_is_installed_GetWindowAttributesReply
-                                                           :: BOOL,
-                                                           map_state_GetWindowAttributesReply ::
-                                                           CARD8,
-                                                           override_redirect_GetWindowAttributesReply
-                                                           :: BOOL,
-                                                           colormap_GetWindowAttributesReply ::
-                                                           COLORMAP,
-                                                           all_event_masks_GetWindowAttributesReply
-                                                           :: CARD32,
-                                                           your_event_mask_GetWindowAttributesReply
-                                                           :: CARD32,
-                                                           do_not_propagate_mask_GetWindowAttributesReply
-                                                           :: CARD16}
-                              deriving (Show, Typeable)
- 
-instance Deserialize GetWindowAttributesReply where
-        deserialize
-          = do skip 1
-               backing_store <- deserialize
-               skip 2
-               length <- deserialize
-               visual <- deserialize
-               class_ <- deserialize
-               bit_gravity <- deserialize
-               win_gravity <- deserialize
-               backing_planes <- deserialize
-               backing_pixel <- deserialize
-               save_under <- deserialize
-               map_is_installed <- deserialize
-               map_state <- deserialize
-               override_redirect <- deserialize
-               colormap <- deserialize
-               all_event_masks <- deserialize
-               your_event_mask <- deserialize
-               do_not_propagate_mask <- deserialize
-               skip 2
-               let _ = isCard32 length
-               return
-                 (MkGetWindowAttributesReply backing_store visual class_ bit_gravity
-                    win_gravity
-                    backing_planes
-                    backing_pixel
-                    save_under
-                    map_is_installed
-                    map_state
-                    override_redirect
-                    colormap
-                    all_event_masks
-                    your_event_mask
-                    do_not_propagate_mask)
- 
-data DestroyWindow = MkDestroyWindow{window_DestroyWindow ::
-                                     WINDOW}
-                   deriving (Show, Typeable)
- 
-instance Serialize DestroyWindow where
-        serialize x
-          = do putWord8 4
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_DestroyWindow x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (window_DestroyWindow x)
- 
-data DestroySubwindows = MkDestroySubwindows{window_DestroySubwindows
-                                             :: WINDOW}
-                       deriving (Show, Typeable)
- 
-instance Serialize DestroySubwindows where
-        serialize x
-          = do putWord8 5
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_DestroySubwindows x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (window_DestroySubwindows x)
- 
-data SetMode = SetModeInsert
-             | SetModeDelete
- 
-instance SimpleEnum SetMode where
-        toValue SetModeInsert{} = 0
-        toValue SetModeDelete{} = 1
-        fromValue 0 = SetModeInsert
-        fromValue 1 = SetModeDelete
- 
-data ChangeSaveSet = MkChangeSaveSet{mode_ChangeSaveSet :: BYTE,
-                                     window_ChangeSaveSet :: WINDOW}
-                   deriving (Show, Typeable)
- 
-instance Serialize ChangeSaveSet where
-        serialize x
-          = do putWord8 6
-               serialize (mode_ChangeSaveSet x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_ChangeSaveSet x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (mode_ChangeSaveSet x) + size (window_ChangeSaveSet x)
- 
-data ReparentWindow = MkReparentWindow{window_ReparentWindow ::
-                                       WINDOW,
-                                       parent_ReparentWindow :: WINDOW, x_ReparentWindow :: INT16,
-                                       y_ReparentWindow :: INT16}
-                    deriving (Show, Typeable)
- 
-instance Serialize ReparentWindow where
-        serialize x
-          = do putWord8 7
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_ReparentWindow x)
-               serialize (parent_ReparentWindow x)
-               serialize (x_ReparentWindow x)
-               serialize (y_ReparentWindow x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (window_ReparentWindow x) +
-              size (parent_ReparentWindow x)
-              + size (x_ReparentWindow x)
-              + size (y_ReparentWindow x)
- 
-data MapWindow = MkMapWindow{window_MapWindow :: WINDOW}
-               deriving (Show, Typeable)
- 
-instance Serialize MapWindow where
-        serialize x
-          = do putWord8 8
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_MapWindow x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (window_MapWindow x)
- 
-data MapSubwindows = MkMapSubwindows{window_MapSubwindows ::
-                                     WINDOW}
-                   deriving (Show, Typeable)
- 
-instance Serialize MapSubwindows where
-        serialize x
-          = do putWord8 9
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_MapSubwindows x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (window_MapSubwindows x)
- 
-data UnmapWindow = MkUnmapWindow{window_UnmapWindow :: WINDOW}
-                 deriving (Show, Typeable)
- 
-instance Serialize UnmapWindow where
-        serialize x
-          = do putWord8 10
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_UnmapWindow x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (window_UnmapWindow x)
- 
-data UnmapSubwindows = MkUnmapSubwindows{window_UnmapSubwindows ::
-                                         WINDOW}
-                     deriving (Show, Typeable)
- 
-instance Serialize UnmapSubwindows where
-        serialize x
-          = do putWord8 11
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_UnmapSubwindows x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (window_UnmapSubwindows x)
- 
-data ConfigWindow = ConfigWindowX
-                  | ConfigWindowY
-                  | ConfigWindowWidth
-                  | ConfigWindowHeight
-                  | ConfigWindowBorderWidth
-                  | ConfigWindowSibling
-                  | ConfigWindowStackMode
- 
-instance BitEnum ConfigWindow where
-        toBit ConfigWindowX{} = 0
-        toBit ConfigWindowY{} = 1
-        toBit ConfigWindowWidth{} = 2
-        toBit ConfigWindowHeight{} = 3
-        toBit ConfigWindowBorderWidth{} = 4
-        toBit ConfigWindowSibling{} = 5
-        toBit ConfigWindowStackMode{} = 6
-        fromBit 0 = ConfigWindowX
-        fromBit 1 = ConfigWindowY
-        fromBit 2 = ConfigWindowWidth
-        fromBit 3 = ConfigWindowHeight
-        fromBit 4 = ConfigWindowBorderWidth
-        fromBit 5 = ConfigWindowSibling
-        fromBit 6 = ConfigWindowStackMode
- 
-data StackMode = StackModeAbove
-               | StackModeBelow
-               | StackModeTopIf
-               | StackModeBottomIf
-               | StackModeOpposite
- 
-instance SimpleEnum StackMode where
-        toValue StackModeAbove{} = 0
-        toValue StackModeBelow{} = 1
-        toValue StackModeTopIf{} = 2
-        toValue StackModeBottomIf{} = 3
-        toValue StackModeOpposite{} = 4
-        fromValue 0 = StackModeAbove
-        fromValue 1 = StackModeBelow
-        fromValue 2 = StackModeTopIf
-        fromValue 3 = StackModeBottomIf
-        fromValue 4 = StackModeOpposite
- 
-data ConfigureWindow = MkConfigureWindow{window_ConfigureWindow ::
-                                         WINDOW,
-                                         value_ConfigureWindow :: ValueParam CARD16}
-                     deriving (Show, Typeable)
- 
-instance Serialize ConfigureWindow where
-        serialize x
-          = do putWord8 12
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_ConfigureWindow x)
-               serializeValueParam 2 (value_ConfigureWindow x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (window_ConfigureWindow x) +
-              size (value_ConfigureWindow x)
-              + 2
- 
-data Circulate = CirculateRaiseLowest
-               | CirculateLowerHighest
- 
-instance SimpleEnum Circulate where
-        toValue CirculateRaiseLowest{} = 0
-        toValue CirculateLowerHighest{} = 1
-        fromValue 0 = CirculateRaiseLowest
-        fromValue 1 = CirculateLowerHighest
- 
-data CirculateWindow = MkCirculateWindow{direction_CirculateWindow
-                                         :: CARD8,
-                                         window_CirculateWindow :: WINDOW}
-                     deriving (Show, Typeable)
- 
-instance Serialize CirculateWindow where
-        serialize x
-          = do putWord8 13
-               serialize (direction_CirculateWindow x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_CirculateWindow x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (direction_CirculateWindow x) +
-              size (window_CirculateWindow x)
- 
-data GetGeometry = MkGetGeometry{drawable_GetGeometry :: DRAWABLE}
-                 deriving (Show, Typeable)
- 
-instance Serialize GetGeometry where
-        serialize x
-          = do putWord8 14
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_GetGeometry x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (drawable_GetGeometry x)
- 
-data GetGeometryReply = MkGetGeometryReply{depth_GetGeometryReply
-                                           :: CARD8,
-                                           root_GetGeometryReply :: WINDOW,
-                                           x_GetGeometryReply :: INT16, y_GetGeometryReply :: INT16,
-                                           width_GetGeometryReply :: CARD16,
-                                           height_GetGeometryReply :: CARD16,
-                                           border_width_GetGeometryReply :: CARD16}
-                      deriving (Show, Typeable)
- 
-instance Deserialize GetGeometryReply where
-        deserialize
-          = do skip 1
-               depth <- deserialize
-               skip 2
-               length <- deserialize
-               root <- deserialize
-               x <- deserialize
-               y <- deserialize
-               width <- deserialize
-               height <- deserialize
-               border_width <- deserialize
-               skip 2
-               let _ = isCard32 length
-               return
-                 (MkGetGeometryReply depth root x y width height border_width)
- 
-data QueryTree = MkQueryTree{window_QueryTree :: WINDOW}
-               deriving (Show, Typeable)
- 
-instance Serialize QueryTree where
-        serialize x
-          = do putWord8 15
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_QueryTree x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (window_QueryTree x)
- 
-data QueryTreeReply = MkQueryTreeReply{root_QueryTreeReply ::
-                                       WINDOW,
-                                       parent_QueryTreeReply :: WINDOW,
-                                       children_len_QueryTreeReply :: CARD16,
-                                       children_QueryTreeReply :: [WINDOW]}
-                    deriving (Show, Typeable)
- 
-instance Deserialize QueryTreeReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               root <- deserialize
-               parent <- deserialize
-               children_len <- deserialize
-               skip 14
-               children <- deserializeList (fromIntegral children_len)
-               let _ = isCard32 length
-               return (MkQueryTreeReply root parent children_len children)
- 
-data InternAtom = MkInternAtom{only_if_exists_InternAtom :: BOOL,
-                               name_len_InternAtom :: CARD16, name_InternAtom :: [CChar]}
-                deriving (Show, Typeable)
- 
-instance Serialize InternAtom where
-        serialize x
-          = do putWord8 16
-               serialize (only_if_exists_InternAtom x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (name_len_InternAtom x)
-               putSkip 2
-               serializeList (name_InternAtom x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (only_if_exists_InternAtom x) +
-              size (name_len_InternAtom x)
-              + 2
-              + sum (map size (name_InternAtom x))
- 
-data InternAtomReply = MkInternAtomReply{atom_InternAtomReply ::
-                                         ATOM}
-                     deriving (Show, Typeable)
- 
-instance Deserialize InternAtomReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               atom <- deserialize
-               let _ = isCard32 length
-               return (MkInternAtomReply atom)
- 
-data GetAtomName = MkGetAtomName{atom_GetAtomName :: ATOM}
-                 deriving (Show, Typeable)
- 
-instance Serialize GetAtomName where
-        serialize x
-          = do putWord8 17
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (atom_GetAtomName x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (atom_GetAtomName x)
- 
-data GetAtomNameReply = MkGetAtomNameReply{name_len_GetAtomNameReply
-                                           :: CARD16,
-                                           name_GetAtomNameReply :: [CChar]}
-                      deriving (Show, Typeable)
- 
-instance Deserialize GetAtomNameReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               name_len <- deserialize
-               skip 22
-               name <- deserializeList (fromIntegral name_len)
-               let _ = isCard32 length
-               return (MkGetAtomNameReply name_len name)
- 
-data PropMode = PropModeReplace
-              | PropModePrepend
-              | PropModeAppend
- 
-instance SimpleEnum PropMode where
-        toValue PropModeReplace{} = 0
-        toValue PropModePrepend{} = 1
-        toValue PropModeAppend{} = 2
-        fromValue 0 = PropModeReplace
-        fromValue 1 = PropModePrepend
-        fromValue 2 = PropModeAppend
- 
-data ChangeProperty = MkChangeProperty{mode_ChangeProperty ::
-                                       CARD8,
-                                       window_ChangeProperty :: WINDOW,
-                                       property_ChangeProperty :: ATOM, type_ChangeProperty :: ATOM,
-                                       format_ChangeProperty :: CARD8,
-                                       data_len_ChangeProperty :: CARD32,
-                                       data_ChangeProperty :: [Word8]}
-                    deriving (Show, Typeable)
- 
-instance Serialize ChangeProperty where
-        serialize x
-          = do putWord8 18
-               serialize (mode_ChangeProperty x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_ChangeProperty x)
-               serialize (property_ChangeProperty x)
-               serialize (type_ChangeProperty x)
-               serialize (format_ChangeProperty x)
-               putSkip 3
-               serialize (data_len_ChangeProperty x)
-               serializeList (data_ChangeProperty x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (mode_ChangeProperty x) + size (window_ChangeProperty x)
-              + size (property_ChangeProperty x)
-              + size (type_ChangeProperty x)
-              + size (format_ChangeProperty x)
-              + 3
-              + size (data_len_ChangeProperty x)
-              + sum (map size (data_ChangeProperty x))
- 
-data DeleteProperty = MkDeleteProperty{window_DeleteProperty ::
-                                       WINDOW,
-                                       property_DeleteProperty :: ATOM}
-                    deriving (Show, Typeable)
- 
-instance Serialize DeleteProperty where
-        serialize x
-          = do putWord8 19
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_DeleteProperty x)
-               serialize (property_DeleteProperty x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (window_DeleteProperty x) +
-              size (property_DeleteProperty x)
- 
-data GetPropertyType = GetPropertyTypeAny
- 
-instance SimpleEnum GetPropertyType where
-        toValue GetPropertyTypeAny{} = 0
-        fromValue 0 = GetPropertyTypeAny
- 
-data GetProperty = MkGetProperty{delete_GetProperty :: BOOL,
-                                 window_GetProperty :: WINDOW, property_GetProperty :: ATOM,
-                                 type_GetProperty :: ATOM, long_offset_GetProperty :: CARD32,
-                                 long_length_GetProperty :: CARD32}
-                 deriving (Show, Typeable)
- 
-instance Serialize GetProperty where
-        serialize x
-          = do putWord8 20
-               serialize (delete_GetProperty x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_GetProperty x)
-               serialize (property_GetProperty x)
-               serialize (type_GetProperty x)
-               serialize (long_offset_GetProperty x)
-               serialize (long_length_GetProperty x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (delete_GetProperty x) + size (window_GetProperty x) +
-              size (property_GetProperty x)
-              + size (type_GetProperty x)
-              + size (long_offset_GetProperty x)
-              + size (long_length_GetProperty x)
- 
-data GetPropertyReply = MkGetPropertyReply{format_GetPropertyReply
-                                           :: CARD8,
-                                           type_GetPropertyReply :: ATOM,
-                                           bytes_after_GetPropertyReply :: CARD32,
-                                           value_len_GetPropertyReply :: CARD32,
-                                           value_GetPropertyReply :: [Word8]}
-                      deriving (Show, Typeable)
- 
-instance Deserialize GetPropertyReply where
-        deserialize
-          = do skip 1
-               format <- deserialize
-               skip 2
-               length <- deserialize
-               type_ <- deserialize
-               bytes_after <- deserialize
-               value_len <- deserialize
-               skip 12
-               value <- deserializeList (fromIntegral value_len)
-               let _ = isCard32 length
-               return
-                 (MkGetPropertyReply format type_ bytes_after value_len value)
- 
-data ListProperties = MkListProperties{window_ListProperties ::
-                                       WINDOW}
-                    deriving (Show, Typeable)
- 
-instance Serialize ListProperties where
-        serialize x
-          = do putWord8 21
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_ListProperties x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (window_ListProperties x)
- 
-data ListPropertiesReply = MkListPropertiesReply{atoms_len_ListPropertiesReply
-                                                 :: CARD16,
-                                                 atoms_ListPropertiesReply :: [ATOM]}
-                         deriving (Show, Typeable)
- 
-instance Deserialize ListPropertiesReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               atoms_len <- deserialize
-               skip 22
-               atoms <- deserializeList (fromIntegral atoms_len)
-               let _ = isCard32 length
-               return (MkListPropertiesReply atoms_len atoms)
- 
-data SetSelectionOwner = MkSetSelectionOwner{owner_SetSelectionOwner
-                                             :: WINDOW,
-                                             selection_SetSelectionOwner :: ATOM,
-                                             time_SetSelectionOwner :: TIMESTAMP}
-                       deriving (Show, Typeable)
- 
-instance Serialize SetSelectionOwner where
-        serialize x
-          = do putWord8 22
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (owner_SetSelectionOwner x)
-               serialize (selection_SetSelectionOwner x)
-               serialize (time_SetSelectionOwner x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (owner_SetSelectionOwner x) +
-              size (selection_SetSelectionOwner x)
-              + size (time_SetSelectionOwner x)
- 
-data GetSelectionOwner = MkGetSelectionOwner{selection_GetSelectionOwner
-                                             :: ATOM}
-                       deriving (Show, Typeable)
- 
-instance Serialize GetSelectionOwner where
-        serialize x
-          = do putWord8 23
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (selection_GetSelectionOwner x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (selection_GetSelectionOwner x)
- 
-data GetSelectionOwnerReply = MkGetSelectionOwnerReply{owner_GetSelectionOwnerReply
-                                                       :: WINDOW}
-                            deriving (Show, Typeable)
- 
-instance Deserialize GetSelectionOwnerReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               owner <- deserialize
-               let _ = isCard32 length
-               return (MkGetSelectionOwnerReply owner)
- 
-data ConvertSelection = MkConvertSelection{requestor_ConvertSelection
-                                           :: WINDOW,
-                                           selection_ConvertSelection :: ATOM,
-                                           target_ConvertSelection :: ATOM,
-                                           property_ConvertSelection :: ATOM,
-                                           time_ConvertSelection :: TIMESTAMP}
-                      deriving (Show, Typeable)
- 
-instance Serialize ConvertSelection where
-        serialize x
-          = do putWord8 24
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (requestor_ConvertSelection x)
-               serialize (selection_ConvertSelection x)
-               serialize (target_ConvertSelection x)
-               serialize (property_ConvertSelection x)
-               serialize (time_ConvertSelection x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (requestor_ConvertSelection x) +
-              size (selection_ConvertSelection x)
-              + size (target_ConvertSelection x)
-              + size (property_ConvertSelection x)
-              + size (time_ConvertSelection x)
- 
-data SendEventDest = SendEventDestPointerWindow
-                   | SendEventDestItemFocus
- 
-instance SimpleEnum SendEventDest where
-        toValue SendEventDestPointerWindow{} = 0
-        toValue SendEventDestItemFocus{} = 1
-        fromValue 0 = SendEventDestPointerWindow
-        fromValue 1 = SendEventDestItemFocus
- 
-data SendEvent = MkSendEvent{propagate_SendEvent :: BOOL,
-                             destination_SendEvent :: WINDOW, event_mask_SendEvent :: CARD32,
-                             event_SendEvent :: [CChar]}
-               deriving (Show, Typeable)
- 
-instance Serialize SendEvent where
-        serialize x
-          = do putWord8 25
-               serialize (propagate_SendEvent x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (destination_SendEvent x)
-               serialize (event_mask_SendEvent x)
-               serializeList (event_SendEvent x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (propagate_SendEvent x) + size (destination_SendEvent x)
-              + size (event_mask_SendEvent x)
-              + sum (map size (event_SendEvent x))
- 
-data GrabMode = GrabModeSync
-              | GrabModeAsync
- 
-instance SimpleEnum GrabMode where
-        toValue GrabModeSync{} = 0
-        toValue GrabModeAsync{} = 1
-        fromValue 0 = GrabModeSync
-        fromValue 1 = GrabModeAsync
- 
-data GrabStatus = GrabStatusSuccess
-                | GrabStatusAlreadyGrabbed
-                | GrabStatusInvalidTime
-                | GrabStatusNotViewable
-                | GrabStatusFrozen
- 
-instance SimpleEnum GrabStatus where
-        toValue GrabStatusSuccess{} = 0
-        toValue GrabStatusAlreadyGrabbed{} = 1
-        toValue GrabStatusInvalidTime{} = 2
-        toValue GrabStatusNotViewable{} = 3
-        toValue GrabStatusFrozen{} = 4
-        fromValue 0 = GrabStatusSuccess
-        fromValue 1 = GrabStatusAlreadyGrabbed
-        fromValue 2 = GrabStatusInvalidTime
-        fromValue 3 = GrabStatusNotViewable
-        fromValue 4 = GrabStatusFrozen
- 
-data GrabPointer = MkGrabPointer{owner_events_GrabPointer :: BOOL,
-                                 grab_window_GrabPointer :: WINDOW,
-                                 event_mask_GrabPointer :: CARD16, pointer_mode_GrabPointer :: BYTE,
-                                 keyboard_mode_GrabPointer :: BYTE,
-                                 confine_to_GrabPointer :: WINDOW, cursor_GrabPointer :: CURSOR,
-                                 time_GrabPointer :: TIMESTAMP}
-                 deriving (Show, Typeable)
- 
-instance Serialize GrabPointer where
-        serialize x
-          = do putWord8 26
-               serialize (owner_events_GrabPointer x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (grab_window_GrabPointer x)
-               serialize (event_mask_GrabPointer x)
-               serialize (pointer_mode_GrabPointer x)
-               serialize (keyboard_mode_GrabPointer x)
-               serialize (confine_to_GrabPointer x)
-               serialize (cursor_GrabPointer x)
-               serialize (time_GrabPointer x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (owner_events_GrabPointer x) +
-              size (grab_window_GrabPointer x)
-              + size (event_mask_GrabPointer x)
-              + size (pointer_mode_GrabPointer x)
-              + size (keyboard_mode_GrabPointer x)
-              + size (confine_to_GrabPointer x)
-              + size (cursor_GrabPointer x)
-              + size (time_GrabPointer x)
- 
-data GrabPointerReply = MkGrabPointerReply{status_GrabPointerReply
-                                           :: BYTE}
-                      deriving (Show, Typeable)
- 
-instance Deserialize GrabPointerReply where
-        deserialize
-          = do skip 1
-               status <- deserialize
-               skip 2
-               length <- deserialize
-               let _ = isCard32 length
-               return (MkGrabPointerReply status)
- 
-data UngrabPointer = MkUngrabPointer{time_UngrabPointer ::
-                                     TIMESTAMP}
-                   deriving (Show, Typeable)
- 
-instance Serialize UngrabPointer where
-        serialize x
-          = do putWord8 27
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (time_UngrabPointer x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (time_UngrabPointer x)
- 
-data ButtonIndex = ButtonIndexAny
-                 | ButtonIndex1
-                 | ButtonIndex2
-                 | ButtonIndex3
-                 | ButtonIndex4
-                 | ButtonIndex5
- 
-instance SimpleEnum ButtonIndex where
-        toValue ButtonIndexAny{} = 0
-        toValue ButtonIndex1{} = 1
-        toValue ButtonIndex2{} = 2
-        toValue ButtonIndex3{} = 3
-        toValue ButtonIndex4{} = 4
-        toValue ButtonIndex5{} = 5
-        fromValue 0 = ButtonIndexAny
-        fromValue 1 = ButtonIndex1
-        fromValue 2 = ButtonIndex2
-        fromValue 3 = ButtonIndex3
-        fromValue 4 = ButtonIndex4
-        fromValue 5 = ButtonIndex5
- 
-data GrabButton = MkGrabButton{owner_events_GrabButton :: BOOL,
-                               grab_window_GrabButton :: WINDOW, event_mask_GrabButton :: CARD16,
-                               pointer_mode_GrabButton :: CARD8,
-                               keyboard_mode_GrabButton :: CARD8, confine_to_GrabButton :: WINDOW,
-                               cursor_GrabButton :: CURSOR, button_GrabButton :: CARD8,
-                               modifiers_GrabButton :: CARD16}
-                deriving (Show, Typeable)
- 
-instance Serialize GrabButton where
-        serialize x
-          = do putWord8 28
-               serialize (owner_events_GrabButton x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (grab_window_GrabButton x)
-               serialize (event_mask_GrabButton x)
-               serialize (pointer_mode_GrabButton x)
-               serialize (keyboard_mode_GrabButton x)
-               serialize (confine_to_GrabButton x)
-               serialize (cursor_GrabButton x)
-               serialize (button_GrabButton x)
-               putSkip 1
-               serialize (modifiers_GrabButton x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (owner_events_GrabButton x) +
-              size (grab_window_GrabButton x)
-              + size (event_mask_GrabButton x)
-              + size (pointer_mode_GrabButton x)
-              + size (keyboard_mode_GrabButton x)
-              + size (confine_to_GrabButton x)
-              + size (cursor_GrabButton x)
-              + size (button_GrabButton x)
-              + 1
-              + size (modifiers_GrabButton x)
- 
-data UngrabButton = MkUngrabButton{button_UngrabButton :: CARD8,
-                                   grab_window_UngrabButton :: WINDOW,
-                                   modifiers_UngrabButton :: CARD16}
-                  deriving (Show, Typeable)
- 
-instance Serialize UngrabButton where
-        serialize x
-          = do putWord8 29
-               serialize (button_UngrabButton x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (grab_window_UngrabButton x)
-               serialize (modifiers_UngrabButton x)
-               putSkip 2
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (button_UngrabButton x) +
-              size (grab_window_UngrabButton x)
-              + size (modifiers_UngrabButton x)
-              + 2
- 
-data ChangeActivePointerGrab = MkChangeActivePointerGrab{cursor_ChangeActivePointerGrab
-                                                         :: CURSOR,
-                                                         time_ChangeActivePointerGrab :: TIMESTAMP,
-                                                         event_mask_ChangeActivePointerGrab ::
-                                                         CARD16}
-                             deriving (Show, Typeable)
- 
-instance Serialize ChangeActivePointerGrab where
-        serialize x
-          = do putWord8 30
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cursor_ChangeActivePointerGrab x)
-               serialize (time_ChangeActivePointerGrab x)
-               serialize (event_mask_ChangeActivePointerGrab x)
-               putSkip 2
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (cursor_ChangeActivePointerGrab x) +
-              size (time_ChangeActivePointerGrab x)
-              + size (event_mask_ChangeActivePointerGrab x)
-              + 2
- 
-data GrabKeyboard = MkGrabKeyboard{owner_events_GrabKeyboard ::
-                                   BOOL,
-                                   grab_window_GrabKeyboard :: WINDOW,
-                                   time_GrabKeyboard :: TIMESTAMP,
-                                   pointer_mode_GrabKeyboard :: BYTE,
-                                   keyboard_mode_GrabKeyboard :: BYTE}
-                  deriving (Show, Typeable)
- 
-instance Serialize GrabKeyboard where
-        serialize x
-          = do putWord8 31
-               serialize (owner_events_GrabKeyboard x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (grab_window_GrabKeyboard x)
-               serialize (time_GrabKeyboard x)
-               serialize (pointer_mode_GrabKeyboard x)
-               serialize (keyboard_mode_GrabKeyboard x)
-               putSkip 2
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (owner_events_GrabKeyboard x) +
-              size (grab_window_GrabKeyboard x)
-              + size (time_GrabKeyboard x)
-              + size (pointer_mode_GrabKeyboard x)
-              + size (keyboard_mode_GrabKeyboard x)
-              + 2
- 
-data GrabKeyboardReply = MkGrabKeyboardReply{status_GrabKeyboardReply
-                                             :: BYTE}
-                       deriving (Show, Typeable)
- 
-instance Deserialize GrabKeyboardReply where
-        deserialize
-          = do skip 1
-               status <- deserialize
-               skip 2
-               length <- deserialize
-               let _ = isCard32 length
-               return (MkGrabKeyboardReply status)
- 
-data UngrabKeyboard = MkUngrabKeyboard{time_UngrabKeyboard ::
-                                       TIMESTAMP}
-                    deriving (Show, Typeable)
- 
-instance Serialize UngrabKeyboard where
-        serialize x
-          = do putWord8 32
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (time_UngrabKeyboard x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (time_UngrabKeyboard x)
- 
-data Grab = GrabAny
- 
-instance SimpleEnum Grab where
-        toValue GrabAny{} = 0
-        fromValue 0 = GrabAny
- 
-data GrabKey = MkGrabKey{owner_events_GrabKey :: BOOL,
-                         grab_window_GrabKey :: WINDOW, modifiers_GrabKey :: CARD16,
-                         key_GrabKey :: KEYCODE, pointer_mode_GrabKey :: CARD8,
-                         keyboard_mode_GrabKey :: CARD8}
-             deriving (Show, Typeable)
- 
-instance Serialize GrabKey where
-        serialize x
-          = do putWord8 33
-               serialize (owner_events_GrabKey x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (grab_window_GrabKey x)
-               serialize (modifiers_GrabKey x)
-               serialize (key_GrabKey x)
-               serialize (pointer_mode_GrabKey x)
-               serialize (keyboard_mode_GrabKey x)
-               putSkip 3
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (owner_events_GrabKey x) + size (grab_window_GrabKey x)
-              + size (modifiers_GrabKey x)
-              + size (key_GrabKey x)
-              + size (pointer_mode_GrabKey x)
-              + size (keyboard_mode_GrabKey x)
-              + 3
- 
-data UngrabKey = MkUngrabKey{key_UngrabKey :: KEYCODE,
-                             grab_window_UngrabKey :: WINDOW, modifiers_UngrabKey :: CARD16}
-               deriving (Show, Typeable)
- 
-instance Serialize UngrabKey where
-        serialize x
-          = do putWord8 34
-               serialize (key_UngrabKey x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (grab_window_UngrabKey x)
-               serialize (modifiers_UngrabKey x)
-               putSkip 2
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (key_UngrabKey x) + size (grab_window_UngrabKey x) +
-              size (modifiers_UngrabKey x)
-              + 2
- 
-data Allow = AllowAsyncPointer
-           | AllowSyncPointer
-           | AllowReplayPointer
-           | AllowAsyncKeyboard
-           | AllowSyncKeyboard
-           | AllowReplayKeyboard
-           | AllowAsyncBoth
-           | AllowSyncBoth
- 
-instance SimpleEnum Allow where
-        toValue AllowAsyncPointer{} = 0
-        toValue AllowSyncPointer{} = 1
-        toValue AllowReplayPointer{} = 2
-        toValue AllowAsyncKeyboard{} = 3
-        toValue AllowSyncKeyboard{} = 4
-        toValue AllowReplayKeyboard{} = 5
-        toValue AllowAsyncBoth{} = 6
-        toValue AllowSyncBoth{} = 7
-        fromValue 0 = AllowAsyncPointer
-        fromValue 1 = AllowSyncPointer
-        fromValue 2 = AllowReplayPointer
-        fromValue 3 = AllowAsyncKeyboard
-        fromValue 4 = AllowSyncKeyboard
-        fromValue 5 = AllowReplayKeyboard
-        fromValue 6 = AllowAsyncBoth
-        fromValue 7 = AllowSyncBoth
- 
-data AllowEvents = MkAllowEvents{mode_AllowEvents :: CARD8,
-                                 time_AllowEvents :: TIMESTAMP}
-                 deriving (Show, Typeable)
- 
-instance Serialize AllowEvents where
-        serialize x
-          = do putWord8 35
-               serialize (mode_AllowEvents x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (time_AllowEvents x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + size (mode_AllowEvents x) + size (time_AllowEvents x)
- 
-data QueryPointer = MkQueryPointer{window_QueryPointer :: WINDOW}
-                  deriving (Show, Typeable)
- 
-instance Serialize QueryPointer where
-        serialize x
-          = do putWord8 38
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_QueryPointer x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (window_QueryPointer x)
- 
-data QueryPointerReply = MkQueryPointerReply{same_screen_QueryPointerReply
-                                             :: BOOL,
-                                             root_QueryPointerReply :: WINDOW,
-                                             child_QueryPointerReply :: WINDOW,
-                                             root_x_QueryPointerReply :: INT16,
-                                             root_y_QueryPointerReply :: INT16,
-                                             win_x_QueryPointerReply :: INT16,
-                                             win_y_QueryPointerReply :: INT16,
-                                             mask_QueryPointerReply :: CARD16}
-                       deriving (Show, Typeable)
- 
-instance Deserialize QueryPointerReply where
-        deserialize
-          = do skip 1
-               same_screen <- deserialize
-               skip 2
-               length <- deserialize
-               root <- deserialize
-               child <- deserialize
-               root_x <- deserialize
-               root_y <- deserialize
-               win_x <- deserialize
-               win_y <- deserialize
-               mask <- deserialize
-               skip 2
-               let _ = isCard32 length
-               return
-                 (MkQueryPointerReply same_screen root child root_x root_y win_x
-                    win_y
-                    mask)
- 
-data TIMECOORD = MkTIMECOORD{time_TIMECOORD :: TIMESTAMP,
-                             x_TIMECOORD :: INT16, y_TIMECOORD :: INT16}
-               deriving (Show, Typeable)
- 
-instance Serialize TIMECOORD where
-        serialize x
-          = do serialize (time_TIMECOORD x)
-               serialize (x_TIMECOORD x)
-               serialize (y_TIMECOORD x)
-        size x
-          = size (time_TIMECOORD x) + size (x_TIMECOORD x) +
-              size (y_TIMECOORD x)
- 
-instance Deserialize TIMECOORD where
-        deserialize
-          = do time <- deserialize
-               x <- deserialize
-               y <- deserialize
-               return (MkTIMECOORD time x y)
- 
-data GetMotionEvents = MkGetMotionEvents{window_GetMotionEvents ::
-                                         WINDOW,
-                                         start_GetMotionEvents :: TIMESTAMP,
-                                         stop_GetMotionEvents :: TIMESTAMP}
-                     deriving (Show, Typeable)
- 
-instance Serialize GetMotionEvents where
-        serialize x
-          = do putWord8 39
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_GetMotionEvents x)
-               serialize (start_GetMotionEvents x)
-               serialize (stop_GetMotionEvents x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (window_GetMotionEvents x) +
-              size (start_GetMotionEvents x)
-              + size (stop_GetMotionEvents x)
- 
-data GetMotionEventsReply = MkGetMotionEventsReply{events_len_GetMotionEventsReply
-                                                   :: CARD32,
-                                                   events_GetMotionEventsReply :: [TIMECOORD]}
-                          deriving (Show, Typeable)
- 
-instance Deserialize GetMotionEventsReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               events_len <- deserialize
-               skip 20
-               events <- deserializeList (fromIntegral events_len)
-               let _ = isCard32 length
-               return (MkGetMotionEventsReply events_len events)
- 
-data TranslateCoordinates = MkTranslateCoordinates{src_window_TranslateCoordinates
-                                                   :: WINDOW,
-                                                   dst_window_TranslateCoordinates :: WINDOW,
-                                                   src_x_TranslateCoordinates :: INT16,
-                                                   src_y_TranslateCoordinates :: INT16}
-                          deriving (Show, Typeable)
- 
-instance Serialize TranslateCoordinates where
-        serialize x
-          = do putWord8 40
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (src_window_TranslateCoordinates x)
-               serialize (dst_window_TranslateCoordinates x)
-               serialize (src_x_TranslateCoordinates x)
-               serialize (src_y_TranslateCoordinates x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (src_window_TranslateCoordinates x) +
-              size (dst_window_TranslateCoordinates x)
-              + size (src_x_TranslateCoordinates x)
-              + size (src_y_TranslateCoordinates x)
- 
-data TranslateCoordinatesReply = MkTranslateCoordinatesReply{same_screen_TranslateCoordinatesReply
-                                                             :: BOOL,
-                                                             child_TranslateCoordinatesReply ::
-                                                             WINDOW,
-                                                             dst_x_TranslateCoordinatesReply ::
-                                                             CARD16,
-                                                             dst_y_TranslateCoordinatesReply ::
-                                                             CARD16}
-                               deriving (Show, Typeable)
- 
-instance Deserialize TranslateCoordinatesReply where
-        deserialize
-          = do skip 1
-               same_screen <- deserialize
-               skip 2
-               length <- deserialize
-               child <- deserialize
-               dst_x <- deserialize
-               dst_y <- deserialize
-               let _ = isCard32 length
-               return (MkTranslateCoordinatesReply same_screen child dst_x dst_y)
- 
-data WarpPointer = MkWarpPointer{src_window_WarpPointer :: WINDOW,
-                                 dst_window_WarpPointer :: WINDOW, src_x_WarpPointer :: INT16,
-                                 src_y_WarpPointer :: INT16, src_width_WarpPointer :: CARD16,
-                                 src_height_WarpPointer :: CARD16, dst_x_WarpPointer :: INT16,
-                                 dst_y_WarpPointer :: INT16}
-                 deriving (Show, Typeable)
- 
-instance Serialize WarpPointer where
-        serialize x
-          = do putWord8 41
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (src_window_WarpPointer x)
-               serialize (dst_window_WarpPointer x)
-               serialize (src_x_WarpPointer x)
-               serialize (src_y_WarpPointer x)
-               serialize (src_width_WarpPointer x)
-               serialize (src_height_WarpPointer x)
-               serialize (dst_x_WarpPointer x)
-               serialize (dst_y_WarpPointer x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (src_window_WarpPointer x) +
-              size (dst_window_WarpPointer x)
-              + size (src_x_WarpPointer x)
-              + size (src_y_WarpPointer x)
-              + size (src_width_WarpPointer x)
-              + size (src_height_WarpPointer x)
-              + size (dst_x_WarpPointer x)
-              + size (dst_y_WarpPointer x)
- 
-data InputFocus = InputFocusNone
-                | InputFocusPointerRoot
-                | InputFocusParent
- 
-instance SimpleEnum InputFocus where
-        toValue InputFocusNone{} = 0
-        toValue InputFocusPointerRoot{} = 1
-        toValue InputFocusParent{} = 2
-        fromValue 0 = InputFocusNone
-        fromValue 1 = InputFocusPointerRoot
-        fromValue 2 = InputFocusParent
- 
-data SetInputFocus = MkSetInputFocus{revert_to_SetInputFocus ::
-                                     CARD8,
-                                     focus_SetInputFocus :: WINDOW, time_SetInputFocus :: TIMESTAMP}
-                   deriving (Show, Typeable)
- 
-instance Serialize SetInputFocus where
-        serialize x
-          = do putWord8 42
-               serialize (revert_to_SetInputFocus x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (focus_SetInputFocus x)
-               serialize (time_SetInputFocus x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (revert_to_SetInputFocus x) +
-              size (focus_SetInputFocus x)
-              + size (time_SetInputFocus x)
- 
-data GetInputFocus = MkGetInputFocus{}
-                   deriving (Show, Typeable)
- 
-instance Serialize GetInputFocus where
-        serialize x
-          = do putWord8 43
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 4
- 
-data GetInputFocusReply = MkGetInputFocusReply{revert_to_GetInputFocusReply
-                                               :: CARD8,
-                                               focus_GetInputFocusReply :: WINDOW}
-                        deriving (Show, Typeable)
- 
-instance Deserialize GetInputFocusReply where
-        deserialize
-          = do skip 1
-               revert_to <- deserialize
-               skip 2
-               length <- deserialize
-               focus <- deserialize
-               let _ = isCard32 length
-               return (MkGetInputFocusReply revert_to focus)
- 
-data QueryKeymap = MkQueryKeymap{}
-                 deriving (Show, Typeable)
- 
-instance Serialize QueryKeymap where
-        serialize x
-          = do putWord8 44
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 4
- 
-data QueryKeymapReply = MkQueryKeymapReply{keys_QueryKeymapReply ::
-                                           [CARD8]}
-                      deriving (Show, Typeable)
- 
-instance Deserialize QueryKeymapReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               keys <- deserializeList (fromIntegral 32)
-               let _ = isCard32 length
-               return (MkQueryKeymapReply keys)
- 
-data OpenFont = MkOpenFont{fid_OpenFont :: FONT,
-                           name_len_OpenFont :: CARD16, name_OpenFont :: [CChar]}
-              deriving (Show, Typeable)
- 
-instance Serialize OpenFont where
-        serialize x
-          = do putWord8 45
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (fid_OpenFont x)
-               serialize (name_len_OpenFont x)
-               putSkip 2
-               serializeList (name_OpenFont x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (fid_OpenFont x) + size (name_len_OpenFont x) + 2 +
-              sum (map size (name_OpenFont x))
- 
-data CloseFont = MkCloseFont{font_CloseFont :: FONT}
-               deriving (Show, Typeable)
- 
-instance Serialize CloseFont where
-        serialize x
-          = do putWord8 46
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (font_CloseFont x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (font_CloseFont x)
- 
-data FontDraw = FontDrawLeftToRight
-              | FontDrawRightToLeft
- 
-instance SimpleEnum FontDraw where
-        toValue FontDrawLeftToRight{} = 0
-        toValue FontDrawRightToLeft{} = 1
-        fromValue 0 = FontDrawLeftToRight
-        fromValue 1 = FontDrawRightToLeft
- 
-data FONTPROP = MkFONTPROP{name_FONTPROP :: ATOM,
-                           value_FONTPROP :: CARD32}
-              deriving (Show, Typeable)
- 
-instance Serialize FONTPROP where
-        serialize x
-          = do serialize (name_FONTPROP x)
-               serialize (value_FONTPROP x)
-        size x = size (name_FONTPROP x) + size (value_FONTPROP x)
- 
-instance Deserialize FONTPROP where
-        deserialize
-          = do name <- deserialize
-               value <- deserialize
-               return (MkFONTPROP name value)
- 
-data CHARINFO = MkCHARINFO{left_side_bearing_CHARINFO :: INT16,
-                           right_side_bearing_CHARINFO :: INT16,
-                           character_width_CHARINFO :: INT16, ascent_CHARINFO :: INT16,
-                           descent_CHARINFO :: INT16, attributes_CHARINFO :: CARD16}
-              deriving (Show, Typeable)
- 
-instance Serialize CHARINFO where
-        serialize x
-          = do serialize (left_side_bearing_CHARINFO x)
-               serialize (right_side_bearing_CHARINFO x)
-               serialize (character_width_CHARINFO x)
-               serialize (ascent_CHARINFO x)
-               serialize (descent_CHARINFO x)
-               serialize (attributes_CHARINFO x)
-        size x
-          = size (left_side_bearing_CHARINFO x) +
-              size (right_side_bearing_CHARINFO x)
-              + size (character_width_CHARINFO x)
-              + size (ascent_CHARINFO x)
-              + size (descent_CHARINFO x)
-              + size (attributes_CHARINFO x)
- 
-instance Deserialize CHARINFO where
-        deserialize
-          = do left_side_bearing <- deserialize
-               right_side_bearing <- deserialize
-               character_width <- deserialize
-               ascent <- deserialize
-               descent <- deserialize
-               attributes <- deserialize
-               return
-                 (MkCHARINFO left_side_bearing right_side_bearing character_width
-                    ascent
-                    descent
-                    attributes)
- 
-data QueryFont = MkQueryFont{font_QueryFont :: FONTABLE}
-               deriving (Show, Typeable)
- 
-instance Serialize QueryFont where
-        serialize x
-          = do putWord8 47
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (font_QueryFont x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (font_QueryFont x)
- 
-data QueryFontReply = MkQueryFontReply{min_bounds_QueryFontReply ::
-                                       CHARINFO,
-                                       max_bounds_QueryFontReply :: CHARINFO,
-                                       min_char_or_byte2_QueryFontReply :: CARD16,
-                                       max_char_or_byte2_QueryFontReply :: CARD16,
-                                       default_char_QueryFontReply :: CARD16,
-                                       properties_len_QueryFontReply :: CARD16,
-                                       draw_direction_QueryFontReply :: BYTE,
-                                       min_byte1_QueryFontReply :: CARD8,
-                                       max_byte1_QueryFontReply :: CARD8,
-                                       all_chars_exist_QueryFontReply :: BOOL,
-                                       font_ascent_QueryFontReply :: INT16,
-                                       font_descent_QueryFontReply :: INT16,
-                                       char_infos_len_QueryFontReply :: CARD32,
-                                       properties_QueryFontReply :: [FONTPROP],
-                                       char_infos_QueryFontReply :: [CHARINFO]}
-                    deriving (Show, Typeable)
- 
-instance Deserialize QueryFontReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               min_bounds <- deserialize
-               skip 4
-               max_bounds <- deserialize
-               skip 4
-               min_char_or_byte2 <- deserialize
-               max_char_or_byte2 <- deserialize
-               default_char <- deserialize
-               properties_len <- deserialize
-               draw_direction <- deserialize
-               min_byte1 <- deserialize
-               max_byte1 <- deserialize
-               all_chars_exist <- deserialize
-               font_ascent <- deserialize
-               font_descent <- deserialize
-               char_infos_len <- deserialize
-               properties <- deserializeList (fromIntegral properties_len)
-               char_infos <- deserializeList (fromIntegral char_infos_len)
-               let _ = isCard32 length
-               return
-                 (MkQueryFontReply min_bounds max_bounds min_char_or_byte2
-                    max_char_or_byte2
-                    default_char
-                    properties_len
-                    draw_direction
-                    min_byte1
-                    max_byte1
-                    all_chars_exist
-                    font_ascent
-                    font_descent
-                    char_infos_len
-                    properties
-                    char_infos)
- 
-data QueryTextExtents = MkQueryTextExtents{font_QueryTextExtents ::
-                                           FONTABLE,
-                                           string_QueryTextExtents :: [CHAR2B]}
-                      deriving (Show, Typeable)
- 
-odd_length_QueryTextExtents :: QueryTextExtents -> BOOL
-odd_length_QueryTextExtents x
-  = (fromIntegral (string_len_QueryTextExtents x .&. 1))
-
-string_len_QueryTextExtents :: QueryTextExtents -> Word8
-string_len_QueryTextExtents x = genericLength $ string_QueryTextExtents x
- 
-instance Serialize QueryTextExtents where
-        serialize x
-          = do putWord8 48
-               serialize (odd_length_QueryTextExtents x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (font_QueryTextExtents x)
-               serializeList (string_QueryTextExtents x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (odd_length_QueryTextExtents x) +
-              size (font_QueryTextExtents x)
-              + sum (map size (string_QueryTextExtents x))
- 
-data QueryTextExtentsReply = MkQueryTextExtentsReply{draw_direction_QueryTextExtentsReply
-                                                     :: BYTE,
-                                                     font_ascent_QueryTextExtentsReply :: INT16,
-                                                     font_descent_QueryTextExtentsReply :: INT16,
-                                                     overall_ascent_QueryTextExtentsReply :: INT16,
-                                                     overall_descent_QueryTextExtentsReply :: INT16,
-                                                     overall_width_QueryTextExtentsReply :: INT32,
-                                                     overall_left_QueryTextExtentsReply :: INT32,
-                                                     overall_right_QueryTextExtentsReply :: INT32}
-                           deriving (Show, Typeable)
- 
-instance Deserialize QueryTextExtentsReply where
-        deserialize
-          = do skip 1
-               draw_direction <- deserialize
-               skip 2
-               length <- deserialize
-               font_ascent <- deserialize
-               font_descent <- deserialize
-               overall_ascent <- deserialize
-               overall_descent <- deserialize
-               overall_width <- deserialize
-               overall_left <- deserialize
-               overall_right <- deserialize
-               let _ = isCard32 length
-               return
-                 (MkQueryTextExtentsReply draw_direction font_ascent font_descent
-                    overall_ascent
-                    overall_descent
-                    overall_width
-                    overall_left
-                    overall_right)
- 
-data STR = MkSTR{name_len_STR :: CARD8, name_STR :: [CChar]}
-         deriving (Show, Typeable)
- 
-instance Serialize STR where
-        serialize x
-          = do serialize (name_len_STR x)
-               serializeList (name_STR x)
-        size x = size (name_len_STR x) + sum (map size (name_STR x))
- 
-instance Deserialize STR where
-        deserialize
-          = do name_len <- deserialize
-               name <- deserializeList (fromIntegral name_len)
-               return (MkSTR name_len name)
- 
-data ListFonts = MkListFonts{max_names_ListFonts :: CARD16,
-                             pattern_len_ListFonts :: CARD16, pattern_ListFonts :: [CChar]}
-               deriving (Show, Typeable)
- 
-instance Serialize ListFonts where
-        serialize x
-          = do putWord8 49
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (max_names_ListFonts x)
-               serialize (pattern_len_ListFonts x)
-               serializeList (pattern_ListFonts x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (max_names_ListFonts x) +
-              size (pattern_len_ListFonts x)
-              + sum (map size (pattern_ListFonts x))
- 
-data ListFontsReply = MkListFontsReply{names_len_ListFontsReply ::
-                                       CARD16,
-                                       names_ListFontsReply :: [STR]}
-                    deriving (Show, Typeable)
- 
-instance Deserialize ListFontsReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               names_len <- deserialize
-               skip 22
-               names <- deserializeList (fromIntegral names_len)
-               let _ = isCard32 length
-               return (MkListFontsReply names_len names)
- 
-data ListFontsWithInfo = MkListFontsWithInfo{max_names_ListFontsWithInfo
-                                             :: CARD16,
-                                             pattern_len_ListFontsWithInfo :: CARD16,
-                                             pattern_ListFontsWithInfo :: [CChar]}
-                       deriving (Show, Typeable)
- 
-instance Serialize ListFontsWithInfo where
-        serialize x
-          = do putWord8 50
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (max_names_ListFontsWithInfo x)
-               serialize (pattern_len_ListFontsWithInfo x)
-               serializeList (pattern_ListFontsWithInfo x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (max_names_ListFontsWithInfo x) +
-              size (pattern_len_ListFontsWithInfo x)
-              + sum (map size (pattern_ListFontsWithInfo x))
- 
-data ListFontsWithInfoReply = MkListFontsWithInfoReply{name_len_ListFontsWithInfoReply
-                                                       :: CARD8,
-                                                       min_bounds_ListFontsWithInfoReply ::
-                                                       CHARINFO,
-                                                       max_bounds_ListFontsWithInfoReply ::
-                                                       CHARINFO,
-                                                       min_char_or_byte2_ListFontsWithInfoReply ::
-                                                       CARD16,
-                                                       max_char_or_byte2_ListFontsWithInfoReply ::
-                                                       CARD16,
-                                                       default_char_ListFontsWithInfoReply ::
-                                                       CARD16,
-                                                       properties_len_ListFontsWithInfoReply ::
-                                                       CARD16,
-                                                       draw_direction_ListFontsWithInfoReply ::
-                                                       BYTE,
-                                                       min_byte1_ListFontsWithInfoReply :: CARD8,
-                                                       max_byte1_ListFontsWithInfoReply :: CARD8,
-                                                       all_chars_exist_ListFontsWithInfoReply ::
-                                                       BOOL,
-                                                       font_ascent_ListFontsWithInfoReply :: INT16,
-                                                       font_descent_ListFontsWithInfoReply :: INT16,
-                                                       replies_hint_ListFontsWithInfoReply ::
-                                                       CARD32,
-                                                       properties_ListFontsWithInfoReply ::
-                                                       [FONTPROP],
-                                                       name_ListFontsWithInfoReply :: [CChar]}
-                            deriving (Show, Typeable)
- 
-instance Deserialize ListFontsWithInfoReply where
-        deserialize
-          = do skip 1
-               name_len <- deserialize
-               skip 2
-               length <- deserialize
-               min_bounds <- deserialize
-               skip 4
-               max_bounds <- deserialize
-               skip 4
-               min_char_or_byte2 <- deserialize
-               max_char_or_byte2 <- deserialize
-               default_char <- deserialize
-               properties_len <- deserialize
-               draw_direction <- deserialize
-               min_byte1 <- deserialize
-               max_byte1 <- deserialize
-               all_chars_exist <- deserialize
-               font_ascent <- deserialize
-               font_descent <- deserialize
-               replies_hint <- deserialize
-               properties <- deserializeList (fromIntegral properties_len)
-               name <- deserializeList (fromIntegral name_len)
-               let _ = isCard32 length
-               return
-                 (MkListFontsWithInfoReply name_len min_bounds max_bounds
-                    min_char_or_byte2
-                    max_char_or_byte2
-                    default_char
-                    properties_len
-                    draw_direction
-                    min_byte1
-                    max_byte1
-                    all_chars_exist
-                    font_ascent
-                    font_descent
-                    replies_hint
-                    properties
-                    name)
- 
-data SetFontPath = MkSetFontPath{font_qty_SetFontPath :: CARD16,
-                                 path_SetFontPath :: [CChar]}
-                 deriving (Show, Typeable)
- 
-instance Serialize SetFontPath where
-        serialize x
-          = do putWord8 51
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (font_qty_SetFontPath x)
-               serializeList (path_SetFontPath x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (font_qty_SetFontPath x) +
-              sum (map size (path_SetFontPath x))
- 
-data GetFontPath = MkGetFontPath{}
-                 deriving (Show, Typeable)
- 
-instance Serialize GetFontPath where
-        serialize x
-          = do putWord8 52
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 4
- 
-data GetFontPathReply = MkGetFontPathReply{path_len_GetFontPathReply
-                                           :: CARD16,
-                                           path_GetFontPathReply :: [STR]}
-                      deriving (Show, Typeable)
- 
-instance Deserialize GetFontPathReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               path_len <- deserialize
-               skip 22
-               path <- deserializeList (fromIntegral path_len)
-               let _ = isCard32 length
-               return (MkGetFontPathReply path_len path)
- 
-data CreatePixmap = MkCreatePixmap{depth_CreatePixmap :: CARD8,
-                                   pid_CreatePixmap :: PIXMAP, drawable_CreatePixmap :: DRAWABLE,
-                                   width_CreatePixmap :: CARD16, height_CreatePixmap :: CARD16}
-                  deriving (Show, Typeable)
- 
-instance Serialize CreatePixmap where
-        serialize x
-          = do putWord8 53
-               serialize (depth_CreatePixmap x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (pid_CreatePixmap x)
-               serialize (drawable_CreatePixmap x)
-               serialize (width_CreatePixmap x)
-               serialize (height_CreatePixmap x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (depth_CreatePixmap x) + size (pid_CreatePixmap x) +
-              size (drawable_CreatePixmap x)
-              + size (width_CreatePixmap x)
-              + size (height_CreatePixmap x)
- 
-data FreePixmap = MkFreePixmap{pixmap_FreePixmap :: PIXMAP}
-                deriving (Show, Typeable)
- 
-instance Serialize FreePixmap where
-        serialize x
-          = do putWord8 54
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (pixmap_FreePixmap x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (pixmap_FreePixmap x)
- 
-data GC = GCFunction
-        | GCPlaneMask
-        | GCForeground
-        | GCBackground
-        | GCLineWidth
-        | GCLineStyle
-        | GCCapStyle
-        | GCJoinStyle
-        | GCFillStyle
-        | GCFillRule
-        | GCTile
-        | GCStipple
-        | GCTileStippleOriginX
-        | GCTileStippleOriginY
-        | GCFont
-        | GCSubwindowMode
-        | GCGraphicsExposures
-        | GCClipOriginX
-        | GCClipOriginY
-        | GCClipMask
-        | GCDashOffset
-        | GCDashList
-        | GCArcMode
- 
-instance BitEnum GC where
-        toBit GCFunction{} = 0
-        toBit GCPlaneMask{} = 1
-        toBit GCForeground{} = 2
-        toBit GCBackground{} = 3
-        toBit GCLineWidth{} = 4
-        toBit GCLineStyle{} = 5
-        toBit GCCapStyle{} = 6
-        toBit GCJoinStyle{} = 7
-        toBit GCFillStyle{} = 8
-        toBit GCFillRule{} = 9
-        toBit GCTile{} = 10
-        toBit GCStipple{} = 11
-        toBit GCTileStippleOriginX{} = 12
-        toBit GCTileStippleOriginY{} = 13
-        toBit GCFont{} = 14
-        toBit GCSubwindowMode{} = 15
-        toBit GCGraphicsExposures{} = 16
-        toBit GCClipOriginX{} = 17
-        toBit GCClipOriginY{} = 18
-        toBit GCClipMask{} = 19
-        toBit GCDashOffset{} = 20
-        toBit GCDashList{} = 21
-        toBit GCArcMode{} = 22
-        fromBit 0 = GCFunction
-        fromBit 1 = GCPlaneMask
-        fromBit 2 = GCForeground
-        fromBit 3 = GCBackground
-        fromBit 4 = GCLineWidth
-        fromBit 5 = GCLineStyle
-        fromBit 6 = GCCapStyle
-        fromBit 7 = GCJoinStyle
-        fromBit 8 = GCFillStyle
-        fromBit 9 = GCFillRule
-        fromBit 10 = GCTile
-        fromBit 11 = GCStipple
-        fromBit 12 = GCTileStippleOriginX
-        fromBit 13 = GCTileStippleOriginY
-        fromBit 14 = GCFont
-        fromBit 15 = GCSubwindowMode
-        fromBit 16 = GCGraphicsExposures
-        fromBit 17 = GCClipOriginX
-        fromBit 18 = GCClipOriginY
-        fromBit 19 = GCClipMask
-        fromBit 20 = GCDashOffset
-        fromBit 21 = GCDashList
-        fromBit 22 = GCArcMode
- 
-data GX = GXclear
-        | GXand
-        | GXandReverse
-        | GXcopy
-        | GXandInverted
-        | GXnoop
-        | GXxor
-        | GXor
-        | GXnor
-        | GXequiv
-        | GXinvert
-        | GXorReverse
-        | GXcopyInverted
-        | GXorInverted
-        | GXnand
-        | GXset
- 
-instance SimpleEnum GX where
-        toValue GXclear{} = 0
-        toValue GXand{} = 1
-        toValue GXandReverse{} = 2
-        toValue GXcopy{} = 3
-        toValue GXandInverted{} = 4
-        toValue GXnoop{} = 5
-        toValue GXxor{} = 6
-        toValue GXor{} = 7
-        toValue GXnor{} = 8
-        toValue GXequiv{} = 9
-        toValue GXinvert{} = 10
-        toValue GXorReverse{} = 11
-        toValue GXcopyInverted{} = 12
-        toValue GXorInverted{} = 13
-        toValue GXnand{} = 14
-        toValue GXset{} = 15
-        fromValue 0 = GXclear
-        fromValue 1 = GXand
-        fromValue 2 = GXandReverse
-        fromValue 3 = GXcopy
-        fromValue 4 = GXandInverted
-        fromValue 5 = GXnoop
-        fromValue 6 = GXxor
-        fromValue 7 = GXor
-        fromValue 8 = GXnor
-        fromValue 9 = GXequiv
-        fromValue 10 = GXinvert
-        fromValue 11 = GXorReverse
-        fromValue 12 = GXcopyInverted
-        fromValue 13 = GXorInverted
-        fromValue 14 = GXnand
-        fromValue 15 = GXset
- 
-data LineStyle = LineStyleSolid
-               | LineStyleOnOffDash
-               | LineStyleDoubleDash
- 
-instance SimpleEnum LineStyle where
-        toValue LineStyleSolid{} = 0
-        toValue LineStyleOnOffDash{} = 1
-        toValue LineStyleDoubleDash{} = 2
-        fromValue 0 = LineStyleSolid
-        fromValue 1 = LineStyleOnOffDash
-        fromValue 2 = LineStyleDoubleDash
- 
-data CapStyle = CapStyleNotLast
-              | CapStyleButt
-              | CapStyleRound
-              | CapStyleProjecting
- 
-instance SimpleEnum CapStyle where
-        toValue CapStyleNotLast{} = 0
-        toValue CapStyleButt{} = 1
-        toValue CapStyleRound{} = 2
-        toValue CapStyleProjecting{} = 3
-        fromValue 0 = CapStyleNotLast
-        fromValue 1 = CapStyleButt
-        fromValue 2 = CapStyleRound
-        fromValue 3 = CapStyleProjecting
- 
-data JoinStyle = JoinStyleMitre
-               | JoinStyleRound
-               | JoinStyleBevel
- 
-instance SimpleEnum JoinStyle where
-        toValue JoinStyleMitre{} = 0
-        toValue JoinStyleRound{} = 1
-        toValue JoinStyleBevel{} = 2
-        fromValue 0 = JoinStyleMitre
-        fromValue 1 = JoinStyleRound
-        fromValue 2 = JoinStyleBevel
- 
-data FillStyle = FillStyleSolid
-               | FillStyleTiled
-               | FillStyleStippled
-               | FillStyleOpaqueStippled
- 
-instance SimpleEnum FillStyle where
-        toValue FillStyleSolid{} = 0
-        toValue FillStyleTiled{} = 1
-        toValue FillStyleStippled{} = 2
-        toValue FillStyleOpaqueStippled{} = 3
-        fromValue 0 = FillStyleSolid
-        fromValue 1 = FillStyleTiled
-        fromValue 2 = FillStyleStippled
-        fromValue 3 = FillStyleOpaqueStippled
- 
-data FillRule = FillRuleEvenOdd
-              | FillRuleWinding
- 
-instance SimpleEnum FillRule where
-        toValue FillRuleEvenOdd{} = 0
-        toValue FillRuleWinding{} = 1
-        fromValue 0 = FillRuleEvenOdd
-        fromValue 1 = FillRuleWinding
- 
-data SubwindowMode = SubwindowModeClipByChildren
-                   | SubwindowModeIncludeInferiors
- 
-instance SimpleEnum SubwindowMode where
-        toValue SubwindowModeClipByChildren{} = 0
-        toValue SubwindowModeIncludeInferiors{} = 1
-        fromValue 0 = SubwindowModeClipByChildren
-        fromValue 1 = SubwindowModeIncludeInferiors
- 
-data ArcMode = ArcModeChord
-             | ArcModePieSlice
- 
-instance SimpleEnum ArcMode where
-        toValue ArcModeChord{} = 0
-        toValue ArcModePieSlice{} = 1
-        fromValue 0 = ArcModeChord
-        fromValue 1 = ArcModePieSlice
- 
-data CreateGC = MkCreateGC{cid_CreateGC :: GCONTEXT,
-                           drawable_CreateGC :: DRAWABLE, value_CreateGC :: ValueParam CARD32}
-              deriving (Show, Typeable)
- 
-instance Serialize CreateGC where
-        serialize x
-          = do putWord8 55
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cid_CreateGC x)
-               serialize (drawable_CreateGC x)
-               serialize (value_CreateGC x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (cid_CreateGC x) + size (drawable_CreateGC x) +
-              size (value_CreateGC x)
- 
-data ChangeGC = MkChangeGC{gc_ChangeGC :: GCONTEXT,
-                           value_ChangeGC :: ValueParam CARD32}
-              deriving (Show, Typeable)
- 
-instance Serialize ChangeGC where
-        serialize x
-          = do putWord8 56
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (gc_ChangeGC x)
-               serialize (value_ChangeGC x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (gc_ChangeGC x) + size (value_ChangeGC x)
- 
-data CopyGC = MkCopyGC{src_gc_CopyGC :: GCONTEXT,
-                       dst_gc_CopyGC :: GCONTEXT, value_mask_CopyGC :: CARD32}
-            deriving (Show, Typeable)
- 
-instance Serialize CopyGC where
-        serialize x
-          = do putWord8 57
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (src_gc_CopyGC x)
-               serialize (dst_gc_CopyGC x)
-               serialize (value_mask_CopyGC x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (src_gc_CopyGC x) + size (dst_gc_CopyGC x) +
-              size (value_mask_CopyGC x)
- 
-data SetDashes = MkSetDashes{gc_SetDashes :: GCONTEXT,
-                             dash_offset_SetDashes :: CARD16, dashes_len_SetDashes :: CARD16,
-                             dashes_SetDashes :: [CARD8]}
-               deriving (Show, Typeable)
- 
-instance Serialize SetDashes where
-        serialize x
-          = do putWord8 58
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (gc_SetDashes x)
-               serialize (dash_offset_SetDashes x)
-               serialize (dashes_len_SetDashes x)
-               serializeList (dashes_SetDashes x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (gc_SetDashes x) + size (dash_offset_SetDashes x) +
-              size (dashes_len_SetDashes x)
-              + sum (map size (dashes_SetDashes x))
- 
-data ClipOrdering = ClipOrderingUnsorted
-                  | ClipOrderingYSorted
-                  | ClipOrderingYXSorted
-                  | ClipOrderingYXBanded
- 
-instance SimpleEnum ClipOrdering where
-        toValue ClipOrderingUnsorted{} = 0
-        toValue ClipOrderingYSorted{} = 1
-        toValue ClipOrderingYXSorted{} = 2
-        toValue ClipOrderingYXBanded{} = 3
-        fromValue 0 = ClipOrderingUnsorted
-        fromValue 1 = ClipOrderingYSorted
-        fromValue 2 = ClipOrderingYXSorted
-        fromValue 3 = ClipOrderingYXBanded
- 
-data SetClipRectangles = MkSetClipRectangles{ordering_SetClipRectangles
-                                             :: BYTE,
-                                             gc_SetClipRectangles :: GCONTEXT,
-                                             clip_x_origin_SetClipRectangles :: INT16,
-                                             clip_y_origin_SetClipRectangles :: INT16,
-                                             rectangles_SetClipRectangles :: [RECTANGLE]}
-                       deriving (Show, Typeable)
- 
-instance Serialize SetClipRectangles where
-        serialize x
-          = do putWord8 59
-               serialize (ordering_SetClipRectangles x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (gc_SetClipRectangles x)
-               serialize (clip_x_origin_SetClipRectangles x)
-               serialize (clip_y_origin_SetClipRectangles x)
-               serializeList (rectangles_SetClipRectangles x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (ordering_SetClipRectangles x) +
-              size (gc_SetClipRectangles x)
-              + size (clip_x_origin_SetClipRectangles x)
-              + size (clip_y_origin_SetClipRectangles x)
-              + sum (map size (rectangles_SetClipRectangles x))
- 
-data FreeGC = MkFreeGC{gc_FreeGC :: GCONTEXT}
-            deriving (Show, Typeable)
- 
-instance Serialize FreeGC where
-        serialize x
-          = do putWord8 60
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (gc_FreeGC x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (gc_FreeGC x)
- 
-data ClearArea = MkClearArea{exposures_ClearArea :: BOOL,
-                             window_ClearArea :: WINDOW, x_ClearArea :: INT16,
-                             y_ClearArea :: INT16, width_ClearArea :: CARD16,
-                             height_ClearArea :: CARD16}
-               deriving (Show, Typeable)
- 
-instance Serialize ClearArea where
-        serialize x
-          = do putWord8 61
-               serialize (exposures_ClearArea x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_ClearArea x)
-               serialize (x_ClearArea x)
-               serialize (y_ClearArea x)
-               serialize (width_ClearArea x)
-               serialize (height_ClearArea x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (exposures_ClearArea x) + size (window_ClearArea x) +
-              size (x_ClearArea x)
-              + size (y_ClearArea x)
-              + size (width_ClearArea x)
-              + size (height_ClearArea x)
- 
-data CopyArea = MkCopyArea{src_drawable_CopyArea :: DRAWABLE,
-                           dst_drawable_CopyArea :: DRAWABLE, gc_CopyArea :: GCONTEXT,
-                           src_x_CopyArea :: INT16, src_y_CopyArea :: INT16,
-                           dst_x_CopyArea :: INT16, dst_y_CopyArea :: INT16,
-                           width_CopyArea :: CARD16, height_CopyArea :: CARD16}
-              deriving (Show, Typeable)
- 
-instance Serialize CopyArea where
-        serialize x
-          = do putWord8 62
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (src_drawable_CopyArea x)
-               serialize (dst_drawable_CopyArea x)
-               serialize (gc_CopyArea x)
-               serialize (src_x_CopyArea x)
-               serialize (src_y_CopyArea x)
-               serialize (dst_x_CopyArea x)
-               serialize (dst_y_CopyArea x)
-               serialize (width_CopyArea x)
-               serialize (height_CopyArea x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (src_drawable_CopyArea x) +
-              size (dst_drawable_CopyArea x)
-              + size (gc_CopyArea x)
-              + size (src_x_CopyArea x)
-              + size (src_y_CopyArea x)
-              + size (dst_x_CopyArea x)
-              + size (dst_y_CopyArea x)
-              + size (width_CopyArea x)
-              + size (height_CopyArea x)
- 
-data CopyPlane = MkCopyPlane{src_drawable_CopyPlane :: DRAWABLE,
-                             dst_drawable_CopyPlane :: DRAWABLE, gc_CopyPlane :: GCONTEXT,
-                             src_x_CopyPlane :: INT16, src_y_CopyPlane :: INT16,
-                             dst_x_CopyPlane :: INT16, dst_y_CopyPlane :: INT16,
-                             width_CopyPlane :: CARD16, height_CopyPlane :: CARD16,
-                             bit_plane_CopyPlane :: CARD32}
-               deriving (Show, Typeable)
- 
-instance Serialize CopyPlane where
-        serialize x
-          = do putWord8 63
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (src_drawable_CopyPlane x)
-               serialize (dst_drawable_CopyPlane x)
-               serialize (gc_CopyPlane x)
-               serialize (src_x_CopyPlane x)
-               serialize (src_y_CopyPlane x)
-               serialize (dst_x_CopyPlane x)
-               serialize (dst_y_CopyPlane x)
-               serialize (width_CopyPlane x)
-               serialize (height_CopyPlane x)
-               serialize (bit_plane_CopyPlane x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (src_drawable_CopyPlane x) +
-              size (dst_drawable_CopyPlane x)
-              + size (gc_CopyPlane x)
-              + size (src_x_CopyPlane x)
-              + size (src_y_CopyPlane x)
-              + size (dst_x_CopyPlane x)
-              + size (dst_y_CopyPlane x)
-              + size (width_CopyPlane x)
-              + size (height_CopyPlane x)
-              + size (bit_plane_CopyPlane x)
- 
-data CoordMode = CoordModeOrigin
-               | CoordModePrevious
- 
-instance SimpleEnum CoordMode where
-        toValue CoordModeOrigin{} = 0
-        toValue CoordModePrevious{} = 1
-        fromValue 0 = CoordModeOrigin
-        fromValue 1 = CoordModePrevious
- 
-data PolyPoint = MkPolyPoint{coordinate_mode_PolyPoint :: BYTE,
-                             drawable_PolyPoint :: DRAWABLE, gc_PolyPoint :: GCONTEXT,
-                             points_PolyPoint :: [POINT]}
-               deriving (Show, Typeable)
- 
-instance Serialize PolyPoint where
-        serialize x
-          = do putWord8 64
-               serialize (coordinate_mode_PolyPoint x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_PolyPoint x)
-               serialize (gc_PolyPoint x)
-               serializeList (points_PolyPoint x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (coordinate_mode_PolyPoint x) +
-              size (drawable_PolyPoint x)
-              + size (gc_PolyPoint x)
-              + sum (map size (points_PolyPoint x))
- 
-data PolyLine = MkPolyLine{coordinate_mode_PolyLine :: BYTE,
-                           drawable_PolyLine :: DRAWABLE, gc_PolyLine :: GCONTEXT,
-                           points_PolyLine :: [POINT]}
-              deriving (Show, Typeable)
- 
-instance Serialize PolyLine where
-        serialize x
-          = do putWord8 65
-               serialize (coordinate_mode_PolyLine x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_PolyLine x)
-               serialize (gc_PolyLine x)
-               serializeList (points_PolyLine x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (coordinate_mode_PolyLine x) +
-              size (drawable_PolyLine x)
-              + size (gc_PolyLine x)
-              + sum (map size (points_PolyLine x))
- 
-data SEGMENT = MkSEGMENT{x1_SEGMENT :: INT16, y1_SEGMENT :: INT16,
-                         x2_SEGMENT :: INT16, y2_SEGMENT :: INT16}
-             deriving (Show, Typeable)
- 
-instance Serialize SEGMENT where
-        serialize x
-          = do serialize (x1_SEGMENT x)
-               serialize (y1_SEGMENT x)
-               serialize (x2_SEGMENT x)
-               serialize (y2_SEGMENT x)
-        size x
-          = size (x1_SEGMENT x) + size (y1_SEGMENT x) + size (x2_SEGMENT x) +
-              size (y2_SEGMENT x)
- 
-instance Deserialize SEGMENT where
-        deserialize
-          = do x1 <- deserialize
-               y1 <- deserialize
-               x2 <- deserialize
-               y2 <- deserialize
-               return (MkSEGMENT x1 y1 x2 y2)
- 
-data PolySegment = MkPolySegment{drawable_PolySegment :: DRAWABLE,
-                                 gc_PolySegment :: GCONTEXT, segments_PolySegment :: [SEGMENT]}
-                 deriving (Show, Typeable)
- 
-instance Serialize PolySegment where
-        serialize x
-          = do putWord8 66
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_PolySegment x)
-               serialize (gc_PolySegment x)
-               serializeList (segments_PolySegment x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (drawable_PolySegment x) + size (gc_PolySegment x) +
-              sum (map size (segments_PolySegment x))
- 
-data PolyRectangle = MkPolyRectangle{drawable_PolyRectangle ::
-                                     DRAWABLE,
-                                     gc_PolyRectangle :: GCONTEXT,
-                                     rectangles_PolyRectangle :: [RECTANGLE]}
-                   deriving (Show, Typeable)
- 
-instance Serialize PolyRectangle where
-        serialize x
-          = do putWord8 67
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_PolyRectangle x)
-               serialize (gc_PolyRectangle x)
-               serializeList (rectangles_PolyRectangle x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (drawable_PolyRectangle x) +
-              size (gc_PolyRectangle x)
-              + sum (map size (rectangles_PolyRectangle x))
- 
-data PolyArc = MkPolyArc{drawable_PolyArc :: DRAWABLE,
-                         gc_PolyArc :: GCONTEXT, arcs_PolyArc :: [ARC]}
-             deriving (Show, Typeable)
- 
-instance Serialize PolyArc where
-        serialize x
-          = do putWord8 68
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_PolyArc x)
-               serialize (gc_PolyArc x)
-               serializeList (arcs_PolyArc x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (drawable_PolyArc x) + size (gc_PolyArc x) +
-              sum (map size (arcs_PolyArc x))
- 
-data PolyShape = PolyShapeComplex
-               | PolyShapeNonconvex
-               | PolyShapeConvex
- 
-instance SimpleEnum PolyShape where
-        toValue PolyShapeComplex{} = 0
-        toValue PolyShapeNonconvex{} = 1
-        toValue PolyShapeConvex{} = 2
-        fromValue 0 = PolyShapeComplex
-        fromValue 1 = PolyShapeNonconvex
-        fromValue 2 = PolyShapeConvex
- 
-data FillPoly = MkFillPoly{drawable_FillPoly :: DRAWABLE,
-                           gc_FillPoly :: GCONTEXT, shape_FillPoly :: CARD8,
-                           coordinate_mode_FillPoly :: CARD8, points_FillPoly :: [POINT]}
-              deriving (Show, Typeable)
- 
-instance Serialize FillPoly where
-        serialize x
-          = do putWord8 69
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_FillPoly x)
-               serialize (gc_FillPoly x)
-               serialize (shape_FillPoly x)
-               serialize (coordinate_mode_FillPoly x)
-               putSkip 2
-               serializeList (points_FillPoly x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (drawable_FillPoly x) + size (gc_FillPoly x) +
-              size (shape_FillPoly x)
-              + size (coordinate_mode_FillPoly x)
-              + 2
-              + sum (map size (points_FillPoly x))
- 
-data PolyFillRectangle = MkPolyFillRectangle{drawable_PolyFillRectangle
-                                             :: DRAWABLE,
-                                             gc_PolyFillRectangle :: GCONTEXT,
-                                             rectangles_PolyFillRectangle :: [RECTANGLE]}
-                       deriving (Show, Typeable)
- 
-instance Serialize PolyFillRectangle where
-        serialize x
-          = do putWord8 70
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_PolyFillRectangle x)
-               serialize (gc_PolyFillRectangle x)
-               serializeList (rectangles_PolyFillRectangle x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (drawable_PolyFillRectangle x) +
-              size (gc_PolyFillRectangle x)
-              + sum (map size (rectangles_PolyFillRectangle x))
- 
-data PolyFillArc = MkPolyFillArc{drawable_PolyFillArc :: DRAWABLE,
-                                 gc_PolyFillArc :: GCONTEXT, arcs_PolyFillArc :: [ARC]}
-                 deriving (Show, Typeable)
- 
-instance Serialize PolyFillArc where
-        serialize x
-          = do putWord8 71
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_PolyFillArc x)
-               serialize (gc_PolyFillArc x)
-               serializeList (arcs_PolyFillArc x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (drawable_PolyFillArc x) + size (gc_PolyFillArc x) +
-              sum (map size (arcs_PolyFillArc x))
- 
-data ImageFormat = ImageFormatXYBitmap
-                 | ImageFormatXYPixmap
-                 | ImageFormatZPixmap
- 
-instance SimpleEnum ImageFormat where
-        toValue ImageFormatXYBitmap{} = 0
-        toValue ImageFormatXYPixmap{} = 1
-        toValue ImageFormatZPixmap{} = 2
-        fromValue 0 = ImageFormatXYBitmap
-        fromValue 1 = ImageFormatXYPixmap
-        fromValue 2 = ImageFormatZPixmap
- 
-data PutImage = MkPutImage{format_PutImage :: CARD8,
-                           drawable_PutImage :: DRAWABLE, gc_PutImage :: GCONTEXT,
-                           width_PutImage :: CARD16, height_PutImage :: CARD16,
-                           dst_x_PutImage :: INT16, dst_y_PutImage :: INT16,
-                           left_pad_PutImage :: CARD8, depth_PutImage :: CARD8,
-                           data_PutImage :: [BYTE]}
-              deriving (Show, Typeable)
- 
-instance Serialize PutImage where
-        serialize x
-          = do putWord8 72
-               serialize (format_PutImage x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_PutImage x)
-               serialize (gc_PutImage x)
-               serialize (width_PutImage x)
-               serialize (height_PutImage x)
-               serialize (dst_x_PutImage x)
-               serialize (dst_y_PutImage x)
-               serialize (left_pad_PutImage x)
-               serialize (depth_PutImage x)
-               putSkip 2
-               serializeList (data_PutImage x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (format_PutImage x) + size (drawable_PutImage x) +
-              size (gc_PutImage x)
-              + size (width_PutImage x)
-              + size (height_PutImage x)
-              + size (dst_x_PutImage x)
-              + size (dst_y_PutImage x)
-              + size (left_pad_PutImage x)
-              + size (depth_PutImage x)
-              + 2
-              + sum (map size (data_PutImage x))
- 
-data GetImage = MkGetImage{format_GetImage :: CARD8,
-                           drawable_GetImage :: DRAWABLE, x_GetImage :: INT16,
-                           y_GetImage :: INT16, width_GetImage :: CARD16,
-                           height_GetImage :: CARD16, plane_mask_GetImage :: CARD32}
-              deriving (Show, Typeable)
- 
-instance Serialize GetImage where
-        serialize x
-          = do putWord8 73
-               serialize (format_GetImage x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_GetImage x)
-               serialize (x_GetImage x)
-               serialize (y_GetImage x)
-               serialize (width_GetImage x)
-               serialize (height_GetImage x)
-               serialize (plane_mask_GetImage x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (format_GetImage x) + size (drawable_GetImage x) +
-              size (x_GetImage x)
-              + size (y_GetImage x)
-              + size (width_GetImage x)
-              + size (height_GetImage x)
-              + size (plane_mask_GetImage x)
- 
-data GetImageReply = MkGetImageReply{depth_GetImageReply :: CARD8,
-                                     visual_GetImageReply :: VISUALID, data_GetImageReply :: [BYTE]}
-                   deriving (Show, Typeable)
- 
-instance Deserialize GetImageReply where
-        deserialize
-          = do skip 1
-               depth <- deserialize
-               skip 2
-               length <- deserialize
-               visual <- deserialize
-               skip 20
-               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))
-               let _ = isCard32 length
-               return (MkGetImageReply depth visual data_)
- 
-data PolyText8 = MkPolyText8{drawable_PolyText8 :: DRAWABLE,
-                             gc_PolyText8 :: GCONTEXT, x_PolyText8 :: INT16,
-                             y_PolyText8 :: INT16, items_PolyText8 :: [BYTE]}
-               deriving (Show, Typeable)
- 
-instance Serialize PolyText8 where
-        serialize x
-          = do putWord8 74
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_PolyText8 x)
-               serialize (gc_PolyText8 x)
-               serialize (x_PolyText8 x)
-               serialize (y_PolyText8 x)
-               serializeList (items_PolyText8 x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (drawable_PolyText8 x) + size (gc_PolyText8 x) +
-              size (x_PolyText8 x)
-              + size (y_PolyText8 x)
-              + sum (map size (items_PolyText8 x))
- 
-data PolyText16 = MkPolyText16{drawable_PolyText16 :: DRAWABLE,
-                               gc_PolyText16 :: GCONTEXT, x_PolyText16 :: INT16,
-                               y_PolyText16 :: INT16, items_PolyText16 :: [BYTE]}
-                deriving (Show, Typeable)
- 
-instance Serialize PolyText16 where
-        serialize x
-          = do putWord8 75
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_PolyText16 x)
-               serialize (gc_PolyText16 x)
-               serialize (x_PolyText16 x)
-               serialize (y_PolyText16 x)
-               serializeList (items_PolyText16 x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (drawable_PolyText16 x) + size (gc_PolyText16 x) +
-              size (x_PolyText16 x)
-              + size (y_PolyText16 x)
-              + sum (map size (items_PolyText16 x))
- 
-data ImageText8 = MkImageText8{string_len_ImageText8 :: BYTE,
-                               drawable_ImageText8 :: DRAWABLE, gc_ImageText8 :: GCONTEXT,
-                               x_ImageText8 :: INT16, y_ImageText8 :: INT16,
-                               string_ImageText8 :: [CChar]}
-                deriving (Show, Typeable)
- 
-instance Serialize ImageText8 where
-        serialize x
-          = do putWord8 76
-               serialize (string_len_ImageText8 x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_ImageText8 x)
-               serialize (gc_ImageText8 x)
-               serialize (x_ImageText8 x)
-               serialize (y_ImageText8 x)
-               serializeList (string_ImageText8 x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (string_len_ImageText8 x) + size (drawable_ImageText8 x)
-              + size (gc_ImageText8 x)
-              + size (x_ImageText8 x)
-              + size (y_ImageText8 x)
-              + sum (map size (string_ImageText8 x))
- 
-data ImageText16 = MkImageText16{string_len_ImageText16 :: BYTE,
-                                 drawable_ImageText16 :: DRAWABLE, gc_ImageText16 :: GCONTEXT,
-                                 x_ImageText16 :: INT16, y_ImageText16 :: INT16,
-                                 string_ImageText16 :: [CHAR2B]}
-                 deriving (Show, Typeable)
- 
-instance Serialize ImageText16 where
-        serialize x
-          = do putWord8 77
-               serialize (string_len_ImageText16 x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_ImageText16 x)
-               serialize (gc_ImageText16 x)
-               serialize (x_ImageText16 x)
-               serialize (y_ImageText16 x)
-               serializeList (string_ImageText16 x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (string_len_ImageText16 x) +
-              size (drawable_ImageText16 x)
-              + size (gc_ImageText16 x)
-              + size (x_ImageText16 x)
-              + size (y_ImageText16 x)
-              + sum (map size (string_ImageText16 x))
- 
-data ColormapAlloc = ColormapAllocNone
-                   | ColormapAllocAll
- 
-instance SimpleEnum ColormapAlloc where
-        toValue ColormapAllocNone{} = 0
-        toValue ColormapAllocAll{} = 1
-        fromValue 0 = ColormapAllocNone
-        fromValue 1 = ColormapAllocAll
- 
-data CreateColormap = MkCreateColormap{alloc_CreateColormap ::
-                                       BYTE,
-                                       mid_CreateColormap :: COLORMAP,
-                                       window_CreateColormap :: WINDOW,
-                                       visual_CreateColormap :: VISUALID}
-                    deriving (Show, Typeable)
- 
-instance Serialize CreateColormap where
-        serialize x
-          = do putWord8 78
-               serialize (alloc_CreateColormap x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (mid_CreateColormap x)
-               serialize (window_CreateColormap x)
-               serialize (visual_CreateColormap x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (alloc_CreateColormap x) + size (mid_CreateColormap x) +
-              size (window_CreateColormap x)
-              + size (visual_CreateColormap x)
- 
-data FreeColormap = MkFreeColormap{cmap_FreeColormap :: COLORMAP}
-                  deriving (Show, Typeable)
- 
-instance Serialize FreeColormap where
-        serialize x
-          = do putWord8 79
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_FreeColormap x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (cmap_FreeColormap x)
- 
-data CopyColormapAndFree = MkCopyColormapAndFree{mid_CopyColormapAndFree
-                                                 :: COLORMAP,
-                                                 src_cmap_CopyColormapAndFree :: COLORMAP}
-                         deriving (Show, Typeable)
- 
-instance Serialize CopyColormapAndFree where
-        serialize x
-          = do putWord8 80
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (mid_CopyColormapAndFree x)
-               serialize (src_cmap_CopyColormapAndFree x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (mid_CopyColormapAndFree x) +
-              size (src_cmap_CopyColormapAndFree x)
- 
-data InstallColormap = MkInstallColormap{cmap_InstallColormap ::
-                                         COLORMAP}
-                     deriving (Show, Typeable)
- 
-instance Serialize InstallColormap where
-        serialize x
-          = do putWord8 81
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_InstallColormap x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (cmap_InstallColormap x)
- 
-data UninstallColormap = MkUninstallColormap{cmap_UninstallColormap
-                                             :: COLORMAP}
-                       deriving (Show, Typeable)
- 
-instance Serialize UninstallColormap where
-        serialize x
-          = do putWord8 82
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_UninstallColormap x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (cmap_UninstallColormap x)
- 
-data ListInstalledColormaps = MkListInstalledColormaps{window_ListInstalledColormaps
-                                                       :: WINDOW}
-                            deriving (Show, Typeable)
- 
-instance Serialize ListInstalledColormaps where
-        serialize x
-          = do putWord8 83
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_ListInstalledColormaps x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (window_ListInstalledColormaps x)
- 
-data ListInstalledColormapsReply = MkListInstalledColormapsReply{cmaps_len_ListInstalledColormapsReply
-                                                                 :: CARD16,
-                                                                 cmaps_ListInstalledColormapsReply
-                                                                 :: [COLORMAP]}
-                                 deriving (Show, Typeable)
- 
-instance Deserialize ListInstalledColormapsReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               cmaps_len <- deserialize
-               skip 22
-               cmaps <- deserializeList (fromIntegral cmaps_len)
-               let _ = isCard32 length
-               return (MkListInstalledColormapsReply cmaps_len cmaps)
- 
-data AllocColor = MkAllocColor{cmap_AllocColor :: COLORMAP,
-                               red_AllocColor :: CARD16, green_AllocColor :: CARD16,
-                               blue_AllocColor :: CARD16}
-                deriving (Show, Typeable)
- 
-instance Serialize AllocColor where
-        serialize x
-          = do putWord8 84
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_AllocColor x)
-               serialize (red_AllocColor x)
-               serialize (green_AllocColor x)
-               serialize (blue_AllocColor x)
-               putSkip 2
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (cmap_AllocColor x) + size (red_AllocColor x) +
-              size (green_AllocColor x)
-              + size (blue_AllocColor x)
-              + 2
- 
-data AllocColorReply = MkAllocColorReply{red_AllocColorReply ::
-                                         CARD16,
-                                         green_AllocColorReply :: CARD16,
-                                         blue_AllocColorReply :: CARD16,
-                                         pixel_AllocColorReply :: CARD32}
-                     deriving (Show, Typeable)
- 
-instance Deserialize AllocColorReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               red <- deserialize
-               green <- deserialize
-               blue <- deserialize
-               skip 2
-               pixel <- deserialize
-               let _ = isCard32 length
-               return (MkAllocColorReply red green blue pixel)
- 
-data AllocNamedColor = MkAllocNamedColor{cmap_AllocNamedColor ::
-                                         COLORMAP,
-                                         name_len_AllocNamedColor :: CARD16,
-                                         name_AllocNamedColor :: [CChar]}
-                     deriving (Show, Typeable)
- 
-instance Serialize AllocNamedColor where
-        serialize x
-          = do putWord8 85
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_AllocNamedColor x)
-               serialize (name_len_AllocNamedColor x)
-               putSkip 2
-               serializeList (name_AllocNamedColor x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (cmap_AllocNamedColor x) +
-              size (name_len_AllocNamedColor x)
-              + 2
-              + sum (map size (name_AllocNamedColor x))
- 
-data AllocNamedColorReply = MkAllocNamedColorReply{pixel_AllocNamedColorReply
-                                                   :: CARD32,
-                                                   exact_red_AllocNamedColorReply :: CARD16,
-                                                   exact_green_AllocNamedColorReply :: CARD16,
-                                                   exact_blue_AllocNamedColorReply :: CARD16,
-                                                   visual_red_AllocNamedColorReply :: CARD16,
-                                                   visual_green_AllocNamedColorReply :: CARD16,
-                                                   visual_blue_AllocNamedColorReply :: CARD16}
-                          deriving (Show, Typeable)
- 
-instance Deserialize AllocNamedColorReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               pixel <- deserialize
-               exact_red <- deserialize
-               exact_green <- deserialize
-               exact_blue <- deserialize
-               visual_red <- deserialize
-               visual_green <- deserialize
-               visual_blue <- deserialize
-               let _ = isCard32 length
-               return
-                 (MkAllocNamedColorReply pixel exact_red exact_green exact_blue
-                    visual_red
-                    visual_green
-                    visual_blue)
- 
-data AllocColorCells = MkAllocColorCells{contiguous_AllocColorCells
-                                         :: BOOL,
-                                         cmap_AllocColorCells :: COLORMAP,
-                                         colors_AllocColorCells :: CARD16,
-                                         planes_AllocColorCells :: CARD16}
-                     deriving (Show, Typeable)
- 
-instance Serialize AllocColorCells where
-        serialize x
-          = do putWord8 86
-               serialize (contiguous_AllocColorCells x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_AllocColorCells x)
-               serialize (colors_AllocColorCells x)
-               serialize (planes_AllocColorCells x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (contiguous_AllocColorCells x) +
-              size (cmap_AllocColorCells x)
-              + size (colors_AllocColorCells x)
-              + size (planes_AllocColorCells x)
- 
-data AllocColorCellsReply = MkAllocColorCellsReply{pixels_len_AllocColorCellsReply
-                                                   :: CARD16,
-                                                   masks_len_AllocColorCellsReply :: CARD16,
-                                                   pixels_AllocColorCellsReply :: [CARD32],
-                                                   masks_AllocColorCellsReply :: [CARD32]}
-                          deriving (Show, Typeable)
- 
-instance Deserialize AllocColorCellsReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               pixels_len <- deserialize
-               masks_len <- deserialize
-               skip 20
-               pixels <- deserializeList (fromIntegral pixels_len)
-               masks <- deserializeList (fromIntegral masks_len)
-               let _ = isCard32 length
-               return (MkAllocColorCellsReply pixels_len masks_len pixels masks)
- 
-data AllocColorPlanes = MkAllocColorPlanes{contiguous_AllocColorPlanes
-                                           :: BOOL,
-                                           cmap_AllocColorPlanes :: COLORMAP,
-                                           colors_AllocColorPlanes :: CARD16,
-                                           reds_AllocColorPlanes :: CARD16,
-                                           greens_AllocColorPlanes :: CARD16,
-                                           blues_AllocColorPlanes :: CARD16}
-                      deriving (Show, Typeable)
- 
-instance Serialize AllocColorPlanes where
-        serialize x
-          = do putWord8 87
-               serialize (contiguous_AllocColorPlanes x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_AllocColorPlanes x)
-               serialize (colors_AllocColorPlanes x)
-               serialize (reds_AllocColorPlanes x)
-               serialize (greens_AllocColorPlanes x)
-               serialize (blues_AllocColorPlanes x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (contiguous_AllocColorPlanes x) +
-              size (cmap_AllocColorPlanes x)
-              + size (colors_AllocColorPlanes x)
-              + size (reds_AllocColorPlanes x)
-              + size (greens_AllocColorPlanes x)
-              + size (blues_AllocColorPlanes x)
- 
-data AllocColorPlanesReply = MkAllocColorPlanesReply{pixels_len_AllocColorPlanesReply
-                                                     :: CARD16,
-                                                     red_mask_AllocColorPlanesReply :: CARD32,
-                                                     green_mask_AllocColorPlanesReply :: CARD32,
-                                                     blue_mask_AllocColorPlanesReply :: CARD32,
-                                                     pixels_AllocColorPlanesReply :: [CARD32]}
-                           deriving (Show, Typeable)
- 
-instance Deserialize AllocColorPlanesReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               pixels_len <- deserialize
-               skip 2
-               red_mask <- deserialize
-               green_mask <- deserialize
-               blue_mask <- deserialize
-               skip 8
-               pixels <- deserializeList (fromIntegral pixels_len)
-               let _ = isCard32 length
-               return
-                 (MkAllocColorPlanesReply pixels_len red_mask green_mask blue_mask
-                    pixels)
- 
-data FreeColors = MkFreeColors{cmap_FreeColors :: COLORMAP,
-                               plane_mask_FreeColors :: CARD32, pixels_FreeColors :: [CARD32]}
-                deriving (Show, Typeable)
- 
-instance Serialize FreeColors where
-        serialize x
-          = do putWord8 88
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_FreeColors x)
-               serialize (plane_mask_FreeColors x)
-               serializeList (pixels_FreeColors x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (cmap_FreeColors x) + size (plane_mask_FreeColors x)
-              + sum (map size (pixels_FreeColors x))
- 
-data ColorFlag = ColorFlagRed
-               | ColorFlagGreen
-               | ColorFlagBlue
- 
-instance BitEnum ColorFlag where
-        toBit ColorFlagRed{} = 0
-        toBit ColorFlagGreen{} = 1
-        toBit ColorFlagBlue{} = 2
-        fromBit 0 = ColorFlagRed
-        fromBit 1 = ColorFlagGreen
-        fromBit 2 = ColorFlagBlue
- 
-data COLORITEM = MkCOLORITEM{pixel_COLORITEM :: CARD32,
-                             red_COLORITEM :: CARD16, green_COLORITEM :: CARD16,
-                             blue_COLORITEM :: CARD16, flags_COLORITEM :: BYTE}
-               deriving (Show, Typeable)
- 
-instance Serialize COLORITEM where
-        serialize x
-          = do serialize (pixel_COLORITEM x)
-               serialize (red_COLORITEM x)
-               serialize (green_COLORITEM x)
-               serialize (blue_COLORITEM x)
-               serialize (flags_COLORITEM x)
-               putSkip 1
-        size x
-          = size (pixel_COLORITEM x) + size (red_COLORITEM x) +
-              size (green_COLORITEM x)
-              + size (blue_COLORITEM x)
-              + size (flags_COLORITEM x)
-              + 1
- 
-instance Deserialize COLORITEM where
-        deserialize
-          = do pixel <- deserialize
-               red <- deserialize
-               green <- deserialize
-               blue <- deserialize
-               flags <- deserialize
-               skip 1
-               return (MkCOLORITEM pixel red green blue flags)
- 
-data StoreColors = MkStoreColors{cmap_StoreColors :: COLORMAP,
-                                 items_StoreColors :: [COLORITEM]}
-                 deriving (Show, Typeable)
- 
-instance Serialize StoreColors where
-        serialize x
-          = do putWord8 89
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_StoreColors x)
-               serializeList (items_StoreColors x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (cmap_StoreColors x) +
-              sum (map size (items_StoreColors x))
- 
-data StoreNamedColor = MkStoreNamedColor{flags_StoreNamedColor ::
-                                         CARD8,
-                                         cmap_StoreNamedColor :: COLORMAP,
-                                         pixel_StoreNamedColor :: CARD32,
-                                         name_len_StoreNamedColor :: CARD16,
-                                         name_StoreNamedColor :: [CChar]}
-                     deriving (Show, Typeable)
- 
-instance Serialize StoreNamedColor where
-        serialize x
-          = do putWord8 90
-               serialize (flags_StoreNamedColor x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_StoreNamedColor x)
-               serialize (pixel_StoreNamedColor x)
-               serialize (name_len_StoreNamedColor x)
-               putSkip 2
-               serializeList (name_StoreNamedColor x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (flags_StoreNamedColor x) +
-              size (cmap_StoreNamedColor x)
-              + size (pixel_StoreNamedColor x)
-              + size (name_len_StoreNamedColor x)
-              + 2
-              + sum (map size (name_StoreNamedColor x))
- 
-data RGB = MkRGB{red_RGB :: CARD16, green_RGB :: CARD16,
-                 blue_RGB :: CARD16}
-         deriving (Show, Typeable)
- 
-instance Serialize RGB where
-        serialize x
-          = do serialize (red_RGB x)
-               serialize (green_RGB x)
-               serialize (blue_RGB x)
-               putSkip 2
-        size x
-          = size (red_RGB x) + size (green_RGB x) + size (blue_RGB x) + 2
- 
-instance Deserialize RGB where
-        deserialize
-          = do red <- deserialize
-               green <- deserialize
-               blue <- deserialize
-               skip 2
-               return (MkRGB red green blue)
- 
-data QueryColors = MkQueryColors{cmap_QueryColors :: COLORMAP,
-                                 pixels_QueryColors :: [CARD32]}
-                 deriving (Show, Typeable)
- 
-instance Serialize QueryColors where
-        serialize x
-          = do putWord8 91
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_QueryColors x)
-               serializeList (pixels_QueryColors x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (cmap_QueryColors x) +
-              sum (map size (pixels_QueryColors x))
- 
-data QueryColorsReply = MkQueryColorsReply{colors_len_QueryColorsReply
-                                           :: CARD16,
-                                           colors_QueryColorsReply :: [RGB]}
-                      deriving (Show, Typeable)
- 
-instance Deserialize QueryColorsReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               colors_len <- deserialize
-               skip 22
-               colors <- deserializeList (fromIntegral colors_len)
-               let _ = isCard32 length
-               return (MkQueryColorsReply colors_len colors)
- 
-data LookupColor = MkLookupColor{cmap_LookupColor :: COLORMAP,
-                                 name_len_LookupColor :: CARD16, name_LookupColor :: [CChar]}
-                 deriving (Show, Typeable)
- 
-instance Serialize LookupColor where
-        serialize x
-          = do putWord8 92
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cmap_LookupColor x)
-               serialize (name_len_LookupColor x)
-               putSkip 2
-               serializeList (name_LookupColor x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (cmap_LookupColor x) + size (name_len_LookupColor x)
-              + 2
-              + sum (map size (name_LookupColor x))
- 
-data LookupColorReply = MkLookupColorReply{exact_red_LookupColorReply
-                                           :: CARD16,
-                                           exact_green_LookupColorReply :: CARD16,
-                                           exact_blue_LookupColorReply :: CARD16,
-                                           visual_red_LookupColorReply :: CARD16,
-                                           visual_green_LookupColorReply :: CARD16,
-                                           visual_blue_LookupColorReply :: CARD16}
-                      deriving (Show, Typeable)
- 
-instance Deserialize LookupColorReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               exact_red <- deserialize
-               exact_green <- deserialize
-               exact_blue <- deserialize
-               visual_red <- deserialize
-               visual_green <- deserialize
-               visual_blue <- deserialize
-               let _ = isCard32 length
-               return
-                 (MkLookupColorReply exact_red exact_green exact_blue visual_red
-                    visual_green
-                    visual_blue)
- 
-data CreateCursor = MkCreateCursor{cid_CreateCursor :: CURSOR,
-                                   source_CreateCursor :: PIXMAP, mask_CreateCursor :: PIXMAP,
-                                   fore_red_CreateCursor :: CARD16,
-                                   fore_green_CreateCursor :: CARD16,
-                                   fore_blue_CreateCursor :: CARD16,
-                                   back_red_CreateCursor :: CARD16,
-                                   back_green_CreateCursor :: CARD16,
-                                   back_blue_CreateCursor :: CARD16, x_CreateCursor :: CARD16,
-                                   y_CreateCursor :: CARD16}
-                  deriving (Show, Typeable)
- 
-instance Serialize CreateCursor where
-        serialize x
-          = do putWord8 93
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cid_CreateCursor x)
-               serialize (source_CreateCursor x)
-               serialize (mask_CreateCursor x)
-               serialize (fore_red_CreateCursor x)
-               serialize (fore_green_CreateCursor x)
-               serialize (fore_blue_CreateCursor x)
-               serialize (back_red_CreateCursor x)
-               serialize (back_green_CreateCursor x)
-               serialize (back_blue_CreateCursor x)
-               serialize (x_CreateCursor x)
-               serialize (y_CreateCursor x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (cid_CreateCursor x) + size (source_CreateCursor x)
-              + size (mask_CreateCursor x)
-              + size (fore_red_CreateCursor x)
-              + size (fore_green_CreateCursor x)
-              + size (fore_blue_CreateCursor x)
-              + size (back_red_CreateCursor x)
-              + size (back_green_CreateCursor x)
-              + size (back_blue_CreateCursor x)
-              + size (x_CreateCursor x)
-              + size (y_CreateCursor x)
- 
-data CreateGlyphCursor = MkCreateGlyphCursor{cid_CreateGlyphCursor
-                                             :: CURSOR,
-                                             source_font_CreateGlyphCursor :: FONT,
-                                             mask_font_CreateGlyphCursor :: FONT,
-                                             source_char_CreateGlyphCursor :: CARD16,
-                                             mask_char_CreateGlyphCursor :: CARD16,
-                                             fore_red_CreateGlyphCursor :: CARD16,
-                                             fore_green_CreateGlyphCursor :: CARD16,
-                                             fore_blue_CreateGlyphCursor :: CARD16,
-                                             back_red_CreateGlyphCursor :: CARD16,
-                                             back_green_CreateGlyphCursor :: CARD16,
-                                             back_blue_CreateGlyphCursor :: CARD16}
-                       deriving (Show, Typeable)
- 
-instance Serialize CreateGlyphCursor where
-        serialize x
-          = do putWord8 94
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cid_CreateGlyphCursor x)
-               serialize (source_font_CreateGlyphCursor x)
-               serialize (mask_font_CreateGlyphCursor x)
-               serialize (source_char_CreateGlyphCursor x)
-               serialize (mask_char_CreateGlyphCursor x)
-               serialize (fore_red_CreateGlyphCursor x)
-               serialize (fore_green_CreateGlyphCursor x)
-               serialize (fore_blue_CreateGlyphCursor x)
-               serialize (back_red_CreateGlyphCursor x)
-               serialize (back_green_CreateGlyphCursor x)
-               serialize (back_blue_CreateGlyphCursor x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (cid_CreateGlyphCursor x) +
-              size (source_font_CreateGlyphCursor x)
-              + size (mask_font_CreateGlyphCursor x)
-              + size (source_char_CreateGlyphCursor x)
-              + size (mask_char_CreateGlyphCursor x)
-              + size (fore_red_CreateGlyphCursor x)
-              + size (fore_green_CreateGlyphCursor x)
-              + size (fore_blue_CreateGlyphCursor x)
-              + size (back_red_CreateGlyphCursor x)
-              + size (back_green_CreateGlyphCursor x)
-              + size (back_blue_CreateGlyphCursor x)
- 
-data FreeCursor = MkFreeCursor{cursor_FreeCursor :: CURSOR}
-                deriving (Show, Typeable)
- 
-instance Serialize FreeCursor where
-        serialize x
-          = do putWord8 95
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cursor_FreeCursor x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (cursor_FreeCursor x)
- 
-data RecolorCursor = MkRecolorCursor{cursor_RecolorCursor ::
-                                     CURSOR,
-                                     fore_red_RecolorCursor :: CARD16,
-                                     fore_green_RecolorCursor :: CARD16,
-                                     fore_blue_RecolorCursor :: CARD16,
-                                     back_red_RecolorCursor :: CARD16,
-                                     back_green_RecolorCursor :: CARD16,
-                                     back_blue_RecolorCursor :: CARD16}
-                   deriving (Show, Typeable)
- 
-instance Serialize RecolorCursor where
-        serialize x
-          = do putWord8 96
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (cursor_RecolorCursor x)
-               serialize (fore_red_RecolorCursor x)
-               serialize (fore_green_RecolorCursor x)
-               serialize (fore_blue_RecolorCursor x)
-               serialize (back_red_RecolorCursor x)
-               serialize (back_green_RecolorCursor x)
-               serialize (back_blue_RecolorCursor x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (cursor_RecolorCursor x) +
-              size (fore_red_RecolorCursor x)
-              + size (fore_green_RecolorCursor x)
-              + size (fore_blue_RecolorCursor x)
-              + size (back_red_RecolorCursor x)
-              + size (back_green_RecolorCursor x)
-              + size (back_blue_RecolorCursor x)
- 
-data QueryShapeOf = QueryShapeOfLargestCursor
-                  | QueryShapeOfFastestTile
-                  | QueryShapeOfFastestStipple
- 
-instance SimpleEnum QueryShapeOf where
-        toValue QueryShapeOfLargestCursor{} = 0
-        toValue QueryShapeOfFastestTile{} = 1
-        toValue QueryShapeOfFastestStipple{} = 2
-        fromValue 0 = QueryShapeOfLargestCursor
-        fromValue 1 = QueryShapeOfFastestTile
-        fromValue 2 = QueryShapeOfFastestStipple
- 
-data QueryBestSize = MkQueryBestSize{class_QueryBestSize :: CARD8,
-                                     drawable_QueryBestSize :: DRAWABLE,
-                                     width_QueryBestSize :: CARD16, height_QueryBestSize :: CARD16}
-                   deriving (Show, Typeable)
- 
-instance Serialize QueryBestSize where
-        serialize x
-          = do putWord8 97
-               serialize (class_QueryBestSize x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (drawable_QueryBestSize x)
-               serialize (width_QueryBestSize x)
-               serialize (height_QueryBestSize x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (class_QueryBestSize x) +
-              size (drawable_QueryBestSize x)
-              + size (width_QueryBestSize x)
-              + size (height_QueryBestSize x)
- 
-data QueryBestSizeReply = MkQueryBestSizeReply{width_QueryBestSizeReply
-                                               :: CARD16,
-                                               height_QueryBestSizeReply :: CARD16}
-                        deriving (Show, Typeable)
- 
-instance Deserialize QueryBestSizeReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               width <- deserialize
-               height <- deserialize
-               let _ = isCard32 length
-               return (MkQueryBestSizeReply width height)
- 
-data QueryExtension = MkQueryExtension{name_len_QueryExtension ::
-                                       CARD16,
-                                       name_QueryExtension :: [CChar]}
-                    deriving (Show, Typeable)
- 
-instance Serialize QueryExtension where
-        serialize x
-          = do putWord8 98
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (name_len_QueryExtension x)
-               putSkip 2
-               serializeList (name_QueryExtension x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (name_len_QueryExtension x) + 2 +
-              sum (map size (name_QueryExtension x))
- 
-data QueryExtensionReply = MkQueryExtensionReply{present_QueryExtensionReply
-                                                 :: BOOL,
-                                                 major_opcode_QueryExtensionReply :: CARD8,
-                                                 first_event_QueryExtensionReply :: CARD8,
-                                                 first_error_QueryExtensionReply :: CARD8}
-                         deriving (Show, Typeable)
- 
-instance Deserialize QueryExtensionReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               present <- deserialize
-               major_opcode <- deserialize
-               first_event <- deserialize
-               first_error <- deserialize
-               let _ = isCard32 length
-               return
-                 (MkQueryExtensionReply present major_opcode first_event
-                    first_error)
- 
-data ListExtensions = MkListExtensions{}
-                    deriving (Show, Typeable)
- 
-instance Serialize ListExtensions where
-        serialize x
-          = do putWord8 99
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 4
- 
-data ListExtensionsReply = MkListExtensionsReply{names_len_ListExtensionsReply
-                                                 :: CARD8,
-                                                 names_ListExtensionsReply :: [STR]}
-                         deriving (Show, Typeable)
- 
-instance Deserialize ListExtensionsReply where
-        deserialize
-          = do skip 1
-               names_len <- deserialize
-               skip 2
-               length <- deserialize
-               skip 24
-               names <- deserializeList (fromIntegral names_len)
-               let _ = isCard32 length
-               return (MkListExtensionsReply names_len names)
- 
-data ChangeKeyboardMapping = MkChangeKeyboardMapping{keycode_count_ChangeKeyboardMapping
-                                                     :: CARD8,
-                                                     first_keycode_ChangeKeyboardMapping :: KEYCODE,
-                                                     keysyms_per_keycode_ChangeKeyboardMapping ::
-                                                     CARD8,
-                                                     keysyms_ChangeKeyboardMapping :: [KEYSYM]}
-                           deriving (Show, Typeable)
- 
-instance Serialize ChangeKeyboardMapping where
-        serialize x
-          = do putWord8 100
-               serialize (keycode_count_ChangeKeyboardMapping x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (first_keycode_ChangeKeyboardMapping x)
-               serialize (keysyms_per_keycode_ChangeKeyboardMapping x)
-               serializeList (keysyms_ChangeKeyboardMapping x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (keycode_count_ChangeKeyboardMapping x) +
-              size (first_keycode_ChangeKeyboardMapping x)
-              + size (keysyms_per_keycode_ChangeKeyboardMapping x)
-              + sum (map size (keysyms_ChangeKeyboardMapping x))
- 
-data GetKeyboardMapping = MkGetKeyboardMapping{first_keycode_GetKeyboardMapping
-                                               :: KEYCODE,
-                                               count_GetKeyboardMapping :: CARD8}
-                        deriving (Show, Typeable)
- 
-instance Serialize GetKeyboardMapping where
-        serialize x
-          = do putWord8 101
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (first_keycode_GetKeyboardMapping x)
-               serialize (count_GetKeyboardMapping x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (first_keycode_GetKeyboardMapping x) +
-              size (count_GetKeyboardMapping x)
- 
-data GetKeyboardMappingReply = MkGetKeyboardMappingReply{keysyms_per_keycode_GetKeyboardMappingReply
-                                                         :: BYTE,
-                                                         keysyms_GetKeyboardMappingReply ::
-                                                         [KEYSYM]}
-                             deriving (Show, Typeable)
- 
-instance Deserialize GetKeyboardMappingReply where
-        deserialize
-          = do skip 1
-               keysyms_per_keycode <- deserialize
-               skip 2
-               length <- deserialize
-               skip 24
-               keysyms <- deserializeList (fromIntegral length)
-               let _ = isCard32 length
-               return (MkGetKeyboardMappingReply keysyms_per_keycode keysyms)
- 
-data KB = KBKeyClickPercent
-        | KBBellPercent
-        | KBBellPitch
-        | KBBellDuration
-        | KBLed
-        | KBLedMode
-        | KBKey
-        | KBAutoRepeatMode
- 
-instance BitEnum KB where
-        toBit KBKeyClickPercent{} = 0
-        toBit KBBellPercent{} = 1
-        toBit KBBellPitch{} = 2
-        toBit KBBellDuration{} = 3
-        toBit KBLed{} = 4
-        toBit KBLedMode{} = 5
-        toBit KBKey{} = 6
-        toBit KBAutoRepeatMode{} = 7
-        fromBit 0 = KBKeyClickPercent
-        fromBit 1 = KBBellPercent
-        fromBit 2 = KBBellPitch
-        fromBit 3 = KBBellDuration
-        fromBit 4 = KBLed
-        fromBit 5 = KBLedMode
-        fromBit 6 = KBKey
-        fromBit 7 = KBAutoRepeatMode
- 
-data LedMode = LedModeOff
-             | LedModeOn
- 
-instance SimpleEnum LedMode where
-        toValue LedModeOff{} = 0
-        toValue LedModeOn{} = 1
-        fromValue 0 = LedModeOff
-        fromValue 1 = LedModeOn
- 
-data AutoRepeatMode = AutoRepeatModeOff
-                    | AutoRepeatModeOn
-                    | AutoRepeatModeDefault
- 
-instance SimpleEnum AutoRepeatMode where
-        toValue AutoRepeatModeOff{} = 0
-        toValue AutoRepeatModeOn{} = 1
-        toValue AutoRepeatModeDefault{} = 2
-        fromValue 0 = AutoRepeatModeOff
-        fromValue 1 = AutoRepeatModeOn
-        fromValue 2 = AutoRepeatModeDefault
- 
-data ChangeKeyboardControl = MkChangeKeyboardControl{value_ChangeKeyboardControl
-                                                     :: ValueParam CARD32}
-                           deriving (Show, Typeable)
- 
-instance Serialize ChangeKeyboardControl where
-        serialize x
-          = do putWord8 102
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (value_ChangeKeyboardControl x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (value_ChangeKeyboardControl x)
- 
-data GetKeyboardControl = MkGetKeyboardControl{}
-                        deriving (Show, Typeable)
- 
-instance Serialize GetKeyboardControl where
-        serialize x
-          = do putWord8 103
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 4
- 
-data GetKeyboardControlReply = MkGetKeyboardControlReply{global_auto_repeat_GetKeyboardControlReply
-                                                         :: BYTE,
-                                                         led_mask_GetKeyboardControlReply :: CARD32,
-                                                         key_click_percent_GetKeyboardControlReply
-                                                         :: CARD8,
-                                                         bell_percent_GetKeyboardControlReply ::
-                                                         CARD8,
-                                                         bell_pitch_GetKeyboardControlReply ::
-                                                         CARD16,
-                                                         bell_duration_GetKeyboardControlReply ::
-                                                         CARD16,
-                                                         auto_repeats_GetKeyboardControlReply ::
-                                                         [CARD8]}
-                             deriving (Show, Typeable)
- 
-instance Deserialize GetKeyboardControlReply where
-        deserialize
-          = do skip 1
-               global_auto_repeat <- deserialize
-               skip 2
-               length <- deserialize
-               led_mask <- deserialize
-               key_click_percent <- deserialize
-               bell_percent <- deserialize
-               bell_pitch <- deserialize
-               bell_duration <- deserialize
-               skip 2
-               auto_repeats <- deserializeList (fromIntegral 32)
-               let _ = isCard32 length
-               return
-                 (MkGetKeyboardControlReply global_auto_repeat led_mask
-                    key_click_percent
-                    bell_percent
-                    bell_pitch
-                    bell_duration
-                    auto_repeats)
- 
-data Bell = MkBell{percent_Bell :: INT8}
-          deriving (Show, Typeable)
- 
-instance Serialize Bell where
-        serialize x
-          = do putWord8 104
-               serialize (percent_Bell x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 3 + size (percent_Bell x)
- 
-data ChangePointerControl = MkChangePointerControl{acceleration_numerator_ChangePointerControl
-                                                   :: INT16,
-                                                   acceleration_denominator_ChangePointerControl ::
-                                                   INT16,
-                                                   threshold_ChangePointerControl :: INT16,
-                                                   do_acceleration_ChangePointerControl :: BOOL,
-                                                   do_threshold_ChangePointerControl :: BOOL}
-                          deriving (Show, Typeable)
- 
-instance Serialize ChangePointerControl where
-        serialize x
-          = do putWord8 105
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (acceleration_numerator_ChangePointerControl x)
-               serialize (acceleration_denominator_ChangePointerControl x)
-               serialize (threshold_ChangePointerControl x)
-               serialize (do_acceleration_ChangePointerControl x)
-               serialize (do_threshold_ChangePointerControl x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (acceleration_numerator_ChangePointerControl x) +
-              size (acceleration_denominator_ChangePointerControl x)
-              + size (threshold_ChangePointerControl x)
-              + size (do_acceleration_ChangePointerControl x)
-              + size (do_threshold_ChangePointerControl x)
- 
-data GetPointerControl = MkGetPointerControl{}
-                       deriving (Show, Typeable)
- 
-instance Serialize GetPointerControl where
-        serialize x
-          = do putWord8 106
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 4
- 
-data GetPointerControlReply = MkGetPointerControlReply{acceleration_numerator_GetPointerControlReply
-                                                       :: CARD16,
-                                                       acceleration_denominator_GetPointerControlReply
-                                                       :: CARD16,
-                                                       threshold_GetPointerControlReply :: CARD16}
-                            deriving (Show, Typeable)
- 
-instance Deserialize GetPointerControlReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               acceleration_numerator <- deserialize
-               acceleration_denominator <- deserialize
-               threshold <- deserialize
-               skip 18
-               let _ = isCard32 length
-               return
-                 (MkGetPointerControlReply acceleration_numerator
-                    acceleration_denominator
-                    threshold)
- 
-data Blanking = BlankingNotPreferred
-              | BlankingPreferred
-              | BlankingDefault
- 
-instance SimpleEnum Blanking where
-        toValue BlankingNotPreferred{} = 0
-        toValue BlankingPreferred{} = 1
-        toValue BlankingDefault{} = 2
-        fromValue 0 = BlankingNotPreferred
-        fromValue 1 = BlankingPreferred
-        fromValue 2 = BlankingDefault
- 
-data Exposures = ExposuresNotAllowed
-               | ExposuresAllowed
-               | ExposuresDefault
- 
-instance SimpleEnum Exposures where
-        toValue ExposuresNotAllowed{} = 0
-        toValue ExposuresAllowed{} = 1
-        toValue ExposuresDefault{} = 2
-        fromValue 0 = ExposuresNotAllowed
-        fromValue 1 = ExposuresAllowed
-        fromValue 2 = ExposuresDefault
- 
-data SetScreenSaver = MkSetScreenSaver{timeout_SetScreenSaver ::
-                                       INT16,
-                                       interval_SetScreenSaver :: INT16,
-                                       prefer_blanking_SetScreenSaver :: CARD8,
-                                       allow_exposures_SetScreenSaver :: CARD8}
-                    deriving (Show, Typeable)
- 
-instance Serialize SetScreenSaver where
-        serialize x
-          = do putWord8 107
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (timeout_SetScreenSaver x)
-               serialize (interval_SetScreenSaver x)
-               serialize (prefer_blanking_SetScreenSaver x)
-               serialize (allow_exposures_SetScreenSaver x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (timeout_SetScreenSaver x) +
-              size (interval_SetScreenSaver x)
-              + size (prefer_blanking_SetScreenSaver x)
-              + size (allow_exposures_SetScreenSaver x)
- 
-data GetScreenSaver = MkGetScreenSaver{}
-                    deriving (Show, Typeable)
- 
-instance Serialize GetScreenSaver where
-        serialize x
-          = do putWord8 108
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 4
- 
-data GetScreenSaverReply = MkGetScreenSaverReply{timeout_GetScreenSaverReply
-                                                 :: CARD16,
-                                                 interval_GetScreenSaverReply :: CARD16,
-                                                 prefer_blanking_GetScreenSaverReply :: BYTE,
-                                                 allow_exposures_GetScreenSaverReply :: BYTE}
-                         deriving (Show, Typeable)
- 
-instance Deserialize GetScreenSaverReply where
-        deserialize
-          = do skip 1
-               skip 1
-               skip 2
-               length <- deserialize
-               timeout <- deserialize
-               interval <- deserialize
-               prefer_blanking <- deserialize
-               allow_exposures <- deserialize
-               skip 18
-               let _ = isCard32 length
-               return
-                 (MkGetScreenSaverReply timeout interval prefer_blanking
-                    allow_exposures)
- 
-data HostMode = HostModeInsert
-              | HostModeDelete
- 
-instance SimpleEnum HostMode where
-        toValue HostModeInsert{} = 0
-        toValue HostModeDelete{} = 1
-        fromValue 0 = HostModeInsert
-        fromValue 1 = HostModeDelete
- 
-data Family = FamilyInternet
-            | FamilyDECnet
-            | FamilyChaos
-            | FamilyServerInterpreted
-            | FamilyInternet6
- 
-instance SimpleEnum Family where
-        toValue FamilyInternet{} = 0
-        toValue FamilyDECnet{} = 1
-        toValue FamilyChaos{} = 2
-        toValue FamilyServerInterpreted{} = 5
-        toValue FamilyInternet6{} = 6
-        fromValue 0 = FamilyInternet
-        fromValue 1 = FamilyDECnet
-        fromValue 2 = FamilyChaos
-        fromValue 5 = FamilyServerInterpreted
-        fromValue 6 = FamilyInternet6
- 
-data ChangeHosts = MkChangeHosts{mode_ChangeHosts :: CARD8,
-                                 family_ChangeHosts :: CARD8, address_len_ChangeHosts :: CARD16,
-                                 address_ChangeHosts :: [CChar]}
-                 deriving (Show, Typeable)
- 
-instance Serialize ChangeHosts where
-        serialize x
-          = do putWord8 109
-               serialize (mode_ChangeHosts x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (family_ChangeHosts x)
-               putSkip 1
-               serialize (address_len_ChangeHosts x)
-               serializeList (address_ChangeHosts x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (mode_ChangeHosts x) + size (family_ChangeHosts x) + 1 +
-              size (address_len_ChangeHosts x)
-              + sum (map size (address_ChangeHosts x))
- 
-data HOST = MkHOST{family_HOST :: CARD8,
-                   address_len_HOST :: CARD16, address_HOST :: [BYTE]}
-          deriving (Show, Typeable)
- 
-instance Serialize HOST where
-        serialize x
-          = do serialize (family_HOST x)
-               putSkip 1
-               serialize (address_len_HOST x)
-               serializeList (address_HOST x)
-        size x
-          = size (family_HOST x) + 1 + size (address_len_HOST x) +
-              sum (map size (address_HOST x))
- 
-instance Deserialize HOST where
-        deserialize
-          = do family <- deserialize
-               skip 1
-               address_len <- deserialize
-               address <- deserializeList (fromIntegral address_len)
-               return (MkHOST family address_len address)
- 
-data ListHosts = MkListHosts{}
-               deriving (Show, Typeable)
- 
-instance Serialize ListHosts where
-        serialize x
-          = do putWord8 110
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 4
- 
-data ListHostsReply = MkListHostsReply{mode_ListHostsReply :: BYTE,
-                                       hosts_len_ListHostsReply :: CARD16,
-                                       hosts_ListHostsReply :: [HOST]}
-                    deriving (Show, Typeable)
- 
-instance Deserialize ListHostsReply where
-        deserialize
-          = do skip 1
-               mode <- deserialize
-               skip 2
-               length <- deserialize
-               hosts_len <- deserialize
-               skip 22
-               hosts <- deserializeList (fromIntegral hosts_len)
-               let _ = isCard32 length
-               return (MkListHostsReply mode hosts_len hosts)
- 
-data AccessControl = AccessControlDisable
-                   | AccessControlEnable
- 
-instance SimpleEnum AccessControl where
-        toValue AccessControlDisable{} = 0
-        toValue AccessControlEnable{} = 1
-        fromValue 0 = AccessControlDisable
-        fromValue 1 = AccessControlEnable
- 
-data SetAccessControl = MkSetAccessControl{mode_SetAccessControl ::
-                                           CARD8}
-                      deriving (Show, Typeable)
- 
-instance Serialize SetAccessControl where
-        serialize x
-          = do putWord8 111
-               serialize (mode_SetAccessControl x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 3 + size (mode_SetAccessControl x)
- 
-data CloseDown = CloseDownDestroyAll
-               | CloseDownRetainPermanent
-               | CloseDownRetainTemporary
- 
-instance SimpleEnum CloseDown where
-        toValue CloseDownDestroyAll{} = 0
-        toValue CloseDownRetainPermanent{} = 1
-        toValue CloseDownRetainTemporary{} = 2
-        fromValue 0 = CloseDownDestroyAll
-        fromValue 1 = CloseDownRetainPermanent
-        fromValue 2 = CloseDownRetainTemporary
- 
-data SetCloseDownMode = MkSetCloseDownMode{mode_SetCloseDownMode ::
-                                           CARD8}
-                      deriving (Show, Typeable)
- 
-instance Serialize SetCloseDownMode where
-        serialize x
-          = do putWord8 112
-               serialize (mode_SetCloseDownMode x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 3 + size (mode_SetCloseDownMode x)
- 
-data Kill = KillAllTemporary
- 
-instance SimpleEnum Kill where
-        toValue KillAllTemporary{} = 0
-        fromValue 0 = KillAllTemporary
- 
-data KillClient = MkKillClient{resource_KillClient :: CARD32}
-                deriving (Show, Typeable)
- 
-instance Serialize KillClient where
-        serialize x
-          = do putWord8 113
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (resource_KillClient x)
-               putSkip (requiredPadding (size x))
-        size x = 3 + 1 + size (resource_KillClient x)
- 
-data RotateProperties = MkRotateProperties{window_RotateProperties
-                                           :: WINDOW,
-                                           atoms_len_RotateProperties :: CARD16,
-                                           delta_RotateProperties :: INT16,
-                                           atoms_RotateProperties :: [ATOM]}
-                      deriving (Show, Typeable)
- 
-instance Serialize RotateProperties where
-        serialize x
-          = do putWord8 114
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serialize (window_RotateProperties x)
-               serialize (atoms_len_RotateProperties x)
-               serialize (delta_RotateProperties x)
-               serializeList (atoms_RotateProperties x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + 1 + size (window_RotateProperties x) +
-              size (atoms_len_RotateProperties x)
-              + size (delta_RotateProperties x)
-              + sum (map size (atoms_RotateProperties x))
- 
-data ScreenSaver = ScreenSaverReset
-                 | ScreenSaverActive
- 
-instance SimpleEnum ScreenSaver where
-        toValue ScreenSaverReset{} = 0
-        toValue ScreenSaverActive{} = 1
-        fromValue 0 = ScreenSaverReset
-        fromValue 1 = ScreenSaverActive
- 
-data ForceScreenSaver = MkForceScreenSaver{mode_ForceScreenSaver ::
-                                           CARD8}
-                      deriving (Show, Typeable)
- 
-instance Serialize ForceScreenSaver where
-        serialize x
-          = do putWord8 115
-               serialize (mode_ForceScreenSaver x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 3 + size (mode_ForceScreenSaver x)
- 
-data MappingStatus = MappingStatusSuccess
-                   | MappingStatusBusy
-                   | MappingStatusFailure
- 
-instance SimpleEnum MappingStatus where
-        toValue MappingStatusSuccess{} = 0
-        toValue MappingStatusBusy{} = 1
-        toValue MappingStatusFailure{} = 2
-        fromValue 0 = MappingStatusSuccess
-        fromValue 1 = MappingStatusBusy
-        fromValue 2 = MappingStatusFailure
- 
-data SetPointerMapping = MkSetPointerMapping{map_len_SetPointerMapping
-                                             :: CARD8,
-                                             map_SetPointerMapping :: [CARD8]}
-                       deriving (Show, Typeable)
- 
-instance Serialize SetPointerMapping where
-        serialize x
-          = do putWord8 116
-               serialize (map_len_SetPointerMapping x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serializeList (map_SetPointerMapping x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (map_len_SetPointerMapping x) +
-              sum (map size (map_SetPointerMapping x))
- 
-data SetPointerMappingReply = MkSetPointerMappingReply{status_SetPointerMappingReply
-                                                       :: BYTE}
-                            deriving (Show, Typeable)
- 
-instance Deserialize SetPointerMappingReply where
-        deserialize
-          = do skip 1
-               status <- deserialize
-               skip 2
-               length <- deserialize
-               let _ = isCard32 length
-               return (MkSetPointerMappingReply status)
- 
-data GetPointerMapping = MkGetPointerMapping{}
-                       deriving (Show, Typeable)
- 
-instance Serialize GetPointerMapping where
-        serialize x
-          = do putWord8 117
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 4
- 
-data GetPointerMappingReply = MkGetPointerMappingReply{map_len_GetPointerMappingReply
-                                                       :: CARD8,
-                                                       map_GetPointerMappingReply :: [CARD8]}
-                            deriving (Show, Typeable)
- 
-instance Deserialize GetPointerMappingReply where
-        deserialize
-          = do skip 1
-               map_len <- deserialize
-               skip 2
-               length <- deserialize
-               skip 24
-               map <- deserializeList (fromIntegral map_len)
-               let _ = isCard32 length
-               return (MkGetPointerMappingReply map_len map)
- 
-data MapIndex = MapIndexShift
-              | MapIndexLock
-              | MapIndexControl
-              | MapIndex1
-              | MapIndex2
-              | MapIndex3
-              | MapIndex4
-              | MapIndex5
- 
-instance SimpleEnum MapIndex where
-        toValue MapIndexShift{} = 0
-        toValue MapIndexLock{} = 1
-        toValue MapIndexControl{} = 2
-        toValue MapIndex1{} = 3
-        toValue MapIndex2{} = 4
-        toValue MapIndex3{} = 5
-        toValue MapIndex4{} = 6
-        toValue MapIndex5{} = 7
-        fromValue 0 = MapIndexShift
-        fromValue 1 = MapIndexLock
-        fromValue 2 = MapIndexControl
-        fromValue 3 = MapIndex1
-        fromValue 4 = MapIndex2
-        fromValue 5 = MapIndex3
-        fromValue 6 = MapIndex4
-        fromValue 7 = MapIndex5
- 
-data SetModifierMapping = MkSetModifierMapping{keycodes_per_modifier_SetModifierMapping
-                                               :: CARD8,
-                                               keycodes_SetModifierMapping :: [KEYCODE]}
-                        deriving (Show, Typeable)
- 
-instance Serialize SetModifierMapping where
-        serialize x
-          = do putWord8 118
-               serialize (keycodes_per_modifier_SetModifierMapping x)
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               serializeList (keycodes_SetModifierMapping x)
-               putSkip (requiredPadding (size x))
-        size x
-          = 3 + size (keycodes_per_modifier_SetModifierMapping x) +
-              sum (map size (keycodes_SetModifierMapping x))
- 
-data SetModifierMappingReply = MkSetModifierMappingReply{status_SetModifierMappingReply
-                                                         :: BYTE}
-                             deriving (Show, Typeable)
- 
-instance Deserialize SetModifierMappingReply where
-        deserialize
-          = do skip 1
-               status <- deserialize
-               skip 2
-               length <- deserialize
-               let _ = isCard32 length
-               return (MkSetModifierMappingReply status)
- 
-data GetModifierMapping = MkGetModifierMapping{}
-                        deriving (Show, Typeable)
- 
-instance Serialize GetModifierMapping where
-        serialize x
-          = do putWord8 119
-               putSkip 1
-               serialize (convertBytesToRequestSize (size x) :: INT16)
-               putSkip (requiredPadding (size x))
-        size x = 4
- 
-data GetModifierMappingReply = MkGetModifierMappingReply{keycodes_per_modifier_GetModifierMappingReply
-                                                         :: CARD8,
+import Data.Int
+import Foreign.C.Types
+import Data.Bits
+import Data.Binary.Put
+import Data.Binary.Get
+import Data.Typeable
+import Control.Monad
+import Control.Exception
+import Data.List
+import Graphics.XHB.Shared hiding (Event, Error)
+import qualified Graphics.XHB.Shared
+ 
+deserializeError :: Word8 -> Maybe (Get SomeError)
+deserializeError 1
+  = return (liftM toError (deserialize :: Get Request))
+deserializeError 2
+  = return (liftM toError (deserialize :: Get Value))
+deserializeError 3
+  = return (liftM toError (deserialize :: Get Window))
+deserializeError 4
+  = return (liftM toError (deserialize :: Get Pixmap))
+deserializeError 5
+  = return (liftM toError (deserialize :: Get Atom))
+deserializeError 6
+  = return (liftM toError (deserialize :: Get Cursor))
+deserializeError 7
+  = return (liftM toError (deserialize :: Get Font))
+deserializeError 8
+  = return (liftM toError (deserialize :: Get Match))
+deserializeError 9
+  = return (liftM toError (deserialize :: Get Drawable))
+deserializeError 10
+  = return (liftM toError (deserialize :: Get Access))
+deserializeError 11
+  = return (liftM toError (deserialize :: Get Alloc))
+deserializeError 12
+  = return (liftM toError (deserialize :: Get Colormap))
+deserializeError 13
+  = return (liftM toError (deserialize :: Get GContext))
+deserializeError 14
+  = return (liftM toError (deserialize :: Get IDChoice))
+deserializeError 15
+  = return (liftM toError (deserialize :: Get Name))
+deserializeError 16
+  = return (liftM toError (deserialize :: Get Length))
+deserializeError 17
+  = return (liftM toError (deserialize :: Get Implementation))
+deserializeError _ = Nothing
+ 
+deserializeEvent :: Word8 -> Maybe (Get SomeEvent)
+deserializeEvent 2
+  = return (liftM toEvent (deserialize :: Get KeyPress))
+deserializeEvent 3
+  = return (liftM toEvent (deserialize :: Get KeyRelease))
+deserializeEvent 4
+  = return (liftM toEvent (deserialize :: Get ButtonPress))
+deserializeEvent 5
+  = return (liftM toEvent (deserialize :: Get ButtonRelease))
+deserializeEvent 6
+  = return (liftM toEvent (deserialize :: Get MotionNotify))
+deserializeEvent 7
+  = return (liftM toEvent (deserialize :: Get EnterNotify))
+deserializeEvent 8
+  = return (liftM toEvent (deserialize :: Get LeaveNotify))
+deserializeEvent 9
+  = return (liftM toEvent (deserialize :: Get FocusIn))
+deserializeEvent 10
+  = return (liftM toEvent (deserialize :: Get FocusOut))
+deserializeEvent 11
+  = return (liftM toEvent (deserialize :: Get KeymapNotify))
+deserializeEvent 12
+  = return (liftM toEvent (deserialize :: Get Expose))
+deserializeEvent 13
+  = return (liftM toEvent (deserialize :: Get GraphicsExposure))
+deserializeEvent 14
+  = return (liftM toEvent (deserialize :: Get NoExposure))
+deserializeEvent 15
+  = return (liftM toEvent (deserialize :: Get VisibilityNotify))
+deserializeEvent 16
+  = return (liftM toEvent (deserialize :: Get CreateNotify))
+deserializeEvent 17
+  = return (liftM toEvent (deserialize :: Get DestroyNotify))
+deserializeEvent 18
+  = return (liftM toEvent (deserialize :: Get UnmapNotify))
+deserializeEvent 19
+  = return (liftM toEvent (deserialize :: Get MapNotify))
+deserializeEvent 20
+  = return (liftM toEvent (deserialize :: Get MapRequest))
+deserializeEvent 21
+  = return (liftM toEvent (deserialize :: Get ReparentNotify))
+deserializeEvent 22
+  = return (liftM toEvent (deserialize :: Get ConfigureNotify))
+deserializeEvent 23
+  = return (liftM toEvent (deserialize :: Get ConfigureRequest))
+deserializeEvent 24
+  = return (liftM toEvent (deserialize :: Get GravityNotify))
+deserializeEvent 25
+  = return (liftM toEvent (deserialize :: Get ResizeRequest))
+deserializeEvent 26
+  = return (liftM toEvent (deserialize :: Get CirculateNotify))
+deserializeEvent 27
+  = return (liftM toEvent (deserialize :: Get CirculateRequest))
+deserializeEvent 28
+  = return (liftM toEvent (deserialize :: Get PropertyNotify))
+deserializeEvent 29
+  = return (liftM toEvent (deserialize :: Get SelectionClear))
+deserializeEvent 30
+  = return (liftM toEvent (deserialize :: Get SelectionRequest))
+deserializeEvent 31
+  = return (liftM toEvent (deserialize :: Get SelectionNotify))
+deserializeEvent 32
+  = return (liftM toEvent (deserialize :: Get ColormapNotify))
+deserializeEvent 33
+  = return (liftM toEvent (deserialize :: Get ClientMessage))
+deserializeEvent 34
+  = return (liftM toEvent (deserialize :: Get MappingNotify))
+deserializeEvent _ = Nothing
+ 
+data CHAR2B = MkCHAR2B{byte1_CHAR2B :: Word8,
+                       byte2_CHAR2B :: Word8}
+            deriving (Show, Typeable)
+ 
+instance Serialize CHAR2B where
+        serialize x
+          = do serialize (byte1_CHAR2B x)
+               serialize (byte2_CHAR2B x)
+        size x = size (byte1_CHAR2B x) + size (byte2_CHAR2B x)
+ 
+instance Deserialize CHAR2B where
+        deserialize
+          = do byte1 <- deserialize
+               byte2 <- deserialize
+               return (MkCHAR2B byte1 byte2)
+ 
+newtype WINDOW = MkWINDOW Xid
+                 deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
+ 
+newtype PIXMAP = MkPIXMAP Xid
+                 deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
+ 
+newtype CURSOR = MkCURSOR Xid
+                 deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
+ 
+newtype FONT = MkFONT Xid
+               deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
+ 
+newtype GCONTEXT = MkGCONTEXT Xid
+                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
+ 
+newtype COLORMAP = MkCOLORMAP Xid
+                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
+ 
+newtype ATOM = MkATOM Xid
+               deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
+ 
+newtype DRAWABLE = MkDRAWABLE Xid
+                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
+ 
+newtype FONTABLE = MkFONTABLE Xid
+                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
+ 
+type VISUALID = Word32
+ 
+type TIMESTAMP = Word32
+ 
+type KEYSYM = Word32
+ 
+type KEYCODE = Word8
+ 
+type BUTTON = Word8
+ 
+data POINT = MkPOINT{x_POINT :: Int16, y_POINT :: Int16}
+           deriving (Show, Typeable)
+ 
+instance Serialize POINT where
+        serialize x
+          = do serialize (x_POINT x)
+               serialize (y_POINT x)
+        size x = size (x_POINT x) + size (y_POINT x)
+ 
+instance Deserialize POINT where
+        deserialize
+          = do x <- deserialize
+               y <- deserialize
+               return (MkPOINT x y)
+ 
+data RECTANGLE = MkRECTANGLE{x_RECTANGLE :: Int16,
+                             y_RECTANGLE :: Int16, width_RECTANGLE :: Word16,
+                             height_RECTANGLE :: Word16}
+               deriving (Show, Typeable)
+ 
+instance Serialize RECTANGLE where
+        serialize x
+          = do serialize (x_RECTANGLE x)
+               serialize (y_RECTANGLE x)
+               serialize (width_RECTANGLE x)
+               serialize (height_RECTANGLE x)
+        size x
+          = size (x_RECTANGLE x) + size (y_RECTANGLE x) +
+              size (width_RECTANGLE x)
+              + size (height_RECTANGLE x)
+ 
+instance Deserialize RECTANGLE where
+        deserialize
+          = do x <- deserialize
+               y <- deserialize
+               width <- deserialize
+               height <- deserialize
+               return (MkRECTANGLE x y width height)
+ 
+data ARC = MkARC{x_ARC :: Int16, y_ARC :: Int16,
+                 width_ARC :: Word16, height_ARC :: Word16, angle1_ARC :: Int16,
+                 angle2_ARC :: Int16}
+         deriving (Show, Typeable)
+ 
+instance Serialize ARC where
+        serialize x
+          = do serialize (x_ARC x)
+               serialize (y_ARC x)
+               serialize (width_ARC x)
+               serialize (height_ARC x)
+               serialize (angle1_ARC x)
+               serialize (angle2_ARC x)
+        size x
+          = size (x_ARC x) + size (y_ARC x) + size (width_ARC x) +
+              size (height_ARC x)
+              + size (angle1_ARC x)
+              + size (angle2_ARC x)
+ 
+instance Deserialize ARC where
+        deserialize
+          = do x <- deserialize
+               y <- deserialize
+               width <- deserialize
+               height <- deserialize
+               angle1 <- deserialize
+               angle2 <- deserialize
+               return (MkARC x y width height angle1 angle2)
+ 
+data FORMAT = MkFORMAT{depth_FORMAT :: Word8,
+                       bits_per_pixel_FORMAT :: Word8, scanline_pad_FORMAT :: Word8}
+            deriving (Show, Typeable)
+ 
+instance Serialize FORMAT where
+        serialize x
+          = do serialize (depth_FORMAT x)
+               serialize (bits_per_pixel_FORMAT x)
+               serialize (scanline_pad_FORMAT x)
+               putSkip 5
+        size x
+          = size (depth_FORMAT x) + size (bits_per_pixel_FORMAT x) +
+              size (scanline_pad_FORMAT x)
+              + 5
+ 
+instance Deserialize FORMAT where
+        deserialize
+          = do depth <- deserialize
+               bits_per_pixel <- deserialize
+               scanline_pad <- deserialize
+               skip 5
+               return (MkFORMAT depth bits_per_pixel scanline_pad)
+ 
+data VisualClass = VisualClassStaticGray
+                 | VisualClassGrayScale
+                 | VisualClassStaticColor
+                 | VisualClassPseudoColor
+                 | VisualClassTrueColor
+                 | VisualClassDirectColor
+ 
+instance SimpleEnum VisualClass where
+        toValue VisualClassStaticGray{} = 0
+        toValue VisualClassGrayScale{} = 1
+        toValue VisualClassStaticColor{} = 2
+        toValue VisualClassPseudoColor{} = 3
+        toValue VisualClassTrueColor{} = 4
+        toValue VisualClassDirectColor{} = 5
+        fromValue 0 = VisualClassStaticGray
+        fromValue 1 = VisualClassGrayScale
+        fromValue 2 = VisualClassStaticColor
+        fromValue 3 = VisualClassPseudoColor
+        fromValue 4 = VisualClassTrueColor
+        fromValue 5 = VisualClassDirectColor
+ 
+data VISUALTYPE = MkVISUALTYPE{visual_id_VISUALTYPE :: VISUALID,
+                               class_VISUALTYPE :: Word8, bits_per_rgb_value_VISUALTYPE :: Word8,
+                               colormap_entries_VISUALTYPE :: Word16,
+                               red_mask_VISUALTYPE :: Word32, green_mask_VISUALTYPE :: Word32,
+                               blue_mask_VISUALTYPE :: Word32}
+                deriving (Show, Typeable)
+ 
+instance Serialize VISUALTYPE where
+        serialize x
+          = do serialize (visual_id_VISUALTYPE x)
+               serialize (class_VISUALTYPE x)
+               serialize (bits_per_rgb_value_VISUALTYPE x)
+               serialize (colormap_entries_VISUALTYPE x)
+               serialize (red_mask_VISUALTYPE x)
+               serialize (green_mask_VISUALTYPE x)
+               serialize (blue_mask_VISUALTYPE x)
+               putSkip 4
+        size x
+          = size (visual_id_VISUALTYPE x) + size (class_VISUALTYPE x) +
+              size (bits_per_rgb_value_VISUALTYPE x)
+              + size (colormap_entries_VISUALTYPE x)
+              + size (red_mask_VISUALTYPE x)
+              + size (green_mask_VISUALTYPE x)
+              + size (blue_mask_VISUALTYPE x)
+              + 4
+ 
+instance Deserialize VISUALTYPE where
+        deserialize
+          = do visual_id <- deserialize
+               class_ <- deserialize
+               bits_per_rgb_value <- deserialize
+               colormap_entries <- deserialize
+               red_mask <- deserialize
+               green_mask <- deserialize
+               blue_mask <- deserialize
+               skip 4
+               return
+                 (MkVISUALTYPE visual_id class_ bits_per_rgb_value colormap_entries
+                    red_mask
+                    green_mask
+                    blue_mask)
+ 
+data DEPTH = MkDEPTH{depth_DEPTH :: Word8,
+                     visuals_len_DEPTH :: Word16, visuals_DEPTH :: [VISUALTYPE]}
+           deriving (Show, Typeable)
+ 
+instance Serialize DEPTH where
+        serialize x
+          = do serialize (depth_DEPTH x)
+               putSkip 1
+               serialize (visuals_len_DEPTH x)
+               putSkip 4
+               serializeList (visuals_DEPTH x)
+        size x
+          = size (depth_DEPTH x) + 1 + size (visuals_len_DEPTH x) + 4 +
+              sum (map size (visuals_DEPTH x))
+ 
+instance Deserialize DEPTH where
+        deserialize
+          = do depth <- deserialize
+               skip 1
+               visuals_len <- deserialize
+               skip 4
+               visuals <- deserializeList (fromIntegral visuals_len)
+               return (MkDEPTH depth visuals_len visuals)
+ 
+data SCREEN = MkSCREEN{root_SCREEN :: WINDOW,
+                       default_colormap_SCREEN :: COLORMAP, white_pixel_SCREEN :: Word32,
+                       black_pixel_SCREEN :: Word32, current_input_masks_SCREEN :: Word32,
+                       width_in_pixels_SCREEN :: Word16,
+                       height_in_pixels_SCREEN :: Word16,
+                       width_in_millimeters_SCREEN :: Word16,
+                       height_in_millimeters_SCREEN :: Word16,
+                       min_installed_maps_SCREEN :: Word16,
+                       max_installed_maps_SCREEN :: Word16,
+                       root_visual_SCREEN :: VISUALID, backing_stores_SCREEN :: Word8,
+                       save_unders_SCREEN :: Bool, root_depth_SCREEN :: Word8,
+                       allowed_depths_len_SCREEN :: Word8,
+                       allowed_depths_SCREEN :: [DEPTH]}
+            deriving (Show, Typeable)
+ 
+instance Serialize SCREEN where
+        serialize x
+          = do serialize (root_SCREEN x)
+               serialize (default_colormap_SCREEN x)
+               serialize (white_pixel_SCREEN x)
+               serialize (black_pixel_SCREEN x)
+               serialize (current_input_masks_SCREEN x)
+               serialize (width_in_pixels_SCREEN x)
+               serialize (height_in_pixels_SCREEN x)
+               serialize (width_in_millimeters_SCREEN x)
+               serialize (height_in_millimeters_SCREEN x)
+               serialize (min_installed_maps_SCREEN x)
+               serialize (max_installed_maps_SCREEN x)
+               serialize (root_visual_SCREEN x)
+               serialize (backing_stores_SCREEN x)
+               serialize (save_unders_SCREEN x)
+               serialize (root_depth_SCREEN x)
+               serialize (allowed_depths_len_SCREEN x)
+               serializeList (allowed_depths_SCREEN x)
+        size x
+          = size (root_SCREEN x) + size (default_colormap_SCREEN x) +
+              size (white_pixel_SCREEN x)
+              + size (black_pixel_SCREEN x)
+              + size (current_input_masks_SCREEN x)
+              + size (width_in_pixels_SCREEN x)
+              + size (height_in_pixels_SCREEN x)
+              + size (width_in_millimeters_SCREEN x)
+              + size (height_in_millimeters_SCREEN x)
+              + size (min_installed_maps_SCREEN x)
+              + size (max_installed_maps_SCREEN x)
+              + size (root_visual_SCREEN x)
+              + size (backing_stores_SCREEN x)
+              + size (save_unders_SCREEN x)
+              + size (root_depth_SCREEN x)
+              + size (allowed_depths_len_SCREEN x)
+              + sum (map size (allowed_depths_SCREEN x))
+ 
+instance Deserialize SCREEN where
+        deserialize
+          = do root <- deserialize
+               default_colormap <- deserialize
+               white_pixel <- deserialize
+               black_pixel <- deserialize
+               current_input_masks <- deserialize
+               width_in_pixels <- deserialize
+               height_in_pixels <- deserialize
+               width_in_millimeters <- deserialize
+               height_in_millimeters <- deserialize
+               min_installed_maps <- deserialize
+               max_installed_maps <- deserialize
+               root_visual <- deserialize
+               backing_stores <- deserialize
+               save_unders <- deserialize
+               root_depth <- deserialize
+               allowed_depths_len <- deserialize
+               allowed_depths <- deserializeList (fromIntegral allowed_depths_len)
+               return
+                 (MkSCREEN root default_colormap white_pixel black_pixel
+                    current_input_masks
+                    width_in_pixels
+                    height_in_pixels
+                    width_in_millimeters
+                    height_in_millimeters
+                    min_installed_maps
+                    max_installed_maps
+                    root_visual
+                    backing_stores
+                    save_unders
+                    root_depth
+                    allowed_depths_len
+                    allowed_depths)
+ 
+data SetupRequest = MkSetupRequest{byte_order_SetupRequest ::
+                                   Word8,
+                                   protocol_major_version_SetupRequest :: Word16,
+                                   protocol_minor_version_SetupRequest :: Word16,
+                                   authorization_protocol_name_len_SetupRequest :: Word16,
+                                   authorization_protocol_data_len_SetupRequest :: Word16,
+                                   authorization_protocol_name_SetupRequest :: [CChar],
+                                   authorization_protocol_data_SetupRequest :: [CChar]}
+                  deriving (Show, Typeable)
+ 
+instance Serialize SetupRequest where
+        serialize x
+          = do serialize (byte_order_SetupRequest x)
+               putSkip 1
+               serialize (protocol_major_version_SetupRequest x)
+               serialize (protocol_minor_version_SetupRequest x)
+               serialize (authorization_protocol_name_len_SetupRequest x)
+               serialize (authorization_protocol_data_len_SetupRequest x)
+               putSkip 2
+               serializeList (authorization_protocol_name_SetupRequest x)
+               serializeList (authorization_protocol_data_SetupRequest x)
+        size x
+          = size (byte_order_SetupRequest x) + 1 +
+              size (protocol_major_version_SetupRequest x)
+              + size (protocol_minor_version_SetupRequest x)
+              + size (authorization_protocol_name_len_SetupRequest x)
+              + size (authorization_protocol_data_len_SetupRequest x)
+              + 2
+              + sum (map size (authorization_protocol_name_SetupRequest x))
+              + sum (map size (authorization_protocol_data_SetupRequest x))
+ 
+instance Deserialize SetupRequest where
+        deserialize
+          = do byte_order <- deserialize
+               skip 1
+               protocol_major_version <- deserialize
+               protocol_minor_version <- deserialize
+               authorization_protocol_name_len <- deserialize
+               authorization_protocol_data_len <- deserialize
+               skip 2
+               authorization_protocol_name <- deserializeList
+                                                (fromIntegral authorization_protocol_name_len)
+               authorization_protocol_data <- deserializeList
+                                                (fromIntegral authorization_protocol_data_len)
+               return
+                 (MkSetupRequest byte_order protocol_major_version
+                    protocol_minor_version
+                    authorization_protocol_name_len
+                    authorization_protocol_data_len
+                    authorization_protocol_name
+                    authorization_protocol_data)
+ 
+data SetupFailed = MkSetupFailed{status_SetupFailed :: Word8,
+                                 reason_len_SetupFailed :: Word8,
+                                 protocol_major_version_SetupFailed :: Word16,
+                                 protocol_minor_version_SetupFailed :: Word16,
+                                 length_SetupFailed :: Word16, reason_SetupFailed :: [CChar]}
+                 deriving (Show, Typeable)
+ 
+instance Serialize SetupFailed where
+        serialize x
+          = do serialize (status_SetupFailed x)
+               serialize (reason_len_SetupFailed x)
+               serialize (protocol_major_version_SetupFailed x)
+               serialize (protocol_minor_version_SetupFailed x)
+               serialize (length_SetupFailed x)
+               serializeList (reason_SetupFailed x)
+        size x
+          = size (status_SetupFailed x) + size (reason_len_SetupFailed x) +
+              size (protocol_major_version_SetupFailed x)
+              + size (protocol_minor_version_SetupFailed x)
+              + size (length_SetupFailed x)
+              + sum (map size (reason_SetupFailed x))
+ 
+instance Deserialize SetupFailed where
+        deserialize
+          = do status <- deserialize
+               reason_len <- deserialize
+               protocol_major_version <- deserialize
+               protocol_minor_version <- deserialize
+               length <- deserialize
+               reason <- deserializeList (fromIntegral reason_len)
+               return
+                 (MkSetupFailed status reason_len protocol_major_version
+                    protocol_minor_version
+                    length
+                    reason)
+ 
+data SetupAuthenticate = MkSetupAuthenticate{status_SetupAuthenticate
+                                             :: Word8,
+                                             length_SetupAuthenticate :: Word16,
+                                             reason_SetupAuthenticate :: [CChar]}
+                       deriving (Show, Typeable)
+ 
+instance Serialize SetupAuthenticate where
+        serialize x
+          = do serialize (status_SetupAuthenticate x)
+               putSkip 5
+               serialize (length_SetupAuthenticate x)
+               serializeList (reason_SetupAuthenticate x)
+        size x
+          = size (status_SetupAuthenticate x) + 5 +
+              size (length_SetupAuthenticate x)
+              + sum (map size (reason_SetupAuthenticate x))
+ 
+instance Deserialize SetupAuthenticate where
+        deserialize
+          = do status <- deserialize
+               skip 5
+               length <- deserialize
+               reason <- deserializeList
+                           (fromIntegral (fromIntegral (length * 4)))
+               return (MkSetupAuthenticate status length reason)
+ 
+data ImageOrder = ImageOrderLSBFirst
+                | ImageOrderMSBFirst
+ 
+instance SimpleEnum ImageOrder where
+        toValue ImageOrderLSBFirst{} = 0
+        toValue ImageOrderMSBFirst{} = 1
+        fromValue 0 = ImageOrderLSBFirst
+        fromValue 1 = ImageOrderMSBFirst
+ 
+data Setup = MkSetup{status_Setup :: Word8,
+                     protocol_major_version_Setup :: Word16,
+                     protocol_minor_version_Setup :: Word16, length_Setup :: Word16,
+                     release_number_Setup :: Word32, resource_id_base_Setup :: Word32,
+                     resource_id_mask_Setup :: Word32,
+                     motion_buffer_size_Setup :: Word32, vendor_len_Setup :: Word16,
+                     maximum_request_length_Setup :: Word16, roots_len_Setup :: Word8,
+                     pixmap_formats_len_Setup :: Word8, image_byte_order_Setup :: Word8,
+                     bitmap_format_bit_order_Setup :: Word8,
+                     bitmap_format_scanline_unit_Setup :: Word8,
+                     bitmap_format_scanline_pad_Setup :: Word8,
+                     min_keycode_Setup :: KEYCODE, max_keycode_Setup :: KEYCODE,
+                     vendor_Setup :: [CChar], pixmap_formats_Setup :: [FORMAT],
+                     roots_Setup :: [SCREEN]}
+           deriving (Show, Typeable)
+ 
+instance Serialize Setup where
+        serialize x
+          = do serialize (status_Setup x)
+               putSkip 1
+               serialize (protocol_major_version_Setup x)
+               serialize (protocol_minor_version_Setup x)
+               serialize (length_Setup x)
+               serialize (release_number_Setup x)
+               serialize (resource_id_base_Setup x)
+               serialize (resource_id_mask_Setup x)
+               serialize (motion_buffer_size_Setup x)
+               serialize (vendor_len_Setup x)
+               serialize (maximum_request_length_Setup x)
+               serialize (roots_len_Setup x)
+               serialize (pixmap_formats_len_Setup x)
+               serialize (image_byte_order_Setup x)
+               serialize (bitmap_format_bit_order_Setup x)
+               serialize (bitmap_format_scanline_unit_Setup x)
+               serialize (bitmap_format_scanline_pad_Setup x)
+               serialize (min_keycode_Setup x)
+               serialize (max_keycode_Setup x)
+               putSkip 4
+               serializeList (vendor_Setup x)
+               serializeList (pixmap_formats_Setup x)
+               serializeList (roots_Setup x)
+        size x
+          = size (status_Setup x) + 1 + size (protocol_major_version_Setup x)
+              + size (protocol_minor_version_Setup x)
+              + size (length_Setup x)
+              + size (release_number_Setup x)
+              + size (resource_id_base_Setup x)
+              + size (resource_id_mask_Setup x)
+              + size (motion_buffer_size_Setup x)
+              + size (vendor_len_Setup x)
+              + size (maximum_request_length_Setup x)
+              + size (roots_len_Setup x)
+              + size (pixmap_formats_len_Setup x)
+              + size (image_byte_order_Setup x)
+              + size (bitmap_format_bit_order_Setup x)
+              + size (bitmap_format_scanline_unit_Setup x)
+              + size (bitmap_format_scanline_pad_Setup x)
+              + size (min_keycode_Setup x)
+              + size (max_keycode_Setup x)
+              + 4
+              + sum (map size (vendor_Setup x))
+              + sum (map size (pixmap_formats_Setup x))
+              + sum (map size (roots_Setup x))
+ 
+instance Deserialize Setup where
+        deserialize
+          = do status <- deserialize
+               skip 1
+               protocol_major_version <- deserialize
+               protocol_minor_version <- deserialize
+               length <- deserialize
+               release_number <- deserialize
+               resource_id_base <- deserialize
+               resource_id_mask <- deserialize
+               motion_buffer_size <- deserialize
+               vendor_len <- deserialize
+               maximum_request_length <- deserialize
+               roots_len <- deserialize
+               pixmap_formats_len <- deserialize
+               image_byte_order <- deserialize
+               bitmap_format_bit_order <- deserialize
+               bitmap_format_scanline_unit <- deserialize
+               bitmap_format_scanline_pad <- deserialize
+               min_keycode <- deserialize
+               max_keycode <- deserialize
+               skip 4
+               vendor <- deserializeList (fromIntegral vendor_len)
+               pixmap_formats <- deserializeList (fromIntegral pixmap_formats_len)
+               roots <- deserializeList (fromIntegral roots_len)
+               return
+                 (MkSetup status protocol_major_version protocol_minor_version
+                    length
+                    release_number
+                    resource_id_base
+                    resource_id_mask
+                    motion_buffer_size
+                    vendor_len
+                    maximum_request_length
+                    roots_len
+                    pixmap_formats_len
+                    image_byte_order
+                    bitmap_format_bit_order
+                    bitmap_format_scanline_unit
+                    bitmap_format_scanline_pad
+                    min_keycode
+                    max_keycode
+                    vendor
+                    pixmap_formats
+                    roots)
+ 
+data ModMask = ModMaskShift
+             | ModMaskLock
+             | ModMaskControl
+             | ModMask1
+             | ModMask2
+             | ModMask3
+             | ModMask4
+             | ModMask5
+ 
+instance BitEnum ModMask where
+        toBit ModMaskShift{} = 0
+        toBit ModMaskLock{} = 1
+        toBit ModMaskControl{} = 2
+        toBit ModMask1{} = 3
+        toBit ModMask2{} = 4
+        toBit ModMask3{} = 5
+        toBit ModMask4{} = 6
+        toBit ModMask5{} = 7
+        fromBit 0 = ModMaskShift
+        fromBit 1 = ModMaskLock
+        fromBit 2 = ModMaskControl
+        fromBit 3 = ModMask1
+        fromBit 4 = ModMask2
+        fromBit 5 = ModMask3
+        fromBit 6 = ModMask4
+        fromBit 7 = ModMask5
+ 
+data KeyPress = MkKeyPress{detail_KeyPress :: KEYCODE,
+                           time_KeyPress :: TIMESTAMP, root_KeyPress :: WINDOW,
+                           event_KeyPress :: WINDOW, child_KeyPress :: WINDOW,
+                           root_x_KeyPress :: Int16, root_y_KeyPress :: Int16,
+                           event_x_KeyPress :: Int16, event_y_KeyPress :: Int16,
+                           state_KeyPress :: Word16, same_screen_KeyPress :: Bool}
+              deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event KeyPress
+ 
+instance Deserialize KeyPress where
+        deserialize
+          = do skip 1
+               detail <- deserialize
+               skip 2
+               time <- deserialize
+               root <- deserialize
+               event <- deserialize
+               child <- deserialize
+               root_x <- deserialize
+               root_y <- deserialize
+               event_x <- deserialize
+               event_y <- deserialize
+               state <- deserialize
+               same_screen <- deserialize
+               skip 1
+               return
+                 (MkKeyPress detail time root event child root_x root_y event_x
+                    event_y
+                    state
+                    same_screen)
+ 
+data KeyRelease = MkKeyRelease{detail_KeyRelease :: KEYCODE,
+                               time_KeyRelease :: TIMESTAMP, root_KeyRelease :: WINDOW,
+                               event_KeyRelease :: WINDOW, child_KeyRelease :: WINDOW,
+                               root_x_KeyRelease :: Int16, root_y_KeyRelease :: Int16,
+                               event_x_KeyRelease :: Int16, event_y_KeyRelease :: Int16,
+                               state_KeyRelease :: Word16, same_screen_KeyRelease :: Bool}
+                deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event KeyRelease
+ 
+instance Deserialize KeyRelease where
+        deserialize
+          = do skip 1
+               detail <- deserialize
+               skip 2
+               time <- deserialize
+               root <- deserialize
+               event <- deserialize
+               child <- deserialize
+               root_x <- deserialize
+               root_y <- deserialize
+               event_x <- deserialize
+               event_y <- deserialize
+               state <- deserialize
+               same_screen <- deserialize
+               skip 1
+               return
+                 (MkKeyRelease detail time root event child root_x root_y event_x
+                    event_y
+                    state
+                    same_screen)
+ 
+data ButtonMask = ButtonMask1
+                | ButtonMask2
+                | ButtonMask3
+                | ButtonMask4
+                | ButtonMask5
+                | ButtonMaskAny
+ 
+instance BitEnum ButtonMask where
+        toBit ButtonMask1{} = 8
+        toBit ButtonMask2{} = 9
+        toBit ButtonMask3{} = 10
+        toBit ButtonMask4{} = 11
+        toBit ButtonMask5{} = 12
+        toBit ButtonMaskAny{} = 15
+        fromBit 8 = ButtonMask1
+        fromBit 9 = ButtonMask2
+        fromBit 10 = ButtonMask3
+        fromBit 11 = ButtonMask4
+        fromBit 12 = ButtonMask5
+        fromBit 15 = ButtonMaskAny
+ 
+data ButtonPress = MkButtonPress{detail_ButtonPress :: BUTTON,
+                                 time_ButtonPress :: TIMESTAMP, root_ButtonPress :: WINDOW,
+                                 event_ButtonPress :: WINDOW, child_ButtonPress :: WINDOW,
+                                 root_x_ButtonPress :: Int16, root_y_ButtonPress :: Int16,
+                                 event_x_ButtonPress :: Int16, event_y_ButtonPress :: Int16,
+                                 state_ButtonPress :: Word16, same_screen_ButtonPress :: Bool}
+                 deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event ButtonPress
+ 
+instance Deserialize ButtonPress where
+        deserialize
+          = do skip 1
+               detail <- deserialize
+               skip 2
+               time <- deserialize
+               root <- deserialize
+               event <- deserialize
+               child <- deserialize
+               root_x <- deserialize
+               root_y <- deserialize
+               event_x <- deserialize
+               event_y <- deserialize
+               state <- deserialize
+               same_screen <- deserialize
+               skip 1
+               return
+                 (MkButtonPress detail time root event child root_x root_y event_x
+                    event_y
+                    state
+                    same_screen)
+ 
+data ButtonRelease = MkButtonRelease{detail_ButtonRelease ::
+                                     BUTTON,
+                                     time_ButtonRelease :: TIMESTAMP, root_ButtonRelease :: WINDOW,
+                                     event_ButtonRelease :: WINDOW, child_ButtonRelease :: WINDOW,
+                                     root_x_ButtonRelease :: Int16, root_y_ButtonRelease :: Int16,
+                                     event_x_ButtonRelease :: Int16, event_y_ButtonRelease :: Int16,
+                                     state_ButtonRelease :: Word16,
+                                     same_screen_ButtonRelease :: Bool}
+                   deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event ButtonRelease
+ 
+instance Deserialize ButtonRelease where
+        deserialize
+          = do skip 1
+               detail <- deserialize
+               skip 2
+               time <- deserialize
+               root <- deserialize
+               event <- deserialize
+               child <- deserialize
+               root_x <- deserialize
+               root_y <- deserialize
+               event_x <- deserialize
+               event_y <- deserialize
+               state <- deserialize
+               same_screen <- deserialize
+               skip 1
+               return
+                 (MkButtonRelease detail time root event child root_x root_y event_x
+                    event_y
+                    state
+                    same_screen)
+ 
+data Motion = MotionNormal
+            | MotionHint
+ 
+instance SimpleEnum Motion where
+        toValue MotionNormal{} = 0
+        toValue MotionHint{} = 1
+        fromValue 0 = MotionNormal
+        fromValue 1 = MotionHint
+ 
+data MotionNotify = MkMotionNotify{detail_MotionNotify :: Word8,
+                                   time_MotionNotify :: TIMESTAMP, root_MotionNotify :: WINDOW,
+                                   event_MotionNotify :: WINDOW, child_MotionNotify :: WINDOW,
+                                   root_x_MotionNotify :: Int16, root_y_MotionNotify :: Int16,
+                                   event_x_MotionNotify :: Int16, event_y_MotionNotify :: Int16,
+                                   state_MotionNotify :: Word16, same_screen_MotionNotify :: Bool}
+                  deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event MotionNotify
+ 
+instance Deserialize MotionNotify where
+        deserialize
+          = do skip 1
+               detail <- deserialize
+               skip 2
+               time <- deserialize
+               root <- deserialize
+               event <- deserialize
+               child <- deserialize
+               root_x <- deserialize
+               root_y <- deserialize
+               event_x <- deserialize
+               event_y <- deserialize
+               state <- deserialize
+               same_screen <- deserialize
+               skip 1
+               return
+                 (MkMotionNotify detail time root event child root_x root_y event_x
+                    event_y
+                    state
+                    same_screen)
+ 
+data NotifyDetail = NotifyDetailAncestor
+                  | NotifyDetailVirtual
+                  | NotifyDetailInferior
+                  | NotifyDetailNonlinear
+                  | NotifyDetailNonlinearVirtual
+                  | NotifyDetailPointer
+                  | NotifyDetailPointerRoot
+                  | NotifyDetailNone
+ 
+instance SimpleEnum NotifyDetail where
+        toValue NotifyDetailAncestor{} = 0
+        toValue NotifyDetailVirtual{} = 1
+        toValue NotifyDetailInferior{} = 2
+        toValue NotifyDetailNonlinear{} = 3
+        toValue NotifyDetailNonlinearVirtual{} = 4
+        toValue NotifyDetailPointer{} = 5
+        toValue NotifyDetailPointerRoot{} = 6
+        toValue NotifyDetailNone{} = 7
+        fromValue 0 = NotifyDetailAncestor
+        fromValue 1 = NotifyDetailVirtual
+        fromValue 2 = NotifyDetailInferior
+        fromValue 3 = NotifyDetailNonlinear
+        fromValue 4 = NotifyDetailNonlinearVirtual
+        fromValue 5 = NotifyDetailPointer
+        fromValue 6 = NotifyDetailPointerRoot
+        fromValue 7 = NotifyDetailNone
+ 
+data NotifyMode = NotifyModeNormal
+                | NotifyModeGrab
+                | NotifyModeUngrab
+                | NotifyModeWhileGrabbed
+ 
+instance SimpleEnum NotifyMode where
+        toValue NotifyModeNormal{} = 0
+        toValue NotifyModeGrab{} = 1
+        toValue NotifyModeUngrab{} = 2
+        toValue NotifyModeWhileGrabbed{} = 3
+        fromValue 0 = NotifyModeNormal
+        fromValue 1 = NotifyModeGrab
+        fromValue 2 = NotifyModeUngrab
+        fromValue 3 = NotifyModeWhileGrabbed
+ 
+data EnterNotify = MkEnterNotify{detail_EnterNotify :: Word8,
+                                 time_EnterNotify :: TIMESTAMP, root_EnterNotify :: WINDOW,
+                                 event_EnterNotify :: WINDOW, child_EnterNotify :: WINDOW,
+                                 root_x_EnterNotify :: Int16, root_y_EnterNotify :: Int16,
+                                 event_x_EnterNotify :: Int16, event_y_EnterNotify :: Int16,
+                                 state_EnterNotify :: Word16, mode_EnterNotify :: Word8,
+                                 same_screen_focus_EnterNotify :: Word8}
+                 deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event EnterNotify
+ 
+instance Deserialize EnterNotify where
+        deserialize
+          = do skip 1
+               detail <- deserialize
+               skip 2
+               time <- deserialize
+               root <- deserialize
+               event <- deserialize
+               child <- deserialize
+               root_x <- deserialize
+               root_y <- deserialize
+               event_x <- deserialize
+               event_y <- deserialize
+               state <- deserialize
+               mode <- deserialize
+               same_screen_focus <- deserialize
+               return
+                 (MkEnterNotify detail time root event child root_x root_y event_x
+                    event_y
+                    state
+                    mode
+                    same_screen_focus)
+ 
+data LeaveNotify = MkLeaveNotify{detail_LeaveNotify :: Word8,
+                                 time_LeaveNotify :: TIMESTAMP, root_LeaveNotify :: WINDOW,
+                                 event_LeaveNotify :: WINDOW, child_LeaveNotify :: WINDOW,
+                                 root_x_LeaveNotify :: Int16, root_y_LeaveNotify :: Int16,
+                                 event_x_LeaveNotify :: Int16, event_y_LeaveNotify :: Int16,
+                                 state_LeaveNotify :: Word16, mode_LeaveNotify :: Word8,
+                                 same_screen_focus_LeaveNotify :: Word8}
+                 deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event LeaveNotify
+ 
+instance Deserialize LeaveNotify where
+        deserialize
+          = do skip 1
+               detail <- deserialize
+               skip 2
+               time <- deserialize
+               root <- deserialize
+               event <- deserialize
+               child <- deserialize
+               root_x <- deserialize
+               root_y <- deserialize
+               event_x <- deserialize
+               event_y <- deserialize
+               state <- deserialize
+               mode <- deserialize
+               same_screen_focus <- deserialize
+               return
+                 (MkLeaveNotify detail time root event child root_x root_y event_x
+                    event_y
+                    state
+                    mode
+                    same_screen_focus)
+ 
+data FocusIn = MkFocusIn{detail_FocusIn :: Word8,
+                         event_FocusIn :: WINDOW, mode_FocusIn :: Word8}
+             deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event FocusIn
+ 
+instance Deserialize FocusIn where
+        deserialize
+          = do skip 1
+               detail <- deserialize
+               skip 2
+               event <- deserialize
+               mode <- deserialize
+               skip 3
+               return (MkFocusIn detail event mode)
+ 
+data FocusOut = MkFocusOut{detail_FocusOut :: Word8,
+                           event_FocusOut :: WINDOW, mode_FocusOut :: Word8}
+              deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event FocusOut
+ 
+instance Deserialize FocusOut where
+        deserialize
+          = do skip 1
+               detail <- deserialize
+               skip 2
+               event <- deserialize
+               mode <- deserialize
+               skip 3
+               return (MkFocusOut detail event mode)
+ 
+data KeymapNotify = MkKeymapNotify{keys_KeymapNotify :: [Word8]}
+                  deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event KeymapNotify
+ 
+instance Deserialize KeymapNotify where
+        deserialize
+          = do skip 1
+               keys <- deserializeList (fromIntegral 31)
+               return (MkKeymapNotify keys)
+ 
+data Expose = MkExpose{window_Expose :: WINDOW, x_Expose :: Word16,
+                       y_Expose :: Word16, width_Expose :: Word16,
+                       height_Expose :: Word16, count_Expose :: Word16}
+            deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event Expose
+ 
+instance Deserialize Expose where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               window <- deserialize
+               x <- deserialize
+               y <- deserialize
+               width <- deserialize
+               height <- deserialize
+               count <- deserialize
+               skip 2
+               return (MkExpose window x y width height count)
+ 
+data GraphicsExposure = MkGraphicsExposure{drawable_GraphicsExposure
+                                           :: DRAWABLE,
+                                           x_GraphicsExposure :: Word16,
+                                           y_GraphicsExposure :: Word16,
+                                           width_GraphicsExposure :: Word16,
+                                           height_GraphicsExposure :: Word16,
+                                           minor_opcode_GraphicsExposure :: Word16,
+                                           count_GraphicsExposure :: Word16,
+                                           major_opcode_GraphicsExposure :: Word8}
+                      deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event GraphicsExposure
+ 
+instance Deserialize GraphicsExposure where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               drawable <- deserialize
+               x <- deserialize
+               y <- deserialize
+               width <- deserialize
+               height <- deserialize
+               minor_opcode <- deserialize
+               count <- deserialize
+               major_opcode <- deserialize
+               skip 3
+               return
+                 (MkGraphicsExposure drawable x y width height minor_opcode count
+                    major_opcode)
+ 
+data NoExposure = MkNoExposure{drawable_NoExposure :: DRAWABLE,
+                               minor_opcode_NoExposure :: Word16,
+                               major_opcode_NoExposure :: Word8}
+                deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event NoExposure
+ 
+instance Deserialize NoExposure where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               drawable <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkNoExposure drawable minor_opcode major_opcode)
+ 
+data Visibility = VisibilityUnobscured
+                | VisibilityPartiallyObscured
+                | VisibilityFullyObscured
+ 
+instance SimpleEnum Visibility where
+        toValue VisibilityUnobscured{} = 0
+        toValue VisibilityPartiallyObscured{} = 1
+        toValue VisibilityFullyObscured{} = 2
+        fromValue 0 = VisibilityUnobscured
+        fromValue 1 = VisibilityPartiallyObscured
+        fromValue 2 = VisibilityFullyObscured
+ 
+data VisibilityNotify = MkVisibilityNotify{window_VisibilityNotify
+                                           :: WINDOW,
+                                           state_VisibilityNotify :: Word8}
+                      deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event VisibilityNotify
+ 
+instance Deserialize VisibilityNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               window <- deserialize
+               state <- deserialize
+               skip 3
+               return (MkVisibilityNotify window state)
+ 
+data CreateNotify = MkCreateNotify{parent_CreateNotify :: WINDOW,
+                                   window_CreateNotify :: WINDOW, x_CreateNotify :: Int16,
+                                   y_CreateNotify :: Int16, width_CreateNotify :: Word16,
+                                   height_CreateNotify :: Word16,
+                                   border_width_CreateNotify :: Word16,
+                                   override_redirect_CreateNotify :: Bool}
+                  deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event CreateNotify
+ 
+instance Deserialize CreateNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               parent <- deserialize
+               window <- deserialize
+               x <- deserialize
+               y <- deserialize
+               width <- deserialize
+               height <- deserialize
+               border_width <- deserialize
+               override_redirect <- deserialize
+               skip 1
+               return
+                 (MkCreateNotify parent window x y width height border_width
+                    override_redirect)
+ 
+data DestroyNotify = MkDestroyNotify{event_DestroyNotify :: WINDOW,
+                                     window_DestroyNotify :: WINDOW}
+                   deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event DestroyNotify
+ 
+instance Deserialize DestroyNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               event <- deserialize
+               window <- deserialize
+               return (MkDestroyNotify event window)
+ 
+data UnmapNotify = MkUnmapNotify{event_UnmapNotify :: WINDOW,
+                                 window_UnmapNotify :: WINDOW, from_configure_UnmapNotify :: Bool}
+                 deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event UnmapNotify
+ 
+instance Deserialize UnmapNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               event <- deserialize
+               window <- deserialize
+               from_configure <- deserialize
+               skip 3
+               return (MkUnmapNotify event window from_configure)
+ 
+data MapNotify = MkMapNotify{event_MapNotify :: WINDOW,
+                             window_MapNotify :: WINDOW, override_redirect_MapNotify :: Bool}
+               deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event MapNotify
+ 
+instance Deserialize MapNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               event <- deserialize
+               window <- deserialize
+               override_redirect <- deserialize
+               skip 3
+               return (MkMapNotify event window override_redirect)
+ 
+data MapRequest = MkMapRequest{parent_MapRequest :: WINDOW,
+                               window_MapRequest :: WINDOW}
+                deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event MapRequest
+ 
+instance Deserialize MapRequest where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               parent <- deserialize
+               window <- deserialize
+               return (MkMapRequest parent window)
+ 
+data ReparentNotify = MkReparentNotify{event_ReparentNotify ::
+                                       WINDOW,
+                                       window_ReparentNotify :: WINDOW,
+                                       parent_ReparentNotify :: WINDOW, x_ReparentNotify :: Int16,
+                                       y_ReparentNotify :: Int16,
+                                       override_redirect_ReparentNotify :: Bool}
+                    deriving (Show, Typeable)
+
+ 
+data ClientMessageData = ClientData8  [Word8]  -- ^length 20
+                       | ClientData16 [Word16] -- ^length 10
+                       | ClientData32 [Word32] -- ^length 5
+                   deriving (Show, Typeable)
+
+ 
+data ClientMessageDataType = CDType8
+                           | CDType16
+                           | CDType32
+ 
+clientMessageDataType :: ClientMessageData -> ClientMessageDataType
+clientMessageDataType ClientData8{}  = CDType8
+clientMessageDataType ClientData16{} = CDType16
+clientMessageDataType ClientData32{} = CDType32
+ 
+instance Serialize ClientMessageData where
+    serialize (ClientData8 xs) = assert (length xs == 20) $
+                                    serializeList xs
+    serialize (ClientData16 xs) = assert (length xs == 10) $
+                                     serializeList xs
+    serialize (ClientData32 xs) = assert (length xs == 5) $
+                                     serializeList xs
+    size cd = assert
+         (case cd of
+            ClientData8  xs -> length xs == 20
+            ClientData16 xs -> length xs == 10
+            ClientData32 xs -> length xs == 5)
+         20
+
+deserializeClientData :: ClientMessageDataType -> Get ClientMessageData
+deserializeClientData CDType8
+    = ClientData8 `liftM` deserializeList 20
+deserializeClientData CDType16
+    = ClientData16 `liftM` deserializeList 10
+deserializeClientData CDType32
+    = ClientData32 `liftM` deserializeList 5
+ 
+clientDataFormatToType :: Word8 -> ClientMessageDataType
+clientDataFormatToType 8 = CDType8
+clientDataFormatToType 16 = CDType16
+clientDataFormatToType 32 = CDType32
+clientDataFormatToType _ = CDType8 -- should we throw an error here?
+
+ 
+instance Graphics.XHB.Shared.Event ReparentNotify
+ 
+instance Deserialize ReparentNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               event <- deserialize
+               window <- deserialize
+               parent <- deserialize
+               x <- deserialize
+               y <- deserialize
+               override_redirect <- deserialize
+               skip 3
+               return (MkReparentNotify event window parent x y override_redirect)
+ 
+data ConfigureNotify = MkConfigureNotify{event_ConfigureNotify ::
+                                         WINDOW,
+                                         window_ConfigureNotify :: WINDOW,
+                                         above_sibling_ConfigureNotify :: WINDOW,
+                                         x_ConfigureNotify :: Int16, y_ConfigureNotify :: Int16,
+                                         width_ConfigureNotify :: Word16,
+                                         height_ConfigureNotify :: Word16,
+                                         border_width_ConfigureNotify :: Word16,
+                                         override_redirect_ConfigureNotify :: Bool}
+                     deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event ConfigureNotify
+ 
+instance Deserialize ConfigureNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               event <- deserialize
+               window <- deserialize
+               above_sibling <- deserialize
+               x <- deserialize
+               y <- deserialize
+               width <- deserialize
+               height <- deserialize
+               border_width <- deserialize
+               override_redirect <- deserialize
+               skip 1
+               return
+                 (MkConfigureNotify event window above_sibling x y width height
+                    border_width
+                    override_redirect)
+ 
+data ConfigureRequest = MkConfigureRequest{stack_mode_ConfigureRequest
+                                           :: Word8,
+                                           parent_ConfigureRequest :: WINDOW,
+                                           window_ConfigureRequest :: WINDOW,
+                                           sibling_ConfigureRequest :: WINDOW,
+                                           x_ConfigureRequest :: Int16, y_ConfigureRequest :: Int16,
+                                           width_ConfigureRequest :: Word16,
+                                           height_ConfigureRequest :: Word16,
+                                           border_width_ConfigureRequest :: Word16,
+                                           value_mask_ConfigureRequest :: Word16}
+                      deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event ConfigureRequest
+ 
+instance Deserialize ConfigureRequest where
+        deserialize
+          = do skip 1
+               stack_mode <- deserialize
+               skip 2
+               parent <- deserialize
+               window <- deserialize
+               sibling <- deserialize
+               x <- deserialize
+               y <- deserialize
+               width <- deserialize
+               height <- deserialize
+               border_width <- deserialize
+               value_mask <- deserialize
+               return
+                 (MkConfigureRequest stack_mode parent window sibling x y width
+                    height
+                    border_width
+                    value_mask)
+ 
+data GravityNotify = MkGravityNotify{event_GravityNotify :: WINDOW,
+                                     window_GravityNotify :: WINDOW, x_GravityNotify :: Int16,
+                                     y_GravityNotify :: Int16}
+                   deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event GravityNotify
+ 
+instance Deserialize GravityNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               event <- deserialize
+               window <- deserialize
+               x <- deserialize
+               y <- deserialize
+               return (MkGravityNotify event window x y)
+ 
+data ResizeRequest = MkResizeRequest{window_ResizeRequest ::
+                                     WINDOW,
+                                     width_ResizeRequest :: Word16, height_ResizeRequest :: Word16}
+                   deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event ResizeRequest
+ 
+instance Deserialize ResizeRequest where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               window <- deserialize
+               width <- deserialize
+               height <- deserialize
+               return (MkResizeRequest window width height)
+ 
+data Place = PlaceOnTop
+           | PlaceOnBottom
+ 
+instance SimpleEnum Place where
+        toValue PlaceOnTop{} = 0
+        toValue PlaceOnBottom{} = 1
+        fromValue 0 = PlaceOnTop
+        fromValue 1 = PlaceOnBottom
+ 
+data CirculateNotify = MkCirculateNotify{event_CirculateNotify ::
+                                         WINDOW,
+                                         window_CirculateNotify :: WINDOW,
+                                         place_CirculateNotify :: Word8}
+                     deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event CirculateNotify
+ 
+instance Deserialize CirculateNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               event <- deserialize
+               window <- deserialize
+               skip 4
+               place <- deserialize
+               skip 3
+               return (MkCirculateNotify event window place)
+ 
+data CirculateRequest = MkCirculateRequest{event_CirculateRequest
+                                           :: WINDOW,
+                                           window_CirculateRequest :: WINDOW,
+                                           place_CirculateRequest :: Word8}
+                      deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event CirculateRequest
+ 
+instance Deserialize CirculateRequest where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               event <- deserialize
+               window <- deserialize
+               skip 4
+               place <- deserialize
+               skip 3
+               return (MkCirculateRequest event window place)
+ 
+data Property = PropertyNewValue
+              | PropertyDelete
+ 
+instance SimpleEnum Property where
+        toValue PropertyNewValue{} = 0
+        toValue PropertyDelete{} = 1
+        fromValue 0 = PropertyNewValue
+        fromValue 1 = PropertyDelete
+ 
+data PropertyNotify = MkPropertyNotify{window_PropertyNotify ::
+                                       WINDOW,
+                                       atom_PropertyNotify :: ATOM,
+                                       time_PropertyNotify :: TIMESTAMP,
+                                       state_PropertyNotify :: Word8}
+                    deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event PropertyNotify
+ 
+instance Deserialize PropertyNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               window <- deserialize
+               atom <- deserialize
+               time <- deserialize
+               state <- deserialize
+               skip 3
+               return (MkPropertyNotify window atom time state)
+ 
+data SelectionClear = MkSelectionClear{time_SelectionClear ::
+                                       TIMESTAMP,
+                                       owner_SelectionClear :: WINDOW,
+                                       selection_SelectionClear :: ATOM}
+                    deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event SelectionClear
+ 
+instance Deserialize SelectionClear where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               time <- deserialize
+               owner <- deserialize
+               selection <- deserialize
+               return (MkSelectionClear time owner selection)
+ 
+data SelectionRequest = MkSelectionRequest{time_SelectionRequest ::
+                                           TIMESTAMP,
+                                           owner_SelectionRequest :: WINDOW,
+                                           requestor_SelectionRequest :: WINDOW,
+                                           selection_SelectionRequest :: ATOM,
+                                           target_SelectionRequest :: ATOM,
+                                           property_SelectionRequest :: ATOM}
+                      deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event SelectionRequest
+ 
+instance Deserialize SelectionRequest where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               time <- deserialize
+               owner <- deserialize
+               requestor <- deserialize
+               selection <- deserialize
+               target <- deserialize
+               property <- deserialize
+               return
+                 (MkSelectionRequest time owner requestor selection target property)
+ 
+data SelectionNotify = MkSelectionNotify{time_SelectionNotify ::
+                                         TIMESTAMP,
+                                         requestor_SelectionNotify :: WINDOW,
+                                         selection_SelectionNotify :: ATOM,
+                                         target_SelectionNotify :: ATOM,
+                                         property_SelectionNotify :: ATOM}
+                     deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event SelectionNotify
+ 
+instance Deserialize SelectionNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               time <- deserialize
+               requestor <- deserialize
+               selection <- deserialize
+               target <- deserialize
+               property <- deserialize
+               return (MkSelectionNotify time requestor selection target property)
+ 
+data ColormapState = ColormapStateUninstalled
+                   | ColormapStateInstalled
+ 
+instance SimpleEnum ColormapState where
+        toValue ColormapStateUninstalled{} = 0
+        toValue ColormapStateInstalled{} = 1
+        fromValue 0 = ColormapStateUninstalled
+        fromValue 1 = ColormapStateInstalled
+ 
+data ColormapNotify = MkColormapNotify{window_ColormapNotify ::
+                                       WINDOW,
+                                       colormap_ColormapNotify :: COLORMAP,
+                                       new_ColormapNotify :: Bool, state_ColormapNotify :: Word8}
+                    deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event ColormapNotify
+ 
+instance Deserialize ColormapNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               window <- deserialize
+               colormap <- deserialize
+               new <- deserialize
+               state <- deserialize
+               skip 2
+               return (MkColormapNotify window colormap new state)
+ 
+data ClientMessage = MkClientMessage{format_ClientMessage :: Word8,
+                                     window_ClientMessage :: WINDOW, type_ClientMessage :: ATOM,
+                                     data_ClientMessage :: ClientMessageData}
+                   deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event ClientMessage
+ 
+instance Deserialize ClientMessage where
+        deserialize
+          = do skip 1
+               format <- deserialize
+               skip 2
+               window <- deserialize
+               type_ <- deserialize
+               data_ <- deserializeClientData (clientDataFormatToType format)
+               return (MkClientMessage format window type_ data_)
+ 
+data Mapping = MappingModifier
+             | MappingKeyboard
+             | MappingPointer
+ 
+instance SimpleEnum Mapping where
+        toValue MappingModifier{} = 0
+        toValue MappingKeyboard{} = 1
+        toValue MappingPointer{} = 2
+        fromValue 0 = MappingModifier
+        fromValue 1 = MappingKeyboard
+        fromValue 2 = MappingPointer
+ 
+data MappingNotify = MkMappingNotify{request_MappingNotify ::
+                                     Word8,
+                                     first_keycode_MappingNotify :: KEYCODE,
+                                     count_MappingNotify :: Word8}
+                   deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Event MappingNotify
+ 
+instance Deserialize MappingNotify where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               request <- deserialize
+               first_keycode <- deserialize
+               count <- deserialize
+               skip 1
+               return (MkMappingNotify request first_keycode count)
+ 
+data Request = MkRequest{bad_value_Request :: Word32,
+                         minor_opcode_Request :: Word16, major_opcode_Request :: Word8}
+             deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Request
+ 
+instance Deserialize Request where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkRequest bad_value minor_opcode major_opcode)
+ 
+data Value = MkValue{bad_value_Value :: Word32,
+                     minor_opcode_Value :: Word16, major_opcode_Value :: Word8}
+           deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Value
+ 
+instance Deserialize Value where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkValue bad_value minor_opcode major_opcode)
+ 
+data Window = MkWindow{bad_value_Window :: Word32,
+                       minor_opcode_Window :: Word16, major_opcode_Window :: Word8}
+            deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Window
+ 
+instance Deserialize Window where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkWindow bad_value minor_opcode major_opcode)
+ 
+data Pixmap = MkPixmap{bad_value_Pixmap :: Word32,
+                       minor_opcode_Pixmap :: Word16, major_opcode_Pixmap :: Word8}
+            deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Pixmap
+ 
+instance Deserialize Pixmap where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkPixmap bad_value minor_opcode major_opcode)
+ 
+data Atom = MkAtom{bad_value_Atom :: Word32,
+                   minor_opcode_Atom :: Word16, major_opcode_Atom :: Word8}
+          deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Atom
+ 
+instance Deserialize Atom where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkAtom bad_value minor_opcode major_opcode)
+ 
+data Cursor = MkCursor{bad_value_Cursor :: Word32,
+                       minor_opcode_Cursor :: Word16, major_opcode_Cursor :: Word8}
+            deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Cursor
+ 
+instance Deserialize Cursor where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkCursor bad_value minor_opcode major_opcode)
+ 
+data Font = MkFont{bad_value_Font :: Word32,
+                   minor_opcode_Font :: Word16, major_opcode_Font :: Word8}
+          deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Font
+ 
+instance Deserialize Font where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkFont bad_value minor_opcode major_opcode)
+ 
+data Match = MkMatch{bad_value_Match :: Word32,
+                     minor_opcode_Match :: Word16, major_opcode_Match :: Word8}
+           deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Match
+ 
+instance Deserialize Match where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkMatch bad_value minor_opcode major_opcode)
+ 
+data Drawable = MkDrawable{bad_value_Drawable :: Word32,
+                           minor_opcode_Drawable :: Word16, major_opcode_Drawable :: Word8}
+              deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Drawable
+ 
+instance Deserialize Drawable where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkDrawable bad_value minor_opcode major_opcode)
+ 
+data Access = MkAccess{bad_value_Access :: Word32,
+                       minor_opcode_Access :: Word16, major_opcode_Access :: Word8}
+            deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Access
+ 
+instance Deserialize Access where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkAccess bad_value minor_opcode major_opcode)
+ 
+data Alloc = MkAlloc{bad_value_Alloc :: Word32,
+                     minor_opcode_Alloc :: Word16, major_opcode_Alloc :: Word8}
+           deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Alloc
+ 
+instance Deserialize Alloc where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkAlloc bad_value minor_opcode major_opcode)
+ 
+data Colormap = MkColormap{bad_value_Colormap :: Word32,
+                           minor_opcode_Colormap :: Word16, major_opcode_Colormap :: Word8}
+              deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Colormap
+ 
+instance Deserialize Colormap where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkColormap bad_value minor_opcode major_opcode)
+ 
+data GContext = MkGContext{bad_value_GContext :: Word32,
+                           minor_opcode_GContext :: Word16, major_opcode_GContext :: Word8}
+              deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error GContext
+ 
+instance Deserialize GContext where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkGContext bad_value minor_opcode major_opcode)
+ 
+data IDChoice = MkIDChoice{bad_value_IDChoice :: Word32,
+                           minor_opcode_IDChoice :: Word16, major_opcode_IDChoice :: Word8}
+              deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error IDChoice
+ 
+instance Deserialize IDChoice where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkIDChoice bad_value minor_opcode major_opcode)
+ 
+data Name = MkName{bad_value_Name :: Word32,
+                   minor_opcode_Name :: Word16, major_opcode_Name :: Word8}
+          deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Name
+ 
+instance Deserialize Name where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkName bad_value minor_opcode major_opcode)
+ 
+data Length = MkLength{bad_value_Length :: Word32,
+                       minor_opcode_Length :: Word16, major_opcode_Length :: Word8}
+            deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Length
+ 
+instance Deserialize Length where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkLength bad_value minor_opcode major_opcode)
+ 
+data Implementation = MkImplementation{bad_value_Implementation ::
+                                       Word32,
+                                       minor_opcode_Implementation :: Word16,
+                                       major_opcode_Implementation :: Word8}
+                    deriving (Show, Typeable)
+ 
+instance Graphics.XHB.Shared.Error Implementation
+ 
+instance Deserialize Implementation where
+        deserialize
+          = do skip 4
+               bad_value <- deserialize
+               minor_opcode <- deserialize
+               major_opcode <- deserialize
+               skip 1
+               return (MkImplementation bad_value minor_opcode major_opcode)
+ 
+data WindowClass = WindowClassCopyFromParent
+                 | WindowClassInputOutput
+                 | WindowClassInputOnly
+ 
+instance SimpleEnum WindowClass where
+        toValue WindowClassCopyFromParent{} = 0
+        toValue WindowClassInputOutput{} = 1
+        toValue WindowClassInputOnly{} = 2
+        fromValue 0 = WindowClassCopyFromParent
+        fromValue 1 = WindowClassInputOutput
+        fromValue 2 = WindowClassInputOnly
+ 
+data CW = CWBackPixmap
+        | CWBackPixel
+        | CWBorderPixmap
+        | CWBorderPixel
+        | CWBitGravity
+        | CWWinGravity
+        | CWBackingStore
+        | CWBackingPlanes
+        | CWBackingPixel
+        | CWOverrideRedirect
+        | CWSaveUnder
+        | CWEventMask
+        | CWDontPropagate
+        | CWColormap
+        | CWCursor
+ 
+instance BitEnum CW where
+        toBit CWBackPixmap{} = 0
+        toBit CWBackPixel{} = 1
+        toBit CWBorderPixmap{} = 2
+        toBit CWBorderPixel{} = 3
+        toBit CWBitGravity{} = 4
+        toBit CWWinGravity{} = 5
+        toBit CWBackingStore{} = 6
+        toBit CWBackingPlanes{} = 7
+        toBit CWBackingPixel{} = 8
+        toBit CWOverrideRedirect{} = 9
+        toBit CWSaveUnder{} = 10
+        toBit CWEventMask{} = 11
+        toBit CWDontPropagate{} = 12
+        toBit CWColormap{} = 13
+        toBit CWCursor{} = 14
+        fromBit 0 = CWBackPixmap
+        fromBit 1 = CWBackPixel
+        fromBit 2 = CWBorderPixmap
+        fromBit 3 = CWBorderPixel
+        fromBit 4 = CWBitGravity
+        fromBit 5 = CWWinGravity
+        fromBit 6 = CWBackingStore
+        fromBit 7 = CWBackingPlanes
+        fromBit 8 = CWBackingPixel
+        fromBit 9 = CWOverrideRedirect
+        fromBit 10 = CWSaveUnder
+        fromBit 11 = CWEventMask
+        fromBit 12 = CWDontPropagate
+        fromBit 13 = CWColormap
+        fromBit 14 = CWCursor
+ 
+data BackPixmap = BackPixmapNone
+                | BackPixmapParentRelative
+ 
+instance SimpleEnum BackPixmap where
+        toValue BackPixmapNone{} = 0
+        toValue BackPixmapParentRelative{} = 1
+        fromValue 0 = BackPixmapNone
+        fromValue 1 = BackPixmapParentRelative
+ 
+data Gravity = GravityBitForget
+             | GravityWinUnmap
+             | GravityNorthWest
+             | GravityNorth
+             | GravityNorthEast
+             | GravityWest
+             | GravityCenter
+             | GravityEast
+             | GravitySouthWest
+             | GravitySouth
+             | GravitySouthEast
+             | GravityStatic
+ 
+instance SimpleEnum Gravity where
+        toValue GravityBitForget{} = 0
+        toValue GravityWinUnmap{} = 0
+        toValue GravityNorthWest{} = 1
+        toValue GravityNorth{} = 2
+        toValue GravityNorthEast{} = 3
+        toValue GravityWest{} = 4
+        toValue GravityCenter{} = 5
+        toValue GravityEast{} = 6
+        toValue GravitySouthWest{} = 7
+        toValue GravitySouth{} = 8
+        toValue GravitySouthEast{} = 9
+        toValue GravityStatic{} = 10
+        fromValue 0 = GravityBitForget
+        fromValue 0 = GravityWinUnmap
+        fromValue 1 = GravityNorthWest
+        fromValue 2 = GravityNorth
+        fromValue 3 = GravityNorthEast
+        fromValue 4 = GravityWest
+        fromValue 5 = GravityCenter
+        fromValue 6 = GravityEast
+        fromValue 7 = GravitySouthWest
+        fromValue 8 = GravitySouth
+        fromValue 9 = GravitySouthEast
+        fromValue 10 = GravityStatic
+ 
+data BackingStore = BackingStoreNotUseful
+                  | BackingStoreWhenMapped
+                  | BackingStoreAlways
+ 
+instance SimpleEnum BackingStore where
+        toValue BackingStoreNotUseful{} = 0
+        toValue BackingStoreWhenMapped{} = 1
+        toValue BackingStoreAlways{} = 2
+        fromValue 0 = BackingStoreNotUseful
+        fromValue 1 = BackingStoreWhenMapped
+        fromValue 2 = BackingStoreAlways
+ 
+data EventMask = EventMaskKeyPress
+               | EventMaskKeyRelease
+               | EventMaskButtonPress
+               | EventMaskButtonRelease
+               | EventMaskEnterWindow
+               | EventMaskLeaveWindow
+               | EventMaskPointerMotion
+               | EventMaskPointerMotionHint
+               | EventMaskButton1Motion
+               | EventMaskButton2Motion
+               | EventMaskButton3Motion
+               | EventMaskButton4Motion
+               | EventMaskButton5Motion
+               | EventMaskButtonMotion
+               | EventMaskKeymapState
+               | EventMaskExposure
+               | EventMaskVisibilityChange
+               | EventMaskStructureNotify
+               | EventMaskResizeRedirect
+               | EventMaskSubstructureNotify
+               | EventMaskSubstructureRedirect
+               | EventMaskFocusChange
+               | EventMaskPropertyChange
+               | EventMaskColorMapChange
+               | EventMaskOwnerGrabButton
+ 
+instance BitEnum EventMask where
+        toBit EventMaskKeyPress{} = 0
+        toBit EventMaskKeyRelease{} = 1
+        toBit EventMaskButtonPress{} = 2
+        toBit EventMaskButtonRelease{} = 3
+        toBit EventMaskEnterWindow{} = 4
+        toBit EventMaskLeaveWindow{} = 5
+        toBit EventMaskPointerMotion{} = 6
+        toBit EventMaskPointerMotionHint{} = 7
+        toBit EventMaskButton1Motion{} = 8
+        toBit EventMaskButton2Motion{} = 9
+        toBit EventMaskButton3Motion{} = 10
+        toBit EventMaskButton4Motion{} = 11
+        toBit EventMaskButton5Motion{} = 12
+        toBit EventMaskButtonMotion{} = 13
+        toBit EventMaskKeymapState{} = 14
+        toBit EventMaskExposure{} = 15
+        toBit EventMaskVisibilityChange{} = 16
+        toBit EventMaskStructureNotify{} = 17
+        toBit EventMaskResizeRedirect{} = 18
+        toBit EventMaskSubstructureNotify{} = 19
+        toBit EventMaskSubstructureRedirect{} = 20
+        toBit EventMaskFocusChange{} = 21
+        toBit EventMaskPropertyChange{} = 22
+        toBit EventMaskColorMapChange{} = 23
+        toBit EventMaskOwnerGrabButton{} = 24
+        fromBit 0 = EventMaskKeyPress
+        fromBit 1 = EventMaskKeyRelease
+        fromBit 2 = EventMaskButtonPress
+        fromBit 3 = EventMaskButtonRelease
+        fromBit 4 = EventMaskEnterWindow
+        fromBit 5 = EventMaskLeaveWindow
+        fromBit 6 = EventMaskPointerMotion
+        fromBit 7 = EventMaskPointerMotionHint
+        fromBit 8 = EventMaskButton1Motion
+        fromBit 9 = EventMaskButton2Motion
+        fromBit 10 = EventMaskButton3Motion
+        fromBit 11 = EventMaskButton4Motion
+        fromBit 12 = EventMaskButton5Motion
+        fromBit 13 = EventMaskButtonMotion
+        fromBit 14 = EventMaskKeymapState
+        fromBit 15 = EventMaskExposure
+        fromBit 16 = EventMaskVisibilityChange
+        fromBit 17 = EventMaskStructureNotify
+        fromBit 18 = EventMaskResizeRedirect
+        fromBit 19 = EventMaskSubstructureNotify
+        fromBit 20 = EventMaskSubstructureRedirect
+        fromBit 21 = EventMaskFocusChange
+        fromBit 22 = EventMaskPropertyChange
+        fromBit 23 = EventMaskColorMapChange
+        fromBit 24 = EventMaskOwnerGrabButton
+ 
+data CreateWindow = MkCreateWindow{depth_CreateWindow :: Word8,
+                                   wid_CreateWindow :: WINDOW, parent_CreateWindow :: WINDOW,
+                                   x_CreateWindow :: Int16, y_CreateWindow :: Int16,
+                                   width_CreateWindow :: Word16, height_CreateWindow :: Word16,
+                                   border_width_CreateWindow :: Word16,
+                                   class_CreateWindow :: Word16, visual_CreateWindow :: VISUALID,
+                                   value_CreateWindow :: ValueParam Word32}
+                  deriving (Show, Typeable)
+ 
+instance Serialize CreateWindow where
+        serialize x
+          = do putWord8 1
+               serialize (depth_CreateWindow x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (wid_CreateWindow x)
+               serialize (parent_CreateWindow x)
+               serialize (x_CreateWindow x)
+               serialize (y_CreateWindow x)
+               serialize (width_CreateWindow x)
+               serialize (height_CreateWindow x)
+               serialize (border_width_CreateWindow x)
+               serialize (class_CreateWindow x)
+               serialize (visual_CreateWindow x)
+               serialize (value_CreateWindow x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (depth_CreateWindow x) + size (wid_CreateWindow x) +
+              size (parent_CreateWindow x)
+              + size (x_CreateWindow x)
+              + size (y_CreateWindow x)
+              + size (width_CreateWindow x)
+              + size (height_CreateWindow x)
+              + size (border_width_CreateWindow x)
+              + size (class_CreateWindow x)
+              + size (visual_CreateWindow x)
+              + size (value_CreateWindow x)
+ 
+data ChangeWindowAttributes = MkChangeWindowAttributes{window_ChangeWindowAttributes
+                                                       :: WINDOW,
+                                                       value_ChangeWindowAttributes ::
+                                                       ValueParam Word32}
+                            deriving (Show, Typeable)
+ 
+instance Serialize ChangeWindowAttributes where
+        serialize x
+          = do putWord8 2
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_ChangeWindowAttributes x)
+               serialize (value_ChangeWindowAttributes x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (window_ChangeWindowAttributes x) +
+              size (value_ChangeWindowAttributes x)
+ 
+data MapState = MapStateUnmapped
+              | MapStateUnviewable
+              | MapStateViewable
+ 
+instance SimpleEnum MapState where
+        toValue MapStateUnmapped{} = 0
+        toValue MapStateUnviewable{} = 1
+        toValue MapStateViewable{} = 2
+        fromValue 0 = MapStateUnmapped
+        fromValue 1 = MapStateUnviewable
+        fromValue 2 = MapStateViewable
+ 
+data GetWindowAttributes = MkGetWindowAttributes{window_GetWindowAttributes
+                                                 :: WINDOW}
+                         deriving (Show, Typeable)
+ 
+instance Serialize GetWindowAttributes where
+        serialize x
+          = do putWord8 3
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_GetWindowAttributes x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (window_GetWindowAttributes x)
+ 
+data GetWindowAttributesReply = MkGetWindowAttributesReply{backing_store_GetWindowAttributesReply
+                                                           :: Word8,
+                                                           visual_GetWindowAttributesReply ::
+                                                           VISUALID,
+                                                           class_GetWindowAttributesReply :: Word16,
+                                                           bit_gravity_GetWindowAttributesReply ::
+                                                           Word8,
+                                                           win_gravity_GetWindowAttributesReply ::
+                                                           Word8,
+                                                           backing_planes_GetWindowAttributesReply
+                                                           :: Word32,
+                                                           backing_pixel_GetWindowAttributesReply ::
+                                                           Word32,
+                                                           save_under_GetWindowAttributesReply ::
+                                                           Bool,
+                                                           map_is_installed_GetWindowAttributesReply
+                                                           :: Bool,
+                                                           map_state_GetWindowAttributesReply ::
+                                                           Word8,
+                                                           override_redirect_GetWindowAttributesReply
+                                                           :: Bool,
+                                                           colormap_GetWindowAttributesReply ::
+                                                           COLORMAP,
+                                                           all_event_masks_GetWindowAttributesReply
+                                                           :: Word32,
+                                                           your_event_mask_GetWindowAttributesReply
+                                                           :: Word32,
+                                                           do_not_propagate_mask_GetWindowAttributesReply
+                                                           :: Word16}
+                              deriving (Show, Typeable)
+ 
+instance Deserialize GetWindowAttributesReply where
+        deserialize
+          = do skip 1
+               backing_store <- deserialize
+               skip 2
+               length <- deserialize
+               visual <- deserialize
+               class_ <- deserialize
+               bit_gravity <- deserialize
+               win_gravity <- deserialize
+               backing_planes <- deserialize
+               backing_pixel <- deserialize
+               save_under <- deserialize
+               map_is_installed <- deserialize
+               map_state <- deserialize
+               override_redirect <- deserialize
+               colormap <- deserialize
+               all_event_masks <- deserialize
+               your_event_mask <- deserialize
+               do_not_propagate_mask <- deserialize
+               skip 2
+               let _ = isCard32 length
+               return
+                 (MkGetWindowAttributesReply backing_store visual class_ bit_gravity
+                    win_gravity
+                    backing_planes
+                    backing_pixel
+                    save_under
+                    map_is_installed
+                    map_state
+                    override_redirect
+                    colormap
+                    all_event_masks
+                    your_event_mask
+                    do_not_propagate_mask)
+ 
+data DestroyWindow = MkDestroyWindow{window_DestroyWindow ::
+                                     WINDOW}
+                   deriving (Show, Typeable)
+ 
+instance Serialize DestroyWindow where
+        serialize x
+          = do putWord8 4
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_DestroyWindow x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (window_DestroyWindow x)
+ 
+data DestroySubwindows = MkDestroySubwindows{window_DestroySubwindows
+                                             :: WINDOW}
+                       deriving (Show, Typeable)
+ 
+instance Serialize DestroySubwindows where
+        serialize x
+          = do putWord8 5
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_DestroySubwindows x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (window_DestroySubwindows x)
+ 
+data SetMode = SetModeInsert
+             | SetModeDelete
+ 
+instance SimpleEnum SetMode where
+        toValue SetModeInsert{} = 0
+        toValue SetModeDelete{} = 1
+        fromValue 0 = SetModeInsert
+        fromValue 1 = SetModeDelete
+ 
+data ChangeSaveSet = MkChangeSaveSet{mode_ChangeSaveSet :: Word8,
+                                     window_ChangeSaveSet :: WINDOW}
+                   deriving (Show, Typeable)
+ 
+instance Serialize ChangeSaveSet where
+        serialize x
+          = do putWord8 6
+               serialize (mode_ChangeSaveSet x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_ChangeSaveSet x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (mode_ChangeSaveSet x) + size (window_ChangeSaveSet x)
+ 
+data ReparentWindow = MkReparentWindow{window_ReparentWindow ::
+                                       WINDOW,
+                                       parent_ReparentWindow :: WINDOW, x_ReparentWindow :: Int16,
+                                       y_ReparentWindow :: Int16}
+                    deriving (Show, Typeable)
+ 
+instance Serialize ReparentWindow where
+        serialize x
+          = do putWord8 7
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_ReparentWindow x)
+               serialize (parent_ReparentWindow x)
+               serialize (x_ReparentWindow x)
+               serialize (y_ReparentWindow x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (window_ReparentWindow x) +
+              size (parent_ReparentWindow x)
+              + size (x_ReparentWindow x)
+              + size (y_ReparentWindow x)
+ 
+data MapWindow = MkMapWindow{window_MapWindow :: WINDOW}
+               deriving (Show, Typeable)
+ 
+instance Serialize MapWindow where
+        serialize x
+          = do putWord8 8
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_MapWindow x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (window_MapWindow x)
+ 
+data MapSubwindows = MkMapSubwindows{window_MapSubwindows ::
+                                     WINDOW}
+                   deriving (Show, Typeable)
+ 
+instance Serialize MapSubwindows where
+        serialize x
+          = do putWord8 9
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_MapSubwindows x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (window_MapSubwindows x)
+ 
+data UnmapWindow = MkUnmapWindow{window_UnmapWindow :: WINDOW}
+                 deriving (Show, Typeable)
+ 
+instance Serialize UnmapWindow where
+        serialize x
+          = do putWord8 10
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_UnmapWindow x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (window_UnmapWindow x)
+ 
+data UnmapSubwindows = MkUnmapSubwindows{window_UnmapSubwindows ::
+                                         WINDOW}
+                     deriving (Show, Typeable)
+ 
+instance Serialize UnmapSubwindows where
+        serialize x
+          = do putWord8 11
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_UnmapSubwindows x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (window_UnmapSubwindows x)
+ 
+data ConfigWindow = ConfigWindowX
+                  | ConfigWindowY
+                  | ConfigWindowWidth
+                  | ConfigWindowHeight
+                  | ConfigWindowBorderWidth
+                  | ConfigWindowSibling
+                  | ConfigWindowStackMode
+ 
+instance BitEnum ConfigWindow where
+        toBit ConfigWindowX{} = 0
+        toBit ConfigWindowY{} = 1
+        toBit ConfigWindowWidth{} = 2
+        toBit ConfigWindowHeight{} = 3
+        toBit ConfigWindowBorderWidth{} = 4
+        toBit ConfigWindowSibling{} = 5
+        toBit ConfigWindowStackMode{} = 6
+        fromBit 0 = ConfigWindowX
+        fromBit 1 = ConfigWindowY
+        fromBit 2 = ConfigWindowWidth
+        fromBit 3 = ConfigWindowHeight
+        fromBit 4 = ConfigWindowBorderWidth
+        fromBit 5 = ConfigWindowSibling
+        fromBit 6 = ConfigWindowStackMode
+ 
+data StackMode = StackModeAbove
+               | StackModeBelow
+               | StackModeTopIf
+               | StackModeBottomIf
+               | StackModeOpposite
+ 
+instance SimpleEnum StackMode where
+        toValue StackModeAbove{} = 0
+        toValue StackModeBelow{} = 1
+        toValue StackModeTopIf{} = 2
+        toValue StackModeBottomIf{} = 3
+        toValue StackModeOpposite{} = 4
+        fromValue 0 = StackModeAbove
+        fromValue 1 = StackModeBelow
+        fromValue 2 = StackModeTopIf
+        fromValue 3 = StackModeBottomIf
+        fromValue 4 = StackModeOpposite
+ 
+data ConfigureWindow = MkConfigureWindow{window_ConfigureWindow ::
+                                         WINDOW,
+                                         value_ConfigureWindow :: ValueParam Word16}
+                     deriving (Show, Typeable)
+ 
+instance Serialize ConfigureWindow where
+        serialize x
+          = do putWord8 12
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_ConfigureWindow x)
+               serializeValueParam 2 (value_ConfigureWindow x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (window_ConfigureWindow x) +
+              size (value_ConfigureWindow x)
+              + 2
+ 
+data Circulate = CirculateRaiseLowest
+               | CirculateLowerHighest
+ 
+instance SimpleEnum Circulate where
+        toValue CirculateRaiseLowest{} = 0
+        toValue CirculateLowerHighest{} = 1
+        fromValue 0 = CirculateRaiseLowest
+        fromValue 1 = CirculateLowerHighest
+ 
+data CirculateWindow = MkCirculateWindow{direction_CirculateWindow
+                                         :: Word8,
+                                         window_CirculateWindow :: WINDOW}
+                     deriving (Show, Typeable)
+ 
+instance Serialize CirculateWindow where
+        serialize x
+          = do putWord8 13
+               serialize (direction_CirculateWindow x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_CirculateWindow x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (direction_CirculateWindow x) +
+              size (window_CirculateWindow x)
+ 
+data GetGeometry = MkGetGeometry{drawable_GetGeometry :: DRAWABLE}
+                 deriving (Show, Typeable)
+ 
+instance Serialize GetGeometry where
+        serialize x
+          = do putWord8 14
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_GetGeometry x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (drawable_GetGeometry x)
+ 
+data GetGeometryReply = MkGetGeometryReply{depth_GetGeometryReply
+                                           :: Word8,
+                                           root_GetGeometryReply :: WINDOW,
+                                           x_GetGeometryReply :: Int16, y_GetGeometryReply :: Int16,
+                                           width_GetGeometryReply :: Word16,
+                                           height_GetGeometryReply :: Word16,
+                                           border_width_GetGeometryReply :: Word16}
+                      deriving (Show, Typeable)
+ 
+instance Deserialize GetGeometryReply where
+        deserialize
+          = do skip 1
+               depth <- deserialize
+               skip 2
+               length <- deserialize
+               root <- deserialize
+               x <- deserialize
+               y <- deserialize
+               width <- deserialize
+               height <- deserialize
+               border_width <- deserialize
+               skip 2
+               let _ = isCard32 length
+               return
+                 (MkGetGeometryReply depth root x y width height border_width)
+ 
+data QueryTree = MkQueryTree{window_QueryTree :: WINDOW}
+               deriving (Show, Typeable)
+ 
+instance Serialize QueryTree where
+        serialize x
+          = do putWord8 15
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_QueryTree x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (window_QueryTree x)
+ 
+data QueryTreeReply = MkQueryTreeReply{root_QueryTreeReply ::
+                                       WINDOW,
+                                       parent_QueryTreeReply :: WINDOW,
+                                       children_len_QueryTreeReply :: Word16,
+                                       children_QueryTreeReply :: [WINDOW]}
+                    deriving (Show, Typeable)
+ 
+instance Deserialize QueryTreeReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               root <- deserialize
+               parent <- deserialize
+               children_len <- deserialize
+               skip 14
+               children <- deserializeList (fromIntegral children_len)
+               let _ = isCard32 length
+               return (MkQueryTreeReply root parent children_len children)
+ 
+data InternAtom = MkInternAtom{only_if_exists_InternAtom :: Bool,
+                               name_len_InternAtom :: Word16, name_InternAtom :: [CChar]}
+                deriving (Show, Typeable)
+ 
+instance Serialize InternAtom where
+        serialize x
+          = do putWord8 16
+               serialize (only_if_exists_InternAtom x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (name_len_InternAtom x)
+               putSkip 2
+               serializeList (name_InternAtom x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (only_if_exists_InternAtom x) +
+              size (name_len_InternAtom x)
+              + 2
+              + sum (map size (name_InternAtom x))
+ 
+data InternAtomReply = MkInternAtomReply{atom_InternAtomReply ::
+                                         ATOM}
+                     deriving (Show, Typeable)
+ 
+instance Deserialize InternAtomReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               atom <- deserialize
+               let _ = isCard32 length
+               return (MkInternAtomReply atom)
+ 
+data GetAtomName = MkGetAtomName{atom_GetAtomName :: ATOM}
+                 deriving (Show, Typeable)
+ 
+instance Serialize GetAtomName where
+        serialize x
+          = do putWord8 17
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (atom_GetAtomName x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (atom_GetAtomName x)
+ 
+data GetAtomNameReply = MkGetAtomNameReply{name_len_GetAtomNameReply
+                                           :: Word16,
+                                           name_GetAtomNameReply :: [CChar]}
+                      deriving (Show, Typeable)
+ 
+instance Deserialize GetAtomNameReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               name_len <- deserialize
+               skip 22
+               name <- deserializeList (fromIntegral name_len)
+               let _ = isCard32 length
+               return (MkGetAtomNameReply name_len name)
+ 
+data PropMode = PropModeReplace
+              | PropModePrepend
+              | PropModeAppend
+ 
+instance SimpleEnum PropMode where
+        toValue PropModeReplace{} = 0
+        toValue PropModePrepend{} = 1
+        toValue PropModeAppend{} = 2
+        fromValue 0 = PropModeReplace
+        fromValue 1 = PropModePrepend
+        fromValue 2 = PropModeAppend
+ 
+data ChangeProperty = MkChangeProperty{mode_ChangeProperty ::
+                                       Word8,
+                                       window_ChangeProperty :: WINDOW,
+                                       property_ChangeProperty :: ATOM, type_ChangeProperty :: ATOM,
+                                       format_ChangeProperty :: Word8,
+                                       data_len_ChangeProperty :: Word32,
+                                       data_ChangeProperty :: [Word8]}
+                    deriving (Show, Typeable)
+ 
+instance Serialize ChangeProperty where
+        serialize x
+          = do putWord8 18
+               serialize (mode_ChangeProperty x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_ChangeProperty x)
+               serialize (property_ChangeProperty x)
+               serialize (type_ChangeProperty x)
+               serialize (format_ChangeProperty x)
+               putSkip 3
+               serialize (data_len_ChangeProperty x)
+               serializeList (data_ChangeProperty x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (mode_ChangeProperty x) + size (window_ChangeProperty x)
+              + size (property_ChangeProperty x)
+              + size (type_ChangeProperty x)
+              + size (format_ChangeProperty x)
+              + 3
+              + size (data_len_ChangeProperty x)
+              + sum (map size (data_ChangeProperty x))
+ 
+data DeleteProperty = MkDeleteProperty{window_DeleteProperty ::
+                                       WINDOW,
+                                       property_DeleteProperty :: ATOM}
+                    deriving (Show, Typeable)
+ 
+instance Serialize DeleteProperty where
+        serialize x
+          = do putWord8 19
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_DeleteProperty x)
+               serialize (property_DeleteProperty x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (window_DeleteProperty x) +
+              size (property_DeleteProperty x)
+ 
+data GetPropertyType = GetPropertyTypeAny
+ 
+instance SimpleEnum GetPropertyType where
+        toValue GetPropertyTypeAny{} = 0
+        fromValue 0 = GetPropertyTypeAny
+ 
+data GetProperty = MkGetProperty{delete_GetProperty :: Bool,
+                                 window_GetProperty :: WINDOW, property_GetProperty :: ATOM,
+                                 type_GetProperty :: ATOM, long_offset_GetProperty :: Word32,
+                                 long_length_GetProperty :: Word32}
+                 deriving (Show, Typeable)
+ 
+instance Serialize GetProperty where
+        serialize x
+          = do putWord8 20
+               serialize (delete_GetProperty x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_GetProperty x)
+               serialize (property_GetProperty x)
+               serialize (type_GetProperty x)
+               serialize (long_offset_GetProperty x)
+               serialize (long_length_GetProperty x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (delete_GetProperty x) + size (window_GetProperty x) +
+              size (property_GetProperty x)
+              + size (type_GetProperty x)
+              + size (long_offset_GetProperty x)
+              + size (long_length_GetProperty x)
+ 
+data GetPropertyReply = MkGetPropertyReply{format_GetPropertyReply
+                                           :: Word8,
+                                           type_GetPropertyReply :: ATOM,
+                                           bytes_after_GetPropertyReply :: Word32,
+                                           value_len_GetPropertyReply :: Word32,
+                                           value_GetPropertyReply :: [Word8]}
+                      deriving (Show, Typeable)
+ 
+instance Deserialize GetPropertyReply where
+        deserialize
+          = do skip 1
+               format <- deserialize
+               skip 2
+               length <- deserialize
+               type_ <- deserialize
+               bytes_after <- deserialize
+               value_len <- deserialize
+               skip 12
+               value <- deserializeList (fromIntegral value_len)
+               let _ = isCard32 length
+               return
+                 (MkGetPropertyReply format type_ bytes_after value_len value)
+ 
+data ListProperties = MkListProperties{window_ListProperties ::
+                                       WINDOW}
+                    deriving (Show, Typeable)
+ 
+instance Serialize ListProperties where
+        serialize x
+          = do putWord8 21
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_ListProperties x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (window_ListProperties x)
+ 
+data ListPropertiesReply = MkListPropertiesReply{atoms_len_ListPropertiesReply
+                                                 :: Word16,
+                                                 atoms_ListPropertiesReply :: [ATOM]}
+                         deriving (Show, Typeable)
+ 
+instance Deserialize ListPropertiesReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               atoms_len <- deserialize
+               skip 22
+               atoms <- deserializeList (fromIntegral atoms_len)
+               let _ = isCard32 length
+               return (MkListPropertiesReply atoms_len atoms)
+ 
+data SetSelectionOwner = MkSetSelectionOwner{owner_SetSelectionOwner
+                                             :: WINDOW,
+                                             selection_SetSelectionOwner :: ATOM,
+                                             time_SetSelectionOwner :: TIMESTAMP}
+                       deriving (Show, Typeable)
+ 
+instance Serialize SetSelectionOwner where
+        serialize x
+          = do putWord8 22
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (owner_SetSelectionOwner x)
+               serialize (selection_SetSelectionOwner x)
+               serialize (time_SetSelectionOwner x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (owner_SetSelectionOwner x) +
+              size (selection_SetSelectionOwner x)
+              + size (time_SetSelectionOwner x)
+ 
+data GetSelectionOwner = MkGetSelectionOwner{selection_GetSelectionOwner
+                                             :: ATOM}
+                       deriving (Show, Typeable)
+ 
+instance Serialize GetSelectionOwner where
+        serialize x
+          = do putWord8 23
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (selection_GetSelectionOwner x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (selection_GetSelectionOwner x)
+ 
+data GetSelectionOwnerReply = MkGetSelectionOwnerReply{owner_GetSelectionOwnerReply
+                                                       :: WINDOW}
+                            deriving (Show, Typeable)
+ 
+instance Deserialize GetSelectionOwnerReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               owner <- deserialize
+               let _ = isCard32 length
+               return (MkGetSelectionOwnerReply owner)
+ 
+data ConvertSelection = MkConvertSelection{requestor_ConvertSelection
+                                           :: WINDOW,
+                                           selection_ConvertSelection :: ATOM,
+                                           target_ConvertSelection :: ATOM,
+                                           property_ConvertSelection :: ATOM,
+                                           time_ConvertSelection :: TIMESTAMP}
+                      deriving (Show, Typeable)
+ 
+instance Serialize ConvertSelection where
+        serialize x
+          = do putWord8 24
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (requestor_ConvertSelection x)
+               serialize (selection_ConvertSelection x)
+               serialize (target_ConvertSelection x)
+               serialize (property_ConvertSelection x)
+               serialize (time_ConvertSelection x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (requestor_ConvertSelection x) +
+              size (selection_ConvertSelection x)
+              + size (target_ConvertSelection x)
+              + size (property_ConvertSelection x)
+              + size (time_ConvertSelection x)
+ 
+data SendEventDest = SendEventDestPointerWindow
+                   | SendEventDestItemFocus
+ 
+instance SimpleEnum SendEventDest where
+        toValue SendEventDestPointerWindow{} = 0
+        toValue SendEventDestItemFocus{} = 1
+        fromValue 0 = SendEventDestPointerWindow
+        fromValue 1 = SendEventDestItemFocus
+ 
+data SendEvent = MkSendEvent{propagate_SendEvent :: Bool,
+                             destination_SendEvent :: WINDOW, event_mask_SendEvent :: Word32,
+                             event_SendEvent :: [CChar]}
+               deriving (Show, Typeable)
+ 
+instance Serialize SendEvent where
+        serialize x
+          = do putWord8 25
+               serialize (propagate_SendEvent x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (destination_SendEvent x)
+               serialize (event_mask_SendEvent x)
+               serializeList (event_SendEvent x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (propagate_SendEvent x) + size (destination_SendEvent x)
+              + size (event_mask_SendEvent x)
+              + sum (map size (event_SendEvent x))
+ 
+data GrabMode = GrabModeSync
+              | GrabModeAsync
+ 
+instance SimpleEnum GrabMode where
+        toValue GrabModeSync{} = 0
+        toValue GrabModeAsync{} = 1
+        fromValue 0 = GrabModeSync
+        fromValue 1 = GrabModeAsync
+ 
+data GrabStatus = GrabStatusSuccess
+                | GrabStatusAlreadyGrabbed
+                | GrabStatusInvalidTime
+                | GrabStatusNotViewable
+                | GrabStatusFrozen
+ 
+instance SimpleEnum GrabStatus where
+        toValue GrabStatusSuccess{} = 0
+        toValue GrabStatusAlreadyGrabbed{} = 1
+        toValue GrabStatusInvalidTime{} = 2
+        toValue GrabStatusNotViewable{} = 3
+        toValue GrabStatusFrozen{} = 4
+        fromValue 0 = GrabStatusSuccess
+        fromValue 1 = GrabStatusAlreadyGrabbed
+        fromValue 2 = GrabStatusInvalidTime
+        fromValue 3 = GrabStatusNotViewable
+        fromValue 4 = GrabStatusFrozen
+ 
+data GrabPointer = MkGrabPointer{owner_events_GrabPointer :: Bool,
+                                 grab_window_GrabPointer :: WINDOW,
+                                 event_mask_GrabPointer :: Word16,
+                                 pointer_mode_GrabPointer :: Word8,
+                                 keyboard_mode_GrabPointer :: Word8,
+                                 confine_to_GrabPointer :: WINDOW, cursor_GrabPointer :: CURSOR,
+                                 time_GrabPointer :: TIMESTAMP}
+                 deriving (Show, Typeable)
+ 
+instance Serialize GrabPointer where
+        serialize x
+          = do putWord8 26
+               serialize (owner_events_GrabPointer x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (grab_window_GrabPointer x)
+               serialize (event_mask_GrabPointer x)
+               serialize (pointer_mode_GrabPointer x)
+               serialize (keyboard_mode_GrabPointer x)
+               serialize (confine_to_GrabPointer x)
+               serialize (cursor_GrabPointer x)
+               serialize (time_GrabPointer x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (owner_events_GrabPointer x) +
+              size (grab_window_GrabPointer x)
+              + size (event_mask_GrabPointer x)
+              + size (pointer_mode_GrabPointer x)
+              + size (keyboard_mode_GrabPointer x)
+              + size (confine_to_GrabPointer x)
+              + size (cursor_GrabPointer x)
+              + size (time_GrabPointer x)
+ 
+data GrabPointerReply = MkGrabPointerReply{status_GrabPointerReply
+                                           :: Word8}
+                      deriving (Show, Typeable)
+ 
+instance Deserialize GrabPointerReply where
+        deserialize
+          = do skip 1
+               status <- deserialize
+               skip 2
+               length <- deserialize
+               let _ = isCard32 length
+               return (MkGrabPointerReply status)
+ 
+data UngrabPointer = MkUngrabPointer{time_UngrabPointer ::
+                                     TIMESTAMP}
+                   deriving (Show, Typeable)
+ 
+instance Serialize UngrabPointer where
+        serialize x
+          = do putWord8 27
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (time_UngrabPointer x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (time_UngrabPointer x)
+ 
+data ButtonIndex = ButtonIndexAny
+                 | ButtonIndex1
+                 | ButtonIndex2
+                 | ButtonIndex3
+                 | ButtonIndex4
+                 | ButtonIndex5
+ 
+instance SimpleEnum ButtonIndex where
+        toValue ButtonIndexAny{} = 0
+        toValue ButtonIndex1{} = 1
+        toValue ButtonIndex2{} = 2
+        toValue ButtonIndex3{} = 3
+        toValue ButtonIndex4{} = 4
+        toValue ButtonIndex5{} = 5
+        fromValue 0 = ButtonIndexAny
+        fromValue 1 = ButtonIndex1
+        fromValue 2 = ButtonIndex2
+        fromValue 3 = ButtonIndex3
+        fromValue 4 = ButtonIndex4
+        fromValue 5 = ButtonIndex5
+ 
+data GrabButton = MkGrabButton{owner_events_GrabButton :: Bool,
+                               grab_window_GrabButton :: WINDOW, event_mask_GrabButton :: Word16,
+                               pointer_mode_GrabButton :: Word8,
+                               keyboard_mode_GrabButton :: Word8, confine_to_GrabButton :: WINDOW,
+                               cursor_GrabButton :: CURSOR, button_GrabButton :: Word8,
+                               modifiers_GrabButton :: Word16}
+                deriving (Show, Typeable)
+ 
+instance Serialize GrabButton where
+        serialize x
+          = do putWord8 28
+               serialize (owner_events_GrabButton x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (grab_window_GrabButton x)
+               serialize (event_mask_GrabButton x)
+               serialize (pointer_mode_GrabButton x)
+               serialize (keyboard_mode_GrabButton x)
+               serialize (confine_to_GrabButton x)
+               serialize (cursor_GrabButton x)
+               serialize (button_GrabButton x)
+               putSkip 1
+               serialize (modifiers_GrabButton x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (owner_events_GrabButton x) +
+              size (grab_window_GrabButton x)
+              + size (event_mask_GrabButton x)
+              + size (pointer_mode_GrabButton x)
+              + size (keyboard_mode_GrabButton x)
+              + size (confine_to_GrabButton x)
+              + size (cursor_GrabButton x)
+              + size (button_GrabButton x)
+              + 1
+              + size (modifiers_GrabButton x)
+ 
+data UngrabButton = MkUngrabButton{button_UngrabButton :: Word8,
+                                   grab_window_UngrabButton :: WINDOW,
+                                   modifiers_UngrabButton :: Word16}
+                  deriving (Show, Typeable)
+ 
+instance Serialize UngrabButton where
+        serialize x
+          = do putWord8 29
+               serialize (button_UngrabButton x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (grab_window_UngrabButton x)
+               serialize (modifiers_UngrabButton x)
+               putSkip 2
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (button_UngrabButton x) +
+              size (grab_window_UngrabButton x)
+              + size (modifiers_UngrabButton x)
+              + 2
+ 
+data ChangeActivePointerGrab = MkChangeActivePointerGrab{cursor_ChangeActivePointerGrab
+                                                         :: CURSOR,
+                                                         time_ChangeActivePointerGrab :: TIMESTAMP,
+                                                         event_mask_ChangeActivePointerGrab ::
+                                                         Word16}
+                             deriving (Show, Typeable)
+ 
+instance Serialize ChangeActivePointerGrab where
+        serialize x
+          = do putWord8 30
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cursor_ChangeActivePointerGrab x)
+               serialize (time_ChangeActivePointerGrab x)
+               serialize (event_mask_ChangeActivePointerGrab x)
+               putSkip 2
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (cursor_ChangeActivePointerGrab x) +
+              size (time_ChangeActivePointerGrab x)
+              + size (event_mask_ChangeActivePointerGrab x)
+              + 2
+ 
+data GrabKeyboard = MkGrabKeyboard{owner_events_GrabKeyboard ::
+                                   Bool,
+                                   grab_window_GrabKeyboard :: WINDOW,
+                                   time_GrabKeyboard :: TIMESTAMP,
+                                   pointer_mode_GrabKeyboard :: Word8,
+                                   keyboard_mode_GrabKeyboard :: Word8}
+                  deriving (Show, Typeable)
+ 
+instance Serialize GrabKeyboard where
+        serialize x
+          = do putWord8 31
+               serialize (owner_events_GrabKeyboard x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (grab_window_GrabKeyboard x)
+               serialize (time_GrabKeyboard x)
+               serialize (pointer_mode_GrabKeyboard x)
+               serialize (keyboard_mode_GrabKeyboard x)
+               putSkip 2
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (owner_events_GrabKeyboard x) +
+              size (grab_window_GrabKeyboard x)
+              + size (time_GrabKeyboard x)
+              + size (pointer_mode_GrabKeyboard x)
+              + size (keyboard_mode_GrabKeyboard x)
+              + 2
+ 
+data GrabKeyboardReply = MkGrabKeyboardReply{status_GrabKeyboardReply
+                                             :: Word8}
+                       deriving (Show, Typeable)
+ 
+instance Deserialize GrabKeyboardReply where
+        deserialize
+          = do skip 1
+               status <- deserialize
+               skip 2
+               length <- deserialize
+               let _ = isCard32 length
+               return (MkGrabKeyboardReply status)
+ 
+data UngrabKeyboard = MkUngrabKeyboard{time_UngrabKeyboard ::
+                                       TIMESTAMP}
+                    deriving (Show, Typeable)
+ 
+instance Serialize UngrabKeyboard where
+        serialize x
+          = do putWord8 32
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (time_UngrabKeyboard x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (time_UngrabKeyboard x)
+ 
+data Grab = GrabAny
+ 
+instance SimpleEnum Grab where
+        toValue GrabAny{} = 0
+        fromValue 0 = GrabAny
+ 
+data GrabKey = MkGrabKey{owner_events_GrabKey :: Bool,
+                         grab_window_GrabKey :: WINDOW, modifiers_GrabKey :: Word16,
+                         key_GrabKey :: KEYCODE, pointer_mode_GrabKey :: Word8,
+                         keyboard_mode_GrabKey :: Word8}
+             deriving (Show, Typeable)
+ 
+instance Serialize GrabKey where
+        serialize x
+          = do putWord8 33
+               serialize (owner_events_GrabKey x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (grab_window_GrabKey x)
+               serialize (modifiers_GrabKey x)
+               serialize (key_GrabKey x)
+               serialize (pointer_mode_GrabKey x)
+               serialize (keyboard_mode_GrabKey x)
+               putSkip 3
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (owner_events_GrabKey x) + size (grab_window_GrabKey x)
+              + size (modifiers_GrabKey x)
+              + size (key_GrabKey x)
+              + size (pointer_mode_GrabKey x)
+              + size (keyboard_mode_GrabKey x)
+              + 3
+ 
+data UngrabKey = MkUngrabKey{key_UngrabKey :: KEYCODE,
+                             grab_window_UngrabKey :: WINDOW, modifiers_UngrabKey :: Word16}
+               deriving (Show, Typeable)
+ 
+instance Serialize UngrabKey where
+        serialize x
+          = do putWord8 34
+               serialize (key_UngrabKey x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (grab_window_UngrabKey x)
+               serialize (modifiers_UngrabKey x)
+               putSkip 2
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (key_UngrabKey x) + size (grab_window_UngrabKey x) +
+              size (modifiers_UngrabKey x)
+              + 2
+ 
+data Allow = AllowAsyncPointer
+           | AllowSyncPointer
+           | AllowReplayPointer
+           | AllowAsyncKeyboard
+           | AllowSyncKeyboard
+           | AllowReplayKeyboard
+           | AllowAsyncBoth
+           | AllowSyncBoth
+ 
+instance SimpleEnum Allow where
+        toValue AllowAsyncPointer{} = 0
+        toValue AllowSyncPointer{} = 1
+        toValue AllowReplayPointer{} = 2
+        toValue AllowAsyncKeyboard{} = 3
+        toValue AllowSyncKeyboard{} = 4
+        toValue AllowReplayKeyboard{} = 5
+        toValue AllowAsyncBoth{} = 6
+        toValue AllowSyncBoth{} = 7
+        fromValue 0 = AllowAsyncPointer
+        fromValue 1 = AllowSyncPointer
+        fromValue 2 = AllowReplayPointer
+        fromValue 3 = AllowAsyncKeyboard
+        fromValue 4 = AllowSyncKeyboard
+        fromValue 5 = AllowReplayKeyboard
+        fromValue 6 = AllowAsyncBoth
+        fromValue 7 = AllowSyncBoth
+ 
+data AllowEvents = MkAllowEvents{mode_AllowEvents :: Word8,
+                                 time_AllowEvents :: TIMESTAMP}
+                 deriving (Show, Typeable)
+ 
+instance Serialize AllowEvents where
+        serialize x
+          = do putWord8 35
+               serialize (mode_AllowEvents x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (time_AllowEvents x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + size (mode_AllowEvents x) + size (time_AllowEvents x)
+ 
+data QueryPointer = MkQueryPointer{window_QueryPointer :: WINDOW}
+                  deriving (Show, Typeable)
+ 
+instance Serialize QueryPointer where
+        serialize x
+          = do putWord8 38
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_QueryPointer x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (window_QueryPointer x)
+ 
+data QueryPointerReply = MkQueryPointerReply{same_screen_QueryPointerReply
+                                             :: Bool,
+                                             root_QueryPointerReply :: WINDOW,
+                                             child_QueryPointerReply :: WINDOW,
+                                             root_x_QueryPointerReply :: Int16,
+                                             root_y_QueryPointerReply :: Int16,
+                                             win_x_QueryPointerReply :: Int16,
+                                             win_y_QueryPointerReply :: Int16,
+                                             mask_QueryPointerReply :: Word16}
+                       deriving (Show, Typeable)
+ 
+instance Deserialize QueryPointerReply where
+        deserialize
+          = do skip 1
+               same_screen <- deserialize
+               skip 2
+               length <- deserialize
+               root <- deserialize
+               child <- deserialize
+               root_x <- deserialize
+               root_y <- deserialize
+               win_x <- deserialize
+               win_y <- deserialize
+               mask <- deserialize
+               skip 2
+               let _ = isCard32 length
+               return
+                 (MkQueryPointerReply same_screen root child root_x root_y win_x
+                    win_y
+                    mask)
+ 
+data TIMECOORD = MkTIMECOORD{time_TIMECOORD :: TIMESTAMP,
+                             x_TIMECOORD :: Int16, y_TIMECOORD :: Int16}
+               deriving (Show, Typeable)
+ 
+instance Serialize TIMECOORD where
+        serialize x
+          = do serialize (time_TIMECOORD x)
+               serialize (x_TIMECOORD x)
+               serialize (y_TIMECOORD x)
+        size x
+          = size (time_TIMECOORD x) + size (x_TIMECOORD x) +
+              size (y_TIMECOORD x)
+ 
+instance Deserialize TIMECOORD where
+        deserialize
+          = do time <- deserialize
+               x <- deserialize
+               y <- deserialize
+               return (MkTIMECOORD time x y)
+ 
+data GetMotionEvents = MkGetMotionEvents{window_GetMotionEvents ::
+                                         WINDOW,
+                                         start_GetMotionEvents :: TIMESTAMP,
+                                         stop_GetMotionEvents :: TIMESTAMP}
+                     deriving (Show, Typeable)
+ 
+instance Serialize GetMotionEvents where
+        serialize x
+          = do putWord8 39
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_GetMotionEvents x)
+               serialize (start_GetMotionEvents x)
+               serialize (stop_GetMotionEvents x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (window_GetMotionEvents x) +
+              size (start_GetMotionEvents x)
+              + size (stop_GetMotionEvents x)
+ 
+data GetMotionEventsReply = MkGetMotionEventsReply{events_len_GetMotionEventsReply
+                                                   :: Word32,
+                                                   events_GetMotionEventsReply :: [TIMECOORD]}
+                          deriving (Show, Typeable)
+ 
+instance Deserialize GetMotionEventsReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               events_len <- deserialize
+               skip 20
+               events <- deserializeList (fromIntegral events_len)
+               let _ = isCard32 length
+               return (MkGetMotionEventsReply events_len events)
+ 
+data TranslateCoordinates = MkTranslateCoordinates{src_window_TranslateCoordinates
+                                                   :: WINDOW,
+                                                   dst_window_TranslateCoordinates :: WINDOW,
+                                                   src_x_TranslateCoordinates :: Int16,
+                                                   src_y_TranslateCoordinates :: Int16}
+                          deriving (Show, Typeable)
+ 
+instance Serialize TranslateCoordinates where
+        serialize x
+          = do putWord8 40
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (src_window_TranslateCoordinates x)
+               serialize (dst_window_TranslateCoordinates x)
+               serialize (src_x_TranslateCoordinates x)
+               serialize (src_y_TranslateCoordinates x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (src_window_TranslateCoordinates x) +
+              size (dst_window_TranslateCoordinates x)
+              + size (src_x_TranslateCoordinates x)
+              + size (src_y_TranslateCoordinates x)
+ 
+data TranslateCoordinatesReply = MkTranslateCoordinatesReply{same_screen_TranslateCoordinatesReply
+                                                             :: Bool,
+                                                             child_TranslateCoordinatesReply ::
+                                                             WINDOW,
+                                                             dst_x_TranslateCoordinatesReply ::
+                                                             Word16,
+                                                             dst_y_TranslateCoordinatesReply ::
+                                                             Word16}
+                               deriving (Show, Typeable)
+ 
+instance Deserialize TranslateCoordinatesReply where
+        deserialize
+          = do skip 1
+               same_screen <- deserialize
+               skip 2
+               length <- deserialize
+               child <- deserialize
+               dst_x <- deserialize
+               dst_y <- deserialize
+               let _ = isCard32 length
+               return (MkTranslateCoordinatesReply same_screen child dst_x dst_y)
+ 
+data WarpPointer = MkWarpPointer{src_window_WarpPointer :: WINDOW,
+                                 dst_window_WarpPointer :: WINDOW, src_x_WarpPointer :: Int16,
+                                 src_y_WarpPointer :: Int16, src_width_WarpPointer :: Word16,
+                                 src_height_WarpPointer :: Word16, dst_x_WarpPointer :: Int16,
+                                 dst_y_WarpPointer :: Int16}
+                 deriving (Show, Typeable)
+ 
+instance Serialize WarpPointer where
+        serialize x
+          = do putWord8 41
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (src_window_WarpPointer x)
+               serialize (dst_window_WarpPointer x)
+               serialize (src_x_WarpPointer x)
+               serialize (src_y_WarpPointer x)
+               serialize (src_width_WarpPointer x)
+               serialize (src_height_WarpPointer x)
+               serialize (dst_x_WarpPointer x)
+               serialize (dst_y_WarpPointer x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (src_window_WarpPointer x) +
+              size (dst_window_WarpPointer x)
+              + size (src_x_WarpPointer x)
+              + size (src_y_WarpPointer x)
+              + size (src_width_WarpPointer x)
+              + size (src_height_WarpPointer x)
+              + size (dst_x_WarpPointer x)
+              + size (dst_y_WarpPointer x)
+ 
+data InputFocus = InputFocusNone
+                | InputFocusPointerRoot
+                | InputFocusParent
+ 
+instance SimpleEnum InputFocus where
+        toValue InputFocusNone{} = 0
+        toValue InputFocusPointerRoot{} = 1
+        toValue InputFocusParent{} = 2
+        fromValue 0 = InputFocusNone
+        fromValue 1 = InputFocusPointerRoot
+        fromValue 2 = InputFocusParent
+ 
+data SetInputFocus = MkSetInputFocus{revert_to_SetInputFocus ::
+                                     Word8,
+                                     focus_SetInputFocus :: WINDOW, time_SetInputFocus :: TIMESTAMP}
+                   deriving (Show, Typeable)
+ 
+instance Serialize SetInputFocus where
+        serialize x
+          = do putWord8 42
+               serialize (revert_to_SetInputFocus x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (focus_SetInputFocus x)
+               serialize (time_SetInputFocus x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (revert_to_SetInputFocus x) +
+              size (focus_SetInputFocus x)
+              + size (time_SetInputFocus x)
+ 
+data GetInputFocus = MkGetInputFocus{}
+                   deriving (Show, Typeable)
+ 
+instance Serialize GetInputFocus where
+        serialize x
+          = do putWord8 43
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 4
+ 
+data GetInputFocusReply = MkGetInputFocusReply{revert_to_GetInputFocusReply
+                                               :: Word8,
+                                               focus_GetInputFocusReply :: WINDOW}
+                        deriving (Show, Typeable)
+ 
+instance Deserialize GetInputFocusReply where
+        deserialize
+          = do skip 1
+               revert_to <- deserialize
+               skip 2
+               length <- deserialize
+               focus <- deserialize
+               let _ = isCard32 length
+               return (MkGetInputFocusReply revert_to focus)
+ 
+data QueryKeymap = MkQueryKeymap{}
+                 deriving (Show, Typeable)
+ 
+instance Serialize QueryKeymap where
+        serialize x
+          = do putWord8 44
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 4
+ 
+data QueryKeymapReply = MkQueryKeymapReply{keys_QueryKeymapReply ::
+                                           [Word8]}
+                      deriving (Show, Typeable)
+ 
+instance Deserialize QueryKeymapReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               keys <- deserializeList (fromIntegral 32)
+               let _ = isCard32 length
+               return (MkQueryKeymapReply keys)
+ 
+data OpenFont = MkOpenFont{fid_OpenFont :: FONT,
+                           name_len_OpenFont :: Word16, name_OpenFont :: [CChar]}
+              deriving (Show, Typeable)
+ 
+instance Serialize OpenFont where
+        serialize x
+          = do putWord8 45
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (fid_OpenFont x)
+               serialize (name_len_OpenFont x)
+               putSkip 2
+               serializeList (name_OpenFont x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (fid_OpenFont x) + size (name_len_OpenFont x) + 2 +
+              sum (map size (name_OpenFont x))
+ 
+data CloseFont = MkCloseFont{font_CloseFont :: FONT}
+               deriving (Show, Typeable)
+ 
+instance Serialize CloseFont where
+        serialize x
+          = do putWord8 46
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (font_CloseFont x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (font_CloseFont x)
+ 
+data FontDraw = FontDrawLeftToRight
+              | FontDrawRightToLeft
+ 
+instance SimpleEnum FontDraw where
+        toValue FontDrawLeftToRight{} = 0
+        toValue FontDrawRightToLeft{} = 1
+        fromValue 0 = FontDrawLeftToRight
+        fromValue 1 = FontDrawRightToLeft
+ 
+data FONTPROP = MkFONTPROP{name_FONTPROP :: ATOM,
+                           value_FONTPROP :: Word32}
+              deriving (Show, Typeable)
+ 
+instance Serialize FONTPROP where
+        serialize x
+          = do serialize (name_FONTPROP x)
+               serialize (value_FONTPROP x)
+        size x = size (name_FONTPROP x) + size (value_FONTPROP x)
+ 
+instance Deserialize FONTPROP where
+        deserialize
+          = do name <- deserialize
+               value <- deserialize
+               return (MkFONTPROP name value)
+ 
+data CHARINFO = MkCHARINFO{left_side_bearing_CHARINFO :: Int16,
+                           right_side_bearing_CHARINFO :: Int16,
+                           character_width_CHARINFO :: Int16, ascent_CHARINFO :: Int16,
+                           descent_CHARINFO :: Int16, attributes_CHARINFO :: Word16}
+              deriving (Show, Typeable)
+ 
+instance Serialize CHARINFO where
+        serialize x
+          = do serialize (left_side_bearing_CHARINFO x)
+               serialize (right_side_bearing_CHARINFO x)
+               serialize (character_width_CHARINFO x)
+               serialize (ascent_CHARINFO x)
+               serialize (descent_CHARINFO x)
+               serialize (attributes_CHARINFO x)
+        size x
+          = size (left_side_bearing_CHARINFO x) +
+              size (right_side_bearing_CHARINFO x)
+              + size (character_width_CHARINFO x)
+              + size (ascent_CHARINFO x)
+              + size (descent_CHARINFO x)
+              + size (attributes_CHARINFO x)
+ 
+instance Deserialize CHARINFO where
+        deserialize
+          = do left_side_bearing <- deserialize
+               right_side_bearing <- deserialize
+               character_width <- deserialize
+               ascent <- deserialize
+               descent <- deserialize
+               attributes <- deserialize
+               return
+                 (MkCHARINFO left_side_bearing right_side_bearing character_width
+                    ascent
+                    descent
+                    attributes)
+ 
+data QueryFont = MkQueryFont{font_QueryFont :: FONTABLE}
+               deriving (Show, Typeable)
+ 
+instance Serialize QueryFont where
+        serialize x
+          = do putWord8 47
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (font_QueryFont x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (font_QueryFont x)
+ 
+data QueryFontReply = MkQueryFontReply{min_bounds_QueryFontReply ::
+                                       CHARINFO,
+                                       max_bounds_QueryFontReply :: CHARINFO,
+                                       min_char_or_byte2_QueryFontReply :: Word16,
+                                       max_char_or_byte2_QueryFontReply :: Word16,
+                                       default_char_QueryFontReply :: Word16,
+                                       properties_len_QueryFontReply :: Word16,
+                                       draw_direction_QueryFontReply :: Word8,
+                                       min_byte1_QueryFontReply :: Word8,
+                                       max_byte1_QueryFontReply :: Word8,
+                                       all_chars_exist_QueryFontReply :: Bool,
+                                       font_ascent_QueryFontReply :: Int16,
+                                       font_descent_QueryFontReply :: Int16,
+                                       char_infos_len_QueryFontReply :: Word32,
+                                       properties_QueryFontReply :: [FONTPROP],
+                                       char_infos_QueryFontReply :: [CHARINFO]}
+                    deriving (Show, Typeable)
+ 
+instance Deserialize QueryFontReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               min_bounds <- deserialize
+               skip 4
+               max_bounds <- deserialize
+               skip 4
+               min_char_or_byte2 <- deserialize
+               max_char_or_byte2 <- deserialize
+               default_char <- deserialize
+               properties_len <- deserialize
+               draw_direction <- deserialize
+               min_byte1 <- deserialize
+               max_byte1 <- deserialize
+               all_chars_exist <- deserialize
+               font_ascent <- deserialize
+               font_descent <- deserialize
+               char_infos_len <- deserialize
+               properties <- deserializeList (fromIntegral properties_len)
+               char_infos <- deserializeList (fromIntegral char_infos_len)
+               let _ = isCard32 length
+               return
+                 (MkQueryFontReply min_bounds max_bounds min_char_or_byte2
+                    max_char_or_byte2
+                    default_char
+                    properties_len
+                    draw_direction
+                    min_byte1
+                    max_byte1
+                    all_chars_exist
+                    font_ascent
+                    font_descent
+                    char_infos_len
+                    properties
+                    char_infos)
+ 
+data QueryTextExtents = MkQueryTextExtents{font_QueryTextExtents ::
+                                           FONTABLE,
+                                           string_QueryTextExtents :: [CHAR2B]}
+                      deriving (Show, Typeable)
+ 
+odd_length_QueryTextExtents :: QueryTextExtents -> Bool
+odd_length_QueryTextExtents x
+  = wordToBool (string_len_QueryTextExtents x .&. 1)
+
+string_len_QueryTextExtents :: QueryTextExtents -> Word8
+string_len_QueryTextExtents x = genericLength $ string_QueryTextExtents x
+ 
+instance Serialize QueryTextExtents where
+        serialize x
+          = do putWord8 48
+               serialize (odd_length_QueryTextExtents x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (font_QueryTextExtents x)
+               serializeList (string_QueryTextExtents x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (odd_length_QueryTextExtents x) +
+              size (font_QueryTextExtents x)
+              + sum (map size (string_QueryTextExtents x))
+ 
+data QueryTextExtentsReply = MkQueryTextExtentsReply{draw_direction_QueryTextExtentsReply
+                                                     :: Word8,
+                                                     font_ascent_QueryTextExtentsReply :: Int16,
+                                                     font_descent_QueryTextExtentsReply :: Int16,
+                                                     overall_ascent_QueryTextExtentsReply :: Int16,
+                                                     overall_descent_QueryTextExtentsReply :: Int16,
+                                                     overall_width_QueryTextExtentsReply :: Int32,
+                                                     overall_left_QueryTextExtentsReply :: Int32,
+                                                     overall_right_QueryTextExtentsReply :: Int32}
+                           deriving (Show, Typeable)
+ 
+instance Deserialize QueryTextExtentsReply where
+        deserialize
+          = do skip 1
+               draw_direction <- deserialize
+               skip 2
+               length <- deserialize
+               font_ascent <- deserialize
+               font_descent <- deserialize
+               overall_ascent <- deserialize
+               overall_descent <- deserialize
+               overall_width <- deserialize
+               overall_left <- deserialize
+               overall_right <- deserialize
+               let _ = isCard32 length
+               return
+                 (MkQueryTextExtentsReply draw_direction font_ascent font_descent
+                    overall_ascent
+                    overall_descent
+                    overall_width
+                    overall_left
+                    overall_right)
+ 
+data STR = MkSTR{name_len_STR :: Word8, name_STR :: [CChar]}
+         deriving (Show, Typeable)
+ 
+instance Serialize STR where
+        serialize x
+          = do serialize (name_len_STR x)
+               serializeList (name_STR x)
+        size x = size (name_len_STR x) + sum (map size (name_STR x))
+ 
+instance Deserialize STR where
+        deserialize
+          = do name_len <- deserialize
+               name <- deserializeList (fromIntegral name_len)
+               return (MkSTR name_len name)
+ 
+data ListFonts = MkListFonts{max_names_ListFonts :: Word16,
+                             pattern_len_ListFonts :: Word16, pattern_ListFonts :: [CChar]}
+               deriving (Show, Typeable)
+ 
+instance Serialize ListFonts where
+        serialize x
+          = do putWord8 49
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (max_names_ListFonts x)
+               serialize (pattern_len_ListFonts x)
+               serializeList (pattern_ListFonts x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (max_names_ListFonts x) +
+              size (pattern_len_ListFonts x)
+              + sum (map size (pattern_ListFonts x))
+ 
+data ListFontsReply = MkListFontsReply{names_len_ListFontsReply ::
+                                       Word16,
+                                       names_ListFontsReply :: [STR]}
+                    deriving (Show, Typeable)
+ 
+instance Deserialize ListFontsReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               names_len <- deserialize
+               skip 22
+               names <- deserializeList (fromIntegral names_len)
+               let _ = isCard32 length
+               return (MkListFontsReply names_len names)
+ 
+data ListFontsWithInfo = MkListFontsWithInfo{max_names_ListFontsWithInfo
+                                             :: Word16,
+                                             pattern_len_ListFontsWithInfo :: Word16,
+                                             pattern_ListFontsWithInfo :: [CChar]}
+                       deriving (Show, Typeable)
+ 
+instance Serialize ListFontsWithInfo where
+        serialize x
+          = do putWord8 50
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (max_names_ListFontsWithInfo x)
+               serialize (pattern_len_ListFontsWithInfo x)
+               serializeList (pattern_ListFontsWithInfo x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (max_names_ListFontsWithInfo x) +
+              size (pattern_len_ListFontsWithInfo x)
+              + sum (map size (pattern_ListFontsWithInfo x))
+ 
+data ListFontsWithInfoReply = MkListFontsWithInfoReply{name_len_ListFontsWithInfoReply
+                                                       :: Word8,
+                                                       min_bounds_ListFontsWithInfoReply ::
+                                                       CHARINFO,
+                                                       max_bounds_ListFontsWithInfoReply ::
+                                                       CHARINFO,
+                                                       min_char_or_byte2_ListFontsWithInfoReply ::
+                                                       Word16,
+                                                       max_char_or_byte2_ListFontsWithInfoReply ::
+                                                       Word16,
+                                                       default_char_ListFontsWithInfoReply ::
+                                                       Word16,
+                                                       properties_len_ListFontsWithInfoReply ::
+                                                       Word16,
+                                                       draw_direction_ListFontsWithInfoReply ::
+                                                       Word8,
+                                                       min_byte1_ListFontsWithInfoReply :: Word8,
+                                                       max_byte1_ListFontsWithInfoReply :: Word8,
+                                                       all_chars_exist_ListFontsWithInfoReply ::
+                                                       Bool,
+                                                       font_ascent_ListFontsWithInfoReply :: Int16,
+                                                       font_descent_ListFontsWithInfoReply :: Int16,
+                                                       replies_hint_ListFontsWithInfoReply ::
+                                                       Word32,
+                                                       properties_ListFontsWithInfoReply ::
+                                                       [FONTPROP],
+                                                       name_ListFontsWithInfoReply :: [CChar]}
+                            deriving (Show, Typeable)
+ 
+instance Deserialize ListFontsWithInfoReply where
+        deserialize
+          = do skip 1
+               name_len <- deserialize
+               skip 2
+               length <- deserialize
+               min_bounds <- deserialize
+               skip 4
+               max_bounds <- deserialize
+               skip 4
+               min_char_or_byte2 <- deserialize
+               max_char_or_byte2 <- deserialize
+               default_char <- deserialize
+               properties_len <- deserialize
+               draw_direction <- deserialize
+               min_byte1 <- deserialize
+               max_byte1 <- deserialize
+               all_chars_exist <- deserialize
+               font_ascent <- deserialize
+               font_descent <- deserialize
+               replies_hint <- deserialize
+               properties <- deserializeList (fromIntegral properties_len)
+               name <- deserializeList (fromIntegral name_len)
+               let _ = isCard32 length
+               return
+                 (MkListFontsWithInfoReply name_len min_bounds max_bounds
+                    min_char_or_byte2
+                    max_char_or_byte2
+                    default_char
+                    properties_len
+                    draw_direction
+                    min_byte1
+                    max_byte1
+                    all_chars_exist
+                    font_ascent
+                    font_descent
+                    replies_hint
+                    properties
+                    name)
+ 
+data SetFontPath = MkSetFontPath{font_qty_SetFontPath :: Word16,
+                                 path_SetFontPath :: [CChar]}
+                 deriving (Show, Typeable)
+ 
+instance Serialize SetFontPath where
+        serialize x
+          = do putWord8 51
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (font_qty_SetFontPath x)
+               serializeList (path_SetFontPath x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (font_qty_SetFontPath x) +
+              sum (map size (path_SetFontPath x))
+ 
+data GetFontPath = MkGetFontPath{}
+                 deriving (Show, Typeable)
+ 
+instance Serialize GetFontPath where
+        serialize x
+          = do putWord8 52
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 4
+ 
+data GetFontPathReply = MkGetFontPathReply{path_len_GetFontPathReply
+                                           :: Word16,
+                                           path_GetFontPathReply :: [STR]}
+                      deriving (Show, Typeable)
+ 
+instance Deserialize GetFontPathReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               path_len <- deserialize
+               skip 22
+               path <- deserializeList (fromIntegral path_len)
+               let _ = isCard32 length
+               return (MkGetFontPathReply path_len path)
+ 
+data CreatePixmap = MkCreatePixmap{depth_CreatePixmap :: Word8,
+                                   pid_CreatePixmap :: PIXMAP, drawable_CreatePixmap :: DRAWABLE,
+                                   width_CreatePixmap :: Word16, height_CreatePixmap :: Word16}
+                  deriving (Show, Typeable)
+ 
+instance Serialize CreatePixmap where
+        serialize x
+          = do putWord8 53
+               serialize (depth_CreatePixmap x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (pid_CreatePixmap x)
+               serialize (drawable_CreatePixmap x)
+               serialize (width_CreatePixmap x)
+               serialize (height_CreatePixmap x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (depth_CreatePixmap x) + size (pid_CreatePixmap x) +
+              size (drawable_CreatePixmap x)
+              + size (width_CreatePixmap x)
+              + size (height_CreatePixmap x)
+ 
+data FreePixmap = MkFreePixmap{pixmap_FreePixmap :: PIXMAP}
+                deriving (Show, Typeable)
+ 
+instance Serialize FreePixmap where
+        serialize x
+          = do putWord8 54
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (pixmap_FreePixmap x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (pixmap_FreePixmap x)
+ 
+data GC = GCFunction
+        | GCPlaneMask
+        | GCForeground
+        | GCBackground
+        | GCLineWidth
+        | GCLineStyle
+        | GCCapStyle
+        | GCJoinStyle
+        | GCFillStyle
+        | GCFillRule
+        | GCTile
+        | GCStipple
+        | GCTileStippleOriginX
+        | GCTileStippleOriginY
+        | GCFont
+        | GCSubwindowMode
+        | GCGraphicsExposures
+        | GCClipOriginX
+        | GCClipOriginY
+        | GCClipMask
+        | GCDashOffset
+        | GCDashList
+        | GCArcMode
+ 
+instance BitEnum GC where
+        toBit GCFunction{} = 0
+        toBit GCPlaneMask{} = 1
+        toBit GCForeground{} = 2
+        toBit GCBackground{} = 3
+        toBit GCLineWidth{} = 4
+        toBit GCLineStyle{} = 5
+        toBit GCCapStyle{} = 6
+        toBit GCJoinStyle{} = 7
+        toBit GCFillStyle{} = 8
+        toBit GCFillRule{} = 9
+        toBit GCTile{} = 10
+        toBit GCStipple{} = 11
+        toBit GCTileStippleOriginX{} = 12
+        toBit GCTileStippleOriginY{} = 13
+        toBit GCFont{} = 14
+        toBit GCSubwindowMode{} = 15
+        toBit GCGraphicsExposures{} = 16
+        toBit GCClipOriginX{} = 17
+        toBit GCClipOriginY{} = 18
+        toBit GCClipMask{} = 19
+        toBit GCDashOffset{} = 20
+        toBit GCDashList{} = 21
+        toBit GCArcMode{} = 22
+        fromBit 0 = GCFunction
+        fromBit 1 = GCPlaneMask
+        fromBit 2 = GCForeground
+        fromBit 3 = GCBackground
+        fromBit 4 = GCLineWidth
+        fromBit 5 = GCLineStyle
+        fromBit 6 = GCCapStyle
+        fromBit 7 = GCJoinStyle
+        fromBit 8 = GCFillStyle
+        fromBit 9 = GCFillRule
+        fromBit 10 = GCTile
+        fromBit 11 = GCStipple
+        fromBit 12 = GCTileStippleOriginX
+        fromBit 13 = GCTileStippleOriginY
+        fromBit 14 = GCFont
+        fromBit 15 = GCSubwindowMode
+        fromBit 16 = GCGraphicsExposures
+        fromBit 17 = GCClipOriginX
+        fromBit 18 = GCClipOriginY
+        fromBit 19 = GCClipMask
+        fromBit 20 = GCDashOffset
+        fromBit 21 = GCDashList
+        fromBit 22 = GCArcMode
+ 
+data GX = GXclear
+        | GXand
+        | GXandReverse
+        | GXcopy
+        | GXandInverted
+        | GXnoop
+        | GXxor
+        | GXor
+        | GXnor
+        | GXequiv
+        | GXinvert
+        | GXorReverse
+        | GXcopyInverted
+        | GXorInverted
+        | GXnand
+        | GXset
+ 
+instance SimpleEnum GX where
+        toValue GXclear{} = 0
+        toValue GXand{} = 1
+        toValue GXandReverse{} = 2
+        toValue GXcopy{} = 3
+        toValue GXandInverted{} = 4
+        toValue GXnoop{} = 5
+        toValue GXxor{} = 6
+        toValue GXor{} = 7
+        toValue GXnor{} = 8
+        toValue GXequiv{} = 9
+        toValue GXinvert{} = 10
+        toValue GXorReverse{} = 11
+        toValue GXcopyInverted{} = 12
+        toValue GXorInverted{} = 13
+        toValue GXnand{} = 14
+        toValue GXset{} = 15
+        fromValue 0 = GXclear
+        fromValue 1 = GXand
+        fromValue 2 = GXandReverse
+        fromValue 3 = GXcopy
+        fromValue 4 = GXandInverted
+        fromValue 5 = GXnoop
+        fromValue 6 = GXxor
+        fromValue 7 = GXor
+        fromValue 8 = GXnor
+        fromValue 9 = GXequiv
+        fromValue 10 = GXinvert
+        fromValue 11 = GXorReverse
+        fromValue 12 = GXcopyInverted
+        fromValue 13 = GXorInverted
+        fromValue 14 = GXnand
+        fromValue 15 = GXset
+ 
+data LineStyle = LineStyleSolid
+               | LineStyleOnOffDash
+               | LineStyleDoubleDash
+ 
+instance SimpleEnum LineStyle where
+        toValue LineStyleSolid{} = 0
+        toValue LineStyleOnOffDash{} = 1
+        toValue LineStyleDoubleDash{} = 2
+        fromValue 0 = LineStyleSolid
+        fromValue 1 = LineStyleOnOffDash
+        fromValue 2 = LineStyleDoubleDash
+ 
+data CapStyle = CapStyleNotLast
+              | CapStyleButt
+              | CapStyleRound
+              | CapStyleProjecting
+ 
+instance SimpleEnum CapStyle where
+        toValue CapStyleNotLast{} = 0
+        toValue CapStyleButt{} = 1
+        toValue CapStyleRound{} = 2
+        toValue CapStyleProjecting{} = 3
+        fromValue 0 = CapStyleNotLast
+        fromValue 1 = CapStyleButt
+        fromValue 2 = CapStyleRound
+        fromValue 3 = CapStyleProjecting
+ 
+data JoinStyle = JoinStyleMitre
+               | JoinStyleRound
+               | JoinStyleBevel
+ 
+instance SimpleEnum JoinStyle where
+        toValue JoinStyleMitre{} = 0
+        toValue JoinStyleRound{} = 1
+        toValue JoinStyleBevel{} = 2
+        fromValue 0 = JoinStyleMitre
+        fromValue 1 = JoinStyleRound
+        fromValue 2 = JoinStyleBevel
+ 
+data FillStyle = FillStyleSolid
+               | FillStyleTiled
+               | FillStyleStippled
+               | FillStyleOpaqueStippled
+ 
+instance SimpleEnum FillStyle where
+        toValue FillStyleSolid{} = 0
+        toValue FillStyleTiled{} = 1
+        toValue FillStyleStippled{} = 2
+        toValue FillStyleOpaqueStippled{} = 3
+        fromValue 0 = FillStyleSolid
+        fromValue 1 = FillStyleTiled
+        fromValue 2 = FillStyleStippled
+        fromValue 3 = FillStyleOpaqueStippled
+ 
+data FillRule = FillRuleEvenOdd
+              | FillRuleWinding
+ 
+instance SimpleEnum FillRule where
+        toValue FillRuleEvenOdd{} = 0
+        toValue FillRuleWinding{} = 1
+        fromValue 0 = FillRuleEvenOdd
+        fromValue 1 = FillRuleWinding
+ 
+data SubwindowMode = SubwindowModeClipByChildren
+                   | SubwindowModeIncludeInferiors
+ 
+instance SimpleEnum SubwindowMode where
+        toValue SubwindowModeClipByChildren{} = 0
+        toValue SubwindowModeIncludeInferiors{} = 1
+        fromValue 0 = SubwindowModeClipByChildren
+        fromValue 1 = SubwindowModeIncludeInferiors
+ 
+data ArcMode = ArcModeChord
+             | ArcModePieSlice
+ 
+instance SimpleEnum ArcMode where
+        toValue ArcModeChord{} = 0
+        toValue ArcModePieSlice{} = 1
+        fromValue 0 = ArcModeChord
+        fromValue 1 = ArcModePieSlice
+ 
+data CreateGC = MkCreateGC{cid_CreateGC :: GCONTEXT,
+                           drawable_CreateGC :: DRAWABLE, value_CreateGC :: ValueParam Word32}
+              deriving (Show, Typeable)
+ 
+instance Serialize CreateGC where
+        serialize x
+          = do putWord8 55
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cid_CreateGC x)
+               serialize (drawable_CreateGC x)
+               serialize (value_CreateGC x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (cid_CreateGC x) + size (drawable_CreateGC x) +
+              size (value_CreateGC x)
+ 
+data ChangeGC = MkChangeGC{gc_ChangeGC :: GCONTEXT,
+                           value_ChangeGC :: ValueParam Word32}
+              deriving (Show, Typeable)
+ 
+instance Serialize ChangeGC where
+        serialize x
+          = do putWord8 56
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (gc_ChangeGC x)
+               serialize (value_ChangeGC x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (gc_ChangeGC x) + size (value_ChangeGC x)
+ 
+data CopyGC = MkCopyGC{src_gc_CopyGC :: GCONTEXT,
+                       dst_gc_CopyGC :: GCONTEXT, value_mask_CopyGC :: Word32}
+            deriving (Show, Typeable)
+ 
+instance Serialize CopyGC where
+        serialize x
+          = do putWord8 57
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (src_gc_CopyGC x)
+               serialize (dst_gc_CopyGC x)
+               serialize (value_mask_CopyGC x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (src_gc_CopyGC x) + size (dst_gc_CopyGC x) +
+              size (value_mask_CopyGC x)
+ 
+data SetDashes = MkSetDashes{gc_SetDashes :: GCONTEXT,
+                             dash_offset_SetDashes :: Word16, dashes_len_SetDashes :: Word16,
+                             dashes_SetDashes :: [Word8]}
+               deriving (Show, Typeable)
+ 
+instance Serialize SetDashes where
+        serialize x
+          = do putWord8 58
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (gc_SetDashes x)
+               serialize (dash_offset_SetDashes x)
+               serialize (dashes_len_SetDashes x)
+               serializeList (dashes_SetDashes x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (gc_SetDashes x) + size (dash_offset_SetDashes x) +
+              size (dashes_len_SetDashes x)
+              + sum (map size (dashes_SetDashes x))
+ 
+data ClipOrdering = ClipOrderingUnsorted
+                  | ClipOrderingYSorted
+                  | ClipOrderingYXSorted
+                  | ClipOrderingYXBanded
+ 
+instance SimpleEnum ClipOrdering where
+        toValue ClipOrderingUnsorted{} = 0
+        toValue ClipOrderingYSorted{} = 1
+        toValue ClipOrderingYXSorted{} = 2
+        toValue ClipOrderingYXBanded{} = 3
+        fromValue 0 = ClipOrderingUnsorted
+        fromValue 1 = ClipOrderingYSorted
+        fromValue 2 = ClipOrderingYXSorted
+        fromValue 3 = ClipOrderingYXBanded
+ 
+data SetClipRectangles = MkSetClipRectangles{ordering_SetClipRectangles
+                                             :: Word8,
+                                             gc_SetClipRectangles :: GCONTEXT,
+                                             clip_x_origin_SetClipRectangles :: Int16,
+                                             clip_y_origin_SetClipRectangles :: Int16,
+                                             rectangles_SetClipRectangles :: [RECTANGLE]}
+                       deriving (Show, Typeable)
+ 
+instance Serialize SetClipRectangles where
+        serialize x
+          = do putWord8 59
+               serialize (ordering_SetClipRectangles x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (gc_SetClipRectangles x)
+               serialize (clip_x_origin_SetClipRectangles x)
+               serialize (clip_y_origin_SetClipRectangles x)
+               serializeList (rectangles_SetClipRectangles x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (ordering_SetClipRectangles x) +
+              size (gc_SetClipRectangles x)
+              + size (clip_x_origin_SetClipRectangles x)
+              + size (clip_y_origin_SetClipRectangles x)
+              + sum (map size (rectangles_SetClipRectangles x))
+ 
+data FreeGC = MkFreeGC{gc_FreeGC :: GCONTEXT}
+            deriving (Show, Typeable)
+ 
+instance Serialize FreeGC where
+        serialize x
+          = do putWord8 60
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (gc_FreeGC x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (gc_FreeGC x)
+ 
+data ClearArea = MkClearArea{exposures_ClearArea :: Bool,
+                             window_ClearArea :: WINDOW, x_ClearArea :: Int16,
+                             y_ClearArea :: Int16, width_ClearArea :: Word16,
+                             height_ClearArea :: Word16}
+               deriving (Show, Typeable)
+ 
+instance Serialize ClearArea where
+        serialize x
+          = do putWord8 61
+               serialize (exposures_ClearArea x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_ClearArea x)
+               serialize (x_ClearArea x)
+               serialize (y_ClearArea x)
+               serialize (width_ClearArea x)
+               serialize (height_ClearArea x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (exposures_ClearArea x) + size (window_ClearArea x) +
+              size (x_ClearArea x)
+              + size (y_ClearArea x)
+              + size (width_ClearArea x)
+              + size (height_ClearArea x)
+ 
+data CopyArea = MkCopyArea{src_drawable_CopyArea :: DRAWABLE,
+                           dst_drawable_CopyArea :: DRAWABLE, gc_CopyArea :: GCONTEXT,
+                           src_x_CopyArea :: Int16, src_y_CopyArea :: Int16,
+                           dst_x_CopyArea :: Int16, dst_y_CopyArea :: Int16,
+                           width_CopyArea :: Word16, height_CopyArea :: Word16}
+              deriving (Show, Typeable)
+ 
+instance Serialize CopyArea where
+        serialize x
+          = do putWord8 62
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (src_drawable_CopyArea x)
+               serialize (dst_drawable_CopyArea x)
+               serialize (gc_CopyArea x)
+               serialize (src_x_CopyArea x)
+               serialize (src_y_CopyArea x)
+               serialize (dst_x_CopyArea x)
+               serialize (dst_y_CopyArea x)
+               serialize (width_CopyArea x)
+               serialize (height_CopyArea x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (src_drawable_CopyArea x) +
+              size (dst_drawable_CopyArea x)
+              + size (gc_CopyArea x)
+              + size (src_x_CopyArea x)
+              + size (src_y_CopyArea x)
+              + size (dst_x_CopyArea x)
+              + size (dst_y_CopyArea x)
+              + size (width_CopyArea x)
+              + size (height_CopyArea x)
+ 
+data CopyPlane = MkCopyPlane{src_drawable_CopyPlane :: DRAWABLE,
+                             dst_drawable_CopyPlane :: DRAWABLE, gc_CopyPlane :: GCONTEXT,
+                             src_x_CopyPlane :: Int16, src_y_CopyPlane :: Int16,
+                             dst_x_CopyPlane :: Int16, dst_y_CopyPlane :: Int16,
+                             width_CopyPlane :: Word16, height_CopyPlane :: Word16,
+                             bit_plane_CopyPlane :: Word32}
+               deriving (Show, Typeable)
+ 
+instance Serialize CopyPlane where
+        serialize x
+          = do putWord8 63
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (src_drawable_CopyPlane x)
+               serialize (dst_drawable_CopyPlane x)
+               serialize (gc_CopyPlane x)
+               serialize (src_x_CopyPlane x)
+               serialize (src_y_CopyPlane x)
+               serialize (dst_x_CopyPlane x)
+               serialize (dst_y_CopyPlane x)
+               serialize (width_CopyPlane x)
+               serialize (height_CopyPlane x)
+               serialize (bit_plane_CopyPlane x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (src_drawable_CopyPlane x) +
+              size (dst_drawable_CopyPlane x)
+              + size (gc_CopyPlane x)
+              + size (src_x_CopyPlane x)
+              + size (src_y_CopyPlane x)
+              + size (dst_x_CopyPlane x)
+              + size (dst_y_CopyPlane x)
+              + size (width_CopyPlane x)
+              + size (height_CopyPlane x)
+              + size (bit_plane_CopyPlane x)
+ 
+data CoordMode = CoordModeOrigin
+               | CoordModePrevious
+ 
+instance SimpleEnum CoordMode where
+        toValue CoordModeOrigin{} = 0
+        toValue CoordModePrevious{} = 1
+        fromValue 0 = CoordModeOrigin
+        fromValue 1 = CoordModePrevious
+ 
+data PolyPoint = MkPolyPoint{coordinate_mode_PolyPoint :: Word8,
+                             drawable_PolyPoint :: DRAWABLE, gc_PolyPoint :: GCONTEXT,
+                             points_PolyPoint :: [POINT]}
+               deriving (Show, Typeable)
+ 
+instance Serialize PolyPoint where
+        serialize x
+          = do putWord8 64
+               serialize (coordinate_mode_PolyPoint x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_PolyPoint x)
+               serialize (gc_PolyPoint x)
+               serializeList (points_PolyPoint x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (coordinate_mode_PolyPoint x) +
+              size (drawable_PolyPoint x)
+              + size (gc_PolyPoint x)
+              + sum (map size (points_PolyPoint x))
+ 
+data PolyLine = MkPolyLine{coordinate_mode_PolyLine :: Word8,
+                           drawable_PolyLine :: DRAWABLE, gc_PolyLine :: GCONTEXT,
+                           points_PolyLine :: [POINT]}
+              deriving (Show, Typeable)
+ 
+instance Serialize PolyLine where
+        serialize x
+          = do putWord8 65
+               serialize (coordinate_mode_PolyLine x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_PolyLine x)
+               serialize (gc_PolyLine x)
+               serializeList (points_PolyLine x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (coordinate_mode_PolyLine x) +
+              size (drawable_PolyLine x)
+              + size (gc_PolyLine x)
+              + sum (map size (points_PolyLine x))
+ 
+data SEGMENT = MkSEGMENT{x1_SEGMENT :: Int16, y1_SEGMENT :: Int16,
+                         x2_SEGMENT :: Int16, y2_SEGMENT :: Int16}
+             deriving (Show, Typeable)
+ 
+instance Serialize SEGMENT where
+        serialize x
+          = do serialize (x1_SEGMENT x)
+               serialize (y1_SEGMENT x)
+               serialize (x2_SEGMENT x)
+               serialize (y2_SEGMENT x)
+        size x
+          = size (x1_SEGMENT x) + size (y1_SEGMENT x) + size (x2_SEGMENT x) +
+              size (y2_SEGMENT x)
+ 
+instance Deserialize SEGMENT where
+        deserialize
+          = do x1 <- deserialize
+               y1 <- deserialize
+               x2 <- deserialize
+               y2 <- deserialize
+               return (MkSEGMENT x1 y1 x2 y2)
+ 
+data PolySegment = MkPolySegment{drawable_PolySegment :: DRAWABLE,
+                                 gc_PolySegment :: GCONTEXT, segments_PolySegment :: [SEGMENT]}
+                 deriving (Show, Typeable)
+ 
+instance Serialize PolySegment where
+        serialize x
+          = do putWord8 66
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_PolySegment x)
+               serialize (gc_PolySegment x)
+               serializeList (segments_PolySegment x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (drawable_PolySegment x) + size (gc_PolySegment x) +
+              sum (map size (segments_PolySegment x))
+ 
+data PolyRectangle = MkPolyRectangle{drawable_PolyRectangle ::
+                                     DRAWABLE,
+                                     gc_PolyRectangle :: GCONTEXT,
+                                     rectangles_PolyRectangle :: [RECTANGLE]}
+                   deriving (Show, Typeable)
+ 
+instance Serialize PolyRectangle where
+        serialize x
+          = do putWord8 67
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_PolyRectangle x)
+               serialize (gc_PolyRectangle x)
+               serializeList (rectangles_PolyRectangle x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (drawable_PolyRectangle x) +
+              size (gc_PolyRectangle x)
+              + sum (map size (rectangles_PolyRectangle x))
+ 
+data PolyArc = MkPolyArc{drawable_PolyArc :: DRAWABLE,
+                         gc_PolyArc :: GCONTEXT, arcs_PolyArc :: [ARC]}
+             deriving (Show, Typeable)
+ 
+instance Serialize PolyArc where
+        serialize x
+          = do putWord8 68
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_PolyArc x)
+               serialize (gc_PolyArc x)
+               serializeList (arcs_PolyArc x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (drawable_PolyArc x) + size (gc_PolyArc x) +
+              sum (map size (arcs_PolyArc x))
+ 
+data PolyShape = PolyShapeComplex
+               | PolyShapeNonconvex
+               | PolyShapeConvex
+ 
+instance SimpleEnum PolyShape where
+        toValue PolyShapeComplex{} = 0
+        toValue PolyShapeNonconvex{} = 1
+        toValue PolyShapeConvex{} = 2
+        fromValue 0 = PolyShapeComplex
+        fromValue 1 = PolyShapeNonconvex
+        fromValue 2 = PolyShapeConvex
+ 
+data FillPoly = MkFillPoly{drawable_FillPoly :: DRAWABLE,
+                           gc_FillPoly :: GCONTEXT, shape_FillPoly :: Word8,
+                           coordinate_mode_FillPoly :: Word8, points_FillPoly :: [POINT]}
+              deriving (Show, Typeable)
+ 
+instance Serialize FillPoly where
+        serialize x
+          = do putWord8 69
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_FillPoly x)
+               serialize (gc_FillPoly x)
+               serialize (shape_FillPoly x)
+               serialize (coordinate_mode_FillPoly x)
+               putSkip 2
+               serializeList (points_FillPoly x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (drawable_FillPoly x) + size (gc_FillPoly x) +
+              size (shape_FillPoly x)
+              + size (coordinate_mode_FillPoly x)
+              + 2
+              + sum (map size (points_FillPoly x))
+ 
+data PolyFillRectangle = MkPolyFillRectangle{drawable_PolyFillRectangle
+                                             :: DRAWABLE,
+                                             gc_PolyFillRectangle :: GCONTEXT,
+                                             rectangles_PolyFillRectangle :: [RECTANGLE]}
+                       deriving (Show, Typeable)
+ 
+instance Serialize PolyFillRectangle where
+        serialize x
+          = do putWord8 70
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_PolyFillRectangle x)
+               serialize (gc_PolyFillRectangle x)
+               serializeList (rectangles_PolyFillRectangle x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (drawable_PolyFillRectangle x) +
+              size (gc_PolyFillRectangle x)
+              + sum (map size (rectangles_PolyFillRectangle x))
+ 
+data PolyFillArc = MkPolyFillArc{drawable_PolyFillArc :: DRAWABLE,
+                                 gc_PolyFillArc :: GCONTEXT, arcs_PolyFillArc :: [ARC]}
+                 deriving (Show, Typeable)
+ 
+instance Serialize PolyFillArc where
+        serialize x
+          = do putWord8 71
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_PolyFillArc x)
+               serialize (gc_PolyFillArc x)
+               serializeList (arcs_PolyFillArc x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (drawable_PolyFillArc x) + size (gc_PolyFillArc x) +
+              sum (map size (arcs_PolyFillArc x))
+ 
+data ImageFormat = ImageFormatXYBitmap
+                 | ImageFormatXYPixmap
+                 | ImageFormatZPixmap
+ 
+instance SimpleEnum ImageFormat where
+        toValue ImageFormatXYBitmap{} = 0
+        toValue ImageFormatXYPixmap{} = 1
+        toValue ImageFormatZPixmap{} = 2
+        fromValue 0 = ImageFormatXYBitmap
+        fromValue 1 = ImageFormatXYPixmap
+        fromValue 2 = ImageFormatZPixmap
+ 
+data PutImage = MkPutImage{format_PutImage :: Word8,
+                           drawable_PutImage :: DRAWABLE, gc_PutImage :: GCONTEXT,
+                           width_PutImage :: Word16, height_PutImage :: Word16,
+                           dst_x_PutImage :: Int16, dst_y_PutImage :: Int16,
+                           left_pad_PutImage :: Word8, depth_PutImage :: Word8,
+                           data_PutImage :: [Word8]}
+              deriving (Show, Typeable)
+ 
+instance Serialize PutImage where
+        serialize x
+          = do putWord8 72
+               serialize (format_PutImage x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_PutImage x)
+               serialize (gc_PutImage x)
+               serialize (width_PutImage x)
+               serialize (height_PutImage x)
+               serialize (dst_x_PutImage x)
+               serialize (dst_y_PutImage x)
+               serialize (left_pad_PutImage x)
+               serialize (depth_PutImage x)
+               putSkip 2
+               serializeList (data_PutImage x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (format_PutImage x) + size (drawable_PutImage x) +
+              size (gc_PutImage x)
+              + size (width_PutImage x)
+              + size (height_PutImage x)
+              + size (dst_x_PutImage x)
+              + size (dst_y_PutImage x)
+              + size (left_pad_PutImage x)
+              + size (depth_PutImage x)
+              + 2
+              + sum (map size (data_PutImage x))
+ 
+data GetImage = MkGetImage{format_GetImage :: Word8,
+                           drawable_GetImage :: DRAWABLE, x_GetImage :: Int16,
+                           y_GetImage :: Int16, width_GetImage :: Word16,
+                           height_GetImage :: Word16, plane_mask_GetImage :: Word32}
+              deriving (Show, Typeable)
+ 
+instance Serialize GetImage where
+        serialize x
+          = do putWord8 73
+               serialize (format_GetImage x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_GetImage x)
+               serialize (x_GetImage x)
+               serialize (y_GetImage x)
+               serialize (width_GetImage x)
+               serialize (height_GetImage x)
+               serialize (plane_mask_GetImage x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (format_GetImage x) + size (drawable_GetImage x) +
+              size (x_GetImage x)
+              + size (y_GetImage x)
+              + size (width_GetImage x)
+              + size (height_GetImage x)
+              + size (plane_mask_GetImage x)
+ 
+data GetImageReply = MkGetImageReply{depth_GetImageReply :: Word8,
+                                     visual_GetImageReply :: VISUALID,
+                                     data_GetImageReply :: [Word8]}
+                   deriving (Show, Typeable)
+ 
+instance Deserialize GetImageReply where
+        deserialize
+          = do skip 1
+               depth <- deserialize
+               skip 2
+               length <- deserialize
+               visual <- deserialize
+               skip 20
+               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))
+               let _ = isCard32 length
+               return (MkGetImageReply depth visual data_)
+ 
+data PolyText8 = MkPolyText8{drawable_PolyText8 :: DRAWABLE,
+                             gc_PolyText8 :: GCONTEXT, x_PolyText8 :: Int16,
+                             y_PolyText8 :: Int16, items_PolyText8 :: [Word8]}
+               deriving (Show, Typeable)
+ 
+instance Serialize PolyText8 where
+        serialize x
+          = do putWord8 74
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_PolyText8 x)
+               serialize (gc_PolyText8 x)
+               serialize (x_PolyText8 x)
+               serialize (y_PolyText8 x)
+               serializeList (items_PolyText8 x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (drawable_PolyText8 x) + size (gc_PolyText8 x) +
+              size (x_PolyText8 x)
+              + size (y_PolyText8 x)
+              + sum (map size (items_PolyText8 x))
+ 
+data PolyText16 = MkPolyText16{drawable_PolyText16 :: DRAWABLE,
+                               gc_PolyText16 :: GCONTEXT, x_PolyText16 :: Int16,
+                               y_PolyText16 :: Int16, items_PolyText16 :: [Word8]}
+                deriving (Show, Typeable)
+ 
+instance Serialize PolyText16 where
+        serialize x
+          = do putWord8 75
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_PolyText16 x)
+               serialize (gc_PolyText16 x)
+               serialize (x_PolyText16 x)
+               serialize (y_PolyText16 x)
+               serializeList (items_PolyText16 x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (drawable_PolyText16 x) + size (gc_PolyText16 x) +
+              size (x_PolyText16 x)
+              + size (y_PolyText16 x)
+              + sum (map size (items_PolyText16 x))
+ 
+data ImageText8 = MkImageText8{string_len_ImageText8 :: Word8,
+                               drawable_ImageText8 :: DRAWABLE, gc_ImageText8 :: GCONTEXT,
+                               x_ImageText8 :: Int16, y_ImageText8 :: Int16,
+                               string_ImageText8 :: [CChar]}
+                deriving (Show, Typeable)
+ 
+instance Serialize ImageText8 where
+        serialize x
+          = do putWord8 76
+               serialize (string_len_ImageText8 x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_ImageText8 x)
+               serialize (gc_ImageText8 x)
+               serialize (x_ImageText8 x)
+               serialize (y_ImageText8 x)
+               serializeList (string_ImageText8 x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (string_len_ImageText8 x) + size (drawable_ImageText8 x)
+              + size (gc_ImageText8 x)
+              + size (x_ImageText8 x)
+              + size (y_ImageText8 x)
+              + sum (map size (string_ImageText8 x))
+ 
+data ImageText16 = MkImageText16{string_len_ImageText16 :: Word8,
+                                 drawable_ImageText16 :: DRAWABLE, gc_ImageText16 :: GCONTEXT,
+                                 x_ImageText16 :: Int16, y_ImageText16 :: Int16,
+                                 string_ImageText16 :: [CHAR2B]}
+                 deriving (Show, Typeable)
+ 
+instance Serialize ImageText16 where
+        serialize x
+          = do putWord8 77
+               serialize (string_len_ImageText16 x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_ImageText16 x)
+               serialize (gc_ImageText16 x)
+               serialize (x_ImageText16 x)
+               serialize (y_ImageText16 x)
+               serializeList (string_ImageText16 x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (string_len_ImageText16 x) +
+              size (drawable_ImageText16 x)
+              + size (gc_ImageText16 x)
+              + size (x_ImageText16 x)
+              + size (y_ImageText16 x)
+              + sum (map size (string_ImageText16 x))
+ 
+data ColormapAlloc = ColormapAllocNone
+                   | ColormapAllocAll
+ 
+instance SimpleEnum ColormapAlloc where
+        toValue ColormapAllocNone{} = 0
+        toValue ColormapAllocAll{} = 1
+        fromValue 0 = ColormapAllocNone
+        fromValue 1 = ColormapAllocAll
+ 
+data CreateColormap = MkCreateColormap{alloc_CreateColormap ::
+                                       Word8,
+                                       mid_CreateColormap :: COLORMAP,
+                                       window_CreateColormap :: WINDOW,
+                                       visual_CreateColormap :: VISUALID}
+                    deriving (Show, Typeable)
+ 
+instance Serialize CreateColormap where
+        serialize x
+          = do putWord8 78
+               serialize (alloc_CreateColormap x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (mid_CreateColormap x)
+               serialize (window_CreateColormap x)
+               serialize (visual_CreateColormap x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (alloc_CreateColormap x) + size (mid_CreateColormap x) +
+              size (window_CreateColormap x)
+              + size (visual_CreateColormap x)
+ 
+data FreeColormap = MkFreeColormap{cmap_FreeColormap :: COLORMAP}
+                  deriving (Show, Typeable)
+ 
+instance Serialize FreeColormap where
+        serialize x
+          = do putWord8 79
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_FreeColormap x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (cmap_FreeColormap x)
+ 
+data CopyColormapAndFree = MkCopyColormapAndFree{mid_CopyColormapAndFree
+                                                 :: COLORMAP,
+                                                 src_cmap_CopyColormapAndFree :: COLORMAP}
+                         deriving (Show, Typeable)
+ 
+instance Serialize CopyColormapAndFree where
+        serialize x
+          = do putWord8 80
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (mid_CopyColormapAndFree x)
+               serialize (src_cmap_CopyColormapAndFree x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (mid_CopyColormapAndFree x) +
+              size (src_cmap_CopyColormapAndFree x)
+ 
+data InstallColormap = MkInstallColormap{cmap_InstallColormap ::
+                                         COLORMAP}
+                     deriving (Show, Typeable)
+ 
+instance Serialize InstallColormap where
+        serialize x
+          = do putWord8 81
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_InstallColormap x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (cmap_InstallColormap x)
+ 
+data UninstallColormap = MkUninstallColormap{cmap_UninstallColormap
+                                             :: COLORMAP}
+                       deriving (Show, Typeable)
+ 
+instance Serialize UninstallColormap where
+        serialize x
+          = do putWord8 82
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_UninstallColormap x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (cmap_UninstallColormap x)
+ 
+data ListInstalledColormaps = MkListInstalledColormaps{window_ListInstalledColormaps
+                                                       :: WINDOW}
+                            deriving (Show, Typeable)
+ 
+instance Serialize ListInstalledColormaps where
+        serialize x
+          = do putWord8 83
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_ListInstalledColormaps x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (window_ListInstalledColormaps x)
+ 
+data ListInstalledColormapsReply = MkListInstalledColormapsReply{cmaps_len_ListInstalledColormapsReply
+                                                                 :: Word16,
+                                                                 cmaps_ListInstalledColormapsReply
+                                                                 :: [COLORMAP]}
+                                 deriving (Show, Typeable)
+ 
+instance Deserialize ListInstalledColormapsReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               cmaps_len <- deserialize
+               skip 22
+               cmaps <- deserializeList (fromIntegral cmaps_len)
+               let _ = isCard32 length
+               return (MkListInstalledColormapsReply cmaps_len cmaps)
+ 
+data AllocColor = MkAllocColor{cmap_AllocColor :: COLORMAP,
+                               red_AllocColor :: Word16, green_AllocColor :: Word16,
+                               blue_AllocColor :: Word16}
+                deriving (Show, Typeable)
+ 
+instance Serialize AllocColor where
+        serialize x
+          = do putWord8 84
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_AllocColor x)
+               serialize (red_AllocColor x)
+               serialize (green_AllocColor x)
+               serialize (blue_AllocColor x)
+               putSkip 2
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (cmap_AllocColor x) + size (red_AllocColor x) +
+              size (green_AllocColor x)
+              + size (blue_AllocColor x)
+              + 2
+ 
+data AllocColorReply = MkAllocColorReply{red_AllocColorReply ::
+                                         Word16,
+                                         green_AllocColorReply :: Word16,
+                                         blue_AllocColorReply :: Word16,
+                                         pixel_AllocColorReply :: Word32}
+                     deriving (Show, Typeable)
+ 
+instance Deserialize AllocColorReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               red <- deserialize
+               green <- deserialize
+               blue <- deserialize
+               skip 2
+               pixel <- deserialize
+               let _ = isCard32 length
+               return (MkAllocColorReply red green blue pixel)
+ 
+data AllocNamedColor = MkAllocNamedColor{cmap_AllocNamedColor ::
+                                         COLORMAP,
+                                         name_len_AllocNamedColor :: Word16,
+                                         name_AllocNamedColor :: [CChar]}
+                     deriving (Show, Typeable)
+ 
+instance Serialize AllocNamedColor where
+        serialize x
+          = do putWord8 85
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_AllocNamedColor x)
+               serialize (name_len_AllocNamedColor x)
+               putSkip 2
+               serializeList (name_AllocNamedColor x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (cmap_AllocNamedColor x) +
+              size (name_len_AllocNamedColor x)
+              + 2
+              + sum (map size (name_AllocNamedColor x))
+ 
+data AllocNamedColorReply = MkAllocNamedColorReply{pixel_AllocNamedColorReply
+                                                   :: Word32,
+                                                   exact_red_AllocNamedColorReply :: Word16,
+                                                   exact_green_AllocNamedColorReply :: Word16,
+                                                   exact_blue_AllocNamedColorReply :: Word16,
+                                                   visual_red_AllocNamedColorReply :: Word16,
+                                                   visual_green_AllocNamedColorReply :: Word16,
+                                                   visual_blue_AllocNamedColorReply :: Word16}
+                          deriving (Show, Typeable)
+ 
+instance Deserialize AllocNamedColorReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               pixel <- deserialize
+               exact_red <- deserialize
+               exact_green <- deserialize
+               exact_blue <- deserialize
+               visual_red <- deserialize
+               visual_green <- deserialize
+               visual_blue <- deserialize
+               let _ = isCard32 length
+               return
+                 (MkAllocNamedColorReply pixel exact_red exact_green exact_blue
+                    visual_red
+                    visual_green
+                    visual_blue)
+ 
+data AllocColorCells = MkAllocColorCells{contiguous_AllocColorCells
+                                         :: Bool,
+                                         cmap_AllocColorCells :: COLORMAP,
+                                         colors_AllocColorCells :: Word16,
+                                         planes_AllocColorCells :: Word16}
+                     deriving (Show, Typeable)
+ 
+instance Serialize AllocColorCells where
+        serialize x
+          = do putWord8 86
+               serialize (contiguous_AllocColorCells x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_AllocColorCells x)
+               serialize (colors_AllocColorCells x)
+               serialize (planes_AllocColorCells x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (contiguous_AllocColorCells x) +
+              size (cmap_AllocColorCells x)
+              + size (colors_AllocColorCells x)
+              + size (planes_AllocColorCells x)
+ 
+data AllocColorCellsReply = MkAllocColorCellsReply{pixels_len_AllocColorCellsReply
+                                                   :: Word16,
+                                                   masks_len_AllocColorCellsReply :: Word16,
+                                                   pixels_AllocColorCellsReply :: [Word32],
+                                                   masks_AllocColorCellsReply :: [Word32]}
+                          deriving (Show, Typeable)
+ 
+instance Deserialize AllocColorCellsReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               pixels_len <- deserialize
+               masks_len <- deserialize
+               skip 20
+               pixels <- deserializeList (fromIntegral pixels_len)
+               masks <- deserializeList (fromIntegral masks_len)
+               let _ = isCard32 length
+               return (MkAllocColorCellsReply pixels_len masks_len pixels masks)
+ 
+data AllocColorPlanes = MkAllocColorPlanes{contiguous_AllocColorPlanes
+                                           :: Bool,
+                                           cmap_AllocColorPlanes :: COLORMAP,
+                                           colors_AllocColorPlanes :: Word16,
+                                           reds_AllocColorPlanes :: Word16,
+                                           greens_AllocColorPlanes :: Word16,
+                                           blues_AllocColorPlanes :: Word16}
+                      deriving (Show, Typeable)
+ 
+instance Serialize AllocColorPlanes where
+        serialize x
+          = do putWord8 87
+               serialize (contiguous_AllocColorPlanes x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_AllocColorPlanes x)
+               serialize (colors_AllocColorPlanes x)
+               serialize (reds_AllocColorPlanes x)
+               serialize (greens_AllocColorPlanes x)
+               serialize (blues_AllocColorPlanes x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (contiguous_AllocColorPlanes x) +
+              size (cmap_AllocColorPlanes x)
+              + size (colors_AllocColorPlanes x)
+              + size (reds_AllocColorPlanes x)
+              + size (greens_AllocColorPlanes x)
+              + size (blues_AllocColorPlanes x)
+ 
+data AllocColorPlanesReply = MkAllocColorPlanesReply{pixels_len_AllocColorPlanesReply
+                                                     :: Word16,
+                                                     red_mask_AllocColorPlanesReply :: Word32,
+                                                     green_mask_AllocColorPlanesReply :: Word32,
+                                                     blue_mask_AllocColorPlanesReply :: Word32,
+                                                     pixels_AllocColorPlanesReply :: [Word32]}
+                           deriving (Show, Typeable)
+ 
+instance Deserialize AllocColorPlanesReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               pixels_len <- deserialize
+               skip 2
+               red_mask <- deserialize
+               green_mask <- deserialize
+               blue_mask <- deserialize
+               skip 8
+               pixels <- deserializeList (fromIntegral pixels_len)
+               let _ = isCard32 length
+               return
+                 (MkAllocColorPlanesReply pixels_len red_mask green_mask blue_mask
+                    pixels)
+ 
+data FreeColors = MkFreeColors{cmap_FreeColors :: COLORMAP,
+                               plane_mask_FreeColors :: Word32, pixels_FreeColors :: [Word32]}
+                deriving (Show, Typeable)
+ 
+instance Serialize FreeColors where
+        serialize x
+          = do putWord8 88
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_FreeColors x)
+               serialize (plane_mask_FreeColors x)
+               serializeList (pixels_FreeColors x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (cmap_FreeColors x) + size (plane_mask_FreeColors x)
+              + sum (map size (pixels_FreeColors x))
+ 
+data ColorFlag = ColorFlagRed
+               | ColorFlagGreen
+               | ColorFlagBlue
+ 
+instance BitEnum ColorFlag where
+        toBit ColorFlagRed{} = 0
+        toBit ColorFlagGreen{} = 1
+        toBit ColorFlagBlue{} = 2
+        fromBit 0 = ColorFlagRed
+        fromBit 1 = ColorFlagGreen
+        fromBit 2 = ColorFlagBlue
+ 
+data COLORITEM = MkCOLORITEM{pixel_COLORITEM :: Word32,
+                             red_COLORITEM :: Word16, green_COLORITEM :: Word16,
+                             blue_COLORITEM :: Word16, flags_COLORITEM :: Word8}
+               deriving (Show, Typeable)
+ 
+instance Serialize COLORITEM where
+        serialize x
+          = do serialize (pixel_COLORITEM x)
+               serialize (red_COLORITEM x)
+               serialize (green_COLORITEM x)
+               serialize (blue_COLORITEM x)
+               serialize (flags_COLORITEM x)
+               putSkip 1
+        size x
+          = size (pixel_COLORITEM x) + size (red_COLORITEM x) +
+              size (green_COLORITEM x)
+              + size (blue_COLORITEM x)
+              + size (flags_COLORITEM x)
+              + 1
+ 
+instance Deserialize COLORITEM where
+        deserialize
+          = do pixel <- deserialize
+               red <- deserialize
+               green <- deserialize
+               blue <- deserialize
+               flags <- deserialize
+               skip 1
+               return (MkCOLORITEM pixel red green blue flags)
+ 
+data StoreColors = MkStoreColors{cmap_StoreColors :: COLORMAP,
+                                 items_StoreColors :: [COLORITEM]}
+                 deriving (Show, Typeable)
+ 
+instance Serialize StoreColors where
+        serialize x
+          = do putWord8 89
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_StoreColors x)
+               serializeList (items_StoreColors x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (cmap_StoreColors x) +
+              sum (map size (items_StoreColors x))
+ 
+data StoreNamedColor = MkStoreNamedColor{flags_StoreNamedColor ::
+                                         Word8,
+                                         cmap_StoreNamedColor :: COLORMAP,
+                                         pixel_StoreNamedColor :: Word32,
+                                         name_len_StoreNamedColor :: Word16,
+                                         name_StoreNamedColor :: [CChar]}
+                     deriving (Show, Typeable)
+ 
+instance Serialize StoreNamedColor where
+        serialize x
+          = do putWord8 90
+               serialize (flags_StoreNamedColor x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_StoreNamedColor x)
+               serialize (pixel_StoreNamedColor x)
+               serialize (name_len_StoreNamedColor x)
+               putSkip 2
+               serializeList (name_StoreNamedColor x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (flags_StoreNamedColor x) +
+              size (cmap_StoreNamedColor x)
+              + size (pixel_StoreNamedColor x)
+              + size (name_len_StoreNamedColor x)
+              + 2
+              + sum (map size (name_StoreNamedColor x))
+ 
+data RGB = MkRGB{red_RGB :: Word16, green_RGB :: Word16,
+                 blue_RGB :: Word16}
+         deriving (Show, Typeable)
+ 
+instance Serialize RGB where
+        serialize x
+          = do serialize (red_RGB x)
+               serialize (green_RGB x)
+               serialize (blue_RGB x)
+               putSkip 2
+        size x
+          = size (red_RGB x) + size (green_RGB x) + size (blue_RGB x) + 2
+ 
+instance Deserialize RGB where
+        deserialize
+          = do red <- deserialize
+               green <- deserialize
+               blue <- deserialize
+               skip 2
+               return (MkRGB red green blue)
+ 
+data QueryColors = MkQueryColors{cmap_QueryColors :: COLORMAP,
+                                 pixels_QueryColors :: [Word32]}
+                 deriving (Show, Typeable)
+ 
+instance Serialize QueryColors where
+        serialize x
+          = do putWord8 91
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_QueryColors x)
+               serializeList (pixels_QueryColors x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (cmap_QueryColors x) +
+              sum (map size (pixels_QueryColors x))
+ 
+data QueryColorsReply = MkQueryColorsReply{colors_len_QueryColorsReply
+                                           :: Word16,
+                                           colors_QueryColorsReply :: [RGB]}
+                      deriving (Show, Typeable)
+ 
+instance Deserialize QueryColorsReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               colors_len <- deserialize
+               skip 22
+               colors <- deserializeList (fromIntegral colors_len)
+               let _ = isCard32 length
+               return (MkQueryColorsReply colors_len colors)
+ 
+data LookupColor = MkLookupColor{cmap_LookupColor :: COLORMAP,
+                                 name_len_LookupColor :: Word16, name_LookupColor :: [CChar]}
+                 deriving (Show, Typeable)
+ 
+instance Serialize LookupColor where
+        serialize x
+          = do putWord8 92
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cmap_LookupColor x)
+               serialize (name_len_LookupColor x)
+               putSkip 2
+               serializeList (name_LookupColor x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (cmap_LookupColor x) + size (name_len_LookupColor x)
+              + 2
+              + sum (map size (name_LookupColor x))
+ 
+data LookupColorReply = MkLookupColorReply{exact_red_LookupColorReply
+                                           :: Word16,
+                                           exact_green_LookupColorReply :: Word16,
+                                           exact_blue_LookupColorReply :: Word16,
+                                           visual_red_LookupColorReply :: Word16,
+                                           visual_green_LookupColorReply :: Word16,
+                                           visual_blue_LookupColorReply :: Word16}
+                      deriving (Show, Typeable)
+ 
+instance Deserialize LookupColorReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               exact_red <- deserialize
+               exact_green <- deserialize
+               exact_blue <- deserialize
+               visual_red <- deserialize
+               visual_green <- deserialize
+               visual_blue <- deserialize
+               let _ = isCard32 length
+               return
+                 (MkLookupColorReply exact_red exact_green exact_blue visual_red
+                    visual_green
+                    visual_blue)
+ 
+data CreateCursor = MkCreateCursor{cid_CreateCursor :: CURSOR,
+                                   source_CreateCursor :: PIXMAP, mask_CreateCursor :: PIXMAP,
+                                   fore_red_CreateCursor :: Word16,
+                                   fore_green_CreateCursor :: Word16,
+                                   fore_blue_CreateCursor :: Word16,
+                                   back_red_CreateCursor :: Word16,
+                                   back_green_CreateCursor :: Word16,
+                                   back_blue_CreateCursor :: Word16, x_CreateCursor :: Word16,
+                                   y_CreateCursor :: Word16}
+                  deriving (Show, Typeable)
+ 
+instance Serialize CreateCursor where
+        serialize x
+          = do putWord8 93
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cid_CreateCursor x)
+               serialize (source_CreateCursor x)
+               serialize (mask_CreateCursor x)
+               serialize (fore_red_CreateCursor x)
+               serialize (fore_green_CreateCursor x)
+               serialize (fore_blue_CreateCursor x)
+               serialize (back_red_CreateCursor x)
+               serialize (back_green_CreateCursor x)
+               serialize (back_blue_CreateCursor x)
+               serialize (x_CreateCursor x)
+               serialize (y_CreateCursor x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (cid_CreateCursor x) + size (source_CreateCursor x)
+              + size (mask_CreateCursor x)
+              + size (fore_red_CreateCursor x)
+              + size (fore_green_CreateCursor x)
+              + size (fore_blue_CreateCursor x)
+              + size (back_red_CreateCursor x)
+              + size (back_green_CreateCursor x)
+              + size (back_blue_CreateCursor x)
+              + size (x_CreateCursor x)
+              + size (y_CreateCursor x)
+ 
+data CreateGlyphCursor = MkCreateGlyphCursor{cid_CreateGlyphCursor
+                                             :: CURSOR,
+                                             source_font_CreateGlyphCursor :: FONT,
+                                             mask_font_CreateGlyphCursor :: FONT,
+                                             source_char_CreateGlyphCursor :: Word16,
+                                             mask_char_CreateGlyphCursor :: Word16,
+                                             fore_red_CreateGlyphCursor :: Word16,
+                                             fore_green_CreateGlyphCursor :: Word16,
+                                             fore_blue_CreateGlyphCursor :: Word16,
+                                             back_red_CreateGlyphCursor :: Word16,
+                                             back_green_CreateGlyphCursor :: Word16,
+                                             back_blue_CreateGlyphCursor :: Word16}
+                       deriving (Show, Typeable)
+ 
+instance Serialize CreateGlyphCursor where
+        serialize x
+          = do putWord8 94
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cid_CreateGlyphCursor x)
+               serialize (source_font_CreateGlyphCursor x)
+               serialize (mask_font_CreateGlyphCursor x)
+               serialize (source_char_CreateGlyphCursor x)
+               serialize (mask_char_CreateGlyphCursor x)
+               serialize (fore_red_CreateGlyphCursor x)
+               serialize (fore_green_CreateGlyphCursor x)
+               serialize (fore_blue_CreateGlyphCursor x)
+               serialize (back_red_CreateGlyphCursor x)
+               serialize (back_green_CreateGlyphCursor x)
+               serialize (back_blue_CreateGlyphCursor x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (cid_CreateGlyphCursor x) +
+              size (source_font_CreateGlyphCursor x)
+              + size (mask_font_CreateGlyphCursor x)
+              + size (source_char_CreateGlyphCursor x)
+              + size (mask_char_CreateGlyphCursor x)
+              + size (fore_red_CreateGlyphCursor x)
+              + size (fore_green_CreateGlyphCursor x)
+              + size (fore_blue_CreateGlyphCursor x)
+              + size (back_red_CreateGlyphCursor x)
+              + size (back_green_CreateGlyphCursor x)
+              + size (back_blue_CreateGlyphCursor x)
+ 
+data FreeCursor = MkFreeCursor{cursor_FreeCursor :: CURSOR}
+                deriving (Show, Typeable)
+ 
+instance Serialize FreeCursor where
+        serialize x
+          = do putWord8 95
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cursor_FreeCursor x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (cursor_FreeCursor x)
+ 
+data RecolorCursor = MkRecolorCursor{cursor_RecolorCursor ::
+                                     CURSOR,
+                                     fore_red_RecolorCursor :: Word16,
+                                     fore_green_RecolorCursor :: Word16,
+                                     fore_blue_RecolorCursor :: Word16,
+                                     back_red_RecolorCursor :: Word16,
+                                     back_green_RecolorCursor :: Word16,
+                                     back_blue_RecolorCursor :: Word16}
+                   deriving (Show, Typeable)
+ 
+instance Serialize RecolorCursor where
+        serialize x
+          = do putWord8 96
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (cursor_RecolorCursor x)
+               serialize (fore_red_RecolorCursor x)
+               serialize (fore_green_RecolorCursor x)
+               serialize (fore_blue_RecolorCursor x)
+               serialize (back_red_RecolorCursor x)
+               serialize (back_green_RecolorCursor x)
+               serialize (back_blue_RecolorCursor x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (cursor_RecolorCursor x) +
+              size (fore_red_RecolorCursor x)
+              + size (fore_green_RecolorCursor x)
+              + size (fore_blue_RecolorCursor x)
+              + size (back_red_RecolorCursor x)
+              + size (back_green_RecolorCursor x)
+              + size (back_blue_RecolorCursor x)
+ 
+data QueryShapeOf = QueryShapeOfLargestCursor
+                  | QueryShapeOfFastestTile
+                  | QueryShapeOfFastestStipple
+ 
+instance SimpleEnum QueryShapeOf where
+        toValue QueryShapeOfLargestCursor{} = 0
+        toValue QueryShapeOfFastestTile{} = 1
+        toValue QueryShapeOfFastestStipple{} = 2
+        fromValue 0 = QueryShapeOfLargestCursor
+        fromValue 1 = QueryShapeOfFastestTile
+        fromValue 2 = QueryShapeOfFastestStipple
+ 
+data QueryBestSize = MkQueryBestSize{class_QueryBestSize :: Word8,
+                                     drawable_QueryBestSize :: DRAWABLE,
+                                     width_QueryBestSize :: Word16, height_QueryBestSize :: Word16}
+                   deriving (Show, Typeable)
+ 
+instance Serialize QueryBestSize where
+        serialize x
+          = do putWord8 97
+               serialize (class_QueryBestSize x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (drawable_QueryBestSize x)
+               serialize (width_QueryBestSize x)
+               serialize (height_QueryBestSize x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (class_QueryBestSize x) +
+              size (drawable_QueryBestSize x)
+              + size (width_QueryBestSize x)
+              + size (height_QueryBestSize x)
+ 
+data QueryBestSizeReply = MkQueryBestSizeReply{width_QueryBestSizeReply
+                                               :: Word16,
+                                               height_QueryBestSizeReply :: Word16}
+                        deriving (Show, Typeable)
+ 
+instance Deserialize QueryBestSizeReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               width <- deserialize
+               height <- deserialize
+               let _ = isCard32 length
+               return (MkQueryBestSizeReply width height)
+ 
+data QueryExtension = MkQueryExtension{name_len_QueryExtension ::
+                                       Word16,
+                                       name_QueryExtension :: [CChar]}
+                    deriving (Show, Typeable)
+ 
+instance Serialize QueryExtension where
+        serialize x
+          = do putWord8 98
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (name_len_QueryExtension x)
+               putSkip 2
+               serializeList (name_QueryExtension x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (name_len_QueryExtension x) + 2 +
+              sum (map size (name_QueryExtension x))
+ 
+data QueryExtensionReply = MkQueryExtensionReply{present_QueryExtensionReply
+                                                 :: Bool,
+                                                 major_opcode_QueryExtensionReply :: Word8,
+                                                 first_event_QueryExtensionReply :: Word8,
+                                                 first_error_QueryExtensionReply :: Word8}
+                         deriving (Show, Typeable)
+ 
+instance Deserialize QueryExtensionReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               present <- deserialize
+               major_opcode <- deserialize
+               first_event <- deserialize
+               first_error <- deserialize
+               let _ = isCard32 length
+               return
+                 (MkQueryExtensionReply present major_opcode first_event
+                    first_error)
+ 
+data ListExtensions = MkListExtensions{}
+                    deriving (Show, Typeable)
+ 
+instance Serialize ListExtensions where
+        serialize x
+          = do putWord8 99
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 4
+ 
+data ListExtensionsReply = MkListExtensionsReply{names_len_ListExtensionsReply
+                                                 :: Word8,
+                                                 names_ListExtensionsReply :: [STR]}
+                         deriving (Show, Typeable)
+ 
+instance Deserialize ListExtensionsReply where
+        deserialize
+          = do skip 1
+               names_len <- deserialize
+               skip 2
+               length <- deserialize
+               skip 24
+               names <- deserializeList (fromIntegral names_len)
+               let _ = isCard32 length
+               return (MkListExtensionsReply names_len names)
+ 
+data ChangeKeyboardMapping = MkChangeKeyboardMapping{keycode_count_ChangeKeyboardMapping
+                                                     :: Word8,
+                                                     first_keycode_ChangeKeyboardMapping :: KEYCODE,
+                                                     keysyms_per_keycode_ChangeKeyboardMapping ::
+                                                     Word8,
+                                                     keysyms_ChangeKeyboardMapping :: [KEYSYM]}
+                           deriving (Show, Typeable)
+ 
+instance Serialize ChangeKeyboardMapping where
+        serialize x
+          = do putWord8 100
+               serialize (keycode_count_ChangeKeyboardMapping x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (first_keycode_ChangeKeyboardMapping x)
+               serialize (keysyms_per_keycode_ChangeKeyboardMapping x)
+               serializeList (keysyms_ChangeKeyboardMapping x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (keycode_count_ChangeKeyboardMapping x) +
+              size (first_keycode_ChangeKeyboardMapping x)
+              + size (keysyms_per_keycode_ChangeKeyboardMapping x)
+              + sum (map size (keysyms_ChangeKeyboardMapping x))
+ 
+data GetKeyboardMapping = MkGetKeyboardMapping{first_keycode_GetKeyboardMapping
+                                               :: KEYCODE,
+                                               count_GetKeyboardMapping :: Word8}
+                        deriving (Show, Typeable)
+ 
+instance Serialize GetKeyboardMapping where
+        serialize x
+          = do putWord8 101
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (first_keycode_GetKeyboardMapping x)
+               serialize (count_GetKeyboardMapping x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (first_keycode_GetKeyboardMapping x) +
+              size (count_GetKeyboardMapping x)
+ 
+data GetKeyboardMappingReply = MkGetKeyboardMappingReply{keysyms_per_keycode_GetKeyboardMappingReply
+                                                         :: Word8,
+                                                         keysyms_GetKeyboardMappingReply ::
+                                                         [KEYSYM]}
+                             deriving (Show, Typeable)
+ 
+instance Deserialize GetKeyboardMappingReply where
+        deserialize
+          = do skip 1
+               keysyms_per_keycode <- deserialize
+               skip 2
+               length <- deserialize
+               skip 24
+               keysyms <- deserializeList (fromIntegral length)
+               let _ = isCard32 length
+               return (MkGetKeyboardMappingReply keysyms_per_keycode keysyms)
+ 
+data KB = KBKeyClickPercent
+        | KBBellPercent
+        | KBBellPitch
+        | KBBellDuration
+        | KBLed
+        | KBLedMode
+        | KBKey
+        | KBAutoRepeatMode
+ 
+instance BitEnum KB where
+        toBit KBKeyClickPercent{} = 0
+        toBit KBBellPercent{} = 1
+        toBit KBBellPitch{} = 2
+        toBit KBBellDuration{} = 3
+        toBit KBLed{} = 4
+        toBit KBLedMode{} = 5
+        toBit KBKey{} = 6
+        toBit KBAutoRepeatMode{} = 7
+        fromBit 0 = KBKeyClickPercent
+        fromBit 1 = KBBellPercent
+        fromBit 2 = KBBellPitch
+        fromBit 3 = KBBellDuration
+        fromBit 4 = KBLed
+        fromBit 5 = KBLedMode
+        fromBit 6 = KBKey
+        fromBit 7 = KBAutoRepeatMode
+ 
+data LedMode = LedModeOff
+             | LedModeOn
+ 
+instance SimpleEnum LedMode where
+        toValue LedModeOff{} = 0
+        toValue LedModeOn{} = 1
+        fromValue 0 = LedModeOff
+        fromValue 1 = LedModeOn
+ 
+data AutoRepeatMode = AutoRepeatModeOff
+                    | AutoRepeatModeOn
+                    | AutoRepeatModeDefault
+ 
+instance SimpleEnum AutoRepeatMode where
+        toValue AutoRepeatModeOff{} = 0
+        toValue AutoRepeatModeOn{} = 1
+        toValue AutoRepeatModeDefault{} = 2
+        fromValue 0 = AutoRepeatModeOff
+        fromValue 1 = AutoRepeatModeOn
+        fromValue 2 = AutoRepeatModeDefault
+ 
+data ChangeKeyboardControl = MkChangeKeyboardControl{value_ChangeKeyboardControl
+                                                     :: ValueParam Word32}
+                           deriving (Show, Typeable)
+ 
+instance Serialize ChangeKeyboardControl where
+        serialize x
+          = do putWord8 102
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (value_ChangeKeyboardControl x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (value_ChangeKeyboardControl x)
+ 
+data GetKeyboardControl = MkGetKeyboardControl{}
+                        deriving (Show, Typeable)
+ 
+instance Serialize GetKeyboardControl where
+        serialize x
+          = do putWord8 103
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 4
+ 
+data GetKeyboardControlReply = MkGetKeyboardControlReply{global_auto_repeat_GetKeyboardControlReply
+                                                         :: Word8,
+                                                         led_mask_GetKeyboardControlReply :: Word32,
+                                                         key_click_percent_GetKeyboardControlReply
+                                                         :: Word8,
+                                                         bell_percent_GetKeyboardControlReply ::
+                                                         Word8,
+                                                         bell_pitch_GetKeyboardControlReply ::
+                                                         Word16,
+                                                         bell_duration_GetKeyboardControlReply ::
+                                                         Word16,
+                                                         auto_repeats_GetKeyboardControlReply ::
+                                                         [Word8]}
+                             deriving (Show, Typeable)
+ 
+instance Deserialize GetKeyboardControlReply where
+        deserialize
+          = do skip 1
+               global_auto_repeat <- deserialize
+               skip 2
+               length <- deserialize
+               led_mask <- deserialize
+               key_click_percent <- deserialize
+               bell_percent <- deserialize
+               bell_pitch <- deserialize
+               bell_duration <- deserialize
+               skip 2
+               auto_repeats <- deserializeList (fromIntegral 32)
+               let _ = isCard32 length
+               return
+                 (MkGetKeyboardControlReply global_auto_repeat led_mask
+                    key_click_percent
+                    bell_percent
+                    bell_pitch
+                    bell_duration
+                    auto_repeats)
+ 
+data Bell = MkBell{percent_Bell :: Int8}
+          deriving (Show, Typeable)
+ 
+instance Serialize Bell where
+        serialize x
+          = do putWord8 104
+               serialize (percent_Bell x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 3 + size (percent_Bell x)
+ 
+data ChangePointerControl = MkChangePointerControl{acceleration_numerator_ChangePointerControl
+                                                   :: Int16,
+                                                   acceleration_denominator_ChangePointerControl ::
+                                                   Int16,
+                                                   threshold_ChangePointerControl :: Int16,
+                                                   do_acceleration_ChangePointerControl :: Bool,
+                                                   do_threshold_ChangePointerControl :: Bool}
+                          deriving (Show, Typeable)
+ 
+instance Serialize ChangePointerControl where
+        serialize x
+          = do putWord8 105
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (acceleration_numerator_ChangePointerControl x)
+               serialize (acceleration_denominator_ChangePointerControl x)
+               serialize (threshold_ChangePointerControl x)
+               serialize (do_acceleration_ChangePointerControl x)
+               serialize (do_threshold_ChangePointerControl x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (acceleration_numerator_ChangePointerControl x) +
+              size (acceleration_denominator_ChangePointerControl x)
+              + size (threshold_ChangePointerControl x)
+              + size (do_acceleration_ChangePointerControl x)
+              + size (do_threshold_ChangePointerControl x)
+ 
+data GetPointerControl = MkGetPointerControl{}
+                       deriving (Show, Typeable)
+ 
+instance Serialize GetPointerControl where
+        serialize x
+          = do putWord8 106
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 4
+ 
+data GetPointerControlReply = MkGetPointerControlReply{acceleration_numerator_GetPointerControlReply
+                                                       :: Word16,
+                                                       acceleration_denominator_GetPointerControlReply
+                                                       :: Word16,
+                                                       threshold_GetPointerControlReply :: Word16}
+                            deriving (Show, Typeable)
+ 
+instance Deserialize GetPointerControlReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               acceleration_numerator <- deserialize
+               acceleration_denominator <- deserialize
+               threshold <- deserialize
+               skip 18
+               let _ = isCard32 length
+               return
+                 (MkGetPointerControlReply acceleration_numerator
+                    acceleration_denominator
+                    threshold)
+ 
+data Blanking = BlankingNotPreferred
+              | BlankingPreferred
+              | BlankingDefault
+ 
+instance SimpleEnum Blanking where
+        toValue BlankingNotPreferred{} = 0
+        toValue BlankingPreferred{} = 1
+        toValue BlankingDefault{} = 2
+        fromValue 0 = BlankingNotPreferred
+        fromValue 1 = BlankingPreferred
+        fromValue 2 = BlankingDefault
+ 
+data Exposures = ExposuresNotAllowed
+               | ExposuresAllowed
+               | ExposuresDefault
+ 
+instance SimpleEnum Exposures where
+        toValue ExposuresNotAllowed{} = 0
+        toValue ExposuresAllowed{} = 1
+        toValue ExposuresDefault{} = 2
+        fromValue 0 = ExposuresNotAllowed
+        fromValue 1 = ExposuresAllowed
+        fromValue 2 = ExposuresDefault
+ 
+data SetScreenSaver = MkSetScreenSaver{timeout_SetScreenSaver ::
+                                       Int16,
+                                       interval_SetScreenSaver :: Int16,
+                                       prefer_blanking_SetScreenSaver :: Word8,
+                                       allow_exposures_SetScreenSaver :: Word8}
+                    deriving (Show, Typeable)
+ 
+instance Serialize SetScreenSaver where
+        serialize x
+          = do putWord8 107
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (timeout_SetScreenSaver x)
+               serialize (interval_SetScreenSaver x)
+               serialize (prefer_blanking_SetScreenSaver x)
+               serialize (allow_exposures_SetScreenSaver x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (timeout_SetScreenSaver x) +
+              size (interval_SetScreenSaver x)
+              + size (prefer_blanking_SetScreenSaver x)
+              + size (allow_exposures_SetScreenSaver x)
+ 
+data GetScreenSaver = MkGetScreenSaver{}
+                    deriving (Show, Typeable)
+ 
+instance Serialize GetScreenSaver where
+        serialize x
+          = do putWord8 108
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 4
+ 
+data GetScreenSaverReply = MkGetScreenSaverReply{timeout_GetScreenSaverReply
+                                                 :: Word16,
+                                                 interval_GetScreenSaverReply :: Word16,
+                                                 prefer_blanking_GetScreenSaverReply :: Word8,
+                                                 allow_exposures_GetScreenSaverReply :: Word8}
+                         deriving (Show, Typeable)
+ 
+instance Deserialize GetScreenSaverReply where
+        deserialize
+          = do skip 1
+               skip 1
+               skip 2
+               length <- deserialize
+               timeout <- deserialize
+               interval <- deserialize
+               prefer_blanking <- deserialize
+               allow_exposures <- deserialize
+               skip 18
+               let _ = isCard32 length
+               return
+                 (MkGetScreenSaverReply timeout interval prefer_blanking
+                    allow_exposures)
+ 
+data HostMode = HostModeInsert
+              | HostModeDelete
+ 
+instance SimpleEnum HostMode where
+        toValue HostModeInsert{} = 0
+        toValue HostModeDelete{} = 1
+        fromValue 0 = HostModeInsert
+        fromValue 1 = HostModeDelete
+ 
+data Family = FamilyInternet
+            | FamilyDECnet
+            | FamilyChaos
+            | FamilyServerInterpreted
+            | FamilyInternet6
+ 
+instance SimpleEnum Family where
+        toValue FamilyInternet{} = 0
+        toValue FamilyDECnet{} = 1
+        toValue FamilyChaos{} = 2
+        toValue FamilyServerInterpreted{} = 5
+        toValue FamilyInternet6{} = 6
+        fromValue 0 = FamilyInternet
+        fromValue 1 = FamilyDECnet
+        fromValue 2 = FamilyChaos
+        fromValue 5 = FamilyServerInterpreted
+        fromValue 6 = FamilyInternet6
+ 
+data ChangeHosts = MkChangeHosts{mode_ChangeHosts :: Word8,
+                                 family_ChangeHosts :: Word8, address_len_ChangeHosts :: Word16,
+                                 address_ChangeHosts :: [CChar]}
+                 deriving (Show, Typeable)
+ 
+instance Serialize ChangeHosts where
+        serialize x
+          = do putWord8 109
+               serialize (mode_ChangeHosts x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (family_ChangeHosts x)
+               putSkip 1
+               serialize (address_len_ChangeHosts x)
+               serializeList (address_ChangeHosts x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (mode_ChangeHosts x) + size (family_ChangeHosts x) + 1 +
+              size (address_len_ChangeHosts x)
+              + sum (map size (address_ChangeHosts x))
+ 
+data HOST = MkHOST{family_HOST :: Word8,
+                   address_len_HOST :: Word16, address_HOST :: [Word8]}
+          deriving (Show, Typeable)
+ 
+instance Serialize HOST where
+        serialize x
+          = do serialize (family_HOST x)
+               putSkip 1
+               serialize (address_len_HOST x)
+               serializeList (address_HOST x)
+        size x
+          = size (family_HOST x) + 1 + size (address_len_HOST x) +
+              sum (map size (address_HOST x))
+ 
+instance Deserialize HOST where
+        deserialize
+          = do family <- deserialize
+               skip 1
+               address_len <- deserialize
+               address <- deserializeList (fromIntegral address_len)
+               return (MkHOST family address_len address)
+ 
+data ListHosts = MkListHosts{}
+               deriving (Show, Typeable)
+ 
+instance Serialize ListHosts where
+        serialize x
+          = do putWord8 110
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 4
+ 
+data ListHostsReply = MkListHostsReply{mode_ListHostsReply ::
+                                       Word8,
+                                       hosts_len_ListHostsReply :: Word16,
+                                       hosts_ListHostsReply :: [HOST]}
+                    deriving (Show, Typeable)
+ 
+instance Deserialize ListHostsReply where
+        deserialize
+          = do skip 1
+               mode <- deserialize
+               skip 2
+               length <- deserialize
+               hosts_len <- deserialize
+               skip 22
+               hosts <- deserializeList (fromIntegral hosts_len)
+               let _ = isCard32 length
+               return (MkListHostsReply mode hosts_len hosts)
+ 
+data AccessControl = AccessControlDisable
+                   | AccessControlEnable
+ 
+instance SimpleEnum AccessControl where
+        toValue AccessControlDisable{} = 0
+        toValue AccessControlEnable{} = 1
+        fromValue 0 = AccessControlDisable
+        fromValue 1 = AccessControlEnable
+ 
+data SetAccessControl = MkSetAccessControl{mode_SetAccessControl ::
+                                           Word8}
+                      deriving (Show, Typeable)
+ 
+instance Serialize SetAccessControl where
+        serialize x
+          = do putWord8 111
+               serialize (mode_SetAccessControl x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 3 + size (mode_SetAccessControl x)
+ 
+data CloseDown = CloseDownDestroyAll
+               | CloseDownRetainPermanent
+               | CloseDownRetainTemporary
+ 
+instance SimpleEnum CloseDown where
+        toValue CloseDownDestroyAll{} = 0
+        toValue CloseDownRetainPermanent{} = 1
+        toValue CloseDownRetainTemporary{} = 2
+        fromValue 0 = CloseDownDestroyAll
+        fromValue 1 = CloseDownRetainPermanent
+        fromValue 2 = CloseDownRetainTemporary
+ 
+data SetCloseDownMode = MkSetCloseDownMode{mode_SetCloseDownMode ::
+                                           Word8}
+                      deriving (Show, Typeable)
+ 
+instance Serialize SetCloseDownMode where
+        serialize x
+          = do putWord8 112
+               serialize (mode_SetCloseDownMode x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 3 + size (mode_SetCloseDownMode x)
+ 
+data Kill = KillAllTemporary
+ 
+instance SimpleEnum Kill where
+        toValue KillAllTemporary{} = 0
+        fromValue 0 = KillAllTemporary
+ 
+data KillClient = MkKillClient{resource_KillClient :: Word32}
+                deriving (Show, Typeable)
+ 
+instance Serialize KillClient where
+        serialize x
+          = do putWord8 113
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (resource_KillClient x)
+               putSkip (requiredPadding (size x))
+        size x = 3 + 1 + size (resource_KillClient x)
+ 
+data RotateProperties = MkRotateProperties{window_RotateProperties
+                                           :: WINDOW,
+                                           atoms_len_RotateProperties :: Word16,
+                                           delta_RotateProperties :: Int16,
+                                           atoms_RotateProperties :: [ATOM]}
+                      deriving (Show, Typeable)
+ 
+instance Serialize RotateProperties where
+        serialize x
+          = do putWord8 114
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serialize (window_RotateProperties x)
+               serialize (atoms_len_RotateProperties x)
+               serialize (delta_RotateProperties x)
+               serializeList (atoms_RotateProperties x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + 1 + size (window_RotateProperties x) +
+              size (atoms_len_RotateProperties x)
+              + size (delta_RotateProperties x)
+              + sum (map size (atoms_RotateProperties x))
+ 
+data ScreenSaver = ScreenSaverReset
+                 | ScreenSaverActive
+ 
+instance SimpleEnum ScreenSaver where
+        toValue ScreenSaverReset{} = 0
+        toValue ScreenSaverActive{} = 1
+        fromValue 0 = ScreenSaverReset
+        fromValue 1 = ScreenSaverActive
+ 
+data ForceScreenSaver = MkForceScreenSaver{mode_ForceScreenSaver ::
+                                           Word8}
+                      deriving (Show, Typeable)
+ 
+instance Serialize ForceScreenSaver where
+        serialize x
+          = do putWord8 115
+               serialize (mode_ForceScreenSaver x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 3 + size (mode_ForceScreenSaver x)
+ 
+data MappingStatus = MappingStatusSuccess
+                   | MappingStatusBusy
+                   | MappingStatusFailure
+ 
+instance SimpleEnum MappingStatus where
+        toValue MappingStatusSuccess{} = 0
+        toValue MappingStatusBusy{} = 1
+        toValue MappingStatusFailure{} = 2
+        fromValue 0 = MappingStatusSuccess
+        fromValue 1 = MappingStatusBusy
+        fromValue 2 = MappingStatusFailure
+ 
+data SetPointerMapping = MkSetPointerMapping{map_len_SetPointerMapping
+                                             :: Word8,
+                                             map_SetPointerMapping :: [Word8]}
+                       deriving (Show, Typeable)
+ 
+instance Serialize SetPointerMapping where
+        serialize x
+          = do putWord8 116
+               serialize (map_len_SetPointerMapping x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serializeList (map_SetPointerMapping x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (map_len_SetPointerMapping x) +
+              sum (map size (map_SetPointerMapping x))
+ 
+data SetPointerMappingReply = MkSetPointerMappingReply{status_SetPointerMappingReply
+                                                       :: Word8}
+                            deriving (Show, Typeable)
+ 
+instance Deserialize SetPointerMappingReply where
+        deserialize
+          = do skip 1
+               status <- deserialize
+               skip 2
+               length <- deserialize
+               let _ = isCard32 length
+               return (MkSetPointerMappingReply status)
+ 
+data GetPointerMapping = MkGetPointerMapping{}
+                       deriving (Show, Typeable)
+ 
+instance Serialize GetPointerMapping where
+        serialize x
+          = do putWord8 117
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 4
+ 
+data GetPointerMappingReply = MkGetPointerMappingReply{map_len_GetPointerMappingReply
+                                                       :: Word8,
+                                                       map_GetPointerMappingReply :: [Word8]}
+                            deriving (Show, Typeable)
+ 
+instance Deserialize GetPointerMappingReply where
+        deserialize
+          = do skip 1
+               map_len <- deserialize
+               skip 2
+               length <- deserialize
+               skip 24
+               map <- deserializeList (fromIntegral map_len)
+               let _ = isCard32 length
+               return (MkGetPointerMappingReply map_len map)
+ 
+data MapIndex = MapIndexShift
+              | MapIndexLock
+              | MapIndexControl
+              | MapIndex1
+              | MapIndex2
+              | MapIndex3
+              | MapIndex4
+              | MapIndex5
+ 
+instance SimpleEnum MapIndex where
+        toValue MapIndexShift{} = 0
+        toValue MapIndexLock{} = 1
+        toValue MapIndexControl{} = 2
+        toValue MapIndex1{} = 3
+        toValue MapIndex2{} = 4
+        toValue MapIndex3{} = 5
+        toValue MapIndex4{} = 6
+        toValue MapIndex5{} = 7
+        fromValue 0 = MapIndexShift
+        fromValue 1 = MapIndexLock
+        fromValue 2 = MapIndexControl
+        fromValue 3 = MapIndex1
+        fromValue 4 = MapIndex2
+        fromValue 5 = MapIndex3
+        fromValue 6 = MapIndex4
+        fromValue 7 = MapIndex5
+ 
+data SetModifierMapping = MkSetModifierMapping{keycodes_per_modifier_SetModifierMapping
+                                               :: Word8,
+                                               keycodes_SetModifierMapping :: [KEYCODE]}
+                        deriving (Show, Typeable)
+ 
+instance Serialize SetModifierMapping where
+        serialize x
+          = do putWord8 118
+               serialize (keycodes_per_modifier_SetModifierMapping x)
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               serializeList (keycodes_SetModifierMapping x)
+               putSkip (requiredPadding (size x))
+        size x
+          = 3 + size (keycodes_per_modifier_SetModifierMapping x) +
+              sum (map size (keycodes_SetModifierMapping x))
+ 
+data SetModifierMappingReply = MkSetModifierMappingReply{status_SetModifierMappingReply
+                                                         :: Word8}
+                             deriving (Show, Typeable)
+ 
+instance Deserialize SetModifierMappingReply where
+        deserialize
+          = do skip 1
+               status <- deserialize
+               skip 2
+               length <- deserialize
+               let _ = isCard32 length
+               return (MkSetModifierMappingReply status)
+ 
+data GetModifierMapping = MkGetModifierMapping{}
+                        deriving (Show, Typeable)
+ 
+instance Serialize GetModifierMapping where
+        serialize x
+          = do putWord8 119
+               putSkip 1
+               serialize (convertBytesToRequestSize (size x) :: Int16)
+               putSkip (requiredPadding (size x))
+        size x = 4
+ 
+data GetModifierMappingReply = MkGetModifierMappingReply{keycodes_per_modifier_GetModifierMappingReply
+                                                         :: Word8,
                                                          keycodes_GetModifierMappingReply ::
                                                          [KEYCODE]}
                              deriving (Show, Typeable)
diff --git a/patched/Graphics/XHB/Gen/Xv.hs b/patched/Graphics/XHB/Gen/Xv.hs
--- a/patched/Graphics/XHB/Gen/Xv.hs
+++ b/patched/Graphics/XHB/Gen/Xv.hs
@@ -12,6 +12,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xproto.Types
@@ -30,44 +33,45 @@
                  Graphics.XHB.Connection.Types.Connection ->
                    IO (Receipt QueryExtensionReply)
 queryExtension c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryExtension
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryAdaptors ::
                 Graphics.XHB.Connection.Types.Connection ->
                   WINDOW -> IO (Receipt QueryAdaptorsReply)
 queryAdaptors c window
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryAdaptors window
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryEncodings ::
                  Graphics.XHB.Connection.Types.Connection ->
                    PORT -> IO (Receipt QueryEncodingsReply)
 queryEncodings c port
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryEncodings port
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 grabPort ::
            Graphics.XHB.Connection.Types.Connection ->
-             PORT -> TIMESTAMP -> IO (Receipt GrabPortReply)
+             PORT -> TIMESTAMP -> IO (Receipt Word8)
 grabPort c port time
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (result_GrabPortReply `fmap` deserialize))
        let req = MkGrabPort port time
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 ungrabPort ::
@@ -118,7 +122,7 @@
  
 selectVideoNotify ::
                     Graphics.XHB.Connection.Types.Connection ->
-                      DRAWABLE -> BOOL -> IO ()
+                      DRAWABLE -> Bool -> IO ()
 selectVideoNotify c drawable onoff
   = do let req = MkSelectVideoNotify drawable onoff
        putAction <- serializeExtensionRequest c req
@@ -126,7 +130,7 @@
        sendRequest c chunk
  
 selectPortNotify ::
-                   Graphics.XHB.Connection.Types.Connection -> PORT -> BOOL -> IO ()
+                   Graphics.XHB.Connection.Types.Connection -> PORT -> Bool -> IO ()
 selectPortNotify c port onoff
   = do let req = MkSelectPortNotify port onoff
        putAction <- serializeExtensionRequest c req
@@ -137,10 +141,10 @@
                 Graphics.XHB.Connection.Types.Connection ->
                   QueryBestSize -> IO (Receipt QueryBestSizeReply)
 queryBestSize c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 setPortAttribute ::
@@ -153,45 +157,46 @@
  
 getPortAttribute ::
                    Graphics.XHB.Connection.Types.Connection ->
-                     PORT -> ATOM -> IO (Receipt GetPortAttributeReply)
+                     PORT -> ATOM -> IO (Receipt Int32)
 getPortAttribute c port attribute
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (value_GetPortAttributeReply `fmap` deserialize))
        let req = MkGetPortAttribute port attribute
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryPortAttributes ::
                       Graphics.XHB.Connection.Types.Connection ->
                         PORT -> IO (Receipt QueryPortAttributesReply)
 queryPortAttributes c port
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryPortAttributes port
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 listImageFormats ::
                    Graphics.XHB.Connection.Types.Connection ->
                      PORT -> IO (Receipt ListImageFormatsReply)
 listImageFormats c port
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListImageFormats port
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 queryImageAttributes ::
                        Graphics.XHB.Connection.Types.Connection ->
                          QueryImageAttributes -> IO (Receipt QueryImageAttributesReply)
 queryImageAttributes c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 putImage ::
diff --git a/patched/Graphics/XHB/Gen/Xv/Types.hs b/patched/Graphics/XHB/Gen/Xv/Types.hs
--- a/patched/Graphics/XHB/Gen/Xv/Types.hs
+++ b/patched/Graphics/XHB/Gen/Xv/Types.hs
@@ -18,6 +18,7 @@
        where
 import Prelude hiding (Rational)
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -98,8 +99,8 @@
         fromBit 0 = AttributeFlagGettable
         fromBit 1 = AttributeFlagSettable
  
-data Rational = MkRational{numerator_Rational :: INT32,
-                           denominator_Rational :: INT32}
+data Rational = MkRational{numerator_Rational :: Int32,
+                           denominator_Rational :: Int32}
               deriving (Show, Typeable)
  
 instance Serialize Rational where
@@ -116,7 +117,7 @@
                return (MkRational numerator denominator)
  
 data Format = MkFormat{visual_Format :: VISUALID,
-                       depth_Format :: CARD8}
+                       depth_Format :: Word8}
             deriving (Show, Typeable)
  
 instance Serialize Format where
@@ -134,8 +135,8 @@
                return (MkFormat visual depth)
  
 data AdaptorInfo = MkAdaptorInfo{base_id_AdaptorInfo :: PORT,
-                                 name_size_AdaptorInfo :: CARD16, num_ports_AdaptorInfo :: CARD16,
-                                 num_formats_AdaptorInfo :: CARD16, type_AdaptorInfo :: CARD8,
+                                 name_size_AdaptorInfo :: Word16, num_ports_AdaptorInfo :: Word16,
+                                 num_formats_AdaptorInfo :: Word16, type_AdaptorInfo :: Word8,
                                  name_AdaptorInfo :: [CChar], formats_AdaptorInfo :: [Format]}
                  deriving (Show, Typeable)
  
@@ -174,8 +175,8 @@
  
 data EncodingInfo = MkEncodingInfo{encoding_EncodingInfo ::
                                    ENCODING,
-                                   name_size_EncodingInfo :: CARD16, width_EncodingInfo :: CARD16,
-                                   height_EncodingInfo :: CARD16, rate_EncodingInfo :: Rational,
+                                   name_size_EncodingInfo :: Word16, width_EncodingInfo :: Word16,
+                                   height_EncodingInfo :: Word16, rate_EncodingInfo :: Rational,
                                    name_EncodingInfo :: [CChar]}
                   deriving (Show, Typeable)
  
@@ -207,10 +208,10 @@
                name <- deserializeList (fromIntegral name_size)
                return (MkEncodingInfo encoding name_size width height rate name)
  
-data Image = MkImage{id_Image :: CARD32, width_Image :: CARD16,
-                     height_Image :: CARD16, data_size_Image :: CARD32,
-                     num_planes_Image :: CARD32, pitches_Image :: [CARD32],
-                     offsets_Image :: [CARD32], data_Image :: [CARD8]}
+data Image = MkImage{id_Image :: Word32, width_Image :: Word16,
+                     height_Image :: Word16, data_size_Image :: Word32,
+                     num_planes_Image :: Word32, pitches_Image :: [Word32],
+                     offsets_Image :: [Word32], data_Image :: [Word8]}
            deriving (Show, Typeable)
  
 instance Serialize Image where
@@ -245,9 +246,9 @@
                  (MkImage id width height data_size num_planes pitches offsets
                     data_)
  
-data AttributeInfo = MkAttributeInfo{flags_AttributeInfo :: CARD32,
-                                     min_AttributeInfo :: INT32, max_AttributeInfo :: INT32,
-                                     size_AttributeInfo :: CARD32, name_AttributeInfo :: [CChar]}
+data AttributeInfo = MkAttributeInfo{flags_AttributeInfo :: Word32,
+                                     min_AttributeInfo :: Int32, max_AttributeInfo :: Int32,
+                                     size_AttributeInfo :: Word32, name_AttributeInfo :: [CChar]}
                    deriving (Show, Typeable)
  
 instance Serialize AttributeInfo where
@@ -273,28 +274,28 @@
                return (MkAttributeInfo flags min max size name)
  
 data ImageFormatInfo = MkImageFormatInfo{id_ImageFormatInfo ::
-                                         CARD32,
-                                         type_ImageFormatInfo :: CARD8,
-                                         byte_order_ImageFormatInfo :: CARD8,
-                                         guid_ImageFormatInfo :: [CARD8],
-                                         bpp_ImageFormatInfo :: CARD8,
-                                         num_planes_ImageFormatInfo :: CARD8,
-                                         depth_ImageFormatInfo :: CARD8,
-                                         red_mask_ImageFormatInfo :: CARD32,
-                                         green_mask_ImageFormatInfo :: CARD32,
-                                         blue_mask_ImageFormatInfo :: CARD32,
-                                         format_ImageFormatInfo :: CARD8,
-                                         y_sample_bits_ImageFormatInfo :: CARD32,
-                                         u_sample_bits_ImageFormatInfo :: CARD32,
-                                         v_sample_bits_ImageFormatInfo :: CARD32,
-                                         vhorz_y_period_ImageFormatInfo :: CARD32,
-                                         vhorz_u_period_ImageFormatInfo :: CARD32,
-                                         vhorz_v_period_ImageFormatInfo :: CARD32,
-                                         vvert_y_period_ImageFormatInfo :: CARD32,
-                                         vvert_u_period_ImageFormatInfo :: CARD32,
-                                         vvert_v_period_ImageFormatInfo :: CARD32,
-                                         vcomp_order_ImageFormatInfo :: [CARD8],
-                                         vscanline_order_ImageFormatInfo :: CARD8}
+                                         Word32,
+                                         type_ImageFormatInfo :: Word8,
+                                         byte_order_ImageFormatInfo :: Word8,
+                                         guid_ImageFormatInfo :: [Word8],
+                                         bpp_ImageFormatInfo :: Word8,
+                                         num_planes_ImageFormatInfo :: Word8,
+                                         depth_ImageFormatInfo :: Word8,
+                                         red_mask_ImageFormatInfo :: Word32,
+                                         green_mask_ImageFormatInfo :: Word32,
+                                         blue_mask_ImageFormatInfo :: Word32,
+                                         format_ImageFormatInfo :: Word8,
+                                         y_sample_bits_ImageFormatInfo :: Word32,
+                                         u_sample_bits_ImageFormatInfo :: Word32,
+                                         v_sample_bits_ImageFormatInfo :: Word32,
+                                         vhorz_y_period_ImageFormatInfo :: Word32,
+                                         vhorz_u_period_ImageFormatInfo :: Word32,
+                                         vhorz_v_period_ImageFormatInfo :: Word32,
+                                         vvert_y_period_ImageFormatInfo :: Word32,
+                                         vvert_u_period_ImageFormatInfo :: Word32,
+                                         vvert_v_period_ImageFormatInfo :: Word32,
+                                         vcomp_order_ImageFormatInfo :: [Word8],
+                                         vscanline_order_ImageFormatInfo :: Word8}
                      deriving (Show, Typeable)
  
 instance Serialize ImageFormatInfo where
@@ -401,7 +402,7 @@
                     vcomp_order
                     vscanline_order)
  
-data VideoNotify = MkVideoNotify{reason_VideoNotify :: BYTE,
+data VideoNotify = MkVideoNotify{reason_VideoNotify :: Word8,
                                  time_VideoNotify :: TIMESTAMP, drawable_VideoNotify :: DRAWABLE,
                                  port_VideoNotify :: PORT}
                  deriving (Show, Typeable)
@@ -420,7 +421,7 @@
  
 data PortNotify = MkPortNotify{time_PortNotify :: TIMESTAMP,
                                port_PortNotify :: PORT, attribute_PortNotify :: ATOM,
-                               value_PortNotify :: INT32}
+                               value_PortNotify :: Int32}
                 deriving (Show, Typeable)
  
 instance Graphics.XHB.Shared.Event PortNotify
@@ -445,12 +446,12 @@
           = do putWord8 extOpCode
                putWord8 0
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data QueryExtensionReply = MkQueryExtensionReply{major_QueryExtensionReply
-                                                 :: CARD16,
-                                                 minor_QueryExtensionReply :: CARD16}
+                                                 :: Word16,
+                                                 minor_QueryExtensionReply :: Word16}
                          deriving (Show, Typeable)
  
 instance Deserialize QueryExtensionReply where
@@ -474,12 +475,12 @@
           = do putWord8 extOpCode
                putWord8 1
                let size__ = 4 + size (window_QueryAdaptors x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (window_QueryAdaptors x)
                putSkip (requiredPadding size__)
  
 data QueryAdaptorsReply = MkQueryAdaptorsReply{num_adaptors_QueryAdaptorsReply
-                                               :: CARD16,
+                                               :: Word16,
                                                info_QueryAdaptorsReply :: [AdaptorInfo]}
                         deriving (Show, Typeable)
  
@@ -504,12 +505,12 @@
           = do putWord8 extOpCode
                putWord8 2
                let size__ = 4 + size (port_QueryEncodings x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_QueryEncodings x)
                putSkip (requiredPadding size__)
  
 data QueryEncodingsReply = MkQueryEncodingsReply{num_encodings_QueryEncodingsReply
-                                                 :: CARD16,
+                                                 :: Word16,
                                                  info_QueryEncodingsReply :: [EncodingInfo]}
                          deriving (Show, Typeable)
  
@@ -535,12 +536,12 @@
           = do putWord8 extOpCode
                putWord8 3
                let size__ = 4 + size (port_GrabPort x) + size (time_GrabPort x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_GrabPort x)
                serialize (time_GrabPort x)
                putSkip (requiredPadding size__)
  
-data GrabPortReply = MkGrabPortReply{result_GrabPortReply :: BYTE}
+data GrabPortReply = MkGrabPortReply{result_GrabPortReply :: Word8}
                    deriving (Show, Typeable)
  
 instance Deserialize GrabPortReply where
@@ -563,17 +564,17 @@
                putWord8 4
                let size__
                      = 4 + size (port_UngrabPort x) + size (time_UngrabPort x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_UngrabPort x)
                serialize (time_UngrabPort x)
                putSkip (requiredPadding size__)
  
 data PutVideo = MkPutVideo{port_PutVideo :: PORT,
                            drawable_PutVideo :: DRAWABLE, gc_PutVideo :: GCONTEXT,
-                           vid_x_PutVideo :: INT16, vid_y_PutVideo :: INT16,
-                           vid_w_PutVideo :: CARD16, vid_h_PutVideo :: CARD16,
-                           drw_x_PutVideo :: INT16, drw_y_PutVideo :: INT16,
-                           drw_w_PutVideo :: CARD16, drw_h_PutVideo :: CARD16}
+                           vid_x_PutVideo :: Int16, vid_y_PutVideo :: Int16,
+                           vid_w_PutVideo :: Word16, vid_h_PutVideo :: Word16,
+                           drw_x_PutVideo :: Int16, drw_y_PutVideo :: Int16,
+                           drw_w_PutVideo :: Word16, drw_h_PutVideo :: Word16}
               deriving (Show, Typeable)
  
 instance ExtensionRequest PutVideo where
@@ -592,7 +593,7 @@
                          + size (drw_y_PutVideo x)
                          + size (drw_w_PutVideo x)
                          + size (drw_h_PutVideo x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_PutVideo x)
                serialize (drawable_PutVideo x)
                serialize (gc_PutVideo x)
@@ -608,10 +609,10 @@
  
 data PutStill = MkPutStill{port_PutStill :: PORT,
                            drawable_PutStill :: DRAWABLE, gc_PutStill :: GCONTEXT,
-                           vid_x_PutStill :: INT16, vid_y_PutStill :: INT16,
-                           vid_w_PutStill :: CARD16, vid_h_PutStill :: CARD16,
-                           drw_x_PutStill :: INT16, drw_y_PutStill :: INT16,
-                           drw_w_PutStill :: CARD16, drw_h_PutStill :: CARD16}
+                           vid_x_PutStill :: Int16, vid_y_PutStill :: Int16,
+                           vid_w_PutStill :: Word16, vid_h_PutStill :: Word16,
+                           drw_x_PutStill :: Int16, drw_y_PutStill :: Int16,
+                           drw_w_PutStill :: Word16, drw_h_PutStill :: Word16}
               deriving (Show, Typeable)
  
 instance ExtensionRequest PutStill where
@@ -630,7 +631,7 @@
                          + size (drw_y_PutStill x)
                          + size (drw_w_PutStill x)
                          + size (drw_h_PutStill x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_PutStill x)
                serialize (drawable_PutStill x)
                serialize (gc_PutStill x)
@@ -646,10 +647,10 @@
  
 data GetVideo = MkGetVideo{port_GetVideo :: PORT,
                            drawable_GetVideo :: DRAWABLE, gc_GetVideo :: GCONTEXT,
-                           vid_x_GetVideo :: INT16, vid_y_GetVideo :: INT16,
-                           vid_w_GetVideo :: CARD16, vid_h_GetVideo :: CARD16,
-                           drw_x_GetVideo :: INT16, drw_y_GetVideo :: INT16,
-                           drw_w_GetVideo :: CARD16, drw_h_GetVideo :: CARD16}
+                           vid_x_GetVideo :: Int16, vid_y_GetVideo :: Int16,
+                           vid_w_GetVideo :: Word16, vid_h_GetVideo :: Word16,
+                           drw_x_GetVideo :: Int16, drw_y_GetVideo :: Int16,
+                           drw_w_GetVideo :: Word16, drw_h_GetVideo :: Word16}
               deriving (Show, Typeable)
  
 instance ExtensionRequest GetVideo where
@@ -668,7 +669,7 @@
                          + size (drw_y_GetVideo x)
                          + size (drw_w_GetVideo x)
                          + size (drw_h_GetVideo x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_GetVideo x)
                serialize (drawable_GetVideo x)
                serialize (gc_GetVideo x)
@@ -684,10 +685,10 @@
  
 data GetStill = MkGetStill{port_GetStill :: PORT,
                            drawable_GetStill :: DRAWABLE, gc_GetStill :: GCONTEXT,
-                           vid_x_GetStill :: INT16, vid_y_GetStill :: INT16,
-                           vid_w_GetStill :: CARD16, vid_h_GetStill :: CARD16,
-                           drw_x_GetStill :: INT16, drw_y_GetStill :: INT16,
-                           drw_w_GetStill :: CARD16, drw_h_GetStill :: CARD16}
+                           vid_x_GetStill :: Int16, vid_y_GetStill :: Int16,
+                           vid_w_GetStill :: Word16, vid_h_GetStill :: Word16,
+                           drw_x_GetStill :: Int16, drw_y_GetStill :: Int16,
+                           drw_w_GetStill :: Word16, drw_h_GetStill :: Word16}
               deriving (Show, Typeable)
  
 instance ExtensionRequest GetStill where
@@ -706,7 +707,7 @@
                          + size (drw_y_GetStill x)
                          + size (drw_w_GetStill x)
                          + size (drw_h_GetStill x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_GetStill x)
                serialize (drawable_GetStill x)
                serialize (gc_GetStill x)
@@ -731,14 +732,14 @@
                putWord8 9
                let size__
                      = 4 + size (port_StopVideo x) + size (drawable_StopVideo x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_StopVideo x)
                serialize (drawable_StopVideo x)
                putSkip (requiredPadding size__)
  
 data SelectVideoNotify = MkSelectVideoNotify{drawable_SelectVideoNotify
                                              :: DRAWABLE,
-                                             onoff_SelectVideoNotify :: BOOL}
+                                             onoff_SelectVideoNotify :: Bool}
                        deriving (Show, Typeable)
  
 instance ExtensionRequest SelectVideoNotify where
@@ -750,7 +751,7 @@
                      = 4 + size (drawable_SelectVideoNotify x) +
                          size (onoff_SelectVideoNotify x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (drawable_SelectVideoNotify x)
                serialize (onoff_SelectVideoNotify x)
                putSkip 3
@@ -758,7 +759,7 @@
  
 data SelectPortNotify = MkSelectPortNotify{port_SelectPortNotify ::
                                            PORT,
-                                           onoff_SelectPortNotify :: BOOL}
+                                           onoff_SelectPortNotify :: Bool}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest SelectPortNotify where
@@ -770,16 +771,16 @@
                      = 4 + size (port_SelectPortNotify x) +
                          size (onoff_SelectPortNotify x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_SelectPortNotify x)
                serialize (onoff_SelectPortNotify x)
                putSkip 3
                putSkip (requiredPadding size__)
  
 data QueryBestSize = MkQueryBestSize{port_QueryBestSize :: PORT,
-                                     vid_w_QueryBestSize :: CARD16, vid_h_QueryBestSize :: CARD16,
-                                     drw_w_QueryBestSize :: CARD16, drw_h_QueryBestSize :: CARD16,
-                                     motion_QueryBestSize :: BOOL}
+                                     vid_w_QueryBestSize :: Word16, vid_h_QueryBestSize :: Word16,
+                                     drw_w_QueryBestSize :: Word16, drw_h_QueryBestSize :: Word16,
+                                     motion_QueryBestSize :: Bool}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest QueryBestSize where
@@ -794,7 +795,7 @@
                          + size (drw_h_QueryBestSize x)
                          + size (motion_QueryBestSize x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_QueryBestSize x)
                serialize (vid_w_QueryBestSize x)
                serialize (vid_h_QueryBestSize x)
@@ -805,8 +806,8 @@
                putSkip (requiredPadding size__)
  
 data QueryBestSizeReply = MkQueryBestSizeReply{actual_width_QueryBestSizeReply
-                                               :: CARD16,
-                                               actual_height_QueryBestSizeReply :: CARD16}
+                                               :: Word16,
+                                               actual_height_QueryBestSizeReply :: Word16}
                         deriving (Show, Typeable)
  
 instance Deserialize QueryBestSizeReply where
@@ -823,7 +824,7 @@
 data SetPortAttribute = MkSetPortAttribute{port_SetPortAttribute ::
                                            PORT,
                                            attribute_SetPortAttribute :: ATOM,
-                                           value_SetPortAttribute :: INT32}
+                                           value_SetPortAttribute :: Int32}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest SetPortAttribute where
@@ -835,7 +836,7 @@
                      = 4 + size (port_SetPortAttribute x) +
                          size (attribute_SetPortAttribute x)
                          + size (value_SetPortAttribute x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_SetPortAttribute x)
                serialize (attribute_SetPortAttribute x)
                serialize (value_SetPortAttribute x)
@@ -854,13 +855,13 @@
                let size__
                      = 4 + size (port_GetPortAttribute x) +
                          size (attribute_GetPortAttribute x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_GetPortAttribute x)
                serialize (attribute_GetPortAttribute x)
                putSkip (requiredPadding size__)
  
 data GetPortAttributeReply = MkGetPortAttributeReply{value_GetPortAttributeReply
-                                                     :: INT32}
+                                                     :: Int32}
                            deriving (Show, Typeable)
  
 instance Deserialize GetPortAttributeReply where
@@ -883,14 +884,14 @@
           = do putWord8 extOpCode
                putWord8 15
                let size__ = 4 + size (port_QueryPortAttributes x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_QueryPortAttributes x)
                putSkip (requiredPadding size__)
  
 data QueryPortAttributesReply = MkQueryPortAttributesReply{num_attributes_QueryPortAttributesReply
-                                                           :: CARD32,
+                                                           :: Word32,
                                                            text_size_QueryPortAttributesReply ::
-                                                           CARD32,
+                                                           Word32,
                                                            attributes_QueryPortAttributesReply ::
                                                            [AttributeInfo]}
                               deriving (Show, Typeable)
@@ -919,12 +920,12 @@
           = do putWord8 extOpCode
                putWord8 16
                let size__ = 4 + size (port_ListImageFormats x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_ListImageFormats x)
                putSkip (requiredPadding size__)
  
 data ListImageFormatsReply = MkListImageFormatsReply{num_formats_ListImageFormatsReply
-                                                     :: CARD32,
+                                                     :: Word32,
                                                      format_ListImageFormatsReply ::
                                                      [ImageFormatInfo]}
                            deriving (Show, Typeable)
@@ -943,9 +944,9 @@
  
 data QueryImageAttributes = MkQueryImageAttributes{port_QueryImageAttributes
                                                    :: PORT,
-                                                   id_QueryImageAttributes :: CARD32,
-                                                   width_QueryImageAttributes :: CARD16,
-                                                   height_QueryImageAttributes :: CARD16}
+                                                   id_QueryImageAttributes :: Word32,
+                                                   width_QueryImageAttributes :: Word16,
+                                                   height_QueryImageAttributes :: Word16}
                           deriving (Show, Typeable)
  
 instance ExtensionRequest QueryImageAttributes where
@@ -958,7 +959,7 @@
                          size (id_QueryImageAttributes x)
                          + size (width_QueryImageAttributes x)
                          + size (height_QueryImageAttributes x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_QueryImageAttributes x)
                serialize (id_QueryImageAttributes x)
                serialize (width_QueryImageAttributes x)
@@ -966,17 +967,17 @@
                putSkip (requiredPadding size__)
  
 data QueryImageAttributesReply = MkQueryImageAttributesReply{num_planes_QueryImageAttributesReply
-                                                             :: CARD32,
+                                                             :: Word32,
                                                              data_size_QueryImageAttributesReply ::
-                                                             CARD32,
+                                                             Word32,
                                                              width_QueryImageAttributesReply ::
-                                                             CARD16,
+                                                             Word16,
                                                              height_QueryImageAttributesReply ::
-                                                             CARD16,
+                                                             Word16,
                                                              pitches_QueryImageAttributesReply ::
-                                                             [CARD32],
+                                                             [Word32],
                                                              offsets_QueryImageAttributesReply ::
-                                                             [CARD32]}
+                                                             [Word32]}
                                deriving (Show, Typeable)
  
 instance Deserialize QueryImageAttributesReply where
@@ -1000,12 +1001,12 @@
  
 data PutImage = MkPutImage{port_PutImage :: PORT,
                            drawable_PutImage :: DRAWABLE, gc_PutImage :: GCONTEXT,
-                           id_PutImage :: CARD32, src_x_PutImage :: INT16,
-                           src_y_PutImage :: INT16, src_w_PutImage :: CARD16,
-                           src_h_PutImage :: CARD16, drw_x_PutImage :: INT16,
-                           drw_y_PutImage :: INT16, drw_w_PutImage :: CARD16,
-                           drw_h_PutImage :: CARD16, width_PutImage :: CARD16,
-                           height_PutImage :: CARD16, data_PutImage :: [CARD8]}
+                           id_PutImage :: Word32, src_x_PutImage :: Int16,
+                           src_y_PutImage :: Int16, src_w_PutImage :: Word16,
+                           src_h_PutImage :: Word16, drw_x_PutImage :: Int16,
+                           drw_y_PutImage :: Int16, drw_w_PutImage :: Word16,
+                           drw_h_PutImage :: Word16, width_PutImage :: Word16,
+                           height_PutImage :: Word16, data_PutImage :: [Word8]}
               deriving (Show, Typeable)
  
 instance ExtensionRequest PutImage where
@@ -1028,7 +1029,7 @@
                          + size (width_PutImage x)
                          + size (height_PutImage x)
                          + sum (map size (data_PutImage x))
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_PutImage x)
                serialize (drawable_PutImage x)
                serialize (gc_PutImage x)
@@ -1048,13 +1049,13 @@
  
 data ShmPutImage = MkShmPutImage{port_ShmPutImage :: PORT,
                                  drawable_ShmPutImage :: DRAWABLE, gc_ShmPutImage :: GCONTEXT,
-                                 shmseg_ShmPutImage :: SEG, id_ShmPutImage :: CARD32,
-                                 offset_ShmPutImage :: CARD32, src_x_ShmPutImage :: INT16,
-                                 src_y_ShmPutImage :: INT16, src_w_ShmPutImage :: CARD16,
-                                 src_h_ShmPutImage :: CARD16, drw_x_ShmPutImage :: INT16,
-                                 drw_y_ShmPutImage :: INT16, drw_w_ShmPutImage :: CARD16,
-                                 drw_h_ShmPutImage :: CARD16, width_ShmPutImage :: CARD16,
-                                 height_ShmPutImage :: CARD16, send_event_ShmPutImage :: CARD8}
+                                 shmseg_ShmPutImage :: SEG, id_ShmPutImage :: Word32,
+                                 offset_ShmPutImage :: Word32, src_x_ShmPutImage :: Int16,
+                                 src_y_ShmPutImage :: Int16, src_w_ShmPutImage :: Word16,
+                                 src_h_ShmPutImage :: Word16, drw_x_ShmPutImage :: Int16,
+                                 drw_y_ShmPutImage :: Int16, drw_w_ShmPutImage :: Word16,
+                                 drw_h_ShmPutImage :: Word16, width_ShmPutImage :: Word16,
+                                 height_ShmPutImage :: Word16, send_event_ShmPutImage :: Word8}
                  deriving (Show, Typeable)
  
 instance ExtensionRequest ShmPutImage where
@@ -1080,7 +1081,7 @@
                          + size (height_ShmPutImage x)
                          + size (send_event_ShmPutImage x)
                          + 3
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_ShmPutImage x)
                serialize (drawable_ShmPutImage x)
                serialize (gc_ShmPutImage x)
diff --git a/patched/Graphics/XHB/Gen/XvMC.hs b/patched/Graphics/XHB/Gen/XvMC.hs
--- a/patched/Graphics/XHB/Gen/XvMC.hs
+++ b/patched/Graphics/XHB/Gen/XvMC.hs
@@ -10,6 +10,9 @@
 import Graphics.XHB.Connection.Types
 import Control.Concurrent.STM
 import Foreign.C.Types
+import Data.Word
+import Data.Int
+import Data.Binary.Get
 import Data.Binary.Put (runPut)
 import Graphics.XHB.Shared hiding (Event(..), Error(..))
 import Graphics.XHB.Gen.Xv.Types
@@ -23,32 +26,32 @@
                Graphics.XHB.Connection.Types.Connection ->
                  IO (Receipt QueryVersionReply)
 queryVersion c
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkQueryVersion
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 listSurfaceTypes ::
                    Graphics.XHB.Connection.Types.Connection ->
                      PORT -> IO (Receipt ListSurfaceTypesReply)
 listSurfaceTypes c port_id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListSurfaceTypes port_id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 createContext ::
                 Graphics.XHB.Connection.Types.Connection ->
                   CreateContext -> IO (Receipt CreateContextReply)
 createContext c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 destroyContext ::
@@ -61,13 +64,14 @@
  
 createSurface ::
                 Graphics.XHB.Connection.Types.Connection ->
-                  SURFACE -> CONTEXT -> IO (Receipt CreateSurfaceReply)
+                  SURFACE -> CONTEXT -> IO (Receipt [Word32])
 createSurface c surface_id context_id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newEmptyReceipt
+                                (runGet (priv_data_CreateSurfaceReply `fmap` deserialize))
        let req = MkCreateSurface surface_id context_id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 destroySurface ::
@@ -82,10 +86,10 @@
                    Graphics.XHB.Connection.Types.Connection ->
                      CreateSubpicture -> IO (Receipt CreateSubpictureReply)
 createSubpicture c req
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
  
 destroySubpicture ::
@@ -100,9 +104,9 @@
                       Graphics.XHB.Connection.Types.Connection ->
                         PORT -> SURFACE -> IO (Receipt ListSubpictureTypesReply)
 listSubpictureTypes c port_id surface_id
-  = do receipt <- newEmptyReceiptIO
+  = do (receipt, rReceipt) <- newDeserReceipt
        let req = MkListSubpictureTypes port_id surface_id
        putAction <- serializeExtensionRequest c req
        let chunk = runPut putAction
-       sendRequestWithReply c chunk receipt
+       sendRequestWithReply c chunk rReceipt
        return receipt
diff --git a/patched/Graphics/XHB/Gen/XvMC/Types.hs b/patched/Graphics/XHB/Gen/XvMC/Types.hs
--- a/patched/Graphics/XHB/Gen/XvMC/Types.hs
+++ b/patched/Graphics/XHB/Gen/XvMC/Types.hs
@@ -8,6 +8,7 @@
         ListSubpictureTypes(..), ListSubpictureTypesReply(..))
        where
 import Data.Word
+import Data.Int
 import Foreign.C.Types
 import Data.Bits
 import Data.Binary.Put
@@ -38,11 +39,11 @@
                      deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)
  
 data SurfaceInfo = MkSurfaceInfo{id_SurfaceInfo :: SURFACE,
-                                 chroma_format_SurfaceInfo :: CARD16, pad0_SurfaceInfo :: CARD16,
-                                 max_width_SurfaceInfo :: CARD16, max_height_SurfaceInfo :: CARD16,
-                                 subpicture_max_width_SurfaceInfo :: CARD16,
-                                 subpicture_max_height_SurfaceInfo :: CARD16,
-                                 mc_type_SurfaceInfo :: CARD32, flags_SurfaceInfo :: CARD32}
+                                 chroma_format_SurfaceInfo :: Word16, pad0_SurfaceInfo :: Word16,
+                                 max_width_SurfaceInfo :: Word16, max_height_SurfaceInfo :: Word16,
+                                 subpicture_max_width_SurfaceInfo :: Word16,
+                                 subpicture_max_height_SurfaceInfo :: Word16,
+                                 mc_type_SurfaceInfo :: Word32, flags_SurfaceInfo :: Word32}
                  deriving (Show, Typeable)
  
 instance Serialize SurfaceInfo where
@@ -93,12 +94,12 @@
           = do putWord8 extOpCode
                putWord8 0
                let size__ = 4
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                putSkip (requiredPadding size__)
  
 data QueryVersionReply = MkQueryVersionReply{major_QueryVersionReply
-                                             :: CARD32,
-                                             minor_QueryVersionReply :: CARD32}
+                                             :: Word32,
+                                             minor_QueryVersionReply :: Word32}
                        deriving (Show, Typeable)
  
 instance Deserialize QueryVersionReply where
@@ -122,12 +123,12 @@
           = do putWord8 extOpCode
                putWord8 1
                let size__ = 4 + size (port_id_ListSurfaceTypes x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_id_ListSurfaceTypes x)
                putSkip (requiredPadding size__)
  
 data ListSurfaceTypesReply = MkListSurfaceTypesReply{num_ListSurfaceTypesReply
-                                                     :: CARD32,
+                                                     :: Word32,
                                                      surfaces_ListSurfaceTypesReply ::
                                                      [SurfaceInfo]}
                            deriving (Show, Typeable)
@@ -148,8 +149,8 @@
                                      CONTEXT,
                                      port_id_CreateContext :: PORT,
                                      surface_id_CreateContext :: SURFACE,
-                                     width_CreateContext :: CARD16, height_CreateContext :: CARD16,
-                                     flags_CreateContext :: CARD32}
+                                     width_CreateContext :: Word16, height_CreateContext :: Word16,
+                                     flags_CreateContext :: Word32}
                    deriving (Show, Typeable)
  
 instance ExtensionRequest CreateContext where
@@ -164,7 +165,7 @@
                          + size (width_CreateContext x)
                          + size (height_CreateContext x)
                          + size (flags_CreateContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_id_CreateContext x)
                serialize (port_id_CreateContext x)
                serialize (surface_id_CreateContext x)
@@ -174,10 +175,10 @@
                putSkip (requiredPadding size__)
  
 data CreateContextReply = MkCreateContextReply{width_actual_CreateContextReply
-                                               :: CARD16,
-                                               height_actual_CreateContextReply :: CARD16,
-                                               flags_return_CreateContextReply :: CARD32,
-                                               priv_data_CreateContextReply :: [CARD32]}
+                                               :: Word16,
+                                               height_actual_CreateContextReply :: Word16,
+                                               flags_return_CreateContextReply :: Word32,
+                                               priv_data_CreateContextReply :: [Word32]}
                         deriving (Show, Typeable)
  
 instance Deserialize CreateContextReply where
@@ -206,7 +207,7 @@
           = do putWord8 extOpCode
                putWord8 3
                let size__ = 4 + size (context_id_DestroyContext x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (context_id_DestroyContext x)
                putSkip (requiredPadding size__)
  
@@ -223,13 +224,13 @@
                let size__
                      = 4 + size (surface_id_CreateSurface x) +
                          size (context_id_CreateSurface x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (surface_id_CreateSurface x)
                serialize (context_id_CreateSurface x)
                putSkip (requiredPadding size__)
  
 data CreateSurfaceReply = MkCreateSurfaceReply{priv_data_CreateSurfaceReply
-                                               :: [CARD32]}
+                                               :: [Word32]}
                         deriving (Show, Typeable)
  
 instance Deserialize CreateSurfaceReply where
@@ -253,16 +254,16 @@
           = do putWord8 extOpCode
                putWord8 5
                let size__ = 4 + size (surface_id_DestroySurface x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (surface_id_DestroySurface x)
                putSkip (requiredPadding size__)
  
 data CreateSubpicture = MkCreateSubpicture{subpicture_id_CreateSubpicture
                                            :: SUBPICTURE,
                                            context_CreateSubpicture :: CONTEXT,
-                                           xvimage_id_CreateSubpicture :: CARD32,
-                                           width_CreateSubpicture :: CARD16,
-                                           height_CreateSubpicture :: CARD16}
+                                           xvimage_id_CreateSubpicture :: Word32,
+                                           width_CreateSubpicture :: Word16,
+                                           height_CreateSubpicture :: Word16}
                       deriving (Show, Typeable)
  
 instance ExtensionRequest CreateSubpicture where
@@ -276,7 +277,7 @@
                          + size (xvimage_id_CreateSubpicture x)
                          + size (width_CreateSubpicture x)
                          + size (height_CreateSubpicture x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (subpicture_id_CreateSubpicture x)
                serialize (context_CreateSubpicture x)
                serialize (xvimage_id_CreateSubpicture x)
@@ -285,14 +286,14 @@
                putSkip (requiredPadding size__)
  
 data CreateSubpictureReply = MkCreateSubpictureReply{width_actual_CreateSubpictureReply
-                                                     :: CARD16,
-                                                     height_actual_CreateSubpictureReply :: CARD16,
+                                                     :: Word16,
+                                                     height_actual_CreateSubpictureReply :: Word16,
                                                      num_palette_entries_CreateSubpictureReply ::
-                                                     CARD16,
-                                                     entry_bytes_CreateSubpictureReply :: CARD16,
+                                                     Word16,
+                                                     entry_bytes_CreateSubpictureReply :: Word16,
                                                      component_order_CreateSubpictureReply ::
-                                                     [CARD8],
-                                                     priv_data_CreateSubpictureReply :: [CARD32]}
+                                                     [Word8],
+                                                     priv_data_CreateSubpictureReply :: [Word32]}
                            deriving (Show, Typeable)
  
 instance Deserialize CreateSubpictureReply where
@@ -326,7 +327,7 @@
           = do putWord8 extOpCode
                putWord8 7
                let size__ = 4 + size (subpicture_id_DestroySubpicture x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (subpicture_id_DestroySubpicture x)
                putSkip (requiredPadding size__)
  
@@ -343,13 +344,13 @@
                let size__
                      = 4 + size (port_id_ListSubpictureTypes x) +
                          size (surface_id_ListSubpictureTypes x)
-               serialize (convertBytesToRequestSize size__ :: INT16)
+               serialize (convertBytesToRequestSize size__ :: Int16)
                serialize (port_id_ListSubpictureTypes x)
                serialize (surface_id_ListSubpictureTypes x)
                putSkip (requiredPadding size__)
  
 data ListSubpictureTypesReply = MkListSubpictureTypesReply{num_ListSubpictureTypesReply
-                                                           :: CARD32,
+                                                           :: Word32,
                                                            types_ListSubpictureTypesReply ::
                                                            [ImageFormatInfo]}
                               deriving (Show, Typeable)
diff --git a/xhb.cabal b/xhb.cabal
--- a/xhb.cabal
+++ b/xhb.cabal
@@ -1,5 +1,5 @@
 Name:         xhb
-Version:      0.0.2009.1.6
+Version:      0.1.2009.2.8
 Cabal-Version:  >= 1.2.3
 Synopsis:     X Haskell Bindings
 Description:
