packages feed

xhb (empty) → 0.0.2009.1.6

raw patch · 63 files changed

+29891/−0 lines, 63 filesdep +Xauthdep +basedep +binarysetup-changed

Dependencies added: Xauth, base, binary, byteorder, bytestring, containers, network, parsec, stm

Files

+ CONTRIBUTORS view
@@ -0,0 +1,6 @@+In order of appearance:++Antoine Latter <aslatter@gmail.com>+Spencer Janssen+Artyom Shalkhakov+
+ Graphics/XHB.hs view
@@ -0,0 +1,54 @@+-- Module to re-export te portions of XHB.Shared that should be public,+-- as well as tie together core functionality.+++{- |++X Haskell Bindings+This module containes (or re-exports) the core functionality needed to+communicate with an X server.++No frills.++If you'd like to work with an extension to the X Protocol, you should be+able to find what you're looking for in one of the Graphics.XHB.Gen.*+modules.  Also, the module Graphics.XHB.Connection.Extension may be of use.++-}++module Graphics.XHB+    ( module Graphics.XHB.Connection+    , module Graphics.XHB.Gen.Xproto+    , Xid+    , XidLike(..)+    , SimpleEnum(..)+    , BitEnum(..)+    , fromMask+    , toMask+    , ValueParam()+    , toValueParam+    , fromValueParam+    , emptyValueParam+    , stringToCList+    , Receipt+    , getReply+    , Error(..)+    , SomeError+    , UnknownError(..)+    , Event(..)+    , SomeEvent+    , UnknownEvent(..)+    , CARD8+    , CARD16+    , CARD32+    , INT8+    , INT16+    , INT32+    , BOOL+    , BYTE+     ) where++import Graphics.XHB.Connection+import Graphics.XHB.Shared++import Graphics.XHB.Gen.Xproto
+ Graphics/XHB/Connection.hs view
@@ -0,0 +1,438 @@+{- |++Basic functions for initiating and working with a connection to an+X11 server.++-}++module Graphics.XHB.Connection+    (Connection+    ,connect+    ,connectTo+    ,displayInfo+    ,connectionSetup+    ,mkConnection+    ,newResource+    ,pollForEvent+    ,waitForEvent+    ,pollForError+    ,waitForError+    ,setCrashOnError+    ,SomeError+    ,SomeEvent+    ,getRoot+    )+    where++import Data.Word++-- MAY import generated type modules (XHB.Gen.*.Types)+-- MAY NOT import other generated modules++import Control.Concurrent.STM+import Control.Concurrent+import Control.Monad++import System.IO+import System.ByteOrder++import Foreign.C.String++import Data.List (genericLength)+import Data.Maybe+import Data.Monoid(mempty)+import qualified Data.Map as M++import Data.ByteString.Lazy(ByteString)+import qualified Data.ByteString.Lazy as BS++import Data.Binary.Get+import Data.Binary.Put++import Data.Bits++import Graphics.XHB.Gen.Xproto.Types+import Graphics.XHB.Gen.Extension++import Graphics.XHB.Connection.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Open+import Graphics.XHB.Shared++import Graphics.X11.Xauth++-- | Returns the 'Setup' information returned by the server+-- during the initiation of the connection.+connectionSetup :: Connection -> Setup+connectionSetup = conf_setup . conn_conf++newResource :: XidLike a => Connection -> IO a+newResource c = do+  xidM <- nextXid c+  case xidM of+    Just xid -> return . fromXid $ xid+    Nothing -> error "resource ids exhausted" -- request more here++nextXid :: Connection -> IO (Maybe Xid)+nextXid c = atomically $ do+              let tv =  conn_resource_ids c+              xids <- readTVar tv+              case xids of+                [] -> return Nothing+                (x:xs) -> do+                   writeTVar tv xs+                   return . return $ x+++pollForEvent :: Connection -> IO (Maybe SomeEvent)+pollForEvent c = atomically $ pollTChan $ conn_event_queue c++waitForEvent :: Connection -> IO SomeEvent+waitForEvent c = atomically $ readTChan $ conn_event_queue c+                +pollForError :: Connection -> IO (Maybe SomeError)+pollForError c = atomically $ pollTChan $ conn_error_queue c++waitForError :: Connection -> IO SomeError+waitForError c = atomically $ readTChan $ conn_error_queue c++pollTChan :: TChan a -> STM (Maybe a)+pollTChan tc = do+  empty <- isEmptyTChan tc+  if empty then return Nothing+   else Just `liftM` readTChan tc+++-- | If you don't feel like writing error handlers, but at least want to know that+-- one happened for debugging purposes, call this to have execution come to an+-- abrupt end if an error is received.+setCrashOnError :: Connection -> IO ()+setCrashOnError c = do+  forkIO $ do+    waitForError c+    error "Received error from server.  Crashing."+  return ()+++-- Any response from the server is first read into+-- this type.+data GenericReply = GenericReply+    {grep_response_type :: ResponseType+    ,grep_error_code :: Word8+    ,grep_sequence :: Word16+    ,grep_reply_length :: Word32 -- only useful for replies+    }++data ResponseType+    = ResponseTypeEvent Word8+    | ResponseTypeError+    | ResponseTypeReply++instance Deserialize GenericReply where+    deserialize = do+      type_flag <- deserialize+      let rType = case type_flag of+                    0 -> ResponseTypeError+                    1 -> ResponseTypeReply+                    _ -> ResponseTypeEvent type_flag+      code <- deserialize+      sequence <- deserialize+      reply_length <- deserialize+      return $ GenericReply rType code sequence reply_length++++-- state maintained by the read loop+data ReadLoop = ReadLoop+    {read_error_queue :: TChan SomeError -- write only+    ,read_event_queue :: TChan SomeEvent -- write only+    ,read_input_queue :: Handle -- read only+    ,read_reps :: TChan PendedReply -- read only+    ,read_config :: ConnectionConfig+    ,read_extensions :: TVar ExtensionMap+    }++---- Processing for events/errors++-- 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 f r code = do+  ext_map <- atomically . readTVar $ read_extensions r+  return $ findFromCode ext_map+ where findFromCode xmap = foldr go Nothing (M.toList xmap)+       go (ident, extInfo) old+           | num <= code =+               case old of+                 Just (_oldIndent, oldNum) |  oldNum > num -> old+                 _ -> Just (ident, num)+           | otherwise = old+         where num = f extInfo++-- | Returns the extension id and the base event code+extensionIdFromEventCode :: ReadLoop -> CARD8+                         -> IO (Maybe (ExtensionId, CARD8))+extensionIdFromEventCode = queryExtMap first_event_QueryExtensionReply++-- | Returns the extension id and the base error code+extensionIdFromErrorCode :: ReadLoop -> CARD8+                         -> IO (Maybe (ExtensionId, CARD8))+extensionIdFromErrorCode = queryExtMap first_error_QueryExtensionReply+++bsToError :: ReadLoop+          -> ByteString -- ^Raw data+          -> Word8 -- ^Error code+          -> IO SomeError+bsToError _r chunk code | code < 128 = case deserializeError code of+     Nothing -> return . toError . UnknownError $ chunk+     Just getAction -> return $ runGet getAction chunk+bsToError r chunk code+    = extensionIdFromErrorCode r code >>= \errInfo -> case errInfo of+         Nothing -> return . toError . UnknownError $ chunk+         Just (extId, baseErr) ->+             case errorDispatch extId (code - baseErr) of+               Nothing -> return . toError . UnknownError $ chunk+               Just getAction -> return $ runGet getAction chunk+                 ++bsToEvent :: ReadLoop+          -> ByteString -- ^Raw data+          -> Word8 -- ^Event code+          -> IO SomeEvent+bsToEvent _r chunk code | code < 64 = case deserializeEvent code of+    Nothing -> return . toEvent . UnknownEvent $ chunk+    Just getAction -> return $ runGet getAction chunk+bsToEvent r chunk code+    = extensionIdFromEventCode r code >>= \evInfo -> case evInfo of+         Nothing -> return . toEvent . UnknownEvent $ chunk+         Just (extId, baseEv) ->+             case eventDispatch extId (code - baseEv) of+               Nothing -> return . toEvent . UnknownEvent $ chunk+               Just getAction -> return $ runGet getAction chunk++deserializeInReadLoop rl = deserialize++readBytes :: ReadLoop -> Int -> IO ByteString+readBytes rl n = BS.hGet (read_input_queue rl) n++-- the read loop slurps bytes off of the handle, and places+-- them into the appropriate shared structure.+readLoop :: ReadLoop -> IO ()+readLoop rl = do+  chunk <- readBytes rl 32+  let genRep = flip runGet chunk $ deserialize+               +  case grep_response_type genRep of+    ResponseTypeError -> readLoopError rl genRep chunk+    ResponseTypeReply -> readLoopReply rl genRep chunk+    ResponseTypeEvent _ -> readLoopEvent rl genRep chunk+  readLoop rl++-- handle a response to a request+readLoopReply :: ReadLoop -> GenericReply -> ByteString -> IO ()+readLoopReply rl genRep chunk = do++  -- grab the rest of the response bytes+  let rlength = grep_reply_length genRep+  extra <- readBytes rl $ fromIntegral $ 4 * rlength+  let bytes = chunk `BS.append` extra++  -- place the response into the pending reply TMVar, or discard it+  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+     else unGetTChan (read_reps rl) nextPend+++-- take the bytes making up the error response, shove it in+-- a queue.+--+-- If the error corresponds to one of the pending replies,+-- place the error into the pending reply TMVar instead.+readLoopError rl genRep chunk = do+  let errorCode = grep_error_code genRep++  err <- bsToError rl chunk errorCode+  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)+     else do+       unGetTChan (read_reps rl) nextPend+       writeTChan (read_error_queue rl) err++-- take the bytes making up the event response, shove it in+-- a queue+readLoopEvent rl genRep chunk = do+    ev <- bsToEvent rl chunk eventCode+    atomically $ writeTChan (read_event_queue rl) ev++ where eventCode = case grep_response_type genRep of+                     ResponseTypeEvent w -> w .&. 127++-- | Connect to the the default display.+connect :: IO (Maybe Connection)+connect = connectTo ""++-- | Connect to the display specified.+-- The string must be of the format used in the+-- DISPLAY environment variable.+connectTo :: String -> IO (Maybe Connection)+connectTo display = do+  (h, xau, dispName) <- open display+  hSetBuffering h NoBuffering+  mkConnection h xau dispName++-- | Returns the information about what we originally tried to+-- connect to.+displayInfo :: Connection -> DispName+displayInfo = conn_dispInfo++-- Handshake with the server+-- parse result of handshake+-- launch the thread which holds the handle for reading+mkConnection :: Handle -> Maybe Xauth -> DispName -> IO (Maybe Connection)+mkConnection hnd auth dispInfo = do+  errorQueue <- newTChanIO+  eventQueue <- newTChanIO+  replies <- newTChanIO+  sequence <- initialSequence+  extensions <- newTVarIO mempty++  wrappedHandle <- newMVar hnd ++  confM <- handshake hnd auth+  if isNothing confM then return Nothing else do+  let Just conf = confM++  rIds <- newTVarIO $ resourceIds conf++  let rlData = ReadLoop errorQueue eventQueue hnd replies conf extensions+  +  readTid <- forkIO $ readLoop rlData++  return $ Just $ +     Connection+      errorQueue+      eventQueue+      readTid+      wrappedHandle+      replies+      conf+      sequence+      rIds+      extensions+      dispInfo++resourceIds :: ConnectionConfig -> [Xid]+resourceIds cc = resourceIdsFromSetup $ conf_setup cc++resourceIdsFromSetup :: Setup -> [Xid]+resourceIdsFromSetup s =+    let base = resource_id_base_Setup s+        mask = resource_id_mask_Setup s+        max = mask+        step = mask .&. (-mask)+    in map MkXid $ map (.|. base) [0,step .. max]++-- first 8 bytes of the response from the setup request+data GenericSetup = GenericSetup+                  {setup_status :: SetupStatus+                  ,setup_length :: Word16+                  }+                    deriving Show++instance Deserialize GenericSetup where+    deserialize = do+      status <- deserialize+      skip 5+      length <- deserialize+      return $ GenericSetup status length ++data SetupStatus = SetupFailed | SetupAuthenticate | SetupSuccess+ deriving Show++instance Deserialize SetupStatus where+    deserialize = wordToStatus `liftM` deserialize+        where wordToStatus :: Word8 -> SetupStatus+              wordToStatus 0 = SetupFailed+              wordToStatus 1 = SetupSuccess+              wordToStatus 2 = SetupAuthenticate+              wordToStatus n = error $ +                     "Unkonwn setup status flag: " ++ show n++-- send the setup request to the server,+-- receive the setup response+handshake :: Handle -> Maybe Xauth -> IO (Maybe ConnectionConfig)+handshake hnd auth = do++  -- send setup request+  let requestChunk =  runPut $ serialize $ setupRequest auth+  BS.hPut hnd $ requestChunk++  -- grab an 8-byte chunk to get the response type and size+  firstChunk <- BS.hGet hnd 8++  let genSetup = runGet deserialize firstChunk++  -- grab the rest of the setup response+  secondChunk <- BS.hGet hnd $ fromIntegral $ (4 *) $ setup_length genSetup+  let setupBytes = firstChunk `BS.append` secondChunk++  -- handle the response type+  case setup_status genSetup of+    SetupFailed -> do+       let failed = runGet deserialize setupBytes+           failMessage = map castCCharToChar (reason_SetupFailed failed)+       hPutStrLn stderr failMessage+       return Nothing+    SetupAuthenticate -> do+       let auth = runGet deserialize setupBytes+           authMessage = map castCCharToChar (reason_SetupAuthenticate auth)+       hPutStrLn stderr authMessage+       return Nothing+    SetupSuccess -> do+       let setup = runGet deserialize setupBytes+       return . return $ ConnectionConfig setup+       +padBS n = BS.replicate n 0++initialSequence :: IO (TVar SequenceId)+initialSequence = newTVarIO 1++setupRequest :: Maybe Xauth -> SetupRequest+setupRequest auth = MkSetupRequest+                  (fromIntegral $ byteOrderToNum byteOrder)+                  11       -- major version+                  0        -- minor version+                  anamelen -- auth name length+                  adatalen -- auth data length+                  -- TODO this manual padding is a horrible hack, it should be+                  -- done by the serialization instance+                  (aname ++ replicate (requiredPadding anamelen) 0)+                           -- auth name+                  (adata ++ replicate (requiredPadding adatalen) 0)+                           -- auth data+ where+    (anamelen, aname, adatalen, adata) = case auth of+        Nothing -> (0, [], 0, [])+        Just (Xauth n d) -> (genericLength n, n, genericLength d, d)+++-- | I plan on deprecating this one soon, but until I put together+-- some sort of 'utils' package, it will live here.+--+-- Given a connection, this function returns the root window of the+-- first screen.+--+-- If your display string specifies a screen other than the first,+-- this probably doesnt do what you want.+getRoot :: Connection -> WINDOW+getRoot = root_SCREEN . head . roots_Setup . conf_setup . conn_conf
+ Graphics/XHB/Connection/Auth.hs view
@@ -0,0 +1,56 @@+module Graphics.XHB.Connection.Auth (getAuthInfo) where++import Data.Bits+import Data.Word++import System.IO++import Graphics.X11.Xauth++import Network.Socket+import Network.BSD (getHostName)++import Foreign.C (CChar)+import Foreign.C.String (castCharToCChar)++-- | Yields libxau record for given socket/display configuration.+getAuthInfo :: Socket -> Int -> IO (Maybe Xauth)+getAuthInfo fd display = do+    sock <- getPeerName fd+    (addr, fam) <- f sock+    getAuthByAddr fam addr (cstring $ show display) (cstring atype)+    where+        f x | isLocal x = getHostName >>= \h ->+                            return (cstring h, 256) -- familyLocal+            -- XCB_FAMILY_INTERNET+            | isIPv4 x || isIPv6Mappedv4 x = return (host x, 0)+            -- XCB_FAMILY_INTERNET_6+            | otherwise = return (host x, 6)++        isLocal (SockAddrUnix _) = True+        isLocal (SockAddrInet _ h) = h == 16777343 -- 127.0.0.1+        isLocal (SockAddrInet6 _ _ (0,0,0,1) _) = True+        isLocal _ = False++        isIPv4 (SockAddrInet _ _) = True+        isIPv4 _ = False++        isIPv6Mappedv4 (SockAddrInet6 _ _ (0,0,0xFFFF,x) _) = True+        isIPv6Mappedv4 _ = False++        -- tear it to bytes+        -- we do this because we need bare bytes for comparison on C side+        bytes :: Word32 -> [CChar]+        bytes x = foldr g [] [0,8..24] where+            g a = let r = (x `shiftR` a) .&. 0xFF+                  in ((fromIntegral r):)++        -- N.B.: no endianness conversion necessary+        host (SockAddrInet _ h) = bytes h+        host (SockAddrInet6 _ _ (x,y,z,w) _) = concatMap bytes [x,y,z,w]++        atype = "MIT-MAGIC-COOKIE-1"++cstring :: String -> [CChar]+cstring = map castCharToCChar+
+ Graphics/XHB/Connection/Extension.hs view
@@ -0,0 +1,73 @@+-- helper functions for working with extensions.++module Graphics.XHB.Connection.Extension+    ( ExtensionId+    , RequestOpCode+    , extensionPresent+    , extensionOpCode+    , extensionInfo+    , serializeExtensionRequest+    )+        where++import Control.Exception(assert)++import Data.Binary(Put)++import Data.List(genericLength)++import Graphics.XHB.Gen.Xproto+import Graphics.XHB.Gen.Xproto.Types++import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Types+import Graphics.XHB.Connection+import Graphics.XHB.Shared++-- | Convert an extension request to a put action.+-- Handles grabbing the extension opcode and feeding it+-- into the 'serializeRequest' function.+serializeExtensionRequest :: ExtensionRequest a => Connection -> a -> IO Put+serializeExtensionRequest c req = do+  extRep <- extensionInfo c $ extensionId req+  let present = _extensionPresent extRep+      opCode = _extensionOpCode extRep++      putAction = serializeRequest req opCode++  assert present $ return ()+  return putAction++-- | Lookup an extension.  Will attempt to check the extension cache+-- first.  Will block until the info is retrieved from the server.+-- Will cache the extension information when found.+extensionInfo :: Connection -> ExtensionId -> IO (QueryExtensionReply)+extensionInfo c extId = do++  extInfoMaybe <- lookupExtension c extId++  case extInfoMaybe of+    Just extInfo -> return extInfo++    Nothing -> do+      receipt <- queryExtension c (genericLength extId) (stringToCList extId)+      reply <- getReply receipt+      case reply of+        Left{} -> error $ "Fatal error resolving extension info"+        Right extInfo -> do+           cacheExtension c extId extInfo+           return extInfo++-- friendly helper functions.++extensionOpCode :: Connection -> ExtensionId -> IO RequestOpCode+extensionOpCode c x = _extensionOpCode `fmap` extensionInfo c x++extensionPresent :: Connection -> ExtensionId -> IO Bool+extensionPresent c x = _extensionPresent `fmap` extensionInfo c x++_extensionOpCode :: QueryExtensionReply -> RequestOpCode+_extensionOpCode = major_opcode_QueryExtensionReply++_extensionPresent :: QueryExtensionReply -> Bool+_extensionPresent = (/= 0) . present_QueryExtensionReply
+ Graphics/XHB/Connection/Internal.hs view
@@ -0,0 +1,98 @@++-- | This module contains functioanlity only for use+-- by other XHB modules, while still trying to hide some+-- of the implementation details of the 'Connection'+-- data type.++module Graphics.XHB.Connection.Internal+    (sendRequest+    ,sendRequestWithReply+    ,lookupExtension+    ,cacheExtension+    ,Connection+    ) where++import Data.Word(Word16)+import Control.Exception(bracket)++import Control.Concurrent.STM+import Control.Concurrent++import System.IO++import Data.ByteString.Lazy(ByteString)+import qualified Data.ByteString.Lazy as BS++import Data.Maybe+import qualified Data.Map as M++import Graphics.XHB.Connection.Types+import Graphics.XHB.Shared++import Graphics.XHB.Gen.Xproto.Types++-- Assumes that the input bytestring is a properly formatted+-- and padded request.+sendRequest :: Connection -> ByteString -> IO ()+sendRequest c bytes = withConnectionHandle c $ \h -> do++  -- send bytes onto connection+  BS.hPut h bytes++  -- increment sequence+  _ <- atomically $ nextSequence c++  return ()++sendRequestWithReply :: Deserialize a => Connection -> ByteString -> Receipt a -> 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+++-- Returns the next sequence ID+nextSequence :: Connection -> STM SequenceId+nextSequence c = do+  let tv = conn_next_sequence c+  seq <- readTVar tv+  writeTVar tv (seq + 1)+  return seq++-- Locks the handle for use by the passed in function.  Intended for+-- write access only.+--+-- NOTE: the read loop has a separate reference to the handle,+-- so it will not be blocked by this.+withConnectionHandle :: Connection -> (Handle -> IO a) -> IO a+withConnectionHandle c f = do+  let mv = conn_handle c+  bracket+     (takeMVar mv)+     (putMVar mv)+     f+{-# INLINE withConnectionHandle #-}++-- | Lookup an extension in the extension cache.  Returns 'Nothing'+-- if queried extension is not cached+lookupExtension :: Connection -> ExtensionId -> IO (Maybe QueryExtensionReply)+lookupExtension c extId = atomically $ do+   m <- readTVar $ conn_extensions c+   return $ M.lookup extId m++-- | Add an extension to the extension cache.+cacheExtension :: Connection -> ExtensionId -> QueryExtensionReply -> IO ()+cacheExtension c extId ext = atomically $ do+   let tv = conn_extensions c++   m <- readTVar tv+   if isNothing (M.lookup extId m)+    then +      let m' = M.insert extId ext m+      in writeTVar tv m'+    else return ()++
+ Graphics/XHB/Connection/Open.hs view
@@ -0,0 +1,101 @@+module Graphics.XHB.Connection.Open (open, DispName(..)) where++import System.Environment(getEnv)+import System.IO++import Control.Exception hiding (try)+import Control.Monad+import Control.Applicative((<$>))++import Data.Foldable (foldrM)++import Network.Socket+import Graphics.X11.Xauth++import Data.Maybe (fromMaybe)+import Text.ParserCombinators.Parsec++import Graphics.XHB.Connection.Auth++data DispName = DispName { proto :: String+                         , host :: String+                         , display :: Int+                         , screen :: Int+                         } deriving Show++-- | Open a Handle to the X11 server specified in the argument.  The DISPLAY+-- environment variable is consulted if the argument is null.+open :: String -> IO (Handle , Maybe Xauth, DispName)+open [] = (getEnv "DISPLAY") >>= open+open disp+    | take 11 disp == "/tmp/launch" = do+        fd <- fromMaybe (error "couldn't open socket") <$> openUnix "" disp+        hndl <- socketToHandle fd ReadWriteMode+        return (hndl, Nothing, launchDDisplayInfo disp)+open xs = let+    cont (DispName p h d s)+        | null h || null p && h == "unix" = openUnix p+             ("/tmp/.X11-unix/X" ++ show d)+        | otherwise = openTCP p h (6000 + d)++    openTCP proto host port+        | proto == [] || proto == "tcp" =+            let addrInfo = defaultHints { addrFlags  = [ AI_ADDRCONFIG+                                                       , AI_NUMERICSERV+                                                       ]+                                        , addrFamily = AF_UNSPEC+                                        , addrSocketType = Stream+                                        }+                conn (AddrInfo _ fam socktype proto addr _) Nothing = do+                   fd <- socket fam socktype proto+                   connect fd addr+                   return $ Just fd+                conn _ x = return x+            in getAddrInfo (Just addrInfo) (Just host) (Just (show port))+               >>= foldrM conn Nothing+        | otherwise = error "'protocol' should be empty or 'tcp'"+ +    in case parseDisplay xs of+        (Left e) -> error (show e)+        (Right x) -> do+             socket <- cont x >>= return . fromMaybe+                 (error "couldn't open socket")+             auth <- getAuthInfo socket (display x) +             hndl <- socketToHandle socket ReadWriteMode+             return (hndl, auth, x)++openUnix proto file+    | proto == [] || proto == "unix" = do+        fd <- socket AF_UNIX Stream defaultProtocol+        connect fd (SockAddrUnix file)+        return $ Just fd+    | otherwise = error "'protocol' should be empty or 'unix'"+++-- | Parse the contents of an X11 DISPLAY environment variable.+-- TODO: make a public version (see xcb_parse_display)+parseDisplay :: String -> Either ParseError DispName+parseDisplay [] = Right defaultDisplayInfo+parseDisplay xs = parse exp "" xs where+    exp = do+        p <- option "" (try $ skip '/') <?> "protocol"+        h <- option "" ((try ipv6) <|> (try host)) <?> "host"+        d <- char ':' >> integer <?> "display"+        s <- option 0 (char '.' >> integer <?> "screen")+        return $ DispName p h d s+    eat c s = char c >> return s+    anyExcept c = many1 (noneOf [c])+    skip c = anyExcept c >>= eat c+    ipv6 = char '[' >> skip ']'+    host = anyExcept ':'+    integer :: Parser Int+    integer = many1 digit >>= \x -> return $ read x++-- | Given a launchd display-string, return the appropriate+-- DispName structure for it.+launchDDisplayInfo :: String -> DispName+launchDDisplayInfo str = case parseDisplay (dropWhile (/= ':') str) of+                    Left{} -> defaultDisplayInfo+                    Right d -> d++defaultDisplayInfo = DispName "" "" 0 0
+ Graphics/XHB/Connection/Types.hs view
@@ -0,0 +1,42 @@+module Graphics.XHB.Connection.Types where++import Graphics.XHB.Shared+import Graphics.XHB.Connection.Open++import Control.Concurrent.STM+import Control.Concurrent++import System.IO++import Data.Word+import Data.Map(Map)++import Graphics.XHB.Gen.Xproto.Types++data Connection = Connection+    {conn_error_queue :: TChan SomeError -- read only+    ,conn_event_queue :: TChan SomeEvent -- read only+    ,conn_read_loop_tid :: ThreadId+    ,conn_handle :: MVar Handle -- write only+    ,conn_reps :: TChan PendedReply -- insert only+    ,conn_conf :: ConnectionConfig+    ,conn_next_sequence :: TVar SequenceId+    ,conn_resource_ids :: TVar [Xid]+    ,conn_extensions :: TVar ExtensionMap+    ,conn_dispInfo :: DispName -- what we were told to connect to+    }++type ExtensionMap = Map ExtensionId QueryExtensionReply++data ConnectionConfig = ConnectionConfig+    { conf_setup :: Setup+    }++type SequenceId = Word16++data PendedReply = PendedReply+    {pended_sequence :: SequenceId+    ,pended_reply :: WrappedReply+    }++data WrappedReply = forall a . Deserialize a => WrappedReply (Receipt a)
+ Graphics/XHB/Shared.hs view
@@ -0,0 +1,373 @@+{-# LANGUAGE GeneralizedNewtypeDeriving, BangPatterns #-}++module Graphics.XHB.Shared where++-- MAY NOT import any gnerated files++import Data.Typeable++import Data.Binary.Put+import Data.Binary.Get++import Data.Word+import Data.Int+import Data.Bits+import Data.Maybe++import Control.Monad+import Control.Exception+import Data.Function++import Data.List as L++import Foreign.C.Types (CChar, CFloat, CDouble)+import Foreign.C.String++import qualified Data.ByteString.Lazy as BS+import Data.ByteString.Lazy (ByteString)++import Control.Concurrent.STM+    ( TMVar+    , STM+    , putTMVar+    , newEmptyTMVarIO+    , takeTMVar+    , putTMVar+    , atomically+    )++import System.ByteOrder++-- crazy imports for put/get storable+import qualified Data.ByteString.Internal as Strict+import Foreign+import Foreign.Storable+import Foreign.Ptr+import Foreign.ForeignPtr++byteOrderToNum :: ByteOrder -> Int+byteOrderToNum BigEndian = fromEnum '\o102' -- B+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)++instance Show Xid where+    show (MkXid x) = show x++class XidLike a where+    fromXid :: Xid -> a+    toXid   :: a -> Xid++instance XidLike Xid where+    fromXid = id+    toXid   = id++-- Enums and ValueParams++class SimpleEnum a where+    toValue :: Num n => a -> n+    fromValue :: Num n => n -> a++class BitEnum a where+    toBit :: a -> Int+    fromBit :: Int -> a++instance BitEnum Integer where+    toBit = fromIntegral+    fromBit = fromIntegral++fromMask :: (Bits b, BitEnum e) => b -> [e]+fromMask x = mapMaybe go [0..(bitSize x) - 1]+    where go i | x `testBit` i = return $ fromBit i+               | otherwise = Nothing++toMask :: (Bits b, BitEnum e) => [e] -> b+toMask = foldl' (.|.) 0 . map (bit . toBit)+++data ValueParam a = VP a [Word32]++toValueParam :: (Bits a, BitEnum e) => [(e,Word32)] -> ValueParam a+toValueParam xs = +    let (es,ws) = unzip $ L.sortBy (compare `on` toBit . fst) xs+    in VP (toMask es) ws++fromValueParam :: (Bits a, BitEnum e) => ValueParam a -> [(e,Word32)]+fromValueParam (VP x ws) =+    let es = fromMask x+    in assert (length es == length ws) $ zip es ws++emptyValueParam :: Bits a => ValueParam a+emptyValueParam = VP 0 []++instance (Bits a, Show a) => Show (ValueParam a) where+    show v = show (fromValueParam v :: [(Integer,Word32)])++stringToCList :: String -> [CChar]+stringToCList = map castCharToCChar+++class Serialize a where+    serialize :: a -> Put+    size :: a -> Int -- Size in bytes++class Deserialize a where+    deserialize :: Get a++class ExtensionRequest a where+    serializeRequest :: a -> RequestOpCode -> Put+    extensionId :: a -> ExtensionId++type RequestOpCode = Word8+type ExtensionId = String -- limited to ASCII+  ++-- In units of four bytes+type ReplyLength = Word32++newtype Receipt a = MkReceipt+    {unReceipt :: TMVar (Either SomeError a)}++newEmptyReceiptIO :: IO (Receipt a)+newEmptyReceiptIO = MkReceipt `fmap` newEmptyTMVarIO++putReceipt :: Receipt a -> Either SomeError a -> STM ()+putReceipt = putTMVar . unReceipt++-- | 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++-- Because new errors and events are introduced with each extension,+-- I don't want to give the users of this library pattern-match+-- error every time a new extension is added.++class (Typeable a, Show a) => Error a where+    fromError :: SomeError -> Maybe a+    toError :: a -> SomeError++    fromError (SomeError e) = cast e+    toError = SomeError++data SomeError = forall a . Error a => SomeError a++instance Show SomeError where+    show se = case se of+          SomeError err -> show err++data UnknownError = UnknownError BS.ByteString deriving (Typeable, Show)+instance Error UnknownError++++class Typeable a => Event a where+    fromEvent :: SomeEvent -> Maybe a+    toEvent :: a -> SomeEvent++    fromEvent (SomeEvent e) = cast e+    toEvent = SomeEvent++data SomeEvent = forall a . Event a => SomeEvent a++data UnknownEvent = UnknownEvent BS.ByteString deriving (Typeable)+instance Event UnknownEvent++++++deserializeList :: Deserialize a => Int -> Get [a]+deserializeList n = go n+    where go 0 = return []+          go n = do+            x <- deserialize+            xs <- go (n-1)+            return $ x : xs++serializeList :: Serialize a => [a] -> Put+serializeList = mapM_ serialize++convertBytesToRequestSize n =+    fromIntegral $ case quotRem n 4 of+      (d,0) -> d+      (d,r) -> d + 1++requiredPadding n = +    fromIntegral $ case quotRem n 4 of+      (_,0) -> 0+      (_,r) -> 4 - r++--Instances++-- Words+instance Serialize Word8 where+    serialize = putWord8+    size _ = 1++instance Deserialize Word8 where+    deserialize = getWord8++instance Serialize Word16 where+    serialize = putWord16host+    size _ = 2++instance Deserialize Word16 where+    deserialize = getWord16host+++instance Serialize Word32 where+    serialize = putWord32host+    size _ = 4++instance Deserialize Word32 where+    deserialize = getWord32host++-- Ints+instance Serialize Int8 where+    serialize = putInt8+    size _ = 1++instance Deserialize Int8 where+    deserialize = getInt8+++instance Serialize Int16 where+    serialize = putInt16host+    size _ = 2++instance Deserialize Int16 where+    deserialize = getInt16host+++instance Serialize Int32 where+    serialize = putInt32host+    size _ = 4++instance Deserialize Int32 where+    deserialize = getInt32host+++instance Serialize CChar where+    serialize = putWord8 . fromIntegral -- assumes a CChar is one word+    size _ = 1++instance Deserialize CChar where+    deserialize = liftM fromIntegral getWord8++++-- Binary.Missing++-- All of this relies on being able to roundtrip:+-- (IntN -> WordN) and (WordN -> IntN) using 'fromIntegral'++putInt8 :: Int8 -> Put+putInt8 = putWord8 . fromIntegral++getInt8 :: Get Int8+getInt8 = liftM fromIntegral getWord8++putInt16host :: Int16 -> Put+putInt16host = putWord16host . fromIntegral++getInt16host :: Get Int16+getInt16host = liftM fromIntegral getWord16host++putInt32host :: Int32 -> Put+putInt32host = putWord32host . fromIntegral++getInt32host :: Get Int32+getInt32host = liftM fromIntegral getWord32host++-- Fun stuff++-- I've no idea if this is what the other end expects+instance Deserialize CFloat where+    deserialize = getStorable++instance Serialize CFloat where+    size x = sizeOf x+    serialize = putStorable++instance Deserialize CDouble where+    deserialize = getStorable+++getStorable :: Storable a => Get a+getStorable = (\dummy -> do+       let n = sizeOf dummy+       bytes <- getBytes n+       return $ storableFromBS bytes `asTypeOf` dummy+              ) undefined  ++putStorable :: Storable a => a -> Put+putStorable = putByteString . bsFromStorable++storableFromBS (Strict.PS fptr len off) = +    unsafePerformIO $ withForeignPtr fptr $ flip peekElemOff off . castPtr++bsFromStorable x = Strict.unsafeCreate (sizeOf x) $ \p -> do+                     poke (castPtr p) x++-- Other++instance (Serialize a, Bits a) => Serialize (ValueParam a) where+    serialize = serializeValueParam 0+    size (VP mask xs) = size mask + sum (map size xs)++-- there's one value param which needs funny padding, so it+-- uses the special function+serializeValueParam :: (Serialize a, Bits a) =>+                       Int -> ValueParam a -> Put+serializeValueParam pad (VP mask xs) = do+  serialize mask+  putSkip pad+  assert (length xs == setBits mask) $ return ()+  serializeList xs+  ++instance (Deserialize a, Bits a) => Deserialize (ValueParam a) where+    deserialize = deserializeValueParam 0++deserializeValueParam :: (Deserialize a, Bits a) =>+                         Int -> Get (ValueParam a)+deserializeValueParam pad = do+  mask <- deserialize+  skip pad+  let n = setBits mask+  xs <- deserializeList n+  return $ VP mask xs++-- |Returns the number of bits set in the passed-in+-- bitmask.+setBits :: Bits a => a -> Int+setBits a = foldl' go 0 [0 .. (bitSize a) - 1]+    where go !n bit | a `testBit` bit = n + 1+                    | otherwise = n+++putSkip :: Int -> Put+putSkip 0 = return ()+putSkip n = replicateM_ n $ putWord8 0++isCard32 :: CARD32 -> a+isCard32 = undefined
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2008, 2009 Antoine Latter and other contributors++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of the author nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ patched/Graphics/XHB/Gen/BigRequests.hs view
@@ -0,0 +1,25 @@+module Graphics.XHB.Gen.BigRequests+       (extension, enable, module Graphics.XHB.Gen.BigRequests.Types)+       where+import Graphics.XHB.Gen.BigRequests.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+ +extension :: ExtensionId+extension = "BIG-REQUESTS"+ +enable ::+         Graphics.XHB.Connection.Types.Connection ->+           IO (Receipt EnableReply)+enable c+  = do receipt <- newEmptyReceiptIO+       let req = MkEnable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/BigRequests/Types.hs view
@@ -0,0 +1,46 @@+module Graphics.XHB.Gen.BigRequests.Types+       (deserializeError, deserializeEvent, Enable(..), EnableReply(..))+       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 _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +data Enable = MkEnable{}+            deriving (Show, Typeable)+ +instance ExtensionRequest Enable where+        extensionId _ = "BIG-REQUESTS"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data EnableReply = MkEnableReply{maximum_request_length_EnableReply+                                 :: CARD32}+                 deriving (Show, Typeable)+ +instance Deserialize EnableReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               maximum_request_length <- deserialize+               let _ = isCard32 length+               return (MkEnableReply maximum_request_length)
+ patched/Graphics/XHB/Gen/Composite.hs view
@@ -0,0 +1,108 @@+module Graphics.XHB.Gen.Composite+       (extension, queryVersion, redirectWindow, redirectSubwindows,+        unredirectWindow, unredirectSubwindows, createRegionFromBorderClip,+        nameWindowPixmap, getOverlayWindow, releaseOverlayWindow,+        module Graphics.XHB.Gen.Composite.Types)+       where+import Graphics.XHB.Gen.Composite.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+import Graphics.XHB.Gen.XFixes.Types+       hiding (QueryVersion(..), QueryVersionReply(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.XFixes.Types+ +extension :: ExtensionId+extension = "Composite"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)+queryVersion c client_major_version client_minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion client_major_version client_minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +redirectWindow ::+                 Graphics.XHB.Connection.Types.Connection ->+                   WINDOW -> CARD8 -> IO ()+redirectWindow c window update+  = do let req = MkRedirectWindow window update+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +redirectSubwindows ::+                     Graphics.XHB.Connection.Types.Connection ->+                       WINDOW -> CARD8 -> IO ()+redirectSubwindows c window update+  = do let req = MkRedirectSubwindows window update+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +unredirectWindow ::+                   Graphics.XHB.Connection.Types.Connection ->+                     WINDOW -> CARD8 -> IO ()+unredirectWindow c window update+  = do let req = MkUnredirectWindow window update+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +unredirectSubwindows ::+                       Graphics.XHB.Connection.Types.Connection ->+                         WINDOW -> CARD8 -> IO ()+unredirectSubwindows c window update+  = do let req = MkUnredirectSubwindows window update+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createRegionFromBorderClip ::+                             Graphics.XHB.Connection.Types.Connection ->+                               REGION -> WINDOW -> IO ()+createRegionFromBorderClip c region window+  = do let req = MkCreateRegionFromBorderClip region window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +nameWindowPixmap ::+                   Graphics.XHB.Connection.Types.Connection ->+                     WINDOW -> PIXMAP -> IO ()+nameWindowPixmap c window pixmap+  = do let req = MkNameWindowPixmap window pixmap+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getOverlayWindow ::+                   Graphics.XHB.Connection.Types.Connection ->+                     WINDOW -> IO (Receipt GetOverlayWindowReply)+getOverlayWindow c window+  = do receipt <- newEmptyReceiptIO+       let req = MkGetOverlayWindow window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +releaseOverlayWindow ::+                       Graphics.XHB.Connection.Types.Connection -> WINDOW -> IO ()+releaseOverlayWindow c window+  = do let req = MkReleaseOverlayWindow window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk
+ patched/Graphics/XHB/Gen/Composite/Types.hs view
@@ -0,0 +1,236 @@+module Graphics.XHB.Gen.Composite.Types+       (deserializeError, deserializeEvent, Redirect(..),+        QueryVersion(..), QueryVersionReply(..), RedirectWindow(..),+        RedirectSubwindows(..), UnredirectWindow(..),+        UnredirectSubwindows(..), CreateRegionFromBorderClip(..),+        NameWindowPixmap(..), GetOverlayWindow(..),+        GetOverlayWindowReply(..), ReleaseOverlayWindow(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+import Graphics.XHB.Gen.XFixes.Types+       hiding (QueryVersion(..), QueryVersionReply(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.XFixes.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +data Redirect = RedirectAutomatic+              | RedirectManual+ +instance SimpleEnum Redirect where+        toValue RedirectAutomatic{} = 0+        toValue RedirectManual{} = 1+        fromValue 0 = RedirectAutomatic+        fromValue 1 = RedirectManual+ +data QueryVersion = MkQueryVersion{client_major_version_QueryVersion+                                   :: CARD32,+                                   client_minor_version_QueryVersion :: CARD32}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "Composite"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (client_major_version_QueryVersion x) ++                         size (client_minor_version_QueryVersion x)+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major_version <- deserialize+               minor_version <- deserialize+               skip 16+               let _ = isCard32 length+               return (MkQueryVersionReply major_version minor_version)+ +data RedirectWindow = MkRedirectWindow{window_RedirectWindow ::+                                       WINDOW,+                                       update_RedirectWindow :: CARD8}+                    deriving (Show, Typeable)+ +instance ExtensionRequest RedirectWindow where+        extensionId _ = "Composite"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__+                     = 4 + size (window_RedirectWindow x) ++                         size (update_RedirectWindow x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_RedirectWindow x)+               serialize (update_RedirectWindow x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data RedirectSubwindows = MkRedirectSubwindows{window_RedirectSubwindows+                                               :: WINDOW,+                                               update_RedirectSubwindows :: CARD8}+                        deriving (Show, Typeable)+ +instance ExtensionRequest RedirectSubwindows where+        extensionId _ = "Composite"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__+                     = 4 + size (window_RedirectSubwindows x) ++                         size (update_RedirectSubwindows x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_RedirectSubwindows x)+               serialize (update_RedirectSubwindows x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data UnredirectWindow = MkUnredirectWindow{window_UnredirectWindow+                                           :: WINDOW,+                                           update_UnredirectWindow :: CARD8}+                      deriving (Show, Typeable)+ +instance ExtensionRequest UnredirectWindow where+        extensionId _ = "Composite"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (window_UnredirectWindow x) ++                         size (update_UnredirectWindow x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_UnredirectWindow x)+               serialize (update_UnredirectWindow x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data UnredirectSubwindows = MkUnredirectSubwindows{window_UnredirectSubwindows+                                                   :: WINDOW,+                                                   update_UnredirectSubwindows :: CARD8}+                          deriving (Show, Typeable)+ +instance ExtensionRequest UnredirectSubwindows where+        extensionId _ = "Composite"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__+                     = 4 + size (window_UnredirectSubwindows x) ++                         size (update_UnredirectSubwindows x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_UnredirectSubwindows x)+               serialize (update_UnredirectSubwindows x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data CreateRegionFromBorderClip = MkCreateRegionFromBorderClip{region_CreateRegionFromBorderClip+                                                               :: REGION,+                                                               window_CreateRegionFromBorderClip ::+                                                               WINDOW}+                                deriving (Show, Typeable)+ +instance ExtensionRequest CreateRegionFromBorderClip where+        extensionId _ = "Composite"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__+                     = 4 + size (region_CreateRegionFromBorderClip x) ++                         size (window_CreateRegionFromBorderClip x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (region_CreateRegionFromBorderClip x)+               serialize (window_CreateRegionFromBorderClip x)+               putSkip (requiredPadding size__)+ +data NameWindowPixmap = MkNameWindowPixmap{window_NameWindowPixmap+                                           :: WINDOW,+                                           pixmap_NameWindowPixmap :: PIXMAP}+                      deriving (Show, Typeable)+ +instance ExtensionRequest NameWindowPixmap where+        extensionId _ = "Composite"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__+                     = 4 + size (window_NameWindowPixmap x) ++                         size (pixmap_NameWindowPixmap x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_NameWindowPixmap x)+               serialize (pixmap_NameWindowPixmap x)+               putSkip (requiredPadding size__)+ +data GetOverlayWindow = MkGetOverlayWindow{window_GetOverlayWindow+                                           :: WINDOW}+                      deriving (Show, Typeable)+ +instance ExtensionRequest GetOverlayWindow where+        extensionId _ = "Composite"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__ = 4 + size (window_GetOverlayWindow x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetOverlayWindow x)+               putSkip (requiredPadding size__)+ +data GetOverlayWindowReply = MkGetOverlayWindowReply{overlay_win_GetOverlayWindowReply+                                                     :: WINDOW}+                           deriving (Show, Typeable)+ +instance Deserialize GetOverlayWindowReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               overlay_win <- deserialize+               skip 20+               let _ = isCard32 length+               return (MkGetOverlayWindowReply overlay_win)+ +data ReleaseOverlayWindow = MkReleaseOverlayWindow{window_ReleaseOverlayWindow+                                                   :: WINDOW}+                          deriving (Show, Typeable)+ +instance ExtensionRequest ReleaseOverlayWindow where+        extensionId _ = "Composite"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__ = 4 + size (window_ReleaseOverlayWindow x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_ReleaseOverlayWindow x)+               putSkip (requiredPadding size__)
+ patched/Graphics/XHB/Gen/DPMS.hs view
@@ -0,0 +1,73 @@+module Graphics.XHB.Gen.DPMS+       (extension, getVersion, capable, getTimeouts, setTimeouts,+        forceLevel, info, module Graphics.XHB.Gen.DPMS.Types)+       where+import Graphics.XHB.Gen.DPMS.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+ +extension :: ExtensionId+extension = "DPMS"+ +getVersion ::+             Graphics.XHB.Connection.Types.Connection ->+               CARD16 -> CARD16 -> IO (Receipt GetVersionReply)+getVersion c client_major_version client_minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkGetVersion client_major_version client_minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +capable ::+          Graphics.XHB.Connection.Types.Connection ->+            IO (Receipt CapableReply)+capable c+  = do receipt <- newEmptyReceiptIO+       let req = MkCapable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getTimeouts ::+              Graphics.XHB.Connection.Types.Connection ->+                IO (Receipt GetTimeoutsReply)+getTimeouts c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetTimeouts+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setTimeouts ::+              Graphics.XHB.Connection.Types.Connection -> SetTimeouts -> IO ()+setTimeouts c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +forceLevel ::+             Graphics.XHB.Connection.Types.Connection -> CARD16 -> IO ()+forceLevel c power_level+  = do let req = MkForceLevel power_level+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +info ::+       Graphics.XHB.Connection.Types.Connection -> IO (Receipt InfoReply)+info c+  = do receipt <- newEmptyReceiptIO+       let req = MkInfo+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/DPMS/Types.hs view
@@ -0,0 +1,178 @@+module Graphics.XHB.Gen.DPMS.Types+       (deserializeError, deserializeEvent, GetVersion(..),+        GetVersionReply(..), Capable(..), CapableReply(..),+        GetTimeouts(..), GetTimeoutsReply(..), SetTimeouts(..),+        ForceLevel(..), Info(..), InfoReply(..))+       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 _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +data GetVersion = MkGetVersion{client_major_version_GetVersion ::+                               CARD16,+                               client_minor_version_GetVersion :: CARD16}+                deriving (Show, Typeable)+ +instance ExtensionRequest GetVersion where+        extensionId _ = "DPMS"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (client_major_version_GetVersion x) ++                         size (client_minor_version_GetVersion x)+               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}+                     deriving (Show, Typeable)+ +instance Deserialize GetVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               server_major_version <- deserialize+               server_minor_version <- deserialize+               let _ = isCard32 length+               return+                 (MkGetVersionReply server_major_version server_minor_version)+ +data Capable = MkCapable{}+             deriving (Show, Typeable)+ +instance ExtensionRequest Capable where+        extensionId _ = "DPMS"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data CapableReply = MkCapableReply{capable_CapableReply :: BOOL}+                  deriving (Show, Typeable)+ +instance Deserialize CapableReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               capable <- deserialize+               skip 23+               let _ = isCard32 length+               return (MkCapableReply capable)+ +data GetTimeouts = MkGetTimeouts{}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetTimeouts where+        extensionId _ = "DPMS"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data GetTimeoutsReply = MkGetTimeoutsReply{standby_timeout_GetTimeoutsReply+                                           :: CARD16,+                                           suspend_timeout_GetTimeoutsReply :: CARD16,+                                           off_timeout_GetTimeoutsReply :: CARD16}+                      deriving (Show, Typeable)+ +instance Deserialize GetTimeoutsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               standby_timeout <- deserialize+               suspend_timeout <- deserialize+               off_timeout <- deserialize+               skip 18+               let _ = isCard32 length+               return+                 (MkGetTimeoutsReply standby_timeout suspend_timeout off_timeout)+ +data SetTimeouts = MkSetTimeouts{standby_timeout_SetTimeouts ::+                                 CARD16,+                                 suspend_timeout_SetTimeouts :: CARD16,+                                 off_timeout_SetTimeouts :: CARD16}+                 deriving (Show, Typeable)+ +instance ExtensionRequest SetTimeouts where+        extensionId _ = "DPMS"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (standby_timeout_SetTimeouts x) ++                         size (suspend_timeout_SetTimeouts x)+                         + size (off_timeout_SetTimeouts x)+               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}+                deriving (Show, Typeable)+ +instance ExtensionRequest ForceLevel where+        extensionId _ = "DPMS"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__ = 4 + size (power_level_ForceLevel x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (power_level_ForceLevel x)+               putSkip (requiredPadding size__)+ +data Info = MkInfo{}+          deriving (Show, Typeable)+ +instance ExtensionRequest Info where+        extensionId _ = "DPMS"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data InfoReply = MkInfoReply{power_level_InfoReply :: CARD16,+                             state_InfoReply :: BOOL}+               deriving (Show, Typeable)+ +instance Deserialize InfoReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               power_level <- deserialize+               state <- deserialize+               skip 21+               let _ = isCard32 length+               return (MkInfoReply power_level state)
+ patched/Graphics/XHB/Gen/Damage.hs view
@@ -0,0 +1,65 @@+module Graphics.XHB.Gen.Damage+       (extension, queryVersion, create, destroy, subtract, add,+        module Graphics.XHB.Gen.Damage.Types)+       where+import Prelude hiding (subtract)+import Graphics.XHB.Gen.Damage.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+import Graphics.XHB.Gen.XFixes.Types+       hiding (QueryVersion(..), QueryVersionReply(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.XFixes.Types+ +extension :: ExtensionId+extension = "DAMAGE"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)+queryVersion c client_major_version client_minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion client_major_version client_minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +create ::+         Graphics.XHB.Connection.Types.Connection -> Create -> IO ()+create c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +destroy ::+          Graphics.XHB.Connection.Types.Connection -> DAMAGE -> IO ()+destroy c damage+  = do let req = MkDestroy damage+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +subtract ::+           Graphics.XHB.Connection.Types.Connection -> Subtract -> IO ()+subtract c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +add ::+      Graphics.XHB.Connection.Types.Connection ->+        DRAWABLE -> REGION -> IO ()+add c drawable region+  = do let req = MkAdd drawable region+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk
+ patched/Graphics/XHB/Gen/Damage/Types.hs view
@@ -0,0 +1,169 @@+module Graphics.XHB.Gen.Damage.Types+       (deserializeError, deserializeEvent, DAMAGE, ReportLevel(..),+        QueryVersion(..), QueryVersionReply(..), Create(..), Destroy(..),+        Subtract(..), Add(..), Notify(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+import Graphics.XHB.Gen.XFixes.Types+       hiding (QueryVersion(..), QueryVersionReply(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.XFixes.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent 0+  = return (liftM toEvent (deserialize :: Get Notify))+deserializeEvent _ = Nothing+ +newtype DAMAGE = MkDAMAGE Xid+                 deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +data ReportLevel = ReportLevelRawRectangles+                 | ReportLevelDeltaRectangles+                 | ReportLevelBoundingBox+                 | ReportLevelNonEmpty+ +instance SimpleEnum ReportLevel where+        toValue ReportLevelRawRectangles{} = 0+        toValue ReportLevelDeltaRectangles{} = 1+        toValue ReportLevelBoundingBox{} = 2+        toValue ReportLevelNonEmpty{} = 3+        fromValue 0 = ReportLevelRawRectangles+        fromValue 1 = ReportLevelDeltaRectangles+        fromValue 2 = ReportLevelBoundingBox+        fromValue 3 = ReportLevelNonEmpty+ +data QueryVersion = MkQueryVersion{client_major_version_QueryVersion+                                   :: CARD32,+                                   client_minor_version_QueryVersion :: CARD32}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "DAMAGE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (client_major_version_QueryVersion x) ++                         size (client_minor_version_QueryVersion x)+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major_version <- deserialize+               minor_version <- deserialize+               skip 16+               let _ = isCard32 length+               return (MkQueryVersionReply major_version minor_version)+ +data Create = MkCreate{damage_Create :: DAMAGE,+                       drawable_Create :: DRAWABLE, level_Create :: CARD8}+            deriving (Show, Typeable)+ +instance ExtensionRequest Create where+        extensionId _ = "DAMAGE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__+                     = 4 + size (damage_Create x) + size (drawable_Create x) ++                         size (level_Create x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (damage_Create x)+               serialize (drawable_Create x)+               serialize (level_Create x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data Destroy = MkDestroy{damage_Destroy :: DAMAGE}+             deriving (Show, Typeable)+ +instance ExtensionRequest Destroy where+        extensionId _ = "DAMAGE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4 + size (damage_Destroy x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (damage_Destroy x)+               putSkip (requiredPadding size__)+ +data Subtract = MkSubtract{damage_Subtract :: DAMAGE,+                           repair_Subtract :: REGION, parts_Subtract :: REGION}+              deriving (Show, Typeable)+ +instance ExtensionRequest Subtract where+        extensionId _ = "DAMAGE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (damage_Subtract x) + size (repair_Subtract x) ++                         size (parts_Subtract x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (damage_Subtract x)+               serialize (repair_Subtract x)+               serialize (parts_Subtract x)+               putSkip (requiredPadding size__)+ +data Add = MkAdd{drawable_Add :: DRAWABLE, region_Add :: REGION}+         deriving (Show, Typeable)+ +instance ExtensionRequest Add where+        extensionId _ = "DAMAGE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__ = 4 + size (drawable_Add x) + size (region_Add x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (drawable_Add x)+               serialize (region_Add x)+               putSkip (requiredPadding size__)+ +data Notify = MkNotify{level_Notify :: CARD8,+                       drawable_Notify :: DRAWABLE, damage_Notify :: DAMAGE,+                       timestamp_Notify :: TIMESTAMP, area_Notify :: RECTANGLE,+                       geometry_Notify :: RECTANGLE}+            deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event Notify+ +instance Deserialize Notify where+        deserialize+          = do skip 1+               level <- deserialize+               skip 2+               drawable <- deserialize+               damage <- deserialize+               timestamp <- deserialize+               area <- deserialize+               geometry <- deserialize+               return (MkNotify level drawable damage timestamp area geometry)
+ patched/Graphics/XHB/Gen/Extension.hs view
@@ -0,0 +1,122 @@+module Graphics.XHB.Gen.Extension where+import Graphics.XHB.Shared+import Data.Binary.Get+import Data.Word+import qualified Graphics.XHB.Gen.BigRequests.Types+import qualified Graphics.XHB.Gen.Composite.Types+import qualified Graphics.XHB.Gen.Damage.Types+import qualified Graphics.XHB.Gen.DPMS.Types+import qualified Graphics.XHB.Gen.Glx.Types+import qualified Graphics.XHB.Gen.RandR.Types+import qualified Graphics.XHB.Gen.Record.Types+import qualified Graphics.XHB.Gen.Render.Types+import qualified Graphics.XHB.Gen.Res.Types+import qualified Graphics.XHB.Gen.ScreenSaver.Types+import qualified Graphics.XHB.Gen.Shape.Types+import qualified Graphics.XHB.Gen.Shm.Types+import qualified Graphics.XHB.Gen.Sync.Types+import qualified Graphics.XHB.Gen.XCMisc.Types+import qualified Graphics.XHB.Gen.Xevie.Types+import qualified Graphics.XHB.Gen.XF86Dri.Types+import qualified Graphics.XHB.Gen.XFixes.Types+import qualified Graphics.XHB.Gen.Xinerama.Types+import qualified Graphics.XHB.Gen.Input.Types+import qualified Graphics.XHB.Gen.XPrint.Types+import qualified Graphics.XHB.Gen.SELinux.Types+import qualified Graphics.XHB.Gen.Test.Types+import qualified Graphics.XHB.Gen.Xv.Types+import qualified Graphics.XHB.Gen.XvMC.Types+ +errorDispatch :: ExtensionId -> Word8 -> Maybe (Get SomeError)+errorDispatch "BIG-REQUESTS"+  = Graphics.XHB.Gen.BigRequests.Types.deserializeError+errorDispatch "Composite"+  = Graphics.XHB.Gen.Composite.Types.deserializeError+errorDispatch "DAMAGE"+  = Graphics.XHB.Gen.Damage.Types.deserializeError+errorDispatch "DPMS" = Graphics.XHB.Gen.DPMS.Types.deserializeError+errorDispatch "GLX" = Graphics.XHB.Gen.Glx.Types.deserializeError+errorDispatch "RANDR"+  = Graphics.XHB.Gen.RandR.Types.deserializeError+errorDispatch "RECORD"+  = Graphics.XHB.Gen.Record.Types.deserializeError+errorDispatch "RENDER"+  = Graphics.XHB.Gen.Render.Types.deserializeError+errorDispatch "X-Resource"+  = Graphics.XHB.Gen.Res.Types.deserializeError+errorDispatch "MIT-SCREEN-SAVER"+  = Graphics.XHB.Gen.ScreenSaver.Types.deserializeError+errorDispatch "SHAPE"+  = Graphics.XHB.Gen.Shape.Types.deserializeError+errorDispatch "MIT-SHM"+  = Graphics.XHB.Gen.Shm.Types.deserializeError+errorDispatch "SYNC" = Graphics.XHB.Gen.Sync.Types.deserializeError+errorDispatch "XC-MISC"+  = Graphics.XHB.Gen.XCMisc.Types.deserializeError+errorDispatch "XEVIE"+  = Graphics.XHB.Gen.Xevie.Types.deserializeError+errorDispatch "XFree86-DRI"+  = Graphics.XHB.Gen.XF86Dri.Types.deserializeError+errorDispatch "XFIXES"+  = Graphics.XHB.Gen.XFixes.Types.deserializeError+errorDispatch "XINERAMA"+  = Graphics.XHB.Gen.Xinerama.Types.deserializeError+errorDispatch "XInputExtension"+  = Graphics.XHB.Gen.Input.Types.deserializeError+errorDispatch "XpExtension"+  = Graphics.XHB.Gen.XPrint.Types.deserializeError+errorDispatch "SELinux"+  = Graphics.XHB.Gen.SELinux.Types.deserializeError+errorDispatch "XTEST"+  = Graphics.XHB.Gen.Test.Types.deserializeError+errorDispatch "XVideo" = Graphics.XHB.Gen.Xv.Types.deserializeError+errorDispatch "XVideo-MotionCompensation"+  = Graphics.XHB.Gen.XvMC.Types.deserializeError+errorDispatch _ = const (Nothing)+ +eventDispatch :: ExtensionId -> Word8 -> Maybe (Get SomeEvent)+eventDispatch "BIG-REQUESTS"+  = Graphics.XHB.Gen.BigRequests.Types.deserializeEvent+eventDispatch "Composite"+  = Graphics.XHB.Gen.Composite.Types.deserializeEvent+eventDispatch "DAMAGE"+  = Graphics.XHB.Gen.Damage.Types.deserializeEvent+eventDispatch "DPMS" = Graphics.XHB.Gen.DPMS.Types.deserializeEvent+eventDispatch "GLX" = Graphics.XHB.Gen.Glx.Types.deserializeEvent+eventDispatch "RANDR"+  = Graphics.XHB.Gen.RandR.Types.deserializeEvent+eventDispatch "RECORD"+  = Graphics.XHB.Gen.Record.Types.deserializeEvent+eventDispatch "RENDER"+  = Graphics.XHB.Gen.Render.Types.deserializeEvent+eventDispatch "X-Resource"+  = Graphics.XHB.Gen.Res.Types.deserializeEvent+eventDispatch "MIT-SCREEN-SAVER"+  = Graphics.XHB.Gen.ScreenSaver.Types.deserializeEvent+eventDispatch "SHAPE"+  = Graphics.XHB.Gen.Shape.Types.deserializeEvent+eventDispatch "MIT-SHM"+  = Graphics.XHB.Gen.Shm.Types.deserializeEvent+eventDispatch "SYNC" = Graphics.XHB.Gen.Sync.Types.deserializeEvent+eventDispatch "XC-MISC"+  = Graphics.XHB.Gen.XCMisc.Types.deserializeEvent+eventDispatch "XEVIE"+  = Graphics.XHB.Gen.Xevie.Types.deserializeEvent+eventDispatch "XFree86-DRI"+  = Graphics.XHB.Gen.XF86Dri.Types.deserializeEvent+eventDispatch "XFIXES"+  = Graphics.XHB.Gen.XFixes.Types.deserializeEvent+eventDispatch "XINERAMA"+  = Graphics.XHB.Gen.Xinerama.Types.deserializeEvent+eventDispatch "XInputExtension"+  = Graphics.XHB.Gen.Input.Types.deserializeEvent+eventDispatch "XpExtension"+  = Graphics.XHB.Gen.XPrint.Types.deserializeEvent+eventDispatch "SELinux"+  = Graphics.XHB.Gen.SELinux.Types.deserializeEvent+eventDispatch "XTEST"+  = Graphics.XHB.Gen.Test.Types.deserializeEvent+eventDispatch "XVideo" = Graphics.XHB.Gen.Xv.Types.deserializeEvent+eventDispatch "XVideo-MotionCompensation"+  = Graphics.XHB.Gen.XvMC.Types.deserializeEvent+eventDispatch _ = const (Nothing)
+ patched/Graphics/XHB/Gen/Glx.hs view
@@ -0,0 +1,980 @@+module Graphics.XHB.Gen.Glx+       (extension, render, renderLarge, createContext, destroyContext,+        makeCurrent, isDirect, queryVersion, waitGL, waitX, copyContext,+        swapBuffers, useXFont, createGLXPixmap, getVisualConfigs,+        destroyGLXPixmap, vendorPrivate, vendorPrivateWithReply,+        queryExtensionsString, queryServerString, clientInfo, getFBConfigs,+        createPixmap, destroyPixmap, createNewContext, queryContext,+        makeContextCurrent, createPbuffer, destroyPbuffer,+        getDrawableAttributes, changeDrawableAttributes, createWindow,+        deleteWindow, newList, endList, deleteLists, genLists,+        feedbackBuffer, selectBuffer, renderMode, finish, pixelStoref,+        pixelStorei, readPixels, getBooleanv, getClipPlane, getDoublev,+        getError, getFloatv, getIntegerv, getLightfv, getLightiv, getMapdv,+        getMapfv, getMapiv, getMaterialfv, getMaterialiv, getPixelMapfv,+        getPixelMapuiv, getPixelMapusv, getPolygonStipple, getString,+        getTexEnvfv, getTexEnviv, getTexGendv, getTexGenfv, getTexGeniv,+        getTexImage, getTexParameterfv, getTexParameteriv,+        getTexLevelParameterfv, getTexLevelParameteriv, isList, flush,+        areTexturesResident, deleteTextures, genTextures, isTexture,+        getColorTable, getColorTableParameterfv, getColorTableParameteriv,+        getConvolutionFilter, getConvolutionParameterfv,+        getConvolutionParameteriv, getSeparableFilter, getHistogram,+        getHistogramParameterfv, getHistogramParameteriv, getMinmax,+        getMinmaxParameterfv, getMinmaxParameteriv,+        getCompressedTexImageARB, deleteQueriesARB, genQueriesARB,+        isQueryARB, getQueryivARB, getQueryObjectivARB,+        getQueryObjectuivARB, module Graphics.XHB.Gen.Glx.Types)+       where+import Graphics.XHB.Gen.Glx.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (PIXMAP(..), WINDOW(..), DRAWABLE(..), GC(..),+               CreatePixmap(..), CreateWindow(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "GLX"+ +render ::+         Graphics.XHB.Connection.Types.Connection ->+           CONTEXT_TAG -> [BYTE] -> IO ()+render c context_tag data_+  = do let req = MkRender context_tag data_+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +renderLarge ::+              Graphics.XHB.Connection.Types.Connection -> RenderLarge -> IO ()+renderLarge c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createContext ::+                Graphics.XHB.Connection.Types.Connection -> CreateContext -> IO ()+createContext c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +destroyContext ::+                 Graphics.XHB.Connection.Types.Connection ->+                   Graphics.XHB.Gen.Glx.Types.CONTEXT -> IO ()+destroyContext c context+  = do let req = MkDestroyContext context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +makeCurrent ::+              Graphics.XHB.Connection.Types.Connection ->+                MakeCurrent -> IO (Receipt MakeCurrentReply)+makeCurrent c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +isDirect ::+           Graphics.XHB.Connection.Types.Connection ->+             Graphics.XHB.Gen.Glx.Types.CONTEXT -> IO (Receipt IsDirectReply)+isDirect c context+  = do receipt <- newEmptyReceiptIO+       let req = MkIsDirect context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)+queryVersion c major_version minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion major_version minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +waitGL ::+         Graphics.XHB.Connection.Types.Connection -> CONTEXT_TAG -> IO ()+waitGL c context_tag+  = do let req = MkWaitGL context_tag+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +waitX ::+        Graphics.XHB.Connection.Types.Connection -> CONTEXT_TAG -> IO ()+waitX c context_tag+  = do let req = MkWaitX context_tag+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +copyContext ::+              Graphics.XHB.Connection.Types.Connection -> CopyContext -> IO ()+copyContext c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +swapBuffers ::+              Graphics.XHB.Connection.Types.Connection ->+                CONTEXT_TAG -> Graphics.XHB.Gen.Glx.Types.DRAWABLE -> IO ()+swapBuffers c context_tag drawable+  = do let req = MkSwapBuffers context_tag drawable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +useXFont ::+           Graphics.XHB.Connection.Types.Connection -> UseXFont -> IO ()+useXFont c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createGLXPixmap ::+                  Graphics.XHB.Connection.Types.Connection ->+                    CreateGLXPixmap -> IO ()+createGLXPixmap c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getVisualConfigs ::+                   Graphics.XHB.Connection.Types.Connection ->+                     CARD32 -> IO (Receipt GetVisualConfigsReply)+getVisualConfigs c screen+  = do receipt <- newEmptyReceiptIO+       let req = MkGetVisualConfigs screen+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +destroyGLXPixmap ::+                   Graphics.XHB.Connection.Types.Connection ->+                     Graphics.XHB.Gen.Glx.Types.PIXMAP -> IO ()+destroyGLXPixmap c glx_pixmap+  = do let req = MkDestroyGLXPixmap glx_pixmap+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +vendorPrivate ::+                Graphics.XHB.Connection.Types.Connection -> VendorPrivate -> IO ()+vendorPrivate c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +vendorPrivateWithReply ::+                         Graphics.XHB.Connection.Types.Connection ->+                           VendorPrivateWithReply -> IO (Receipt VendorPrivateWithReplyReply)+vendorPrivateWithReply c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryExtensionsString ::+                        Graphics.XHB.Connection.Types.Connection ->+                          CARD32 -> IO (Receipt QueryExtensionsStringReply)+queryExtensionsString c screen+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryExtensionsString screen+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryServerString ::+                    Graphics.XHB.Connection.Types.Connection ->+                      CARD32 -> CARD32 -> IO (Receipt QueryServerStringReply)+queryServerString c screen name+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryServerString screen name+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +clientInfo ::+             Graphics.XHB.Connection.Types.Connection -> ClientInfo -> IO ()+clientInfo c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getFBConfigs ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD32 -> IO (Receipt GetFBConfigsReply)+getFBConfigs c screen+  = do receipt <- newEmptyReceiptIO+       let req = MkGetFBConfigs screen+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +createPixmap ::+               Graphics.XHB.Connection.Types.Connection -> CreatePixmap -> IO ()+createPixmap c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +destroyPixmap ::+                Graphics.XHB.Connection.Types.Connection ->+                  Graphics.XHB.Gen.Glx.Types.PIXMAP -> IO ()+destroyPixmap c glx_pixmap+  = do let req = MkDestroyPixmap glx_pixmap+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createNewContext ::+                   Graphics.XHB.Connection.Types.Connection ->+                     CreateNewContext -> IO ()+createNewContext c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +queryContext ::+               Graphics.XHB.Connection.Types.Connection ->+                 Graphics.XHB.Gen.Glx.Types.CONTEXT ->+                   IO (Receipt QueryContextReply)+queryContext c context+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryContext context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +makeContextCurrent ::+                     Graphics.XHB.Connection.Types.Connection ->+                       MakeContextCurrent -> IO (Receipt MakeContextCurrentReply)+makeContextCurrent c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +createPbuffer ::+                Graphics.XHB.Connection.Types.Connection -> CreatePbuffer -> IO ()+createPbuffer c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +destroyPbuffer ::+                 Graphics.XHB.Connection.Types.Connection -> PBUFFER -> IO ()+destroyPbuffer c pbuffer+  = do let req = MkDestroyPbuffer pbuffer+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getDrawableAttributes ::+                        Graphics.XHB.Connection.Types.Connection ->+                          Graphics.XHB.Gen.Glx.Types.DRAWABLE ->+                            IO (Receipt GetDrawableAttributesReply)+getDrawableAttributes c drawable+  = do receipt <- newEmptyReceiptIO+       let req = MkGetDrawableAttributes drawable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +changeDrawableAttributes ::+                           Graphics.XHB.Connection.Types.Connection ->+                             ChangeDrawableAttributes -> IO ()+changeDrawableAttributes c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createWindow ::+               Graphics.XHB.Connection.Types.Connection -> CreateWindow -> IO ()+createWindow c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +deleteWindow ::+               Graphics.XHB.Connection.Types.Connection ->+                 Graphics.XHB.Gen.Glx.Types.WINDOW -> IO ()+deleteWindow c glxwindow+  = do let req = MkDeleteWindow glxwindow+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +newList ::+          Graphics.XHB.Connection.Types.Connection -> NewList -> IO ()+newList c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +endList ::+          Graphics.XHB.Connection.Types.Connection -> CONTEXT_TAG -> IO ()+endList c context_tag+  = do let req = MkEndList context_tag+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +deleteLists ::+              Graphics.XHB.Connection.Types.Connection -> DeleteLists -> IO ()+deleteLists c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +genLists ::+           Graphics.XHB.Connection.Types.Connection ->+             CONTEXT_TAG -> INT32 -> IO (Receipt GenListsReply)+genLists c context_tag range+  = do receipt <- newEmptyReceiptIO+       let req = MkGenLists context_tag range+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +feedbackBuffer ::+                 Graphics.XHB.Connection.Types.Connection -> FeedbackBuffer -> IO ()+feedbackBuffer c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +selectBuffer ::+               Graphics.XHB.Connection.Types.Connection ->+                 CONTEXT_TAG -> INT32 -> IO ()+selectBuffer c context_tag size+  = do let req = MkSelectBuffer context_tag size+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +renderMode ::+             Graphics.XHB.Connection.Types.Connection ->+               CONTEXT_TAG -> CARD32 -> IO (Receipt RenderModeReply)+renderMode c context_tag mode+  = do receipt <- newEmptyReceiptIO+       let req = MkRenderMode context_tag mode+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +finish ::+         Graphics.XHB.Connection.Types.Connection ->+           CONTEXT_TAG -> IO (Receipt FinishReply)+finish c context_tag+  = do receipt <- newEmptyReceiptIO+       let req = MkFinish context_tag+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +pixelStoref ::+              Graphics.XHB.Connection.Types.Connection -> PixelStoref -> IO ()+pixelStoref c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +pixelStorei ::+              Graphics.XHB.Connection.Types.Connection -> PixelStorei -> IO ()+pixelStorei c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +readPixels ::+             Graphics.XHB.Connection.Types.Connection ->+               ReadPixels -> IO (Receipt ReadPixelsReply)+readPixels c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getBooleanv ::+              Graphics.XHB.Connection.Types.Connection ->+                CONTEXT_TAG -> INT32 -> IO (Receipt GetBooleanvReply)+getBooleanv c context_tag pname+  = do receipt <- newEmptyReceiptIO+       let req = MkGetBooleanv context_tag pname+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getClipPlane ::+               Graphics.XHB.Connection.Types.Connection ->+                 CONTEXT_TAG -> INT32 -> IO (Receipt GetClipPlaneReply)+getClipPlane c context_tag plane+  = do receipt <- newEmptyReceiptIO+       let req = MkGetClipPlane context_tag plane+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getDoublev ::+             Graphics.XHB.Connection.Types.Connection ->+               CONTEXT_TAG -> CARD32 -> IO (Receipt GetDoublevReply)+getDoublev c context_tag pname+  = do receipt <- newEmptyReceiptIO+       let req = MkGetDoublev context_tag pname+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getError ::+           Graphics.XHB.Connection.Types.Connection ->+             CONTEXT_TAG -> IO (Receipt GetErrorReply)+getError c context_tag+  = do receipt <- newEmptyReceiptIO+       let req = MkGetError context_tag+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getFloatv ::+            Graphics.XHB.Connection.Types.Connection ->+              CONTEXT_TAG -> CARD32 -> IO (Receipt GetFloatvReply)+getFloatv c context_tag pname+  = do receipt <- newEmptyReceiptIO+       let req = MkGetFloatv context_tag pname+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getIntegerv ::+              Graphics.XHB.Connection.Types.Connection ->+                CONTEXT_TAG -> CARD32 -> IO (Receipt GetIntegervReply)+getIntegerv c context_tag pname+  = do receipt <- newEmptyReceiptIO+       let req = MkGetIntegerv context_tag pname+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getLightfv ::+             Graphics.XHB.Connection.Types.Connection ->+               GetLightfv -> IO (Receipt GetLightfvReply)+getLightfv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getLightiv ::+             Graphics.XHB.Connection.Types.Connection ->+               GetLightiv -> IO (Receipt GetLightivReply)+getLightiv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getMapdv ::+           Graphics.XHB.Connection.Types.Connection ->+             GetMapdv -> IO (Receipt GetMapdvReply)+getMapdv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getMapfv ::+           Graphics.XHB.Connection.Types.Connection ->+             GetMapfv -> IO (Receipt GetMapfvReply)+getMapfv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getMapiv ::+           Graphics.XHB.Connection.Types.Connection ->+             GetMapiv -> IO (Receipt GetMapivReply)+getMapiv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getMaterialfv ::+                Graphics.XHB.Connection.Types.Connection ->+                  GetMaterialfv -> IO (Receipt GetMaterialfvReply)+getMaterialfv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getMaterialiv ::+                Graphics.XHB.Connection.Types.Connection ->+                  GetMaterialiv -> IO (Receipt GetMaterialivReply)+getMaterialiv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getPixelMapfv ::+                Graphics.XHB.Connection.Types.Connection ->+                  CONTEXT_TAG -> CARD32 -> IO (Receipt GetPixelMapfvReply)+getPixelMapfv c context_tag map+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPixelMapfv context_tag map+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getPixelMapuiv ::+                 Graphics.XHB.Connection.Types.Connection ->+                   CONTEXT_TAG -> CARD32 -> IO (Receipt GetPixelMapuivReply)+getPixelMapuiv c context_tag map+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPixelMapuiv context_tag map+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getPixelMapusv ::+                 Graphics.XHB.Connection.Types.Connection ->+                   CONTEXT_TAG -> CARD32 -> IO (Receipt GetPixelMapusvReply)+getPixelMapusv c context_tag map+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPixelMapusv context_tag map+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getPolygonStipple ::+                    Graphics.XHB.Connection.Types.Connection ->+                      CONTEXT_TAG -> BOOL -> IO (Receipt GetPolygonStippleReply)+getPolygonStipple c context_tag lsb_first+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPolygonStipple context_tag lsb_first+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getString ::+            Graphics.XHB.Connection.Types.Connection ->+              CONTEXT_TAG -> CARD32 -> IO (Receipt GetStringReply)+getString c context_tag name+  = do receipt <- newEmptyReceiptIO+       let req = MkGetString context_tag name+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getTexEnvfv ::+              Graphics.XHB.Connection.Types.Connection ->+                GetTexEnvfv -> IO (Receipt GetTexEnvfvReply)+getTexEnvfv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getTexEnviv ::+              Graphics.XHB.Connection.Types.Connection ->+                GetTexEnviv -> IO (Receipt GetTexEnvivReply)+getTexEnviv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getTexGendv ::+              Graphics.XHB.Connection.Types.Connection ->+                GetTexGendv -> IO (Receipt GetTexGendvReply)+getTexGendv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getTexGenfv ::+              Graphics.XHB.Connection.Types.Connection ->+                GetTexGenfv -> IO (Receipt GetTexGenfvReply)+getTexGenfv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getTexGeniv ::+              Graphics.XHB.Connection.Types.Connection ->+                GetTexGeniv -> IO (Receipt GetTexGenivReply)+getTexGeniv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getTexImage ::+              Graphics.XHB.Connection.Types.Connection ->+                GetTexImage -> IO (Receipt GetTexImageReply)+getTexImage c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getTexParameterfv ::+                    Graphics.XHB.Connection.Types.Connection ->+                      GetTexParameterfv -> IO (Receipt GetTexParameterfvReply)+getTexParameterfv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getTexParameteriv ::+                    Graphics.XHB.Connection.Types.Connection ->+                      GetTexParameteriv -> IO (Receipt GetTexParameterivReply)+getTexParameteriv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getTexLevelParameterfv ::+                         Graphics.XHB.Connection.Types.Connection ->+                           GetTexLevelParameterfv -> IO (Receipt GetTexLevelParameterfvReply)+getTexLevelParameterfv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getTexLevelParameteriv ::+                         Graphics.XHB.Connection.Types.Connection ->+                           GetTexLevelParameteriv -> IO (Receipt GetTexLevelParameterivReply)+getTexLevelParameteriv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +isList ::+         Graphics.XHB.Connection.Types.Connection ->+           CONTEXT_TAG -> CARD32 -> IO (Receipt IsListReply)+isList c context_tag list+  = do receipt <- newEmptyReceiptIO+       let req = MkIsList context_tag list+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +flush ::+        Graphics.XHB.Connection.Types.Connection -> CONTEXT_TAG -> IO ()+flush c context_tag+  = do let req = MkFlush context_tag+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +areTexturesResident ::+                      Graphics.XHB.Connection.Types.Connection ->+                        AreTexturesResident -> IO (Receipt AreTexturesResidentReply)+areTexturesResident c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +deleteTextures ::+                 Graphics.XHB.Connection.Types.Connection -> DeleteTextures -> IO ()+deleteTextures c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +genTextures ::+              Graphics.XHB.Connection.Types.Connection ->+                CONTEXT_TAG -> INT32 -> IO (Receipt GenTexturesReply)+genTextures c context_tag n+  = do receipt <- newEmptyReceiptIO+       let req = MkGenTextures context_tag n+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +isTexture ::+            Graphics.XHB.Connection.Types.Connection ->+              CONTEXT_TAG -> CARD32 -> IO (Receipt IsTextureReply)+isTexture c context_tag texture+  = do receipt <- newEmptyReceiptIO+       let req = MkIsTexture context_tag texture+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getColorTable ::+                Graphics.XHB.Connection.Types.Connection ->+                  GetColorTable -> IO (Receipt GetColorTableReply)+getColorTable c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getColorTableParameterfv ::+                           Graphics.XHB.Connection.Types.Connection ->+                             GetColorTableParameterfv ->+                               IO (Receipt GetColorTableParameterfvReply)+getColorTableParameterfv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getColorTableParameteriv ::+                           Graphics.XHB.Connection.Types.Connection ->+                             GetColorTableParameteriv ->+                               IO (Receipt GetColorTableParameterivReply)+getColorTableParameteriv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getConvolutionFilter ::+                       Graphics.XHB.Connection.Types.Connection ->+                         GetConvolutionFilter -> IO (Receipt GetConvolutionFilterReply)+getConvolutionFilter c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getConvolutionParameterfv ::+                            Graphics.XHB.Connection.Types.Connection ->+                              GetConvolutionParameterfv ->+                                IO (Receipt GetConvolutionParameterfvReply)+getConvolutionParameterfv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getConvolutionParameteriv ::+                            Graphics.XHB.Connection.Types.Connection ->+                              GetConvolutionParameteriv ->+                                IO (Receipt GetConvolutionParameterivReply)+getConvolutionParameteriv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getSeparableFilter ::+                     Graphics.XHB.Connection.Types.Connection ->+                       GetSeparableFilter -> IO (Receipt GetSeparableFilterReply)+getSeparableFilter c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getHistogram ::+               Graphics.XHB.Connection.Types.Connection ->+                 GetHistogram -> IO (Receipt GetHistogramReply)+getHistogram c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getHistogramParameterfv ::+                          Graphics.XHB.Connection.Types.Connection ->+                            GetHistogramParameterfv ->+                              IO (Receipt GetHistogramParameterfvReply)+getHistogramParameterfv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getHistogramParameteriv ::+                          Graphics.XHB.Connection.Types.Connection ->+                            GetHistogramParameteriv ->+                              IO (Receipt GetHistogramParameterivReply)+getHistogramParameteriv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getMinmax ::+            Graphics.XHB.Connection.Types.Connection ->+              GetMinmax -> IO (Receipt GetMinmaxReply)+getMinmax c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getMinmaxParameterfv ::+                       Graphics.XHB.Connection.Types.Connection ->+                         GetMinmaxParameterfv -> IO (Receipt GetMinmaxParameterfvReply)+getMinmaxParameterfv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getMinmaxParameteriv ::+                       Graphics.XHB.Connection.Types.Connection ->+                         GetMinmaxParameteriv -> IO (Receipt GetMinmaxParameterivReply)+getMinmaxParameteriv c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getCompressedTexImageARB ::+                           Graphics.XHB.Connection.Types.Connection ->+                             GetCompressedTexImageARB ->+                               IO (Receipt GetCompressedTexImageARBReply)+getCompressedTexImageARB c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +deleteQueriesARB ::+                   Graphics.XHB.Connection.Types.Connection ->+                     DeleteQueriesARB -> IO ()+deleteQueriesARB c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +genQueriesARB ::+                Graphics.XHB.Connection.Types.Connection ->+                  CONTEXT_TAG -> INT32 -> IO (Receipt GenQueriesARBReply)+genQueriesARB c context_tag n+  = do receipt <- newEmptyReceiptIO+       let req = MkGenQueriesARB context_tag n+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +isQueryARB ::+             Graphics.XHB.Connection.Types.Connection ->+               CONTEXT_TAG -> CARD32 -> IO (Receipt IsQueryARBReply)+isQueryARB c context_tag id+  = do receipt <- newEmptyReceiptIO+       let req = MkIsQueryARB context_tag id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getQueryivARB ::+                Graphics.XHB.Connection.Types.Connection ->+                  GetQueryivARB -> IO (Receipt GetQueryivARBReply)+getQueryivARB c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getQueryObjectivARB ::+                      Graphics.XHB.Connection.Types.Connection ->+                        GetQueryObjectivARB -> IO (Receipt GetQueryObjectivARBReply)+getQueryObjectivARB c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getQueryObjectuivARB ::+                       Graphics.XHB.Connection.Types.Connection ->+                         GetQueryObjectuivARB -> IO (Receipt GetQueryObjectuivARBReply)+getQueryObjectuivARB c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/Glx/Types.hs view
@@ -0,0 +1,3666 @@+module Graphics.XHB.Gen.Glx.Types+       (deserializeError, deserializeEvent, PIXMAP, CONTEXT, PBUFFER,+        WINDOW, FBCONFIG, DRAWABLE, FLOAT32, FLOAT64, BOOL32, CONTEXT_TAG,+        Generic(..), BadContext(..), BadContextState(..), BadDrawable(..),+        BadPixmap(..), BadContextTag(..), BadCurrentWindow(..),+        BadRenderRequest(..), BadLargeRequest(..),+        UnsupportedPrivateRequest(..), BadFBConfig(..), BadPbuffer(..),+        BadCurrentDrawable(..), BadWindow(..), PbufferClobber(..),+        PBCET(..), PBCDT(..), Render(..), RenderLarge(..),+        CreateContext(..), DestroyContext(..), MakeCurrent(..),+        MakeCurrentReply(..), IsDirect(..), IsDirectReply(..),+        QueryVersion(..), QueryVersionReply(..), WaitGL(..), WaitX(..),+        CopyContext(..), GC(..), SwapBuffers(..), UseXFont(..),+        CreateGLXPixmap(..), GetVisualConfigs(..),+        GetVisualConfigsReply(..), DestroyGLXPixmap(..), VendorPrivate(..),+        VendorPrivateWithReply(..), VendorPrivateWithReplyReply(..),+        QueryExtensionsString(..), QueryExtensionsStringReply(..),+        QueryServerString(..), QueryServerStringReply(..), ClientInfo(..),+        GetFBConfigs(..), GetFBConfigsReply(..), CreatePixmap(..),+        DestroyPixmap(..), CreateNewContext(..), QueryContext(..),+        QueryContextReply(..), MakeContextCurrent(..),+        MakeContextCurrentReply(..), CreatePbuffer(..), DestroyPbuffer(..),+        GetDrawableAttributes(..), GetDrawableAttributesReply(..),+        ChangeDrawableAttributes(..), CreateWindow(..), DeleteWindow(..),+        NewList(..), EndList(..), DeleteLists(..), GenLists(..),+        GenListsReply(..), FeedbackBuffer(..), SelectBuffer(..),+        RenderMode(..), RenderModeReply(..), RM(..), Finish(..),+        FinishReply(..), PixelStoref(..), PixelStorei(..), ReadPixels(..),+        ReadPixelsReply(..), GetBooleanv(..), GetBooleanvReply(..),+        GetClipPlane(..), GetClipPlaneReply(..), GetDoublev(..),+        GetDoublevReply(..), GetError(..), GetErrorReply(..),+        GetFloatv(..), GetFloatvReply(..), GetIntegerv(..),+        GetIntegervReply(..), GetLightfv(..), GetLightfvReply(..),+        GetLightiv(..), GetLightivReply(..), GetMapdv(..),+        GetMapdvReply(..), GetMapfv(..), GetMapfvReply(..), GetMapiv(..),+        GetMapivReply(..), GetMaterialfv(..), GetMaterialfvReply(..),+        GetMaterialiv(..), GetMaterialivReply(..), GetPixelMapfv(..),+        GetPixelMapfvReply(..), GetPixelMapuiv(..),+        GetPixelMapuivReply(..), GetPixelMapusv(..),+        GetPixelMapusvReply(..), GetPolygonStipple(..),+        GetPolygonStippleReply(..), GetString(..), GetStringReply(..),+        GetTexEnvfv(..), GetTexEnvfvReply(..), GetTexEnviv(..),+        GetTexEnvivReply(..), GetTexGendv(..), GetTexGendvReply(..),+        GetTexGenfv(..), GetTexGenfvReply(..), GetTexGeniv(..),+        GetTexGenivReply(..), GetTexImage(..), GetTexImageReply(..),+        GetTexParameterfv(..), GetTexParameterfvReply(..),+        GetTexParameteriv(..), GetTexParameterivReply(..),+        GetTexLevelParameterfv(..), GetTexLevelParameterfvReply(..),+        GetTexLevelParameteriv(..), GetTexLevelParameterivReply(..),+        IsList(..), IsListReply(..), Flush(..), AreTexturesResident(..),+        AreTexturesResidentReply(..), DeleteTextures(..), GenTextures(..),+        GenTexturesReply(..), IsTexture(..), IsTextureReply(..),+        GetColorTable(..), GetColorTableReply(..),+        GetColorTableParameterfv(..), GetColorTableParameterfvReply(..),+        GetColorTableParameteriv(..), GetColorTableParameterivReply(..),+        GetConvolutionFilter(..), GetConvolutionFilterReply(..),+        GetConvolutionParameterfv(..), GetConvolutionParameterfvReply(..),+        GetConvolutionParameteriv(..), GetConvolutionParameterivReply(..),+        GetSeparableFilter(..), GetSeparableFilterReply(..),+        GetHistogram(..), GetHistogramReply(..),+        GetHistogramParameterfv(..), GetHistogramParameterfvReply(..),+        GetHistogramParameteriv(..), GetHistogramParameterivReply(..),+        GetMinmax(..), GetMinmaxReply(..), GetMinmaxParameterfv(..),+        GetMinmaxParameterfvReply(..), GetMinmaxParameteriv(..),+        GetMinmaxParameterivReply(..), GetCompressedTexImageARB(..),+        GetCompressedTexImageARBReply(..), DeleteQueriesARB(..),+        GenQueriesARB(..), GenQueriesARBReply(..), IsQueryARB(..),+        IsQueryARBReply(..), GetQueryivARB(..), GetQueryivARBReply(..),+        GetQueryObjectivARB(..), GetQueryObjectivARBReply(..),+        GetQueryObjectuivARB(..), GetQueryObjectuivARBReply(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (PIXMAP(..), WINDOW(..), DRAWABLE(..), GC(..),+               CreatePixmap(..), CreateWindow(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError 0+  = return (liftM toError (deserialize :: Get BadContext))+deserializeError 1+  = return (liftM toError (deserialize :: Get BadContextState))+deserializeError 2+  = return (liftM toError (deserialize :: Get BadDrawable))+deserializeError 3+  = return (liftM toError (deserialize :: Get BadPixmap))+deserializeError 4+  = return (liftM toError (deserialize :: Get BadContextTag))+deserializeError 5+  = return (liftM toError (deserialize :: Get BadCurrentWindow))+deserializeError 6+  = return (liftM toError (deserialize :: Get BadRenderRequest))+deserializeError 7+  = return (liftM toError (deserialize :: Get BadLargeRequest))+deserializeError 8+  = return+      (liftM toError (deserialize :: Get UnsupportedPrivateRequest))+deserializeError 9+  = return (liftM toError (deserialize :: Get BadFBConfig))+deserializeError 10+  = return (liftM toError (deserialize :: Get BadPbuffer))+deserializeError 11+  = return (liftM toError (deserialize :: Get BadCurrentDrawable))+deserializeError 12+  = return (liftM toError (deserialize :: Get BadWindow))+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent 0+  = return (liftM toEvent (deserialize :: Get PbufferClobber))+deserializeEvent _ = Nothing+ +newtype PIXMAP = MkPIXMAP Xid+                 deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype CONTEXT = MkCONTEXT Xid+                  deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype PBUFFER = MkPBUFFER Xid+                  deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype WINDOW = MkWINDOW Xid+                 deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype FBCONFIG = MkFBCONFIG Xid+                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype DRAWABLE = MkDRAWABLE Xid+                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +type FLOAT32 = CFloat+ +type FLOAT64 = CDouble+ +type BOOL32 = CARD32+ +type CONTEXT_TAG = CARD32+ +data Generic = MkGeneric{bad_value_Generic :: CARD32,+                         minor_opcode_Generic :: CARD16, major_opcode_Generic :: CARD8}+             deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error Generic+ +instance Deserialize Generic where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               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}+                deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadContext+ +instance Deserialize BadContext where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               skip 21+               return (MkBadContext bad_value minor_opcode major_opcode)+ +data BadContextState = MkBadContextState{bad_value_BadContextState+                                         :: CARD32,+                                         minor_opcode_BadContextState :: CARD16,+                                         major_opcode_BadContextState :: CARD8}+                     deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadContextState+ +instance Deserialize BadContextState where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               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}+                 deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadDrawable+ +instance Deserialize BadDrawable where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               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}+               deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadPixmap+ +instance Deserialize BadPixmap where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               skip 21+               return (MkBadPixmap bad_value minor_opcode major_opcode)+ +data BadContextTag = MkBadContextTag{bad_value_BadContextTag ::+                                     CARD32,+                                     minor_opcode_BadContextTag :: CARD16,+                                     major_opcode_BadContextTag :: CARD8}+                   deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadContextTag+ +instance Deserialize BadContextTag where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               skip 21+               return (MkBadContextTag bad_value minor_opcode major_opcode)+ +data BadCurrentWindow = MkBadCurrentWindow{bad_value_BadCurrentWindow+                                           :: CARD32,+                                           minor_opcode_BadCurrentWindow :: CARD16,+                                           major_opcode_BadCurrentWindow :: CARD8}+                      deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadCurrentWindow+ +instance Deserialize BadCurrentWindow where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               skip 21+               return (MkBadCurrentWindow bad_value minor_opcode major_opcode)+ +data BadRenderRequest = MkBadRenderRequest{bad_value_BadRenderRequest+                                           :: CARD32,+                                           minor_opcode_BadRenderRequest :: CARD16,+                                           major_opcode_BadRenderRequest :: CARD8}+                      deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadRenderRequest+ +instance Deserialize BadRenderRequest where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               skip 21+               return (MkBadRenderRequest bad_value minor_opcode major_opcode)+ +data BadLargeRequest = MkBadLargeRequest{bad_value_BadLargeRequest+                                         :: CARD32,+                                         minor_opcode_BadLargeRequest :: CARD16,+                                         major_opcode_BadLargeRequest :: CARD8}+                     deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadLargeRequest+ +instance Deserialize BadLargeRequest where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               skip 21+               return (MkBadLargeRequest bad_value minor_opcode major_opcode)+ +data UnsupportedPrivateRequest = MkUnsupportedPrivateRequest{bad_value_UnsupportedPrivateRequest+                                                             :: CARD32,+                                                             minor_opcode_UnsupportedPrivateRequest+                                                             :: CARD16,+                                                             major_opcode_UnsupportedPrivateRequest+                                                             :: CARD8}+                               deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error UnsupportedPrivateRequest+ +instance Deserialize UnsupportedPrivateRequest where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               skip 21+               return+                 (MkUnsupportedPrivateRequest bad_value minor_opcode major_opcode)+ +data BadFBConfig = MkBadFBConfig{bad_value_BadFBConfig :: CARD32,+                                 minor_opcode_BadFBConfig :: CARD16,+                                 major_opcode_BadFBConfig :: CARD8}+                 deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadFBConfig+ +instance Deserialize BadFBConfig where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               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}+                deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadPbuffer+ +instance Deserialize BadPbuffer where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               skip 21+               return (MkBadPbuffer bad_value minor_opcode major_opcode)+ +data BadCurrentDrawable = MkBadCurrentDrawable{bad_value_BadCurrentDrawable+                                               :: CARD32,+                                               minor_opcode_BadCurrentDrawable :: CARD16,+                                               major_opcode_BadCurrentDrawable :: CARD8}+                        deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadCurrentDrawable+ +instance Deserialize BadCurrentDrawable where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               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}+               deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadWindow+ +instance Deserialize BadWindow where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               skip 21+               return (MkBadWindow bad_value minor_opcode major_opcode)+ +data PbufferClobber = MkPbufferClobber{event_type_PbufferClobber ::+                                       CARD16,+                                       draw_type_PbufferClobber :: CARD16,+                                       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}+                    deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event PbufferClobber+ +instance Deserialize PbufferClobber where+        deserialize+          = do skip 1+               skip 1+               skip 2+               event_type <- deserialize+               draw_type <- deserialize+               drawable <- deserialize+               b_mask <- deserialize+               aux_buffer <- deserialize+               x <- deserialize+               y <- deserialize+               width <- deserialize+               height <- deserialize+               count <- deserialize+               skip 4+               return+                 (MkPbufferClobber event_type draw_type drawable b_mask aux_buffer x+                    y+                    width+                    height+                    count)+ +data PBCET = PBCETDamaged+           | PBCETSaved+ +instance SimpleEnum PBCET where+        toValue PBCETDamaged{} = 32791+        toValue PBCETSaved{} = 32792+        fromValue 32791 = PBCETDamaged+        fromValue 32792 = PBCETSaved+ +data PBCDT = PBCDTWindow+           | PBCDTPbuffer+ +instance SimpleEnum PBCDT where+        toValue PBCDTWindow{} = 32793+        toValue PBCDTPbuffer{} = 32794+        fromValue 32793 = PBCDTWindow+        fromValue 32794 = PBCDTPbuffer+ +data Render = MkRender{context_tag_Render :: CONTEXT_TAG,+                       data_Render :: [BYTE]}+            deriving (Show, Typeable)+ +instance ExtensionRequest Render where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__+                     = 4 + size (context_tag_Render x) + sum (map size (data_Render x))+               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]}+                 deriving (Show, Typeable)+ +instance ExtensionRequest RenderLarge where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__+                     = 4 + size (context_tag_RenderLarge x) ++                         size (request_num_RenderLarge x)+                         + size (request_total_RenderLarge x)+                         + size (data_len_RenderLarge x)+                         + sum (map size (data_RenderLarge x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_RenderLarge x)+               serialize (request_num_RenderLarge x)+               serialize (request_total_RenderLarge x)+               serialize (data_len_RenderLarge x)+               serializeList (data_RenderLarge x)+               putSkip (requiredPadding size__)+ +data CreateContext = MkCreateContext{context_CreateContext ::+                                     Graphics.XHB.Gen.Glx.Types.CONTEXT,+                                     visual_CreateContext :: VISUALID,+                                     screen_CreateContext :: CARD32,+                                     share_list_CreateContext :: Graphics.XHB.Gen.Glx.Types.CONTEXT,+                                     is_direct_CreateContext :: BOOL}+                   deriving (Show, Typeable)+ +instance ExtensionRequest CreateContext where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (context_CreateContext x) ++                         size (visual_CreateContext x)+                         + size (screen_CreateContext x)+                         + size (share_list_CreateContext x)+                         + size (is_direct_CreateContext x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_CreateContext x)+               serialize (visual_CreateContext x)+               serialize (screen_CreateContext x)+               serialize (share_list_CreateContext x)+               serialize (is_direct_CreateContext x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data DestroyContext = MkDestroyContext{context_DestroyContext ::+                                       Graphics.XHB.Gen.Glx.Types.CONTEXT}+                    deriving (Show, Typeable)+ +instance ExtensionRequest DestroyContext where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__ = 4 + size (context_DestroyContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_DestroyContext x)+               putSkip (requiredPadding size__)+ +data MakeCurrent = MkMakeCurrent{drawable_MakeCurrent ::+                                 Graphics.XHB.Gen.Glx.Types.DRAWABLE,+                                 context_MakeCurrent :: Graphics.XHB.Gen.Glx.Types.CONTEXT,+                                 old_context_tag_MakeCurrent :: CONTEXT_TAG}+                 deriving (Show, Typeable)+ +instance ExtensionRequest MakeCurrent where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__+                     = 4 + size (drawable_MakeCurrent x) + size (context_MakeCurrent x)+                         + size (old_context_tag_MakeCurrent x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (drawable_MakeCurrent x)+               serialize (context_MakeCurrent x)+               serialize (old_context_tag_MakeCurrent x)+               putSkip (requiredPadding size__)+ +data MakeCurrentReply = MkMakeCurrentReply{context_tag_MakeCurrentReply+                                           :: CONTEXT_TAG}+                      deriving (Show, Typeable)+ +instance Deserialize MakeCurrentReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_tag <- deserialize+               skip 20+               let _ = isCard32 length+               return (MkMakeCurrentReply context_tag)+ +data IsDirect = MkIsDirect{context_IsDirect ::+                           Graphics.XHB.Gen.Glx.Types.CONTEXT}+              deriving (Show, Typeable)+ +instance ExtensionRequest IsDirect where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__ = 4 + size (context_IsDirect x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_IsDirect x)+               putSkip (requiredPadding size__)+ +data IsDirectReply = MkIsDirectReply{is_direct_IsDirectReply ::+                                     BOOL}+                   deriving (Show, Typeable)+ +instance Deserialize IsDirectReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               is_direct <- deserialize+               skip 23+               let _ = isCard32 length+               return (MkIsDirectReply is_direct)+ +data QueryVersion = MkQueryVersion{major_version_QueryVersion ::+                                   CARD32,+                                   minor_version_QueryVersion :: CARD32}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__+                     = 4 + size (major_version_QueryVersion x) ++                         size (minor_version_QueryVersion x)+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major_version <- deserialize+               minor_version <- deserialize+               skip 16+               let _ = isCard32 length+               return (MkQueryVersionReply major_version minor_version)+ +data WaitGL = MkWaitGL{context_tag_WaitGL :: CONTEXT_TAG}+            deriving (Show, Typeable)+ +instance ExtensionRequest WaitGL where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__ = 4 + size (context_tag_WaitGL x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_WaitGL x)+               putSkip (requiredPadding size__)+ +data WaitX = MkWaitX{context_tag_WaitX :: CONTEXT_TAG}+           deriving (Show, Typeable)+ +instance ExtensionRequest WaitX where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 9+               let size__ = 4 + size (context_tag_WaitX x)+               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,+                                 src_context_tag_CopyContext :: CONTEXT_TAG}+                 deriving (Show, Typeable)+ +instance ExtensionRequest CopyContext where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 10+               let size__+                     = 4 + size (src_CopyContext x) + size (dest_CopyContext x) ++                         size (mask_CopyContext x)+                         + size (src_context_tag_CopyContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (src_CopyContext x)+               serialize (dest_CopyContext x)+               serialize (mask_CopyContext x)+               serialize (src_context_tag_CopyContext x)+               putSkip (requiredPadding size__)+ +data GC = GCGL_CURRENT_BIT+        | GCGL_POINT_BIT+        | GCGL_LINE_BIT+        | GCGL_POLYGON_BIT+        | GCGL_POLYGON_STIPPLE_BIT+        | GCGL_PIXEL_MODE_BIT+        | GCGL_LIGHTING_BIT+        | GCGL_FOG_BIT+        | GCGL_DEPTH_BUFFER_BIT+        | GCGL_ACCUM_BUFFER_BIT+        | GCGL_STENCIL_BUFFER_BIT+        | GCGL_VIEWPORT_BIT+        | GCGL_TRANSFORM_BIT+        | GCGL_ENABLE_BIT+        | GCGL_COLOR_BUFFER_BIT+        | GCGL_HINT_BIT+        | GCGL_EVAL_BIT+        | GCGL_LIST_BIT+        | GCGL_TEXTURE_BIT+        | GCGL_SCISSOR_BIT+ +instance BitEnum GC where+        toBit GCGL_CURRENT_BIT{} = 0+        toBit GCGL_POINT_BIT{} = 1+        toBit GCGL_LINE_BIT{} = 2+        toBit GCGL_POLYGON_BIT{} = 3+        toBit GCGL_POLYGON_STIPPLE_BIT{} = 4+        toBit GCGL_PIXEL_MODE_BIT{} = 5+        toBit GCGL_LIGHTING_BIT{} = 6+        toBit GCGL_FOG_BIT{} = 7+        toBit GCGL_DEPTH_BUFFER_BIT{} = 8+        toBit GCGL_ACCUM_BUFFER_BIT{} = 9+        toBit GCGL_STENCIL_BUFFER_BIT{} = 10+        toBit GCGL_VIEWPORT_BIT{} = 11+        toBit GCGL_TRANSFORM_BIT{} = 12+        toBit GCGL_ENABLE_BIT{} = 13+        toBit GCGL_COLOR_BUFFER_BIT{} = 14+        toBit GCGL_HINT_BIT{} = 15+        toBit GCGL_EVAL_BIT{} = 16+        toBit GCGL_LIST_BIT{} = 17+        toBit GCGL_TEXTURE_BIT{} = 18+        toBit GCGL_SCISSOR_BIT{} = 19+        fromBit 0 = GCGL_CURRENT_BIT+        fromBit 1 = GCGL_POINT_BIT+        fromBit 2 = GCGL_LINE_BIT+        fromBit 3 = GCGL_POLYGON_BIT+        fromBit 4 = GCGL_POLYGON_STIPPLE_BIT+        fromBit 5 = GCGL_PIXEL_MODE_BIT+        fromBit 6 = GCGL_LIGHTING_BIT+        fromBit 7 = GCGL_FOG_BIT+        fromBit 8 = GCGL_DEPTH_BUFFER_BIT+        fromBit 9 = GCGL_ACCUM_BUFFER_BIT+        fromBit 10 = GCGL_STENCIL_BUFFER_BIT+        fromBit 11 = GCGL_VIEWPORT_BIT+        fromBit 12 = GCGL_TRANSFORM_BIT+        fromBit 13 = GCGL_ENABLE_BIT+        fromBit 14 = GCGL_COLOR_BUFFER_BIT+        fromBit 15 = GCGL_HINT_BIT+        fromBit 16 = GCGL_EVAL_BIT+        fromBit 17 = GCGL_LIST_BIT+        fromBit 18 = GCGL_TEXTURE_BIT+        fromBit 19 = GCGL_SCISSOR_BIT+ +data SwapBuffers = MkSwapBuffers{context_tag_SwapBuffers ::+                                 CONTEXT_TAG,+                                 drawable_SwapBuffers :: Graphics.XHB.Gen.Glx.Types.DRAWABLE}+                 deriving (Show, Typeable)+ +instance ExtensionRequest SwapBuffers where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 11+               let size__+                     = 4 + size (context_tag_SwapBuffers x) ++                         size (drawable_SwapBuffers x)+               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}+              deriving (Show, Typeable)+ +instance ExtensionRequest UseXFont where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 12+               let size__+                     = 4 + size (context_tag_UseXFont x) + size (font_UseXFont x) ++                         size (first_UseXFont x)+                         + size (count_UseXFont x)+                         + size (list_base_UseXFont x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_UseXFont x)+               serialize (font_UseXFont x)+               serialize (first_UseXFont x)+               serialize (count_UseXFont x)+               serialize (list_base_UseXFont x)+               putSkip (requiredPadding size__)+ +data CreateGLXPixmap = MkCreateGLXPixmap{screen_CreateGLXPixmap ::+                                         CARD32,+                                         visual_CreateGLXPixmap :: VISUALID,+                                         pixmap_CreateGLXPixmap ::+                                         Graphics.XHB.Gen.Xproto.Types.PIXMAP,+                                         glx_pixmap_CreateGLXPixmap ::+                                         Graphics.XHB.Gen.Glx.Types.PIXMAP}+                     deriving (Show, Typeable)+ +instance ExtensionRequest CreateGLXPixmap where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 13+               let size__+                     = 4 + size (screen_CreateGLXPixmap x) ++                         size (visual_CreateGLXPixmap x)+                         + size (pixmap_CreateGLXPixmap x)+                         + size (glx_pixmap_CreateGLXPixmap x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_CreateGLXPixmap x)+               serialize (visual_CreateGLXPixmap x)+               serialize (pixmap_CreateGLXPixmap x)+               serialize (glx_pixmap_CreateGLXPixmap x)+               putSkip (requiredPadding size__)+ +data GetVisualConfigs = MkGetVisualConfigs{screen_GetVisualConfigs+                                           :: CARD32}+                      deriving (Show, Typeable)+ +instance ExtensionRequest GetVisualConfigs where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 14+               let size__ = 4 + size (screen_GetVisualConfigs x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_GetVisualConfigs x)+               putSkip (requiredPadding size__)+ +data GetVisualConfigsReply = MkGetVisualConfigsReply{num_visuals_GetVisualConfigsReply+                                                     :: CARD32,+                                                     num_properties_GetVisualConfigsReply :: CARD32,+                                                     property_list_GetVisualConfigsReply ::+                                                     [CARD32]}+                           deriving (Show, Typeable)+ +instance Deserialize GetVisualConfigsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_visuals <- deserialize+               num_properties <- deserialize+               skip 16+               property_list <- deserializeList (fromIntegral length)+               let _ = isCard32 length+               return+                 (MkGetVisualConfigsReply num_visuals num_properties property_list)+ +data DestroyGLXPixmap = MkDestroyGLXPixmap{glx_pixmap_DestroyGLXPixmap+                                           :: Graphics.XHB.Gen.Glx.Types.PIXMAP}+                      deriving (Show, Typeable)+ +instance ExtensionRequest DestroyGLXPixmap where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 15+               let size__ = 4 + size (glx_pixmap_DestroyGLXPixmap x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (glx_pixmap_DestroyGLXPixmap x)+               putSkip (requiredPadding size__)+ +data VendorPrivate = MkVendorPrivate{vendor_code_VendorPrivate ::+                                     CARD32,+                                     context_tag_VendorPrivate :: CONTEXT_TAG,+                                     data_VendorPrivate :: [BYTE]}+                   deriving (Show, Typeable)+ +instance ExtensionRequest VendorPrivate where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 16+               let size__+                     = 4 + size (vendor_code_VendorPrivate x) ++                         size (context_tag_VendorPrivate x)+                         + sum (map size (data_VendorPrivate x))+               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,+                                                       context_tag_VendorPrivateWithReply ::+                                                       CONTEXT_TAG,+                                                       data_VendorPrivateWithReply :: [BYTE]}+                            deriving (Show, Typeable)+ +instance ExtensionRequest VendorPrivateWithReply where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 17+               let size__+                     = 4 + size (vendor_code_VendorPrivateWithReply x) ++                         size (context_tag_VendorPrivateWithReply x)+                         + sum (map size (data_VendorPrivateWithReply x))+               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,+                                                                 data1_VendorPrivateWithReplyReply+                                                                 :: [BYTE],+                                                                 data2_VendorPrivateWithReplyReply+                                                                 :: [BYTE]}+                                 deriving (Show, Typeable)+ +instance Deserialize VendorPrivateWithReplyReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               retval <- deserialize+               data1 <- deserializeList (fromIntegral 24)+               data2 <- deserializeList (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return (MkVendorPrivateWithReplyReply retval data1 data2)+ +data QueryExtensionsString = MkQueryExtensionsString{screen_QueryExtensionsString+                                                     :: CARD32}+                           deriving (Show, Typeable)+ +instance ExtensionRequest QueryExtensionsString where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 18+               let size__ = 4 + size (screen_QueryExtensionsString x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_QueryExtensionsString x)+               putSkip (requiredPadding size__)+ +data QueryExtensionsStringReply = MkQueryExtensionsStringReply{n_QueryExtensionsStringReply+                                                               :: CARD32}+                                deriving (Show, Typeable)+ +instance Deserialize QueryExtensionsStringReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               skip 16+               let _ = isCard32 length+               return (MkQueryExtensionsStringReply n)+ +data QueryServerString = MkQueryServerString{screen_QueryServerString+                                             :: CARD32,+                                             name_QueryServerString :: CARD32}+                       deriving (Show, Typeable)+ +instance ExtensionRequest QueryServerString where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 19+               let size__+                     = 4 + size (screen_QueryServerString x) ++                         size (name_QueryServerString x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_QueryServerString x)+               serialize (name_QueryServerString x)+               putSkip (requiredPadding size__)+ +data QueryServerStringReply = MkQueryServerStringReply{str_len_QueryServerStringReply+                                                       :: CARD32,+                                                       string_QueryServerStringReply :: [CChar]}+                            deriving (Show, Typeable)+ +instance Deserialize QueryServerStringReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               str_len <- deserialize+               skip 16+               string <- deserializeList (fromIntegral str_len)+               let _ = isCard32 length+               return (MkQueryServerStringReply str_len string)+ +data ClientInfo = MkClientInfo{major_version_ClientInfo :: CARD32,+                               minor_version_ClientInfo :: CARD32, str_len_ClientInfo :: CARD32,+                               string_ClientInfo :: [CChar]}+                deriving (Show, Typeable)+ +instance ExtensionRequest ClientInfo where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 20+               let size__+                     = 4 + size (major_version_ClientInfo x) ++                         size (minor_version_ClientInfo x)+                         + size (str_len_ClientInfo x)+                         + sum (map size (string_ClientInfo x))+               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}+                  deriving (Show, Typeable)+ +instance ExtensionRequest GetFBConfigs where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 21+               let size__ = 4 + size (screen_GetFBConfigs x)+               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]}+                       deriving (Show, Typeable)+ +instance Deserialize GetFBConfigsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_FB_configs <- deserialize+               num_properties <- deserialize+               skip 16+               property_list <- deserializeList (fromIntegral length)+               let _ = isCard32 length+               return+                 (MkGetFBConfigsReply num_FB_configs num_properties property_list)+ +data CreatePixmap = MkCreatePixmap{screen_CreatePixmap :: CARD32,+                                   fbconfig_CreatePixmap :: CARD32,+                                   pixmap_CreatePixmap :: Graphics.XHB.Gen.Xproto.Types.PIXMAP,+                                   glx_pixmap_CreatePixmap :: Graphics.XHB.Gen.Glx.Types.PIXMAP,+                                   num_attribs_CreatePixmap :: CARD32,+                                   attribs_CreatePixmap :: [CARD32]}+                  deriving (Show, Typeable)+ +instance ExtensionRequest CreatePixmap where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 22+               let size__+                     = 4 + size (screen_CreatePixmap x) + size (fbconfig_CreatePixmap x)+                         + size (pixmap_CreatePixmap x)+                         + size (glx_pixmap_CreatePixmap x)+                         + size (num_attribs_CreatePixmap x)+                         + sum (map size (attribs_CreatePixmap x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_CreatePixmap x)+               serialize (fbconfig_CreatePixmap x)+               serialize (pixmap_CreatePixmap x)+               serialize (glx_pixmap_CreatePixmap x)+               serialize (num_attribs_CreatePixmap x)+               serializeList (attribs_CreatePixmap x)+               putSkip (requiredPadding size__)+ +data DestroyPixmap = MkDestroyPixmap{glx_pixmap_DestroyPixmap ::+                                     Graphics.XHB.Gen.Glx.Types.PIXMAP}+                   deriving (Show, Typeable)+ +instance ExtensionRequest DestroyPixmap where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 23+               let size__ = 4 + size (glx_pixmap_DestroyPixmap x)+               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}+                      deriving (Show, Typeable)+ +instance ExtensionRequest CreateNewContext where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 24+               let size__+                     = 4 + size (context_CreateNewContext x) ++                         size (fbconfig_CreateNewContext x)+                         + size (screen_CreateNewContext x)+                         + size (render_type_CreateNewContext x)+                         + size (share_list_CreateNewContext x)+                         + size (is_direct_CreateNewContext x)+                         + size (reserved1_CreateNewContext x)+                         + size (reserved2_CreateNewContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_CreateNewContext x)+               serialize (fbconfig_CreateNewContext x)+               serialize (screen_CreateNewContext x)+               serialize (render_type_CreateNewContext x)+               serialize (share_list_CreateNewContext x)+               serialize (is_direct_CreateNewContext x)+               serialize (reserved1_CreateNewContext x)+               serialize (reserved2_CreateNewContext x)+               putSkip (requiredPadding size__)+ +data QueryContext = MkQueryContext{context_QueryContext ::+                                   Graphics.XHB.Gen.Glx.Types.CONTEXT}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryContext where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 25+               let size__ = 4 + size (context_QueryContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_QueryContext x)+               putSkip (requiredPadding size__)+ +data QueryContextReply = MkQueryContextReply{num_attribs_QueryContextReply+                                             :: CARD32,+                                             attribs_QueryContextReply :: [CARD32]}+                       deriving (Show, Typeable)+ +instance Deserialize QueryContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_attribs <- deserialize+               skip 20+               attribs <- deserializeList+                            (fromIntegral (fromIntegral (num_attribs * 2)))+               let _ = isCard32 length+               return (MkQueryContextReply num_attribs attribs)+ +data MakeContextCurrent = MkMakeContextCurrent{old_context_tag_MakeContextCurrent+                                               :: CONTEXT_TAG,+                                               drawable_MakeContextCurrent ::+                                               Graphics.XHB.Gen.Glx.Types.DRAWABLE,+                                               read_drawable_MakeContextCurrent ::+                                               Graphics.XHB.Gen.Glx.Types.DRAWABLE,+                                               context_MakeContextCurrent ::+                                               Graphics.XHB.Gen.Glx.Types.CONTEXT}+                        deriving (Show, Typeable)+ +instance ExtensionRequest MakeContextCurrent where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 26+               let size__+                     = 4 + size (old_context_tag_MakeContextCurrent x) ++                         size (drawable_MakeContextCurrent x)+                         + size (read_drawable_MakeContextCurrent x)+                         + size (context_MakeContextCurrent x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (old_context_tag_MakeContextCurrent x)+               serialize (drawable_MakeContextCurrent x)+               serialize (read_drawable_MakeContextCurrent x)+               serialize (context_MakeContextCurrent x)+               putSkip (requiredPadding size__)+ +data MakeContextCurrentReply = MkMakeContextCurrentReply{context_tag_MakeContextCurrentReply+                                                         :: CONTEXT_TAG}+                             deriving (Show, Typeable)+ +instance Deserialize MakeContextCurrentReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_tag <- deserialize+               skip 20+               let _ = isCard32 length+               return (MkMakeContextCurrentReply context_tag)+ +data CreatePbuffer = MkCreatePbuffer{screen_CreatePbuffer ::+                                     CARD32,+                                     fbconfig_CreatePbuffer :: FBCONFIG,+                                     pbuffer_CreatePbuffer :: PBUFFER,+                                     num_attribs_CreatePbuffer :: CARD32,+                                     attribs_CreatePbuffer :: [CARD32]}+                   deriving (Show, Typeable)+ +instance ExtensionRequest CreatePbuffer where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 27+               let size__+                     = 4 + size (screen_CreatePbuffer x) ++                         size (fbconfig_CreatePbuffer x)+                         + size (pbuffer_CreatePbuffer x)+                         + size (num_attribs_CreatePbuffer x)+                         + sum (map size (attribs_CreatePbuffer x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_CreatePbuffer x)+               serialize (fbconfig_CreatePbuffer x)+               serialize (pbuffer_CreatePbuffer x)+               serialize (num_attribs_CreatePbuffer x)+               serializeList (attribs_CreatePbuffer x)+               putSkip (requiredPadding size__)+ +data DestroyPbuffer = MkDestroyPbuffer{pbuffer_DestroyPbuffer ::+                                       PBUFFER}+                    deriving (Show, Typeable)+ +instance ExtensionRequest DestroyPbuffer where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 28+               let size__ = 4 + size (pbuffer_DestroyPbuffer x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (pbuffer_DestroyPbuffer x)+               putSkip (requiredPadding size__)+ +data GetDrawableAttributes = MkGetDrawableAttributes{drawable_GetDrawableAttributes+                                                     :: Graphics.XHB.Gen.Glx.Types.DRAWABLE}+                           deriving (Show, Typeable)+ +instance ExtensionRequest GetDrawableAttributes where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 29+               let size__ = 4 + size (drawable_GetDrawableAttributes x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (drawable_GetDrawableAttributes x)+               putSkip (requiredPadding size__)+ +data GetDrawableAttributesReply = MkGetDrawableAttributesReply{num_attribs_GetDrawableAttributesReply+                                                               :: CARD32,+                                                               attribs_GetDrawableAttributesReply ::+                                                               [CARD32]}+                                deriving (Show, Typeable)+ +instance Deserialize GetDrawableAttributesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_attribs <- deserialize+               skip 20+               attribs <- deserializeList+                            (fromIntegral (fromIntegral (num_attribs * 2)))+               let _ = isCard32 length+               return (MkGetDrawableAttributesReply num_attribs attribs)+ +data ChangeDrawableAttributes = MkChangeDrawableAttributes{drawable_ChangeDrawableAttributes+                                                           :: Graphics.XHB.Gen.Glx.Types.DRAWABLE,+                                                           num_attribs_ChangeDrawableAttributes ::+                                                           CARD32,+                                                           attribs_ChangeDrawableAttributes ::+                                                           [CARD32]}+                              deriving (Show, Typeable)+ +instance ExtensionRequest ChangeDrawableAttributes where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 30+               let size__+                     = 4 + size (drawable_ChangeDrawableAttributes x) ++                         size (num_attribs_ChangeDrawableAttributes x)+                         + sum (map size (attribs_ChangeDrawableAttributes x))+               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,+                                   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]}+                  deriving (Show, Typeable)+ +instance ExtensionRequest CreateWindow where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 31+               let size__+                     = 4 + size (screen_CreateWindow x) + size (fbconfig_CreateWindow x)+                         + size (window_CreateWindow x)+                         + size (glx_window_CreateWindow x)+                         + size (num_attribs_CreateWindow x)+                         + sum (map size (attribs_CreateWindow x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_CreateWindow x)+               serialize (fbconfig_CreateWindow x)+               serialize (window_CreateWindow x)+               serialize (glx_window_CreateWindow x)+               serialize (num_attribs_CreateWindow x)+               serializeList (attribs_CreateWindow x)+               putSkip (requiredPadding size__)+ +data DeleteWindow = MkDeleteWindow{glxwindow_DeleteWindow ::+                                   Graphics.XHB.Gen.Glx.Types.WINDOW}+                  deriving (Show, Typeable)+ +instance ExtensionRequest DeleteWindow where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 32+               let size__ = 4 + size (glxwindow_DeleteWindow x)+               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}+             deriving (Show, Typeable)+ +instance ExtensionRequest NewList where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 101+               let size__+                     = 4 + size (context_tag_NewList x) + size (list_NewList x) ++                         size (mode_NewList x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_NewList x)+               serialize (list_NewList x)+               serialize (mode_NewList x)+               putSkip (requiredPadding size__)+ +data EndList = MkEndList{context_tag_EndList :: CONTEXT_TAG}+             deriving (Show, Typeable)+ +instance ExtensionRequest EndList where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 102+               let size__ = 4 + size (context_tag_EndList x)+               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}+                 deriving (Show, Typeable)+ +instance ExtensionRequest DeleteLists where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 103+               let size__+                     = 4 + size (context_tag_DeleteLists x) + size (list_DeleteLists x)+                         + size (range_DeleteLists x)+               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}+              deriving (Show, Typeable)+ +instance ExtensionRequest GenLists where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 104+               let size__+                     = 4 + size (context_tag_GenLists x) + size (range_GenLists x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GenLists x)+               serialize (range_GenLists x)+               putSkip (requiredPadding size__)+ +data GenListsReply = MkGenListsReply{ret_val_GenListsReply ::+                                     CARD32}+                   deriving (Show, Typeable)+ +instance Deserialize GenListsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               ret_val <- deserialize+               let _ = isCard32 length+               return (MkGenListsReply ret_val)+ +data FeedbackBuffer = MkFeedbackBuffer{context_tag_FeedbackBuffer+                                       :: CONTEXT_TAG,+                                       size_FeedbackBuffer :: INT32, type_FeedbackBuffer :: INT32}+                    deriving (Show, Typeable)+ +instance ExtensionRequest FeedbackBuffer where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 105+               let size__+                     = 4 + size (context_tag_FeedbackBuffer x) ++                         size (size_FeedbackBuffer x)+                         + size (type_FeedbackBuffer x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_FeedbackBuffer x)+               serialize (size_FeedbackBuffer x)+               serialize (type_FeedbackBuffer x)+               putSkip (requiredPadding size__)+ +data SelectBuffer = MkSelectBuffer{context_tag_SelectBuffer ::+                                   CONTEXT_TAG,+                                   size_SelectBuffer :: INT32}+                  deriving (Show, Typeable)+ +instance ExtensionRequest SelectBuffer where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 106+               let size__+                     = 4 + size (context_tag_SelectBuffer x) ++                         size (size_SelectBuffer x)+               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}+                deriving (Show, Typeable)+ +instance ExtensionRequest RenderMode where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 107+               let size__+                     = 4 + size (context_tag_RenderMode x) + size (mode_RenderMode x)+               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]}+                     deriving (Show, Typeable)+ +instance Deserialize RenderModeReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               ret_val <- deserialize+               n <- deserialize+               new_mode <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkRenderModeReply ret_val n new_mode data_)+ +data RM = RMGL_RENDER+        | RMGL_FEEDBACK+        | RMGL_SELECT+ +instance SimpleEnum RM where+        toValue RMGL_RENDER{} = 7168+        toValue RMGL_FEEDBACK{} = 7169+        toValue RMGL_SELECT{} = 7170+        fromValue 7168 = RMGL_RENDER+        fromValue 7169 = RMGL_FEEDBACK+        fromValue 7170 = RMGL_SELECT+ +data Finish = MkFinish{context_tag_Finish :: CONTEXT_TAG}+            deriving (Show, Typeable)+ +instance ExtensionRequest Finish where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 108+               let size__ = 4 + size (context_tag_Finish x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_Finish x)+               putSkip (requiredPadding size__)+ +data FinishReply = MkFinishReply{}+                 deriving (Show, Typeable)+ +instance Deserialize FinishReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               let _ = isCard32 length+               return (MkFinishReply)+ +data PixelStoref = MkPixelStoref{context_tag_PixelStoref ::+                                 CONTEXT_TAG,+                                 pname_PixelStoref :: CARD32, datum_PixelStoref :: FLOAT32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest PixelStoref where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 109+               let size__+                     = 4 + size (context_tag_PixelStoref x) + size (pname_PixelStoref x)+                         + size (datum_PixelStoref x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_PixelStoref x)+               serialize (pname_PixelStoref x)+               serialize (datum_PixelStoref x)+               putSkip (requiredPadding size__)+ +data PixelStorei = MkPixelStorei{context_tag_PixelStorei ::+                                 CONTEXT_TAG,+                                 pname_PixelStorei :: CARD32, datum_PixelStorei :: INT32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest PixelStorei where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 110+               let size__+                     = 4 + size (context_tag_PixelStorei x) + size (pname_PixelStorei x)+                         + size (datum_PixelStorei x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_PixelStorei x)+               serialize (pname_PixelStorei x)+               serialize (datum_PixelStorei x)+               putSkip (requiredPadding size__)+ +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}+                deriving (Show, Typeable)+ +instance ExtensionRequest ReadPixels where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 111+               let size__+                     = 4 + size (context_tag_ReadPixels x) + size (x_ReadPixels x) ++                         size (y_ReadPixels x)+                         + size (width_ReadPixels x)+                         + size (height_ReadPixels x)+                         + size (format_ReadPixels x)+                         + size (type_ReadPixels x)+                         + size (swap_bytes_ReadPixels x)+                         + size (lsb_first_ReadPixels x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_ReadPixels x)+               serialize (x_ReadPixels x)+               serialize (y_ReadPixels x)+               serialize (width_ReadPixels x)+               serialize (height_ReadPixels x)+               serialize (format_ReadPixels x)+               serialize (type_ReadPixels x)+               serialize (swap_bytes_ReadPixels x)+               serialize (lsb_first_ReadPixels x)+               putSkip (requiredPadding size__)+ +data ReadPixelsReply = MkReadPixelsReply{data_ReadPixelsReply ::+                                         [BYTE]}+                     deriving (Show, Typeable)+ +instance Deserialize ReadPixelsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 24+               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return (MkReadPixelsReply data_)+ +data GetBooleanv = MkGetBooleanv{context_tag_GetBooleanv ::+                                 CONTEXT_TAG,+                                 pname_GetBooleanv :: INT32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetBooleanv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 112+               let size__+                     = 4 + size (context_tag_GetBooleanv x) + size (pname_GetBooleanv x)+               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]}+                      deriving (Show, Typeable)+ +instance Deserialize GetBooleanvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 15+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetBooleanvReply n datum data_)+ +data GetClipPlane = MkGetClipPlane{context_tag_GetClipPlane ::+                                   CONTEXT_TAG,+                                   plane_GetClipPlane :: INT32}+                  deriving (Show, Typeable)+ +instance ExtensionRequest GetClipPlane where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 113+               let size__+                     = 4 + size (context_tag_GetClipPlane x) ++                         size (plane_GetClipPlane x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetClipPlane x)+               serialize (plane_GetClipPlane x)+               putSkip (requiredPadding size__)+ +data GetClipPlaneReply = MkGetClipPlaneReply{data_GetClipPlaneReply+                                             :: [FLOAT64]}+                       deriving (Show, Typeable)+ +instance Deserialize GetClipPlaneReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 24+               data_ <- deserializeList+                          (fromIntegral (fromIntegral (length `div` 2)))+               let _ = isCard32 length+               return (MkGetClipPlaneReply data_)+ +data GetDoublev = MkGetDoublev{context_tag_GetDoublev ::+                               CONTEXT_TAG,+                               pname_GetDoublev :: CARD32}+                deriving (Show, Typeable)+ +instance ExtensionRequest GetDoublev where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 114+               let size__+                     = 4 + size (context_tag_GetDoublev x) + size (pname_GetDoublev x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetDoublev x)+               serialize (pname_GetDoublev x)+               putSkip (requiredPadding size__)+ +data GetDoublevReply = MkGetDoublevReply{n_GetDoublevReply ::+                                         CARD32,+                                         datum_GetDoublevReply :: FLOAT64,+                                         data_GetDoublevReply :: [FLOAT64]}+                     deriving (Show, Typeable)+ +instance Deserialize GetDoublevReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 8+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetDoublevReply n datum data_)+ +data GetError = MkGetError{context_tag_GetError :: CONTEXT_TAG}+              deriving (Show, Typeable)+ +instance ExtensionRequest GetError where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 115+               let size__ = 4 + size (context_tag_GetError x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetError x)+               putSkip (requiredPadding size__)+ +data GetErrorReply = MkGetErrorReply{error_GetErrorReply :: INT32}+                   deriving (Show, Typeable)+ +instance Deserialize GetErrorReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               error <- deserialize+               let _ = isCard32 length+               return (MkGetErrorReply error)+ +data GetFloatv = MkGetFloatv{context_tag_GetFloatv :: CONTEXT_TAG,+                             pname_GetFloatv :: CARD32}+               deriving (Show, Typeable)+ +instance ExtensionRequest GetFloatv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 116+               let size__+                     = 4 + size (context_tag_GetFloatv x) + size (pname_GetFloatv x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetFloatv x)+               serialize (pname_GetFloatv x)+               putSkip (requiredPadding size__)+ +data GetFloatvReply = MkGetFloatvReply{n_GetFloatvReply :: CARD32,+                                       datum_GetFloatvReply :: FLOAT32,+                                       data_GetFloatvReply :: [FLOAT32]}+                    deriving (Show, Typeable)+ +instance Deserialize GetFloatvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetFloatvReply n datum data_)+ +data GetIntegerv = MkGetIntegerv{context_tag_GetIntegerv ::+                                 CONTEXT_TAG,+                                 pname_GetIntegerv :: CARD32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetIntegerv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 117+               let size__+                     = 4 + size (context_tag_GetIntegerv x) + size (pname_GetIntegerv x)+               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]}+                      deriving (Show, Typeable)+ +instance Deserialize GetIntegervReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetIntegervReply n datum data_)+ +data GetLightfv = MkGetLightfv{context_tag_GetLightfv ::+                               CONTEXT_TAG,+                               light_GetLightfv :: CARD32, pname_GetLightfv :: CARD32}+                deriving (Show, Typeable)+ +instance ExtensionRequest GetLightfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 118+               let size__+                     = 4 + size (context_tag_GetLightfv x) + size (light_GetLightfv x) ++                         size (pname_GetLightfv x)+               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,+                                         datum_GetLightfvReply :: FLOAT32,+                                         data_GetLightfvReply :: [FLOAT32]}+                     deriving (Show, Typeable)+ +instance Deserialize GetLightfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetLightfvReply n datum data_)+ +data GetLightiv = MkGetLightiv{context_tag_GetLightiv ::+                               CONTEXT_TAG,+                               light_GetLightiv :: CARD32, pname_GetLightiv :: CARD32}+                deriving (Show, Typeable)+ +instance ExtensionRequest GetLightiv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 119+               let size__+                     = 4 + size (context_tag_GetLightiv x) + size (light_GetLightiv x) ++                         size (pname_GetLightiv x)+               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]}+                     deriving (Show, Typeable)+ +instance Deserialize GetLightivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetLightivReply n datum data_)+ +data GetMapdv = MkGetMapdv{context_tag_GetMapdv :: CONTEXT_TAG,+                           target_GetMapdv :: CARD32, query_GetMapdv :: CARD32}+              deriving (Show, Typeable)+ +instance ExtensionRequest GetMapdv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 120+               let size__+                     = 4 + size (context_tag_GetMapdv x) + size (target_GetMapdv x) ++                         size (query_GetMapdv x)+               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,+                                     datum_GetMapdvReply :: FLOAT64,+                                     data_GetMapdvReply :: [FLOAT64]}+                   deriving (Show, Typeable)+ +instance Deserialize GetMapdvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 8+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetMapdvReply n datum data_)+ +data GetMapfv = MkGetMapfv{context_tag_GetMapfv :: CONTEXT_TAG,+                           target_GetMapfv :: CARD32, query_GetMapfv :: CARD32}+              deriving (Show, Typeable)+ +instance ExtensionRequest GetMapfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 121+               let size__+                     = 4 + size (context_tag_GetMapfv x) + size (target_GetMapfv x) ++                         size (query_GetMapfv x)+               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,+                                     datum_GetMapfvReply :: FLOAT32,+                                     data_GetMapfvReply :: [FLOAT32]}+                   deriving (Show, Typeable)+ +instance Deserialize GetMapfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetMapfvReply n datum data_)+ +data GetMapiv = MkGetMapiv{context_tag_GetMapiv :: CONTEXT_TAG,+                           target_GetMapiv :: CARD32, query_GetMapiv :: CARD32}+              deriving (Show, Typeable)+ +instance ExtensionRequest GetMapiv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 122+               let size__+                     = 4 + size (context_tag_GetMapiv x) + size (target_GetMapiv x) ++                         size (query_GetMapiv x)+               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]}+                   deriving (Show, Typeable)+ +instance Deserialize GetMapivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetMapivReply n datum data_)+ +data GetMaterialfv = MkGetMaterialfv{context_tag_GetMaterialfv ::+                                     CONTEXT_TAG,+                                     face_GetMaterialfv :: CARD32, pname_GetMaterialfv :: CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GetMaterialfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 123+               let size__+                     = 4 + size (context_tag_GetMaterialfv x) ++                         size (face_GetMaterialfv x)+                         + size (pname_GetMaterialfv x)+               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,+                                               datum_GetMaterialfvReply :: FLOAT32,+                                               data_GetMaterialfvReply :: [FLOAT32]}+                        deriving (Show, Typeable)+ +instance Deserialize GetMaterialfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetMaterialfvReply n datum data_)+ +data GetMaterialiv = MkGetMaterialiv{context_tag_GetMaterialiv ::+                                     CONTEXT_TAG,+                                     face_GetMaterialiv :: CARD32, pname_GetMaterialiv :: CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GetMaterialiv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 124+               let size__+                     = 4 + size (context_tag_GetMaterialiv x) ++                         size (face_GetMaterialiv x)+                         + size (pname_GetMaterialiv x)+               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]}+                        deriving (Show, Typeable)+ +instance Deserialize GetMaterialivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetMaterialivReply n datum data_)+ +data GetPixelMapfv = MkGetPixelMapfv{context_tag_GetPixelMapfv ::+                                     CONTEXT_TAG,+                                     map_GetPixelMapfv :: CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GetPixelMapfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 125+               let size__+                     = 4 + size (context_tag_GetPixelMapfv x) ++                         size (map_GetPixelMapfv x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetPixelMapfv x)+               serialize (map_GetPixelMapfv x)+               putSkip (requiredPadding size__)+ +data GetPixelMapfvReply = MkGetPixelMapfvReply{n_GetPixelMapfvReply+                                               :: CARD32,+                                               datum_GetPixelMapfvReply :: FLOAT32,+                                               data_GetPixelMapfvReply :: [FLOAT32]}+                        deriving (Show, Typeable)+ +instance Deserialize GetPixelMapfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetPixelMapfvReply n datum data_)+ +data GetPixelMapuiv = MkGetPixelMapuiv{context_tag_GetPixelMapuiv+                                       :: CONTEXT_TAG,+                                       map_GetPixelMapuiv :: CARD32}+                    deriving (Show, Typeable)+ +instance ExtensionRequest GetPixelMapuiv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 126+               let size__+                     = 4 + size (context_tag_GetPixelMapuiv x) ++                         size (map_GetPixelMapuiv x)+               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]}+                         deriving (Show, Typeable)+ +instance Deserialize GetPixelMapuivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetPixelMapuivReply n datum data_)+ +data GetPixelMapusv = MkGetPixelMapusv{context_tag_GetPixelMapusv+                                       :: CONTEXT_TAG,+                                       map_GetPixelMapusv :: CARD32}+                    deriving (Show, Typeable)+ +instance ExtensionRequest GetPixelMapusv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 127+               let size__+                     = 4 + size (context_tag_GetPixelMapusv x) ++                         size (map_GetPixelMapusv x)+               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]}+                         deriving (Show, Typeable)+ +instance Deserialize GetPixelMapusvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 16+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetPixelMapusvReply n datum data_)+ +data GetPolygonStipple = MkGetPolygonStipple{context_tag_GetPolygonStipple+                                             :: CONTEXT_TAG,+                                             lsb_first_GetPolygonStipple :: BOOL}+                       deriving (Show, Typeable)+ +instance ExtensionRequest GetPolygonStipple where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 128+               let size__+                     = 4 + size (context_tag_GetPolygonStipple x) ++                         size (lsb_first_GetPolygonStipple x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetPolygonStipple x)+               serialize (lsb_first_GetPolygonStipple x)+               putSkip (requiredPadding size__)+ +data GetPolygonStippleReply = MkGetPolygonStippleReply{data_GetPolygonStippleReply+                                                       :: [BYTE]}+                            deriving (Show, Typeable)+ +instance Deserialize GetPolygonStippleReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 24+               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return (MkGetPolygonStippleReply data_)+ +data GetString = MkGetString{context_tag_GetString :: CONTEXT_TAG,+                             name_GetString :: CARD32}+               deriving (Show, Typeable)+ +instance ExtensionRequest GetString where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 129+               let size__+                     = 4 + size (context_tag_GetString x) + size (name_GetString x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetString x)+               serialize (name_GetString x)+               putSkip (requiredPadding size__)+ +data GetStringReply = MkGetStringReply{n_GetStringReply :: CARD32,+                                       string_GetStringReply :: [CChar]}+                    deriving (Show, Typeable)+ +instance Deserialize GetStringReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               skip 16+               string <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetStringReply n string)+ +data GetTexEnvfv = MkGetTexEnvfv{context_tag_GetTexEnvfv ::+                                 CONTEXT_TAG,+                                 target_GetTexEnvfv :: CARD32, pname_GetTexEnvfv :: CARD32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetTexEnvfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 130+               let size__+                     = 4 + size (context_tag_GetTexEnvfv x) ++                         size (target_GetTexEnvfv x)+                         + size (pname_GetTexEnvfv x)+               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,+                                           datum_GetTexEnvfvReply :: FLOAT32,+                                           data_GetTexEnvfvReply :: [FLOAT32]}+                      deriving (Show, Typeable)+ +instance Deserialize GetTexEnvfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetTexEnvfvReply n datum data_)+ +data GetTexEnviv = MkGetTexEnviv{context_tag_GetTexEnviv ::+                                 CONTEXT_TAG,+                                 target_GetTexEnviv :: CARD32, pname_GetTexEnviv :: CARD32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetTexEnviv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 131+               let size__+                     = 4 + size (context_tag_GetTexEnviv x) ++                         size (target_GetTexEnviv x)+                         + size (pname_GetTexEnviv x)+               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]}+                      deriving (Show, Typeable)+ +instance Deserialize GetTexEnvivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetTexEnvivReply n datum data_)+ +data GetTexGendv = MkGetTexGendv{context_tag_GetTexGendv ::+                                 CONTEXT_TAG,+                                 coord_GetTexGendv :: CARD32, pname_GetTexGendv :: CARD32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetTexGendv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 132+               let size__+                     = 4 + size (context_tag_GetTexGendv x) + size (coord_GetTexGendv x)+                         + size (pname_GetTexGendv x)+               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,+                                           datum_GetTexGendvReply :: FLOAT64,+                                           data_GetTexGendvReply :: [FLOAT64]}+                      deriving (Show, Typeable)+ +instance Deserialize GetTexGendvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 8+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetTexGendvReply n datum data_)+ +data GetTexGenfv = MkGetTexGenfv{context_tag_GetTexGenfv ::+                                 CONTEXT_TAG,+                                 coord_GetTexGenfv :: CARD32, pname_GetTexGenfv :: CARD32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetTexGenfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 133+               let size__+                     = 4 + size (context_tag_GetTexGenfv x) + size (coord_GetTexGenfv x)+                         + size (pname_GetTexGenfv x)+               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,+                                           datum_GetTexGenfvReply :: FLOAT32,+                                           data_GetTexGenfvReply :: [FLOAT32]}+                      deriving (Show, Typeable)+ +instance Deserialize GetTexGenfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetTexGenfvReply n datum data_)+ +data GetTexGeniv = MkGetTexGeniv{context_tag_GetTexGeniv ::+                                 CONTEXT_TAG,+                                 coord_GetTexGeniv :: CARD32, pname_GetTexGeniv :: CARD32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetTexGeniv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 134+               let size__+                     = 4 + size (context_tag_GetTexGeniv x) + size (coord_GetTexGeniv x)+                         + size (pname_GetTexGeniv x)+               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]}+                      deriving (Show, Typeable)+ +instance Deserialize GetTexGenivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetTexGenivReply n datum data_)+ +data GetTexImage = MkGetTexImage{context_tag_GetTexImage ::+                                 CONTEXT_TAG,+                                 target_GetTexImage :: CARD32, level_GetTexImage :: INT32,+                                 format_GetTexImage :: CARD32, type_GetTexImage :: CARD32,+                                 swap_bytes_GetTexImage :: BOOL}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetTexImage where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 135+               let size__+                     = 4 + size (context_tag_GetTexImage x) ++                         size (target_GetTexImage x)+                         + size (level_GetTexImage x)+                         + size (format_GetTexImage x)+                         + size (type_GetTexImage x)+                         + size (swap_bytes_GetTexImage x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetTexImage x)+               serialize (target_GetTexImage x)+               serialize (level_GetTexImage x)+               serialize (format_GetTexImage x)+               serialize (type_GetTexImage x)+               serialize (swap_bytes_GetTexImage x)+               putSkip (requiredPadding size__)+ +data GetTexImageReply = MkGetTexImageReply{width_GetTexImageReply+                                           :: INT32,+                                           height_GetTexImageReply :: INT32,+                                           depth_GetTexImageReply :: INT32,+                                           data_GetTexImageReply :: [BYTE]}+                      deriving (Show, Typeable)+ +instance Deserialize GetTexImageReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 8+               width <- deserialize+               height <- deserialize+               depth <- deserialize+               skip 4+               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return (MkGetTexImageReply width height depth data_)+ +data GetTexParameterfv = MkGetTexParameterfv{context_tag_GetTexParameterfv+                                             :: CONTEXT_TAG,+                                             target_GetTexParameterfv :: CARD32,+                                             pname_GetTexParameterfv :: CARD32}+                       deriving (Show, Typeable)+ +instance ExtensionRequest GetTexParameterfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 136+               let size__+                     = 4 + size (context_tag_GetTexParameterfv x) ++                         size (target_GetTexParameterfv x)+                         + size (pname_GetTexParameterfv x)+               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,+                                                       datum_GetTexParameterfvReply :: FLOAT32,+                                                       data_GetTexParameterfvReply :: [FLOAT32]}+                            deriving (Show, Typeable)+ +instance Deserialize GetTexParameterfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetTexParameterfvReply n datum data_)+ +data GetTexParameteriv = MkGetTexParameteriv{context_tag_GetTexParameteriv+                                             :: CONTEXT_TAG,+                                             target_GetTexParameteriv :: CARD32,+                                             pname_GetTexParameteriv :: CARD32}+                       deriving (Show, Typeable)+ +instance ExtensionRequest GetTexParameteriv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 137+               let size__+                     = 4 + size (context_tag_GetTexParameteriv x) ++                         size (target_GetTexParameteriv x)+                         + size (pname_GetTexParameteriv x)+               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]}+                            deriving (Show, Typeable)+ +instance Deserialize GetTexParameterivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetTexParameterivReply n datum data_)+ +data GetTexLevelParameterfv = MkGetTexLevelParameterfv{context_tag_GetTexLevelParameterfv+                                                       :: CONTEXT_TAG,+                                                       target_GetTexLevelParameterfv :: CARD32,+                                                       level_GetTexLevelParameterfv :: INT32,+                                                       pname_GetTexLevelParameterfv :: CARD32}+                            deriving (Show, Typeable)+ +instance ExtensionRequest GetTexLevelParameterfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 138+               let size__+                     = 4 + size (context_tag_GetTexLevelParameterfv x) ++                         size (target_GetTexLevelParameterfv x)+                         + size (level_GetTexLevelParameterfv x)+                         + size (pname_GetTexLevelParameterfv x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetTexLevelParameterfv x)+               serialize (target_GetTexLevelParameterfv x)+               serialize (level_GetTexLevelParameterfv x)+               serialize (pname_GetTexLevelParameterfv x)+               putSkip (requiredPadding size__)+ +data GetTexLevelParameterfvReply = MkGetTexLevelParameterfvReply{n_GetTexLevelParameterfvReply+                                                                 :: CARD32,+                                                                 datum_GetTexLevelParameterfvReply+                                                                 :: FLOAT32,+                                                                 data_GetTexLevelParameterfvReply ::+                                                                 [FLOAT32]}+                                 deriving (Show, Typeable)+ +instance Deserialize GetTexLevelParameterfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetTexLevelParameterfvReply n datum data_)+ +data GetTexLevelParameteriv = MkGetTexLevelParameteriv{context_tag_GetTexLevelParameteriv+                                                       :: CONTEXT_TAG,+                                                       target_GetTexLevelParameteriv :: CARD32,+                                                       level_GetTexLevelParameteriv :: INT32,+                                                       pname_GetTexLevelParameteriv :: CARD32}+                            deriving (Show, Typeable)+ +instance ExtensionRequest GetTexLevelParameteriv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 139+               let size__+                     = 4 + size (context_tag_GetTexLevelParameteriv x) ++                         size (target_GetTexLevelParameteriv x)+                         + size (level_GetTexLevelParameteriv x)+                         + size (pname_GetTexLevelParameteriv x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetTexLevelParameteriv x)+               serialize (target_GetTexLevelParameteriv x)+               serialize (level_GetTexLevelParameteriv x)+               serialize (pname_GetTexLevelParameteriv x)+               putSkip (requiredPadding size__)+ +data GetTexLevelParameterivReply = MkGetTexLevelParameterivReply{n_GetTexLevelParameterivReply+                                                                 :: CARD32,+                                                                 datum_GetTexLevelParameterivReply+                                                                 :: INT32,+                                                                 data_GetTexLevelParameterivReply ::+                                                                 [INT32]}+                                 deriving (Show, Typeable)+ +instance Deserialize GetTexLevelParameterivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetTexLevelParameterivReply n datum data_)+ +data IsList = MkIsList{context_tag_IsList :: CONTEXT_TAG,+                       list_IsList :: CARD32}+            deriving (Show, Typeable)+ +instance ExtensionRequest IsList where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 141+               let size__ = 4 + size (context_tag_IsList x) + size (list_IsList x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_IsList x)+               serialize (list_IsList x)+               putSkip (requiredPadding size__)+ +data IsListReply = MkIsListReply{ret_val_IsListReply :: BOOL32}+                 deriving (Show, Typeable)+ +instance Deserialize IsListReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               ret_val <- deserialize+               let _ = isCard32 length+               return (MkIsListReply ret_val)+ +data Flush = MkFlush{context_tag_Flush :: CONTEXT_TAG}+           deriving (Show, Typeable)+ +instance ExtensionRequest Flush where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 142+               let size__ = 4 + size (context_tag_Flush x)+               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]}+                         deriving (Show, Typeable)+ +instance ExtensionRequest AreTexturesResident where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 143+               let size__+                     = 4 + size (context_tag_AreTexturesResident x) ++                         size (n_AreTexturesResident x)+                         + sum (map size (textures_AreTexturesResident x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_AreTexturesResident x)+               serialize (n_AreTexturesResident x)+               serializeList (textures_AreTexturesResident x)+               putSkip (requiredPadding size__)+ +data AreTexturesResidentReply = MkAreTexturesResidentReply{ret_val_AreTexturesResidentReply+                                                           :: BOOL32,+                                                           data_AreTexturesResidentReply :: [BOOL]}+                              deriving (Show, Typeable)+ +instance Deserialize AreTexturesResidentReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               ret_val <- deserialize+               skip 20+               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return (MkAreTexturesResidentReply ret_val data_)+ +data DeleteTextures = MkDeleteTextures{context_tag_DeleteTextures+                                       :: CONTEXT_TAG,+                                       n_DeleteTextures :: INT32,+                                       textures_DeleteTextures :: [CARD32]}+                    deriving (Show, Typeable)+ +instance ExtensionRequest DeleteTextures where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 144+               let size__+                     = 4 + size (context_tag_DeleteTextures x) ++                         size (n_DeleteTextures x)+                         + sum (map size (textures_DeleteTextures x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_DeleteTextures x)+               serialize (n_DeleteTextures x)+               serializeList (textures_DeleteTextures x)+               putSkip (requiredPadding size__)+ +data GenTextures = MkGenTextures{context_tag_GenTextures ::+                                 CONTEXT_TAG,+                                 n_GenTextures :: INT32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GenTextures where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 145+               let size__+                     = 4 + size (context_tag_GenTextures x) + size (n_GenTextures x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GenTextures x)+               serialize (n_GenTextures x)+               putSkip (requiredPadding size__)+ +data GenTexturesReply = MkGenTexturesReply{data_GenTexturesReply ::+                                           [CARD32]}+                      deriving (Show, Typeable)+ +instance Deserialize GenTexturesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 24+               data_ <- deserializeList (fromIntegral length)+               let _ = isCard32 length+               return (MkGenTexturesReply data_)+ +data IsTexture = MkIsTexture{context_tag_IsTexture :: CONTEXT_TAG,+                             texture_IsTexture :: CARD32}+               deriving (Show, Typeable)+ +instance ExtensionRequest IsTexture where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 146+               let size__+                     = 4 + size (context_tag_IsTexture x) + size (texture_IsTexture x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_IsTexture x)+               serialize (texture_IsTexture x)+               putSkip (requiredPadding size__)+ +data IsTextureReply = MkIsTextureReply{ret_val_IsTextureReply ::+                                       BOOL32}+                    deriving (Show, Typeable)+ +instance Deserialize IsTextureReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               ret_val <- deserialize+               let _ = isCard32 length+               return (MkIsTextureReply ret_val)+ +data GetColorTable = MkGetColorTable{context_tag_GetColorTable ::+                                     CONTEXT_TAG,+                                     target_GetColorTable :: CARD32, format_GetColorTable :: CARD32,+                                     type_GetColorTable :: CARD32, swap_bytes_GetColorTable :: BOOL}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GetColorTable where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 147+               let size__+                     = 4 + size (context_tag_GetColorTable x) ++                         size (target_GetColorTable x)+                         + size (format_GetColorTable x)+                         + size (type_GetColorTable x)+                         + size (swap_bytes_GetColorTable x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetColorTable x)+               serialize (target_GetColorTable x)+               serialize (format_GetColorTable x)+               serialize (type_GetColorTable x)+               serialize (swap_bytes_GetColorTable x)+               putSkip (requiredPadding size__)+ +data GetColorTableReply = MkGetColorTableReply{width_GetColorTableReply+                                               :: INT32,+                                               data_GetColorTableReply :: [BYTE]}+                        deriving (Show, Typeable)+ +instance Deserialize GetColorTableReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 8+               width <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return (MkGetColorTableReply width data_)+ +data GetColorTableParameterfv = MkGetColorTableParameterfv{context_tag_GetColorTableParameterfv+                                                           :: CONTEXT_TAG,+                                                           target_GetColorTableParameterfv ::+                                                           CARD32,+                                                           pname_GetColorTableParameterfv :: CARD32}+                              deriving (Show, Typeable)+ +instance ExtensionRequest GetColorTableParameterfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 148+               let size__+                     = 4 + size (context_tag_GetColorTableParameterfv x) ++                         size (target_GetColorTableParameterfv x)+                         + size (pname_GetColorTableParameterfv x)+               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,+                                                                     datum_GetColorTableParameterfvReply+                                                                     :: FLOAT32,+                                                                     data_GetColorTableParameterfvReply+                                                                     :: [FLOAT32]}+                                   deriving (Show, Typeable)+ +instance Deserialize GetColorTableParameterfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetColorTableParameterfvReply n datum data_)+ +data GetColorTableParameteriv = MkGetColorTableParameteriv{context_tag_GetColorTableParameteriv+                                                           :: CONTEXT_TAG,+                                                           target_GetColorTableParameteriv ::+                                                           CARD32,+                                                           pname_GetColorTableParameteriv :: CARD32}+                              deriving (Show, Typeable)+ +instance ExtensionRequest GetColorTableParameteriv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 149+               let size__+                     = 4 + size (context_tag_GetColorTableParameteriv x) ++                         size (target_GetColorTableParameteriv x)+                         + size (pname_GetColorTableParameteriv x)+               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,+                                                                     datum_GetColorTableParameterivReply+                                                                     :: INT32,+                                                                     data_GetColorTableParameterivReply+                                                                     :: [INT32]}+                                   deriving (Show, Typeable)+ +instance Deserialize GetColorTableParameterivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetColorTableParameterivReply n datum data_)+ +data GetConvolutionFilter = MkGetConvolutionFilter{context_tag_GetConvolutionFilter+                                                   :: CONTEXT_TAG,+                                                   target_GetConvolutionFilter :: CARD32,+                                                   format_GetConvolutionFilter :: CARD32,+                                                   type_GetConvolutionFilter :: CARD32,+                                                   swap_bytes_GetConvolutionFilter :: BOOL}+                          deriving (Show, Typeable)+ +instance ExtensionRequest GetConvolutionFilter where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 150+               let size__+                     = 4 + size (context_tag_GetConvolutionFilter x) ++                         size (target_GetConvolutionFilter x)+                         + size (format_GetConvolutionFilter x)+                         + size (type_GetConvolutionFilter x)+                         + size (swap_bytes_GetConvolutionFilter x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetConvolutionFilter x)+               serialize (target_GetConvolutionFilter x)+               serialize (format_GetConvolutionFilter x)+               serialize (type_GetConvolutionFilter x)+               serialize (swap_bytes_GetConvolutionFilter x)+               putSkip (requiredPadding size__)+ +data GetConvolutionFilterReply = MkGetConvolutionFilterReply{width_GetConvolutionFilterReply+                                                             :: INT32,+                                                             height_GetConvolutionFilterReply ::+                                                             INT32,+                                                             data_GetConvolutionFilterReply ::+                                                             [BYTE]}+                               deriving (Show, Typeable)+ +instance Deserialize GetConvolutionFilterReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 8+               width <- deserialize+               height <- deserialize+               skip 8+               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return (MkGetConvolutionFilterReply width height data_)+ +data GetConvolutionParameterfv = MkGetConvolutionParameterfv{context_tag_GetConvolutionParameterfv+                                                             :: CONTEXT_TAG,+                                                             target_GetConvolutionParameterfv ::+                                                             CARD32,+                                                             pname_GetConvolutionParameterfv ::+                                                             CARD32}+                               deriving (Show, Typeable)+ +instance ExtensionRequest GetConvolutionParameterfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 151+               let size__+                     = 4 + size (context_tag_GetConvolutionParameterfv x) ++                         size (target_GetConvolutionParameterfv x)+                         + size (pname_GetConvolutionParameterfv x)+               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,+                                                                       datum_GetConvolutionParameterfvReply+                                                                       :: FLOAT32,+                                                                       data_GetConvolutionParameterfvReply+                                                                       :: [FLOAT32]}+                                    deriving (Show, Typeable)+ +instance Deserialize GetConvolutionParameterfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetConvolutionParameterfvReply n datum data_)+ +data GetConvolutionParameteriv = MkGetConvolutionParameteriv{context_tag_GetConvolutionParameteriv+                                                             :: CONTEXT_TAG,+                                                             target_GetConvolutionParameteriv ::+                                                             CARD32,+                                                             pname_GetConvolutionParameteriv ::+                                                             CARD32}+                               deriving (Show, Typeable)+ +instance ExtensionRequest GetConvolutionParameteriv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 152+               let size__+                     = 4 + size (context_tag_GetConvolutionParameteriv x) ++                         size (target_GetConvolutionParameteriv x)+                         + size (pname_GetConvolutionParameteriv x)+               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,+                                                                       datum_GetConvolutionParameterivReply+                                                                       :: INT32,+                                                                       data_GetConvolutionParameterivReply+                                                                       :: [INT32]}+                                    deriving (Show, Typeable)+ +instance Deserialize GetConvolutionParameterivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetConvolutionParameterivReply n datum data_)+ +data GetSeparableFilter = MkGetSeparableFilter{context_tag_GetSeparableFilter+                                               :: CONTEXT_TAG,+                                               target_GetSeparableFilter :: CARD32,+                                               format_GetSeparableFilter :: CARD32,+                                               type_GetSeparableFilter :: CARD32,+                                               swap_bytes_GetSeparableFilter :: BOOL}+                        deriving (Show, Typeable)+ +instance ExtensionRequest GetSeparableFilter where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 153+               let size__+                     = 4 + size (context_tag_GetSeparableFilter x) ++                         size (target_GetSeparableFilter x)+                         + size (format_GetSeparableFilter x)+                         + size (type_GetSeparableFilter x)+                         + size (swap_bytes_GetSeparableFilter x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetSeparableFilter x)+               serialize (target_GetSeparableFilter x)+               serialize (format_GetSeparableFilter x)+               serialize (type_GetSeparableFilter x)+               serialize (swap_bytes_GetSeparableFilter x)+               putSkip (requiredPadding size__)+ +data GetSeparableFilterReply = MkGetSeparableFilterReply{row_w_GetSeparableFilterReply+                                                         :: INT32,+                                                         col_h_GetSeparableFilterReply :: INT32,+                                                         rows_and_cols_GetSeparableFilterReply ::+                                                         [BYTE]}+                             deriving (Show, Typeable)+ +instance Deserialize GetSeparableFilterReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 8+               row_w <- deserialize+               col_h <- deserialize+               skip 8+               rows_and_cols <- deserializeList+                                  (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return (MkGetSeparableFilterReply row_w col_h rows_and_cols)+ +data GetHistogram = MkGetHistogram{context_tag_GetHistogram ::+                                   CONTEXT_TAG,+                                   target_GetHistogram :: CARD32, format_GetHistogram :: CARD32,+                                   type_GetHistogram :: CARD32, swap_bytes_GetHistogram :: BOOL,+                                   reset_GetHistogram :: BOOL}+                  deriving (Show, Typeable)+ +instance ExtensionRequest GetHistogram where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 154+               let size__+                     = 4 + size (context_tag_GetHistogram x) ++                         size (target_GetHistogram x)+                         + size (format_GetHistogram x)+                         + size (type_GetHistogram x)+                         + size (swap_bytes_GetHistogram x)+                         + size (reset_GetHistogram x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetHistogram x)+               serialize (target_GetHistogram x)+               serialize (format_GetHistogram x)+               serialize (type_GetHistogram x)+               serialize (swap_bytes_GetHistogram x)+               serialize (reset_GetHistogram x)+               putSkip (requiredPadding size__)+ +data GetHistogramReply = MkGetHistogramReply{width_GetHistogramReply+                                             :: INT32,+                                             data_GetHistogramReply :: [BYTE]}+                       deriving (Show, Typeable)+ +instance Deserialize GetHistogramReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 8+               width <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return (MkGetHistogramReply width data_)+ +data GetHistogramParameterfv = MkGetHistogramParameterfv{context_tag_GetHistogramParameterfv+                                                         :: CONTEXT_TAG,+                                                         target_GetHistogramParameterfv :: CARD32,+                                                         pname_GetHistogramParameterfv :: CARD32}+                             deriving (Show, Typeable)+ +instance ExtensionRequest GetHistogramParameterfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 155+               let size__+                     = 4 + size (context_tag_GetHistogramParameterfv x) ++                         size (target_GetHistogramParameterfv x)+                         + size (pname_GetHistogramParameterfv x)+               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,+                                                                   datum_GetHistogramParameterfvReply+                                                                   :: FLOAT32,+                                                                   data_GetHistogramParameterfvReply+                                                                   :: [FLOAT32]}+                                  deriving (Show, Typeable)+ +instance Deserialize GetHistogramParameterfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetHistogramParameterfvReply n datum data_)+ +data GetHistogramParameteriv = MkGetHistogramParameteriv{context_tag_GetHistogramParameteriv+                                                         :: CONTEXT_TAG,+                                                         target_GetHistogramParameteriv :: CARD32,+                                                         pname_GetHistogramParameteriv :: CARD32}+                             deriving (Show, Typeable)+ +instance ExtensionRequest GetHistogramParameteriv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 156+               let size__+                     = 4 + size (context_tag_GetHistogramParameteriv x) ++                         size (target_GetHistogramParameteriv x)+                         + size (pname_GetHistogramParameteriv x)+               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,+                                                                   datum_GetHistogramParameterivReply+                                                                   :: INT32,+                                                                   data_GetHistogramParameterivReply+                                                                   :: [INT32]}+                                  deriving (Show, Typeable)+ +instance Deserialize GetHistogramParameterivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               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}+               deriving (Show, Typeable)+ +instance ExtensionRequest GetMinmax where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 157+               let size__+                     = 4 + size (context_tag_GetMinmax x) + size (target_GetMinmax x) ++                         size (format_GetMinmax x)+                         + size (type_GetMinmax x)+                         + size (swap_bytes_GetMinmax x)+                         + size (reset_GetMinmax x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GetMinmax x)+               serialize (target_GetMinmax x)+               serialize (format_GetMinmax x)+               serialize (type_GetMinmax x)+               serialize (swap_bytes_GetMinmax x)+               serialize (reset_GetMinmax x)+               putSkip (requiredPadding size__)+ +data GetMinmaxReply = MkGetMinmaxReply{data_GetMinmaxReply ::+                                       [BYTE]}+                    deriving (Show, Typeable)+ +instance Deserialize GetMinmaxReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 24+               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return (MkGetMinmaxReply data_)+ +data GetMinmaxParameterfv = MkGetMinmaxParameterfv{context_tag_GetMinmaxParameterfv+                                                   :: CONTEXT_TAG,+                                                   target_GetMinmaxParameterfv :: CARD32,+                                                   pname_GetMinmaxParameterfv :: CARD32}+                          deriving (Show, Typeable)+ +instance ExtensionRequest GetMinmaxParameterfv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 158+               let size__+                     = 4 + size (context_tag_GetMinmaxParameterfv x) ++                         size (target_GetMinmaxParameterfv x)+                         + size (pname_GetMinmaxParameterfv x)+               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,+                                                             datum_GetMinmaxParameterfvReply ::+                                                             FLOAT32,+                                                             data_GetMinmaxParameterfvReply ::+                                                             [FLOAT32]}+                               deriving (Show, Typeable)+ +instance Deserialize GetMinmaxParameterfvReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetMinmaxParameterfvReply n datum data_)+ +data GetMinmaxParameteriv = MkGetMinmaxParameteriv{context_tag_GetMinmaxParameteriv+                                                   :: CONTEXT_TAG,+                                                   target_GetMinmaxParameteriv :: CARD32,+                                                   pname_GetMinmaxParameteriv :: CARD32}+                          deriving (Show, Typeable)+ +instance ExtensionRequest GetMinmaxParameteriv where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 159+               let size__+                     = 4 + size (context_tag_GetMinmaxParameteriv x) ++                         size (target_GetMinmaxParameteriv x)+                         + size (pname_GetMinmaxParameteriv x)+               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,+                                                             datum_GetMinmaxParameterivReply ::+                                                             INT32,+                                                             data_GetMinmaxParameterivReply ::+                                                             [INT32]}+                               deriving (Show, Typeable)+ +instance Deserialize GetMinmaxParameterivReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetMinmaxParameterivReply n datum data_)+ +data GetCompressedTexImageARB = MkGetCompressedTexImageARB{context_tag_GetCompressedTexImageARB+                                                           :: CONTEXT_TAG,+                                                           target_GetCompressedTexImageARB ::+                                                           CARD32,+                                                           level_GetCompressedTexImageARB :: INT32}+                              deriving (Show, Typeable)+ +instance ExtensionRequest GetCompressedTexImageARB where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 160+               let size__+                     = 4 + size (context_tag_GetCompressedTexImageARB x) ++                         size (target_GetCompressedTexImageARB x)+                         + size (level_GetCompressedTexImageARB x)+               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,+                                                                     data_GetCompressedTexImageARBReply+                                                                     :: [BYTE]}+                                   deriving (Show, Typeable)+ +instance Deserialize GetCompressedTexImageARBReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 8+               size <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return (MkGetCompressedTexImageARBReply size data_)+ +data DeleteQueriesARB = MkDeleteQueriesARB{context_tag_DeleteQueriesARB+                                           :: CONTEXT_TAG,+                                           n_DeleteQueriesARB :: INT32,+                                           ids_DeleteQueriesARB :: [CARD32]}+                      deriving (Show, Typeable)+ +instance ExtensionRequest DeleteQueriesARB where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 161+               let size__+                     = 4 + size (context_tag_DeleteQueriesARB x) ++                         size (n_DeleteQueriesARB x)+                         + sum (map size (ids_DeleteQueriesARB x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_DeleteQueriesARB x)+               serialize (n_DeleteQueriesARB x)+               serializeList (ids_DeleteQueriesARB x)+               putSkip (requiredPadding size__)+ +data GenQueriesARB = MkGenQueriesARB{context_tag_GenQueriesARB ::+                                     CONTEXT_TAG,+                                     n_GenQueriesARB :: INT32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GenQueriesARB where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 162+               let size__+                     = 4 + size (context_tag_GenQueriesARB x) + size (n_GenQueriesARB x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_GenQueriesARB x)+               serialize (n_GenQueriesARB x)+               putSkip (requiredPadding size__)+ +data GenQueriesARBReply = MkGenQueriesARBReply{data_GenQueriesARBReply+                                               :: [CARD32]}+                        deriving (Show, Typeable)+ +instance Deserialize GenQueriesARBReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 24+               data_ <- deserializeList (fromIntegral length)+               let _ = isCard32 length+               return (MkGenQueriesARBReply data_)+ +data IsQueryARB = MkIsQueryARB{context_tag_IsQueryARB ::+                               CONTEXT_TAG,+                               id_IsQueryARB :: CARD32}+                deriving (Show, Typeable)+ +instance ExtensionRequest IsQueryARB where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 163+               let size__+                     = 4 + size (context_tag_IsQueryARB x) + size (id_IsQueryARB x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_tag_IsQueryARB x)+               serialize (id_IsQueryARB x)+               putSkip (requiredPadding size__)+ +data IsQueryARBReply = MkIsQueryARBReply{ret_val_IsQueryARBReply ::+                                         BOOL32}+                     deriving (Show, Typeable)+ +instance Deserialize IsQueryARBReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               ret_val <- deserialize+               let _ = isCard32 length+               return (MkIsQueryARBReply ret_val)+ +data GetQueryivARB = MkGetQueryivARB{context_tag_GetQueryivARB ::+                                     CONTEXT_TAG,+                                     target_GetQueryivARB :: CARD32, pname_GetQueryivARB :: CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GetQueryivARB where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 164+               let size__+                     = 4 + size (context_tag_GetQueryivARB x) ++                         size (target_GetQueryivARB x)+                         + size (pname_GetQueryivARB x)+               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]}+                        deriving (Show, Typeable)+ +instance Deserialize GetQueryivARBReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetQueryivARBReply n datum data_)+ +data GetQueryObjectivARB = MkGetQueryObjectivARB{context_tag_GetQueryObjectivARB+                                                 :: CONTEXT_TAG,+                                                 id_GetQueryObjectivARB :: CARD32,+                                                 pname_GetQueryObjectivARB :: CARD32}+                         deriving (Show, Typeable)+ +instance ExtensionRequest GetQueryObjectivARB where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 165+               let size__+                     = 4 + size (context_tag_GetQueryObjectivARB x) ++                         size (id_GetQueryObjectivARB x)+                         + size (pname_GetQueryObjectivARB x)+               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]}+                              deriving (Show, Typeable)+ +instance Deserialize GetQueryObjectivARBReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetQueryObjectivARBReply n datum data_)+ +data GetQueryObjectuivARB = MkGetQueryObjectuivARB{context_tag_GetQueryObjectuivARB+                                                   :: CONTEXT_TAG,+                                                   id_GetQueryObjectuivARB :: CARD32,+                                                   pname_GetQueryObjectuivARB :: CARD32}+                          deriving (Show, Typeable)+ +instance ExtensionRequest GetQueryObjectuivARB where+        extensionId _ = "GLX"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 166+               let size__+                     = 4 + size (context_tag_GetQueryObjectuivARB x) ++                         size (id_GetQueryObjectuivARB x)+                         + size (pname_GetQueryObjectuivARB x)+               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,+                                                             datum_GetQueryObjectuivARBReply ::+                                                             CARD32,+                                                             data_GetQueryObjectuivARBReply ::+                                                             [CARD32]}+                               deriving (Show, Typeable)+ +instance Deserialize GetQueryObjectuivARBReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 4+               n <- deserialize+               datum <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral n)+               let _ = isCard32 length+               return (MkGetQueryObjectuivARBReply n datum data_)
+ patched/Graphics/XHB/Gen/Input.hs view
@@ -0,0 +1,346 @@+module Graphics.XHB.Gen.Input+       (extension, getExtensionVersion, listInputDevices, openDevice,+        closeDevice, setDeviceMode, selectExtensionEvent,+        getSelectedExtensionEvents, changeDeviceDontPropagateList,+        getDeviceDontPropagateList, getDeviceMotionEvents,+        changeKeyboardDevice, changePointerDevice, grabDevice,+        ungrabDevice, grabDeviceKey, ungrabDeviceKey, grabDeviceButton,+        ungrabDeviceButton, allowDeviceEvents, getDeviceFocus,+        setDeviceFocus, getFeedbackControl, getDeviceKeyMapping,+        changeDeviceKeyMapping, getDeviceModifierMapping,+        setDeviceModifierMapping, getDeviceButtonMapping,+        setDeviceButtonMapping, queryDeviceState, sendExtensionEvent,+        deviceBell, setDeviceValuators, getDeviceControl,+        module Graphics.XHB.Gen.Input.Types)+       where+import Graphics.XHB.Gen.Input.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (FocusIn(..), FocusOut(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "XInputExtension"+ +getExtensionVersion ::+                      Graphics.XHB.Connection.Types.Connection ->+                        CARD16 -> [CChar] -> IO (Receipt GetExtensionVersionReply)+getExtensionVersion c name_len name+  = do receipt <- newEmptyReceiptIO+       let req = MkGetExtensionVersion name_len name+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +listInputDevices ::+                   Graphics.XHB.Connection.Types.Connection ->+                     IO (Receipt ListInputDevicesReply)+listInputDevices c+  = do receipt <- newEmptyReceiptIO+       let req = MkListInputDevices+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +openDevice ::+             Graphics.XHB.Connection.Types.Connection ->+               CARD8 -> IO (Receipt OpenDeviceReply)+openDevice c device_id+  = do receipt <- newEmptyReceiptIO+       let req = MkOpenDevice device_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +closeDevice ::+              Graphics.XHB.Connection.Types.Connection -> CARD8 -> IO ()+closeDevice c device_id+  = do let req = MkCloseDevice device_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +setDeviceMode ::+                Graphics.XHB.Connection.Types.Connection ->+                  CARD8 -> CARD8 -> IO (Receipt SetDeviceModeReply)+setDeviceMode c device_id mode+  = do receipt <- newEmptyReceiptIO+       let req = MkSetDeviceMode device_id mode+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +selectExtensionEvent ::+                       Graphics.XHB.Connection.Types.Connection ->+                         SelectExtensionEvent -> IO ()+selectExtensionEvent c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getSelectedExtensionEvents ::+                             Graphics.XHB.Connection.Types.Connection ->+                               WINDOW -> IO (Receipt GetSelectedExtensionEventsReply)+getSelectedExtensionEvents c window+  = do receipt <- newEmptyReceiptIO+       let req = MkGetSelectedExtensionEvents window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +changeDeviceDontPropagateList ::+                                Graphics.XHB.Connection.Types.Connection ->+                                  ChangeDeviceDontPropagateList -> IO ()+changeDeviceDontPropagateList c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getDeviceDontPropagateList ::+                             Graphics.XHB.Connection.Types.Connection ->+                               WINDOW -> IO (Receipt GetDeviceDontPropagateListReply)+getDeviceDontPropagateList c window+  = do receipt <- newEmptyReceiptIO+       let req = MkGetDeviceDontPropagateList window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getDeviceMotionEvents ::+                        Graphics.XHB.Connection.Types.Connection ->+                          GetDeviceMotionEvents -> IO (Receipt GetDeviceMotionEventsReply)+getDeviceMotionEvents c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +changeKeyboardDevice ::+                       Graphics.XHB.Connection.Types.Connection ->+                         CARD8 -> IO (Receipt ChangeKeyboardDeviceReply)+changeKeyboardDevice c device_id+  = do receipt <- newEmptyReceiptIO+       let req = MkChangeKeyboardDevice device_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +changePointerDevice ::+                      Graphics.XHB.Connection.Types.Connection ->+                        ChangePointerDevice -> IO (Receipt ChangePointerDeviceReply)+changePointerDevice c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +grabDevice ::+             Graphics.XHB.Connection.Types.Connection ->+               GrabDevice -> IO (Receipt GrabDeviceReply)+grabDevice c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +ungrabDevice ::+               Graphics.XHB.Connection.Types.Connection ->+                 TIMESTAMP -> CARD8 -> IO ()+ungrabDevice c time device_id+  = do let req = MkUngrabDevice time device_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +grabDeviceKey ::+                Graphics.XHB.Connection.Types.Connection -> GrabDeviceKey -> IO ()+grabDeviceKey c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +ungrabDeviceKey ::+                  Graphics.XHB.Connection.Types.Connection ->+                    UngrabDeviceKey -> IO ()+ungrabDeviceKey c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +grabDeviceButton ::+                   Graphics.XHB.Connection.Types.Connection ->+                     GrabDeviceButton -> IO ()+grabDeviceButton c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +ungrabDeviceButton ::+                     Graphics.XHB.Connection.Types.Connection ->+                       UngrabDeviceButton -> IO ()+ungrabDeviceButton c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +allowDeviceEvents ::+                    Graphics.XHB.Connection.Types.Connection ->+                      AllowDeviceEvents -> IO ()+allowDeviceEvents c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getDeviceFocus ::+                 Graphics.XHB.Connection.Types.Connection ->+                   CARD8 -> IO (Receipt GetDeviceFocusReply)+getDeviceFocus c device_id+  = do receipt <- newEmptyReceiptIO+       let req = MkGetDeviceFocus device_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setDeviceFocus ::+                 Graphics.XHB.Connection.Types.Connection -> SetDeviceFocus -> IO ()+setDeviceFocus c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getFeedbackControl ::+                     Graphics.XHB.Connection.Types.Connection ->+                       CARD8 -> IO (Receipt GetFeedbackControlReply)+getFeedbackControl c device_id+  = do receipt <- newEmptyReceiptIO+       let req = MkGetFeedbackControl device_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getDeviceKeyMapping ::+                      Graphics.XHB.Connection.Types.Connection ->+                        GetDeviceKeyMapping -> IO (Receipt GetDeviceKeyMappingReply)+getDeviceKeyMapping c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +changeDeviceKeyMapping ::+                         Graphics.XHB.Connection.Types.Connection ->+                           ChangeDeviceKeyMapping -> IO ()+changeDeviceKeyMapping c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getDeviceModifierMapping ::+                           Graphics.XHB.Connection.Types.Connection ->+                             CARD8 -> IO (Receipt GetDeviceModifierMappingReply)+getDeviceModifierMapping c device_id+  = do receipt <- newEmptyReceiptIO+       let req = MkGetDeviceModifierMapping device_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setDeviceModifierMapping ::+                           Graphics.XHB.Connection.Types.Connection ->+                             SetDeviceModifierMapping ->+                               IO (Receipt SetDeviceModifierMappingReply)+setDeviceModifierMapping c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getDeviceButtonMapping ::+                         Graphics.XHB.Connection.Types.Connection ->+                           CARD8 -> IO (Receipt GetDeviceButtonMappingReply)+getDeviceButtonMapping c device_id+  = do receipt <- newEmptyReceiptIO+       let req = MkGetDeviceButtonMapping device_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setDeviceButtonMapping ::+                         Graphics.XHB.Connection.Types.Connection ->+                           SetDeviceButtonMapping -> IO (Receipt SetDeviceButtonMappingReply)+setDeviceButtonMapping c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryDeviceState ::+                   Graphics.XHB.Connection.Types.Connection ->+                     CARD8 -> IO (Receipt QueryDeviceStateReply)+queryDeviceState c device_id+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryDeviceState device_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +sendExtensionEvent ::+                     Graphics.XHB.Connection.Types.Connection ->+                       SendExtensionEvent -> IO ()+sendExtensionEvent c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +deviceBell ::+             Graphics.XHB.Connection.Types.Connection -> DeviceBell -> IO ()+deviceBell c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +setDeviceValuators ::+                     Graphics.XHB.Connection.Types.Connection ->+                       SetDeviceValuators -> IO (Receipt SetDeviceValuatorsReply)+setDeviceValuators c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getDeviceControl ::+                   Graphics.XHB.Connection.Types.Connection ->+                     CARD16 -> CARD8 -> IO (Receipt GetDeviceControlReply)+getDeviceControl c control_id device_id+  = do receipt <- newEmptyReceiptIO+       let req = MkGetDeviceControl control_id device_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/Input/Types.hs view
@@ -0,0 +1,2927 @@+module Graphics.XHB.Gen.Input.Types+       (deserializeError, deserializeEvent, KeyCode, EventClass,+        ValuatorMode(..), PropagateMode(..), GetExtensionVersion(..),+        GetExtensionVersionReply(..), DeviceInfo(..), ListInputDevices(..),+        ListInputDevicesReply(..), DeviceUse(..), InputInfo(..),+        KeyInfo(..), ButtonInfo(..), AxisInfo(..), ValuatorInfo(..),+        InputClassInfo(..), OpenDevice(..), OpenDeviceReply(..),+        InputClass(..), CloseDevice(..), SetDeviceMode(..),+        SetDeviceModeReply(..), SelectExtensionEvent(..),+        GetSelectedExtensionEvents(..),+        GetSelectedExtensionEventsReply(..),+        ChangeDeviceDontPropagateList(..), GetDeviceDontPropagateList(..),+        GetDeviceDontPropagateListReply(..), GetDeviceMotionEvents(..),+        GetDeviceMotionEventsReply(..), DeviceTimeCoord(..),+        ChangeKeyboardDevice(..), ChangeKeyboardDeviceReply(..),+        ChangePointerDevice(..), ChangePointerDeviceReply(..),+        GrabDevice(..), GrabDeviceReply(..), UngrabDevice(..),+        GrabDeviceKey(..), UngrabDeviceKey(..), GrabDeviceButton(..),+        UngrabDeviceButton(..), AllowDeviceEvents(..), GetDeviceFocus(..),+        GetDeviceFocusReply(..), SetDeviceFocus(..),+        GetFeedbackControl(..), GetFeedbackControlReply(..),+        FeedbackState(..), KbdFeedbackState(..), PtrFeedbackState(..),+        IntegerFeedbackState(..), StringFeedbackState(..),+        BellFeedbackState(..), LedFeedbackState(..), FeedbackCtl(..),+        KbdFeedbackCtl(..), PtrFeedbackCtl(..), IntegerFeedbackCtl(..),+        StringFeedbackCtl(..), BellFeedbackCtl(..), LedFeedbackCtl(..),+        GetDeviceKeyMapping(..), GetDeviceKeyMappingReply(..),+        ChangeDeviceKeyMapping(..), GetDeviceModifierMapping(..),+        GetDeviceModifierMappingReply(..), SetDeviceModifierMapping(..),+        SetDeviceModifierMappingReply(..), GetDeviceButtonMapping(..),+        GetDeviceButtonMappingReply(..), SetDeviceButtonMapping(..),+        SetDeviceButtonMappingReply(..), QueryDeviceState(..),+        QueryDeviceStateReply(..), InputState(..), KeyState(..),+        ButtonState(..), ValuatorState(..), SendExtensionEvent(..),+        DeviceBell(..), SetDeviceValuators(..),+        SetDeviceValuatorsReply(..), GetDeviceControl(..),+        GetDeviceControlReply(..), DeviceState(..),+        DeviceResolutionState(..), DeviceAbsCalibState(..),+        DeviceAbsAreaState(..), DeviceCoreState(..), DeviceEnableState(..),+        DeviceCtl(..), DeviceResolutionCtl(..), DeviceAbsCalibCtl(..),+        DeviceAbsAreaCtrl(..), DeviceCoreCtrl(..), DeviceEnableCtrl(..),+        DeviceValuator(..), DeviceKeyPress(..), DeviceKeyRelease(..),+        DeviceButtonPress(..), DeviceButtonRelease(..),+        DeviceMotionNotify(..), ProximityIn(..), ProximityOut(..),+        FocusIn(..), FocusOut(..), DeviceStateNotify(..),+        DeviceMappingNotify(..), ChangeDeviceNotify(..),+        DeviceKeyStateNotify(..), DeviceButtonStateNotify(..),+        DevicePresenceNotify(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (FocusIn(..), FocusOut(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent 0+  = return (liftM toEvent (deserialize :: Get DeviceValuator))+deserializeEvent 1+  = return (liftM toEvent (deserialize :: Get DeviceKeyPress))+deserializeEvent 2+  = return (liftM toEvent (deserialize :: Get DeviceKeyRelease))+deserializeEvent 3+  = return (liftM toEvent (deserialize :: Get DeviceButtonPress))+deserializeEvent 4+  = return (liftM toEvent (deserialize :: Get DeviceButtonRelease))+deserializeEvent 5+  = return (liftM toEvent (deserialize :: Get DeviceMotionNotify))+deserializeEvent 8+  = return (liftM toEvent (deserialize :: Get ProximityIn))+deserializeEvent 9+  = return (liftM toEvent (deserialize :: Get ProximityOut))+deserializeEvent 6+  = return (liftM toEvent (deserialize :: Get FocusIn))+deserializeEvent 7+  = return (liftM toEvent (deserialize :: Get FocusOut))+deserializeEvent 10+  = return (liftM toEvent (deserialize :: Get DeviceStateNotify))+deserializeEvent 11+  = return (liftM toEvent (deserialize :: Get DeviceMappingNotify))+deserializeEvent 12+  = return (liftM toEvent (deserialize :: Get ChangeDeviceNotify))+deserializeEvent 13+  = return (liftM toEvent (deserialize :: Get DeviceKeyStateNotify))+deserializeEvent 14+  = return+      (liftM toEvent (deserialize :: Get DeviceButtonStateNotify))+deserializeEvent 15+  = return (liftM toEvent (deserialize :: Get DevicePresenceNotify))+deserializeEvent _ = Nothing+ +type KeyCode = CARD8+ +type EventClass = CARD32+ +data ValuatorMode = ValuatorModeRelative+                  | ValuatorModeAbsolute+ +instance SimpleEnum ValuatorMode where+        toValue ValuatorModeRelative{} = 0+        toValue ValuatorModeAbsolute{} = 1+        fromValue 0 = ValuatorModeRelative+        fromValue 1 = ValuatorModeAbsolute+ +data PropagateMode = PropagateModeAddToList+                   | PropagateModeDeleteFromList+ +instance SimpleEnum PropagateMode where+        toValue PropagateModeAddToList{} = 0+        toValue PropagateModeDeleteFromList{} = 1+        fromValue 0 = PropagateModeAddToList+        fromValue 1 = PropagateModeDeleteFromList+ +data GetExtensionVersion = MkGetExtensionVersion{name_len_GetExtensionVersion+                                                 :: CARD16,+                                                 name_GetExtensionVersion :: [CChar]}+                         deriving (Show, Typeable)+ +instance ExtensionRequest GetExtensionVersion where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__+                     = 4 + size (name_len_GetExtensionVersion x) + 2 ++                         sum (map size (name_GetExtensionVersion x))+               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,+                                                           server_minor_GetExtensionVersionReply ::+                                                           CARD16,+                                                           present_GetExtensionVersionReply ::+                                                           CARD8}+                              deriving (Show, Typeable)+ +instance Deserialize GetExtensionVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               server_major <- deserialize+               server_minor <- deserialize+               present <- deserialize+               skip 19+               let _ = isCard32 length+               return+                 (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}+                deriving (Show, Typeable)+ +instance Serialize DeviceInfo where+        serialize x+          = do serialize (device_type_DeviceInfo x)+               serialize (device_id_DeviceInfo x)+               serialize (num_class_info_DeviceInfo x)+               serialize (device_use_DeviceInfo x)+               putSkip 1+        size x+          = size (device_type_DeviceInfo x) + size (device_id_DeviceInfo x) ++              size (num_class_info_DeviceInfo x)+              + size (device_use_DeviceInfo x)+              + 1+ +instance Deserialize DeviceInfo where+        deserialize+          = do device_type <- deserialize+               device_id <- deserialize+               num_class_info <- deserialize+               device_use <- deserialize+               skip 1+               return+                 (MkDeviceInfo device_type device_id num_class_info device_use)+ +data ListInputDevices = MkListInputDevices{}+                      deriving (Show, Typeable)+ +instance ExtensionRequest ListInputDevices where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data ListInputDevicesReply = MkListInputDevicesReply{devices_len_ListInputDevicesReply+                                                     :: CARD8,+                                                     devices_ListInputDevicesReply :: [DeviceInfo]}+                           deriving (Show, Typeable)+ +instance Deserialize ListInputDevicesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               devices_len <- deserialize+               skip 23+               devices <- deserializeList (fromIntegral devices_len)+               let _ = isCard32 length+               return (MkListInputDevicesReply devices_len devices)+ +data DeviceUse = DeviceUseIsXPointer+               | DeviceUseIsXKeyboard+               | DeviceUseIsXExtensionDevice+               | DeviceUseIsXExtensionKeyboard+               | DeviceUseIsXExtensionPointer+ +instance SimpleEnum DeviceUse where+        toValue DeviceUseIsXPointer{} = 0+        toValue DeviceUseIsXKeyboard{} = 1+        toValue DeviceUseIsXExtensionDevice{} = 2+        toValue DeviceUseIsXExtensionKeyboard{} = 3+        toValue DeviceUseIsXExtensionPointer{} = 4+        fromValue 0 = DeviceUseIsXPointer+        fromValue 1 = DeviceUseIsXKeyboard+        fromValue 2 = DeviceUseIsXExtensionDevice+        fromValue 3 = DeviceUseIsXExtensionKeyboard+        fromValue 4 = DeviceUseIsXExtensionPointer+ +data InputInfo = MkInputInfo{class_id_InputInfo :: CARD8,+                             len_InputInfo :: CARD8}+               deriving (Show, Typeable)+ +instance Serialize InputInfo where+        serialize x+          = do serialize (class_id_InputInfo x)+               serialize (len_InputInfo x)+        size x = size (class_id_InputInfo x) + size (len_InputInfo x)+ +instance Deserialize InputInfo where+        deserialize+          = do class_id <- deserialize+               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}+             deriving (Show, Typeable)+ +instance Serialize KeyInfo where+        serialize x+          = do serialize (class_id_KeyInfo x)+               serialize (len_KeyInfo x)+               serialize (min_keycode_KeyInfo x)+               serialize (max_keycode_KeyInfo x)+               serialize (num_keys_KeyInfo x)+               putSkip 2+        size x+          = size (class_id_KeyInfo x) + size (len_KeyInfo x) ++              size (min_keycode_KeyInfo x)+              + size (max_keycode_KeyInfo x)+              + size (num_keys_KeyInfo x)+              + 2+ +instance Deserialize KeyInfo where+        deserialize+          = do class_id <- deserialize+               len <- deserialize+               min_keycode <- deserialize+               max_keycode <- deserialize+               num_keys <- deserialize+               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}+                deriving (Show, Typeable)+ +instance Serialize ButtonInfo where+        serialize x+          = do serialize (class_id_ButtonInfo x)+               serialize (len_ButtonInfo x)+               serialize (num_buttons_ButtonInfo x)+        size x+          = size (class_id_ButtonInfo x) + size (len_ButtonInfo x) ++              size (num_buttons_ButtonInfo x)+ +instance Deserialize ButtonInfo where+        deserialize+          = do class_id <- deserialize+               len <- deserialize+               num_buttons <- deserialize+               return (MkButtonInfo class_id len num_buttons)+ +data AxisInfo = MkAxisInfo{resolution_AxisInfo :: CARD32,+                           minimum_AxisInfo :: CARD32, maximum_AxisInfo :: CARD32}+              deriving (Show, Typeable)+ +instance Serialize AxisInfo where+        serialize x+          = do serialize (resolution_AxisInfo x)+               serialize (minimum_AxisInfo x)+               serialize (maximum_AxisInfo x)+        size x+          = size (resolution_AxisInfo x) + size (minimum_AxisInfo x) ++              size (maximum_AxisInfo x)+ +instance Deserialize AxisInfo where+        deserialize+          = do resolution <- deserialize+               minimum <- deserialize+               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,+                                   axes_ValuatorInfo :: [AxisInfo]}+                  deriving (Show, Typeable)+ +instance Serialize ValuatorInfo where+        serialize x+          = do serialize (class_id_ValuatorInfo x)+               serialize (len_ValuatorInfo x)+               serialize (axes_len_ValuatorInfo x)+               serialize (mode_ValuatorInfo x)+               serialize (motion_size_ValuatorInfo x)+               serializeList (axes_ValuatorInfo x)+        size x+          = size (class_id_ValuatorInfo x) + size (len_ValuatorInfo x) ++              size (axes_len_ValuatorInfo x)+              + size (mode_ValuatorInfo x)+              + size (motion_size_ValuatorInfo x)+              + sum (map size (axes_ValuatorInfo x))+ +instance Deserialize ValuatorInfo where+        deserialize+          = do class_id <- deserialize+               len <- deserialize+               axes_len <- deserialize+               mode <- deserialize+               motion_size <- deserialize+               axes <- deserializeList (fromIntegral axes_len)+               return (MkValuatorInfo class_id len axes_len mode motion_size axes)+ +data InputClassInfo = MkInputClassInfo{class_id_InputClassInfo ::+                                       CARD8,+                                       event_type_base_InputClassInfo :: CARD8}+                    deriving (Show, Typeable)+ +instance Serialize InputClassInfo where+        serialize x+          = do serialize (class_id_InputClassInfo x)+               serialize (event_type_base_InputClassInfo x)+        size x+          = size (class_id_InputClassInfo x) ++              size (event_type_base_InputClassInfo x)+ +instance Deserialize InputClassInfo where+        deserialize+          = do class_id <- deserialize+               event_type_base <- deserialize+               return (MkInputClassInfo class_id event_type_base)+ +data OpenDevice = MkOpenDevice{device_id_OpenDevice :: CARD8}+                deriving (Show, Typeable)+ +instance ExtensionRequest OpenDevice where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__ = 4 + size (device_id_OpenDevice x) + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_OpenDevice x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data OpenDeviceReply = MkOpenDeviceReply{num_classes_OpenDeviceReply+                                         :: CARD8,+                                         class_info_OpenDeviceReply :: [InputClassInfo]}+                     deriving (Show, Typeable)+ +instance Deserialize OpenDeviceReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_classes <- deserialize+               skip 23+               class_info <- deserializeList (fromIntegral num_classes)+               let _ = isCard32 length+               return (MkOpenDeviceReply num_classes class_info)+ +data InputClass = InputClassKey+                | InputClassButton+                | InputClassValuator+                | InputClassFeedback+                | InputClassProximity+                | InputClassFocus+                | InputClassOther+ +instance SimpleEnum InputClass where+        toValue InputClassKey{} = 0+        toValue InputClassButton{} = 1+        toValue InputClassValuator{} = 2+        toValue InputClassFeedback{} = 3+        toValue InputClassProximity{} = 4+        toValue InputClassFocus{} = 5+        toValue InputClassOther{} = 6+        fromValue 0 = InputClassKey+        fromValue 1 = InputClassButton+        fromValue 2 = InputClassValuator+        fromValue 3 = InputClassFeedback+        fromValue 4 = InputClassProximity+        fromValue 5 = InputClassFocus+        fromValue 6 = InputClassOther+ +data CloseDevice = MkCloseDevice{device_id_CloseDevice :: CARD8}+                 deriving (Show, Typeable)+ +instance ExtensionRequest CloseDevice where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__ = 4 + size (device_id_CloseDevice x) + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_CloseDevice x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data SetDeviceMode = MkSetDeviceMode{device_id_SetDeviceMode ::+                                     CARD8,+                                     mode_SetDeviceMode :: CARD8}+                   deriving (Show, Typeable)+ +instance ExtensionRequest SetDeviceMode where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__+                     = 4 + size (device_id_SetDeviceMode x) ++                         size (mode_SetDeviceMode x)+                         + 2+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_SetDeviceMode x)+               serialize (mode_SetDeviceMode x)+               putSkip 2+               putSkip (requiredPadding size__)+ +data SetDeviceModeReply = MkSetDeviceModeReply{status_SetDeviceModeReply+                                               :: CARD8}+                        deriving (Show, Typeable)+ +instance Deserialize SetDeviceModeReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               status <- deserialize+               skip 23+               let _ = isCard32 length+               return (MkSetDeviceModeReply status)+ +data SelectExtensionEvent = MkSelectExtensionEvent{window_SelectExtensionEvent+                                                   :: WINDOW,+                                                   num_classes_SelectExtensionEvent :: CARD16,+                                                   classes_SelectExtensionEvent :: [EventClass]}+                          deriving (Show, Typeable)+ +instance ExtensionRequest SelectExtensionEvent where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__+                     = 4 + size (window_SelectExtensionEvent x) ++                         size (num_classes_SelectExtensionEvent x)+                         + 2+                         + sum (map size (classes_SelectExtensionEvent x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_SelectExtensionEvent x)+               serialize (num_classes_SelectExtensionEvent x)+               putSkip 2+               serializeList (classes_SelectExtensionEvent x)+               putSkip (requiredPadding size__)+ +data GetSelectedExtensionEvents = MkGetSelectedExtensionEvents{window_GetSelectedExtensionEvents+                                                               :: WINDOW}+                                deriving (Show, Typeable)+ +instance ExtensionRequest GetSelectedExtensionEvents where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__ = 4 + size (window_GetSelectedExtensionEvents x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetSelectedExtensionEvents x)+               putSkip (requiredPadding size__)+ +data GetSelectedExtensionEventsReply = MkGetSelectedExtensionEventsReply{num_this_classes_GetSelectedExtensionEventsReply+                                                                         :: CARD16,+                                                                         num_all_classes_GetSelectedExtensionEventsReply+                                                                         :: CARD16,+                                                                         this_classes_GetSelectedExtensionEventsReply+                                                                         :: [EventClass],+                                                                         all_classes_GetSelectedExtensionEventsReply+                                                                         :: [EventClass]}+                                     deriving (Show, Typeable)+ +instance Deserialize GetSelectedExtensionEventsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_this_classes <- deserialize+               num_all_classes <- deserialize+               skip 20+               this_classes <- deserializeList (fromIntegral num_this_classes)+               all_classes <- deserializeList (fromIntegral num_all_classes)+               let _ = isCard32 length+               return+                 (MkGetSelectedExtensionEventsReply num_this_classes num_all_classes+                    this_classes+                    all_classes)+ +data ChangeDeviceDontPropagateList = MkChangeDeviceDontPropagateList{window_ChangeDeviceDontPropagateList+                                                                     :: WINDOW,+                                                                     num_classes_ChangeDeviceDontPropagateList+                                                                     :: CARD16,+                                                                     mode_ChangeDeviceDontPropagateList+                                                                     :: CARD8,+                                                                     classes_ChangeDeviceDontPropagateList+                                                                     :: [EventClass]}+                                   deriving (Show, Typeable)+ +instance ExtensionRequest ChangeDeviceDontPropagateList where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__+                     = 4 + size (window_ChangeDeviceDontPropagateList x) ++                         size (num_classes_ChangeDeviceDontPropagateList x)+                         + size (mode_ChangeDeviceDontPropagateList x)+                         + 1+                         + sum (map size (classes_ChangeDeviceDontPropagateList x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_ChangeDeviceDontPropagateList x)+               serialize (num_classes_ChangeDeviceDontPropagateList x)+               serialize (mode_ChangeDeviceDontPropagateList x)+               putSkip 1+               serializeList (classes_ChangeDeviceDontPropagateList x)+               putSkip (requiredPadding size__)+ +data GetDeviceDontPropagateList = MkGetDeviceDontPropagateList{window_GetDeviceDontPropagateList+                                                               :: WINDOW}+                                deriving (Show, Typeable)+ +instance ExtensionRequest GetDeviceDontPropagateList where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 9+               let size__ = 4 + size (window_GetDeviceDontPropagateList x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetDeviceDontPropagateList x)+               putSkip (requiredPadding size__)+ +data GetDeviceDontPropagateListReply = MkGetDeviceDontPropagateListReply{num_classes_GetDeviceDontPropagateListReply+                                                                         :: CARD16,+                                                                         classes_GetDeviceDontPropagateListReply+                                                                         :: [EventClass]}+                                     deriving (Show, Typeable)+ +instance Deserialize GetDeviceDontPropagateListReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_classes <- deserialize+               skip 22+               classes <- deserializeList (fromIntegral num_classes)+               let _ = isCard32 length+               return (MkGetDeviceDontPropagateListReply num_classes classes)+ +data GetDeviceMotionEvents = MkGetDeviceMotionEvents{start_GetDeviceMotionEvents+                                                     :: TIMESTAMP,+                                                     stop_GetDeviceMotionEvents :: TIMESTAMP,+                                                     device_id_GetDeviceMotionEvents :: CARD8}+                           deriving (Show, Typeable)+ +instance ExtensionRequest GetDeviceMotionEvents where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 10+               let size__+                     = 4 + size (start_GetDeviceMotionEvents x) ++                         size (stop_GetDeviceMotionEvents x)+                         + size (device_id_GetDeviceMotionEvents x)+               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,+                                                               num_axes_GetDeviceMotionEventsReply+                                                               :: CARD8,+                                                               device_mode_GetDeviceMotionEventsReply+                                                               :: CARD8}+                                deriving (Show, Typeable)+ +instance Deserialize GetDeviceMotionEventsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_coords <- deserialize+               num_axes <- deserialize+               device_mode <- deserialize+               skip 18+               let _ = isCard32 length+               return+                 (MkGetDeviceMotionEventsReply num_coords num_axes device_mode)+ +data DeviceTimeCoord = MkDeviceTimeCoord{time_DeviceTimeCoord ::+                                         TIMESTAMP}+                     deriving (Show, Typeable)+ +instance Serialize DeviceTimeCoord where+        serialize x = do serialize (time_DeviceTimeCoord x)+        size x = size (time_DeviceTimeCoord x)+ +instance Deserialize DeviceTimeCoord where+        deserialize+          = do time <- deserialize+               return (MkDeviceTimeCoord time)+ +data ChangeKeyboardDevice = MkChangeKeyboardDevice{device_id_ChangeKeyboardDevice+                                                   :: CARD8}+                          deriving (Show, Typeable)+ +instance ExtensionRequest ChangeKeyboardDevice where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 11+               let size__ = 4 + size (device_id_ChangeKeyboardDevice x) + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_ChangeKeyboardDevice x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data ChangeKeyboardDeviceReply = MkChangeKeyboardDeviceReply{status_ChangeKeyboardDeviceReply+                                                             :: CARD8}+                               deriving (Show, Typeable)+ +instance Deserialize ChangeKeyboardDeviceReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               status <- deserialize+               skip 23+               let _ = isCard32 length+               return (MkChangeKeyboardDeviceReply status)+ +data ChangePointerDevice = MkChangePointerDevice{x_axis_ChangePointerDevice+                                                 :: CARD8,+                                                 y_axis_ChangePointerDevice :: CARD8,+                                                 device_id_ChangePointerDevice :: CARD8}+                         deriving (Show, Typeable)+ +instance ExtensionRequest ChangePointerDevice where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 12+               let size__+                     = 4 + size (x_axis_ChangePointerDevice x) ++                         size (y_axis_ChangePointerDevice x)+                         + size (device_id_ChangePointerDevice x)+                         + 1+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (x_axis_ChangePointerDevice x)+               serialize (y_axis_ChangePointerDevice x)+               serialize (device_id_ChangePointerDevice x)+               putSkip 1+               putSkip (requiredPadding size__)+ +data ChangePointerDeviceReply = MkChangePointerDeviceReply{status_ChangePointerDeviceReply+                                                           :: CARD8}+                              deriving (Show, Typeable)+ +instance Deserialize ChangePointerDeviceReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               status <- deserialize+               skip 23+               let _ = isCard32 length+               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,+                               classes_GrabDevice :: [EventClass]}+                deriving (Show, Typeable)+ +instance ExtensionRequest GrabDevice where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 13+               let size__+                     = 4 + size (grab_window_GrabDevice x) + size (time_GrabDevice x) ++                         size (num_classes_GrabDevice x)+                         + size (this_device_mode_GrabDevice x)+                         + size (other_device_mode_GrabDevice x)+                         + size (owner_events_GrabDevice x)+                         + size (device_id_GrabDevice x)+                         + 2+                         + sum (map size (classes_GrabDevice x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (grab_window_GrabDevice x)+               serialize (time_GrabDevice x)+               serialize (num_classes_GrabDevice x)+               serialize (this_device_mode_GrabDevice x)+               serialize (other_device_mode_GrabDevice x)+               serialize (owner_events_GrabDevice x)+               serialize (device_id_GrabDevice x)+               putSkip 2+               serializeList (classes_GrabDevice x)+               putSkip (requiredPadding size__)+ +data GrabDeviceReply = MkGrabDeviceReply{status_GrabDeviceReply ::+                                         CARD8}+                     deriving (Show, Typeable)+ +instance Deserialize GrabDeviceReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               status <- deserialize+               skip 23+               let _ = isCard32 length+               return (MkGrabDeviceReply status)+ +data UngrabDevice = MkUngrabDevice{time_UngrabDevice :: TIMESTAMP,+                                   device_id_UngrabDevice :: CARD8}+                  deriving (Show, Typeable)+ +instance ExtensionRequest UngrabDevice where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 14+               let size__+                     = 4 + size (time_UngrabDevice x) + size (device_id_UngrabDevice x)+               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,+                                     classes_GrabDeviceKey :: [EventClass]}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GrabDeviceKey where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 15+               let size__+                     = 4 + size (grab_window_GrabDeviceKey x) ++                         size (num_classes_GrabDeviceKey x)+                         + size (modifiers_GrabDeviceKey x)+                         + size (modifier_device_GrabDeviceKey x)+                         + size (grabbed_device_GrabDeviceKey x)+                         + size (key_GrabDeviceKey x)+                         + size (this_device_mode_GrabDeviceKey x)+                         + size (other_device_mode_GrabDeviceKey x)+                         + size (owner_events_GrabDeviceKey x)+                         + 2+                         + sum (map size (classes_GrabDeviceKey x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (grab_window_GrabDeviceKey x)+               serialize (num_classes_GrabDeviceKey x)+               serialize (modifiers_GrabDeviceKey x)+               serialize (modifier_device_GrabDeviceKey x)+               serialize (grabbed_device_GrabDeviceKey x)+               serialize (key_GrabDeviceKey x)+               serialize (this_device_mode_GrabDeviceKey x)+               serialize (other_device_mode_GrabDeviceKey x)+               serialize (owner_events_GrabDeviceKey x)+               putSkip 2+               serializeList (classes_GrabDeviceKey x)+               putSkip (requiredPadding size__)+ +data UngrabDeviceKey = MkUngrabDeviceKey{grabWindow_UngrabDeviceKey+                                         :: WINDOW,+                                         modifiers_UngrabDeviceKey :: CARD16,+                                         modifier_device_UngrabDeviceKey :: CARD8,+                                         key_UngrabDeviceKey :: CARD8,+                                         grabbed_device_UngrabDeviceKey :: CARD8}+                     deriving (Show, Typeable)+ +instance ExtensionRequest UngrabDeviceKey where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 16+               let size__+                     = 4 + size (grabWindow_UngrabDeviceKey x) ++                         size (modifiers_UngrabDeviceKey x)+                         + size (modifier_device_UngrabDeviceKey x)+                         + size (key_UngrabDeviceKey x)+                         + size (grabbed_device_UngrabDeviceKey x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (grabWindow_UngrabDeviceKey x)+               serialize (modifiers_UngrabDeviceKey x)+               serialize (modifier_device_UngrabDeviceKey x)+               serialize (key_UngrabDeviceKey x)+               serialize (grabbed_device_UngrabDeviceKey x)+               putSkip (requiredPadding size__)+ +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,+                                           classes_GrabDeviceButton :: [EventClass]}+                      deriving (Show, Typeable)+ +instance ExtensionRequest GrabDeviceButton where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 17+               let size__+                     = 4 + size (grab_window_GrabDeviceButton x) ++                         size (grabbed_device_GrabDeviceButton x)+                         + size (modifier_device_GrabDeviceButton x)+                         + size (num_classes_GrabDeviceButton x)+                         + size (modifiers_GrabDeviceButton x)+                         + size (this_device_mode_GrabDeviceButton x)+                         + size (other_device_mode_GrabDeviceButton x)+                         + size (button_GrabDeviceButton x)+                         + size (owner_events_GrabDeviceButton x)+                         + 2+                         + sum (map size (classes_GrabDeviceButton x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (grab_window_GrabDeviceButton x)+               serialize (grabbed_device_GrabDeviceButton x)+               serialize (modifier_device_GrabDeviceButton x)+               serialize (num_classes_GrabDeviceButton x)+               serialize (modifiers_GrabDeviceButton x)+               serialize (this_device_mode_GrabDeviceButton x)+               serialize (other_device_mode_GrabDeviceButton x)+               serialize (button_GrabDeviceButton x)+               serialize (owner_events_GrabDeviceButton x)+               putSkip 2+               serializeList (classes_GrabDeviceButton x)+               putSkip (requiredPadding size__)+ +data UngrabDeviceButton = MkUngrabDeviceButton{grab_window_UngrabDeviceButton+                                               :: WINDOW,+                                               modifiers_UngrabDeviceButton :: CARD16,+                                               modifier_device_UngrabDeviceButton :: CARD8,+                                               button_UngrabDeviceButton :: CARD8,+                                               grabbed_device_UngrabDeviceButton :: CARD8}+                        deriving (Show, Typeable)+ +instance ExtensionRequest UngrabDeviceButton where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 18+               let size__+                     = 4 + size (grab_window_UngrabDeviceButton x) ++                         size (modifiers_UngrabDeviceButton x)+                         + size (modifier_device_UngrabDeviceButton x)+                         + size (button_UngrabDeviceButton x)+                         + size (grabbed_device_UngrabDeviceButton x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (grab_window_UngrabDeviceButton x)+               serialize (modifiers_UngrabDeviceButton x)+               serialize (modifier_device_UngrabDeviceButton x)+               serialize (button_UngrabDeviceButton x)+               serialize (grabbed_device_UngrabDeviceButton x)+               putSkip (requiredPadding size__)+ +data AllowDeviceEvents = MkAllowDeviceEvents{time_AllowDeviceEvents+                                             :: TIMESTAMP,+                                             mode_AllowDeviceEvents :: CARD8,+                                             device_id_AllowDeviceEvents :: CARD8}+                       deriving (Show, Typeable)+ +instance ExtensionRequest AllowDeviceEvents where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 19+               let size__+                     = 4 + size (time_AllowDeviceEvents x) ++                         size (mode_AllowDeviceEvents x)+                         + size (device_id_AllowDeviceEvents x)+               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}+                    deriving (Show, Typeable)+ +instance ExtensionRequest GetDeviceFocus where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 20+               let size__ = 4 + size (device_id_GetDeviceFocus x) + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_GetDeviceFocus x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data GetDeviceFocusReply = MkGetDeviceFocusReply{focus_GetDeviceFocusReply+                                                 :: WINDOW,+                                                 time_GetDeviceFocusReply :: TIMESTAMP,+                                                 revert_to_GetDeviceFocusReply :: CARD8}+                         deriving (Show, Typeable)+ +instance Deserialize GetDeviceFocusReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               focus <- deserialize+               time <- deserialize+               revert_to <- deserialize+               skip 15+               let _ = isCard32 length+               return (MkGetDeviceFocusReply focus time revert_to)+ +data SetDeviceFocus = MkSetDeviceFocus{focus_SetDeviceFocus ::+                                       WINDOW,+                                       time_SetDeviceFocus :: TIMESTAMP,+                                       revert_to_SetDeviceFocus :: CARD8,+                                       device_id_SetDeviceFocus :: CARD8}+                    deriving (Show, Typeable)+ +instance ExtensionRequest SetDeviceFocus where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 21+               let size__+                     = 4 + size (focus_SetDeviceFocus x) + size (time_SetDeviceFocus x)+                         + size (revert_to_SetDeviceFocus x)+                         + size (device_id_SetDeviceFocus x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (focus_SetDeviceFocus x)+               serialize (time_SetDeviceFocus x)+               serialize (revert_to_SetDeviceFocus x)+               serialize (device_id_SetDeviceFocus x)+               putSkip (requiredPadding size__)+ +data GetFeedbackControl = MkGetFeedbackControl{device_id_GetFeedbackControl+                                               :: CARD8}+                        deriving (Show, Typeable)+ +instance ExtensionRequest GetFeedbackControl where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 22+               let size__ = 4 + size (device_id_GetFeedbackControl x) + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_GetFeedbackControl x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data GetFeedbackControlReply = MkGetFeedbackControlReply{num_feedback_GetFeedbackControlReply+                                                         :: CARD16}+                             deriving (Show, Typeable)+ +instance Deserialize GetFeedbackControlReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_feedback <- deserialize+               skip 22+               let _ = isCard32 length+               return (MkGetFeedbackControlReply num_feedback)+ +data FeedbackState = MkFeedbackState{class_id_FeedbackState ::+                                     CARD8,+                                     id_FeedbackState :: CARD8, len_FeedbackState :: CARD16}+                   deriving (Show, Typeable)+ +instance Serialize FeedbackState where+        serialize x+          = do serialize (class_id_FeedbackState x)+               serialize (id_FeedbackState x)+               serialize (len_FeedbackState x)+        size x+          = size (class_id_FeedbackState x) + size (id_FeedbackState x) ++              size (len_FeedbackState x)+ +instance Deserialize FeedbackState where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               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]}+                      deriving (Show, Typeable)+ +instance Serialize KbdFeedbackState where+        serialize x+          = do serialize (class_id_KbdFeedbackState x)+               serialize (id_KbdFeedbackState x)+               serialize (len_KbdFeedbackState x)+               serialize (pitch_KbdFeedbackState x)+               serialize (duration_KbdFeedbackState x)+               serialize (led_mask_KbdFeedbackState x)+               serialize (led_values_KbdFeedbackState x)+               serialize (global_auto_repeat_KbdFeedbackState x)+               serialize (click_KbdFeedbackState x)+               serialize (percent_KbdFeedbackState x)+               putSkip 1+               serializeList (auto_repeats_KbdFeedbackState x)+        size x+          = size (class_id_KbdFeedbackState x) + size (id_KbdFeedbackState x)+              + size (len_KbdFeedbackState x)+              + size (pitch_KbdFeedbackState x)+              + size (duration_KbdFeedbackState x)+              + size (led_mask_KbdFeedbackState x)+              + size (led_values_KbdFeedbackState x)+              + size (global_auto_repeat_KbdFeedbackState x)+              + size (click_KbdFeedbackState x)+              + size (percent_KbdFeedbackState x)+              + 1+              + sum (map size (auto_repeats_KbdFeedbackState x))+ +instance Deserialize KbdFeedbackState where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               pitch <- deserialize+               duration <- deserialize+               led_mask <- deserialize+               led_values <- deserialize+               global_auto_repeat <- deserialize+               click <- deserialize+               percent <- deserialize+               skip 1+               auto_repeats <- deserializeList (fromIntegral 32)+               return+                 (MkKbdFeedbackState class_id id len pitch duration led_mask+                    led_values+                    global_auto_repeat+                    click+                    percent+                    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}+                      deriving (Show, Typeable)+ +instance Serialize PtrFeedbackState where+        serialize x+          = do serialize (class_id_PtrFeedbackState x)+               serialize (id_PtrFeedbackState x)+               serialize (len_PtrFeedbackState x)+               putSkip 2+               serialize (accel_num_PtrFeedbackState x)+               serialize (accel_denom_PtrFeedbackState x)+               serialize (threshold_PtrFeedbackState x)+        size x+          = size (class_id_PtrFeedbackState x) + size (id_PtrFeedbackState x)+              + size (len_PtrFeedbackState x)+              + 2+              + size (accel_num_PtrFeedbackState x)+              + size (accel_denom_PtrFeedbackState x)+              + size (threshold_PtrFeedbackState x)+ +instance Deserialize PtrFeedbackState where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               skip 2+               accel_num <- deserialize+               accel_denom <- deserialize+               threshold <- deserialize+               return+                 (MkPtrFeedbackState class_id id len accel_num accel_denom+                    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}+                          deriving (Show, Typeable)+ +instance Serialize IntegerFeedbackState where+        serialize x+          = do serialize (class_id_IntegerFeedbackState x)+               serialize (id_IntegerFeedbackState x)+               serialize (len_IntegerFeedbackState x)+               serialize (resolution_IntegerFeedbackState x)+               serialize (min_value_IntegerFeedbackState x)+               serialize (max_value_IntegerFeedbackState x)+        size x+          = size (class_id_IntegerFeedbackState x) ++              size (id_IntegerFeedbackState x)+              + size (len_IntegerFeedbackState x)+              + size (resolution_IntegerFeedbackState x)+              + size (min_value_IntegerFeedbackState x)+              + size (max_value_IntegerFeedbackState x)+ +instance Deserialize IntegerFeedbackState where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               resolution <- deserialize+               min_value <- deserialize+               max_value <- deserialize+               return+                 (MkIntegerFeedbackState class_id id len resolution min_value+                    max_value)+ +data StringFeedbackState = MkStringFeedbackState{class_id_StringFeedbackState+                                                 :: CARD8,+                                                 id_StringFeedbackState :: CARD8,+                                                 len_StringFeedbackState :: CARD16,+                                                 max_symbols_StringFeedbackState :: CARD16,+                                                 num_keysyms_StringFeedbackState :: CARD16,+                                                 keysyms_StringFeedbackState :: [KEYSYM]}+                         deriving (Show, Typeable)+ +instance Serialize StringFeedbackState where+        serialize x+          = do serialize (class_id_StringFeedbackState x)+               serialize (id_StringFeedbackState x)+               serialize (len_StringFeedbackState x)+               serialize (max_symbols_StringFeedbackState x)+               serialize (num_keysyms_StringFeedbackState x)+               serializeList (keysyms_StringFeedbackState x)+        size x+          = size (class_id_StringFeedbackState x) ++              size (id_StringFeedbackState x)+              + size (len_StringFeedbackState x)+              + size (max_symbols_StringFeedbackState x)+              + size (num_keysyms_StringFeedbackState x)+              + sum (map size (keysyms_StringFeedbackState x))+ +instance Deserialize StringFeedbackState where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               max_symbols <- deserialize+               num_keysyms <- deserialize+               keysyms <- deserializeList (fromIntegral num_keysyms)+               return+                 (MkStringFeedbackState class_id id len max_symbols num_keysyms+                    keysyms)+ +data BellFeedbackState = MkBellFeedbackState{class_id_BellFeedbackState+                                             :: CARD8,+                                             id_BellFeedbackState :: CARD8,+                                             len_BellFeedbackState :: CARD16,+                                             percent_BellFeedbackState :: CARD8,+                                             pitch_BellFeedbackState :: CARD16,+                                             duration_BellFeedbackState :: CARD16}+                       deriving (Show, Typeable)+ +instance Serialize BellFeedbackState where+        serialize x+          = do serialize (class_id_BellFeedbackState x)+               serialize (id_BellFeedbackState x)+               serialize (len_BellFeedbackState x)+               serialize (percent_BellFeedbackState x)+               putSkip 3+               serialize (pitch_BellFeedbackState x)+               serialize (duration_BellFeedbackState x)+        size x+          = size (class_id_BellFeedbackState x) ++              size (id_BellFeedbackState x)+              + size (len_BellFeedbackState x)+              + size (percent_BellFeedbackState x)+              + 3+              + size (pitch_BellFeedbackState x)+              + size (duration_BellFeedbackState x)+ +instance Deserialize BellFeedbackState where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               percent <- deserialize+               skip 3+               pitch <- deserialize+               duration <- deserialize+               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}+                      deriving (Show, Typeable)+ +instance Serialize LedFeedbackState where+        serialize x+          = do serialize (class_id_LedFeedbackState x)+               serialize (id_LedFeedbackState x)+               serialize (len_LedFeedbackState x)+               serialize (led_mask_LedFeedbackState x)+               serialize (led_values_LedFeedbackState x)+        size x+          = size (class_id_LedFeedbackState x) + size (id_LedFeedbackState x)+              + size (len_LedFeedbackState x)+              + size (led_mask_LedFeedbackState x)+              + size (led_values_LedFeedbackState x)+ +instance Deserialize LedFeedbackState where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               led_mask <- deserialize+               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}+                 deriving (Show, Typeable)+ +instance Serialize FeedbackCtl where+        serialize x+          = do serialize (class_id_FeedbackCtl x)+               serialize (id_FeedbackCtl x)+               serialize (len_FeedbackCtl x)+        size x+          = size (class_id_FeedbackCtl x) + size (id_FeedbackCtl x) ++              size (len_FeedbackCtl x)+ +instance Deserialize FeedbackCtl where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               return (MkFeedbackCtl class_id id len)+ +data KbdFeedbackCtl = MkKbdFeedbackCtl{class_id_KbdFeedbackCtl ::+                                       CARD8,+                                       id_KbdFeedbackCtl :: CARD8, len_KbdFeedbackCtl :: CARD16,+                                       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}+                    deriving (Show, Typeable)+ +instance Serialize KbdFeedbackCtl where+        serialize x+          = do serialize (class_id_KbdFeedbackCtl x)+               serialize (id_KbdFeedbackCtl x)+               serialize (len_KbdFeedbackCtl x)+               serialize (key_KbdFeedbackCtl x)+               serialize (auto_repeat_mode_KbdFeedbackCtl x)+               serialize (key_click_percent_KbdFeedbackCtl x)+               serialize (bell_percent_KbdFeedbackCtl x)+               serialize (bell_pitch_KbdFeedbackCtl x)+               serialize (bell_duration_KbdFeedbackCtl x)+               serialize (led_mask_KbdFeedbackCtl x)+               serialize (led_values_KbdFeedbackCtl x)+        size x+          = size (class_id_KbdFeedbackCtl x) + size (id_KbdFeedbackCtl x) ++              size (len_KbdFeedbackCtl x)+              + size (key_KbdFeedbackCtl x)+              + size (auto_repeat_mode_KbdFeedbackCtl x)+              + size (key_click_percent_KbdFeedbackCtl x)+              + size (bell_percent_KbdFeedbackCtl x)+              + size (bell_pitch_KbdFeedbackCtl x)+              + size (bell_duration_KbdFeedbackCtl x)+              + size (led_mask_KbdFeedbackCtl x)+              + size (led_values_KbdFeedbackCtl x)+ +instance Deserialize KbdFeedbackCtl where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               key <- deserialize+               auto_repeat_mode <- deserialize+               key_click_percent <- deserialize+               bell_percent <- deserialize+               bell_pitch <- deserialize+               bell_duration <- deserialize+               led_mask <- deserialize+               led_values <- deserialize+               return+                 (MkKbdFeedbackCtl class_id id len key auto_repeat_mode+                    key_click_percent+                    bell_percent+                    bell_pitch+                    bell_duration+                    led_mask+                    led_values)+ +data PtrFeedbackCtl = MkPtrFeedbackCtl{class_id_PtrFeedbackCtl ::+                                       CARD8,+                                       id_PtrFeedbackCtl :: CARD8, len_PtrFeedbackCtl :: CARD16,+                                       num_PtrFeedbackCtl :: INT16, denom_PtrFeedbackCtl :: INT16,+                                       threshold_PtrFeedbackCtl :: INT16}+                    deriving (Show, Typeable)+ +instance Serialize PtrFeedbackCtl where+        serialize x+          = do serialize (class_id_PtrFeedbackCtl x)+               serialize (id_PtrFeedbackCtl x)+               serialize (len_PtrFeedbackCtl x)+               putSkip 2+               serialize (num_PtrFeedbackCtl x)+               serialize (denom_PtrFeedbackCtl x)+               serialize (threshold_PtrFeedbackCtl x)+        size x+          = size (class_id_PtrFeedbackCtl x) + size (id_PtrFeedbackCtl x) ++              size (len_PtrFeedbackCtl x)+              + 2+              + size (num_PtrFeedbackCtl x)+              + size (denom_PtrFeedbackCtl x)+              + size (threshold_PtrFeedbackCtl x)+ +instance Deserialize PtrFeedbackCtl where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               skip 2+               num <- deserialize+               denom <- deserialize+               threshold <- deserialize+               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}+                        deriving (Show, Typeable)+ +instance Serialize IntegerFeedbackCtl where+        serialize x+          = do serialize (class_id_IntegerFeedbackCtl x)+               serialize (id_IntegerFeedbackCtl x)+               serialize (len_IntegerFeedbackCtl x)+               serialize (int_to_display_IntegerFeedbackCtl x)+        size x+          = size (class_id_IntegerFeedbackCtl x) ++              size (id_IntegerFeedbackCtl x)+              + size (len_IntegerFeedbackCtl x)+              + size (int_to_display_IntegerFeedbackCtl x)+ +instance Deserialize IntegerFeedbackCtl where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               int_to_display <- deserialize+               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,+                                             keysyms_StringFeedbackCtl :: [KEYSYM]}+                       deriving (Show, Typeable)+ +instance Serialize StringFeedbackCtl where+        serialize x+          = do serialize (class_id_StringFeedbackCtl x)+               serialize (id_StringFeedbackCtl x)+               serialize (len_StringFeedbackCtl x)+               putSkip 2+               serialize (num_keysyms_StringFeedbackCtl x)+               serializeList (keysyms_StringFeedbackCtl x)+        size x+          = size (class_id_StringFeedbackCtl x) ++              size (id_StringFeedbackCtl x)+              + size (len_StringFeedbackCtl x)+              + 2+              + size (num_keysyms_StringFeedbackCtl x)+              + sum (map size (keysyms_StringFeedbackCtl x))+ +instance Deserialize StringFeedbackCtl where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               skip 2+               num_keysyms <- deserialize+               keysyms <- deserializeList (fromIntegral num_keysyms)+               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}+                     deriving (Show, Typeable)+ +instance Serialize BellFeedbackCtl where+        serialize x+          = do serialize (class_id_BellFeedbackCtl x)+               serialize (id_BellFeedbackCtl x)+               serialize (len_BellFeedbackCtl x)+               serialize (percent_BellFeedbackCtl x)+               putSkip 3+               serialize (pitch_BellFeedbackCtl x)+               serialize (duration_BellFeedbackCtl x)+        size x+          = size (class_id_BellFeedbackCtl x) + size (id_BellFeedbackCtl x) ++              size (len_BellFeedbackCtl x)+              + size (percent_BellFeedbackCtl x)+              + 3+              + size (pitch_BellFeedbackCtl x)+              + size (duration_BellFeedbackCtl x)+ +instance Deserialize BellFeedbackCtl where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               percent <- deserialize+               skip 3+               pitch <- deserialize+               duration <- deserialize+               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}+                    deriving (Show, Typeable)+ +instance Serialize LedFeedbackCtl where+        serialize x+          = do serialize (class_id_LedFeedbackCtl x)+               serialize (id_LedFeedbackCtl x)+               serialize (len_LedFeedbackCtl x)+               serialize (led_mask_LedFeedbackCtl x)+               serialize (led_values_LedFeedbackCtl x)+        size x+          = size (class_id_LedFeedbackCtl x) + size (id_LedFeedbackCtl x) ++              size (len_LedFeedbackCtl x)+              + size (led_mask_LedFeedbackCtl x)+              + size (led_values_LedFeedbackCtl x)+ +instance Deserialize LedFeedbackCtl where+        deserialize+          = do class_id <- deserialize+               id <- deserialize+               len <- deserialize+               led_mask <- deserialize+               led_values <- deserialize+               return (MkLedFeedbackCtl class_id id len led_mask led_values)+ +data GetDeviceKeyMapping = MkGetDeviceKeyMapping{device_id_GetDeviceKeyMapping+                                                 :: CARD8,+                                                 first_keycode_GetDeviceKeyMapping :: KeyCode,+                                                 count_GetDeviceKeyMapping :: CARD8}+                         deriving (Show, Typeable)+ +instance ExtensionRequest GetDeviceKeyMapping where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 24+               let size__+                     = 4 + size (device_id_GetDeviceKeyMapping x) ++                         size (first_keycode_GetDeviceKeyMapping x)+                         + size (count_GetDeviceKeyMapping x)+               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,+                                                           keysyms_GetDeviceKeyMappingReply ::+                                                           [KEYSYM]}+                              deriving (Show, Typeable)+ +instance Deserialize GetDeviceKeyMappingReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               keysyms_per_keycode <- deserialize+               skip 23+               keysyms <- deserializeList (fromIntegral length)+               let _ = isCard32 length+               return (MkGetDeviceKeyMappingReply keysyms_per_keycode keysyms)+ +data ChangeDeviceKeyMapping = MkChangeDeviceKeyMapping{device_id_ChangeDeviceKeyMapping+                                                       :: CARD8,+                                                       first_keycode_ChangeDeviceKeyMapping ::+                                                       KeyCode,+                                                       keysyms_per_keycode_ChangeDeviceKeyMapping ::+                                                       CARD8,+                                                       keycode_count_ChangeDeviceKeyMapping ::+                                                       CARD8,+                                                       keysyms_ChangeDeviceKeyMapping :: [KEYSYM]}+                            deriving (Show, Typeable)+ +instance ExtensionRequest ChangeDeviceKeyMapping where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 25+               let size__+                     = 4 + size (device_id_ChangeDeviceKeyMapping x) ++                         size (first_keycode_ChangeDeviceKeyMapping x)+                         + size (keysyms_per_keycode_ChangeDeviceKeyMapping x)+                         + size (keycode_count_ChangeDeviceKeyMapping x)+                         + sum (map size (keysyms_ChangeDeviceKeyMapping x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_ChangeDeviceKeyMapping x)+               serialize (first_keycode_ChangeDeviceKeyMapping x)+               serialize (keysyms_per_keycode_ChangeDeviceKeyMapping x)+               serialize (keycode_count_ChangeDeviceKeyMapping x)+               serializeList (keysyms_ChangeDeviceKeyMapping x)+               putSkip (requiredPadding size__)+ +data GetDeviceModifierMapping = MkGetDeviceModifierMapping{device_id_GetDeviceModifierMapping+                                                           :: CARD8}+                              deriving (Show, Typeable)+ +instance ExtensionRequest GetDeviceModifierMapping where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 26+               let size__ = 4 + size (device_id_GetDeviceModifierMapping x) + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_GetDeviceModifierMapping x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data GetDeviceModifierMappingReply = MkGetDeviceModifierMappingReply{keycodes_per_modifier_GetDeviceModifierMappingReply+                                                                     :: CARD8,+                                                                     keymaps_GetDeviceModifierMappingReply+                                                                     :: [CARD8]}+                                   deriving (Show, Typeable)+ +instance Deserialize GetDeviceModifierMappingReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               keycodes_per_modifier <- deserialize+               skip 23+               keymaps <- deserializeList+                            (fromIntegral (fromIntegral (keycodes_per_modifier * 8)))+               let _ = isCard32 length+               return+                 (MkGetDeviceModifierMappingReply keycodes_per_modifier keymaps)+ +data SetDeviceModifierMapping = MkSetDeviceModifierMapping{device_id_SetDeviceModifierMapping+                                                           :: CARD8,+                                                           keycodes_per_modifier_SetDeviceModifierMapping+                                                           :: CARD8,+                                                           keymaps_SetDeviceModifierMapping ::+                                                           [CARD8]}+                              deriving (Show, Typeable)+ +instance ExtensionRequest SetDeviceModifierMapping where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 27+               let size__+                     = 4 + size (device_id_SetDeviceModifierMapping x) ++                         size (keycodes_per_modifier_SetDeviceModifierMapping x)+                         + 1+                         + sum (map size (keymaps_SetDeviceModifierMapping x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_SetDeviceModifierMapping x)+               serialize (keycodes_per_modifier_SetDeviceModifierMapping x)+               putSkip 1+               serializeList (keymaps_SetDeviceModifierMapping x)+               putSkip (requiredPadding size__)+ +data SetDeviceModifierMappingReply = MkSetDeviceModifierMappingReply{status_SetDeviceModifierMappingReply+                                                                     :: CARD8}+                                   deriving (Show, Typeable)+ +instance Deserialize SetDeviceModifierMappingReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               status <- deserialize+               skip 23+               let _ = isCard32 length+               return (MkSetDeviceModifierMappingReply status)+ +data GetDeviceButtonMapping = MkGetDeviceButtonMapping{device_id_GetDeviceButtonMapping+                                                       :: CARD8}+                            deriving (Show, Typeable)+ +instance ExtensionRequest GetDeviceButtonMapping where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 28+               let size__ = 4 + size (device_id_GetDeviceButtonMapping x) + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_GetDeviceButtonMapping x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data GetDeviceButtonMappingReply = MkGetDeviceButtonMappingReply{map_size_GetDeviceButtonMappingReply+                                                                 :: CARD8,+                                                                 map_GetDeviceButtonMappingReply ::+                                                                 [CARD8]}+                                 deriving (Show, Typeable)+ +instance Deserialize GetDeviceButtonMappingReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               map_size <- deserialize+               skip 23+               map <- deserializeList (fromIntegral map_size)+               let _ = isCard32 length+               return (MkGetDeviceButtonMappingReply map_size map)+ +data SetDeviceButtonMapping = MkSetDeviceButtonMapping{device_id_SetDeviceButtonMapping+                                                       :: CARD8,+                                                       map_size_SetDeviceButtonMapping :: CARD8,+                                                       map_SetDeviceButtonMapping :: [CARD8]}+                            deriving (Show, Typeable)+ +instance ExtensionRequest SetDeviceButtonMapping where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 29+               let size__+                     = 4 + size (device_id_SetDeviceButtonMapping x) ++                         size (map_size_SetDeviceButtonMapping x)+                         + 2+                         + sum (map size (map_SetDeviceButtonMapping x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_SetDeviceButtonMapping x)+               serialize (map_size_SetDeviceButtonMapping x)+               putSkip 2+               serializeList (map_SetDeviceButtonMapping x)+               putSkip (requiredPadding size__)+ +data SetDeviceButtonMappingReply = MkSetDeviceButtonMappingReply{status_SetDeviceButtonMappingReply+                                                                 :: CARD8}+                                 deriving (Show, Typeable)+ +instance Deserialize SetDeviceButtonMappingReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               status <- deserialize+               skip 23+               let _ = isCard32 length+               return (MkSetDeviceButtonMappingReply status)+ +data QueryDeviceState = MkQueryDeviceState{device_id_QueryDeviceState+                                           :: CARD8}+                      deriving (Show, Typeable)+ +instance ExtensionRequest QueryDeviceState where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 30+               let size__ = 4 + size (device_id_QueryDeviceState x) + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_QueryDeviceState x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data QueryDeviceStateReply = MkQueryDeviceStateReply{num_classes_QueryDeviceStateReply+                                                     :: CARD8}+                           deriving (Show, Typeable)+ +instance Deserialize QueryDeviceStateReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_classes <- deserialize+               skip 23+               let _ = isCard32 length+               return (MkQueryDeviceStateReply num_classes)+ +data InputState = MkInputState{class_id_InputState :: CARD8,+                               len_InputState :: CARD8, num_items_InputState :: CARD8}+                deriving (Show, Typeable)+ +instance Serialize InputState where+        serialize x+          = do serialize (class_id_InputState x)+               serialize (len_InputState x)+               serialize (num_items_InputState x)+        size x+          = size (class_id_InputState x) + size (len_InputState x) ++              size (num_items_InputState x)+ +instance Deserialize InputState where+        deserialize+          = do class_id <- deserialize+               len <- deserialize+               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]}+              deriving (Show, Typeable)+ +instance Serialize KeyState where+        serialize x+          = do serialize (class_id_KeyState x)+               serialize (len_KeyState x)+               serialize (num_keys_KeyState x)+               putSkip 1+               serializeList (keys_KeyState x)+        size x+          = size (class_id_KeyState x) + size (len_KeyState x) ++              size (num_keys_KeyState x)+              + 1+              + sum (map size (keys_KeyState x))+ +instance Deserialize KeyState where+        deserialize+          = do class_id <- deserialize+               len <- deserialize+               num_keys <- deserialize+               skip 1+               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]}+                 deriving (Show, Typeable)+ +instance Serialize ButtonState where+        serialize x+          = do serialize (class_id_ButtonState x)+               serialize (len_ButtonState x)+               serialize (num_buttons_ButtonState x)+               putSkip 1+               serializeList (buttons_ButtonState x)+        size x+          = size (class_id_ButtonState x) + size (len_ButtonState x) ++              size (num_buttons_ButtonState x)+              + 1+              + sum (map size (buttons_ButtonState x))+ +instance Deserialize ButtonState where+        deserialize+          = do class_id <- deserialize+               len <- deserialize+               num_buttons <- deserialize+               skip 1+               buttons <- deserializeList (fromIntegral 32)+               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]}+                   deriving (Show, Typeable)+ +instance Serialize ValuatorState where+        serialize x+          = do serialize (class_id_ValuatorState x)+               serialize (len_ValuatorState x)+               serialize (num_valuators_ValuatorState x)+               serialize (mode_ValuatorState x)+               serializeList (valuators_ValuatorState x)+        size x+          = size (class_id_ValuatorState x) + size (len_ValuatorState x) ++              size (num_valuators_ValuatorState x)+              + size (mode_ValuatorState x)+              + sum (map size (valuators_ValuatorState x))+ +instance Deserialize ValuatorState where+        deserialize+          = do class_id <- deserialize+               len <- deserialize+               num_valuators <- deserialize+               mode <- deserialize+               valuators <- deserializeList (fromIntegral num_valuators)+               return (MkValuatorState class_id len num_valuators mode valuators)+ +data SendExtensionEvent = MkSendExtensionEvent{destination_SendExtensionEvent+                                               :: WINDOW,+                                               device_id_SendExtensionEvent :: CARD8,+                                               propagate_SendExtensionEvent :: BOOL,+                                               num_classes_SendExtensionEvent :: CARD16,+                                               num_events_SendExtensionEvent :: CARD8,+                                               events_SendExtensionEvent :: [CChar],+                                               classes_SendExtensionEvent :: [EventClass]}+                        deriving (Show, Typeable)+ +instance ExtensionRequest SendExtensionEvent where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 31+               let size__+                     = 4 + size (destination_SendExtensionEvent x) ++                         size (device_id_SendExtensionEvent x)+                         + size (propagate_SendExtensionEvent x)+                         + size (num_classes_SendExtensionEvent x)+                         + size (num_events_SendExtensionEvent x)+                         + 3+                         + sum (map size (events_SendExtensionEvent x))+                         + sum (map size (classes_SendExtensionEvent x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (destination_SendExtensionEvent x)+               serialize (device_id_SendExtensionEvent x)+               serialize (propagate_SendExtensionEvent x)+               serialize (num_classes_SendExtensionEvent x)+               serialize (num_events_SendExtensionEvent x)+               putSkip 3+               serializeList (events_SendExtensionEvent x)+               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}+                deriving (Show, Typeable)+ +instance ExtensionRequest DeviceBell where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 32+               let size__+                     = 4 + size (device_id_DeviceBell x) ++                         size (feedback_id_DeviceBell x)+                         + size (feedback_class_DeviceBell x)+                         + size (percent_DeviceBell x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_DeviceBell x)+               serialize (feedback_id_DeviceBell x)+               serialize (feedback_class_DeviceBell x)+               serialize (percent_DeviceBell x)+               putSkip (requiredPadding size__)+ +data SetDeviceValuators = MkSetDeviceValuators{device_id_SetDeviceValuators+                                               :: CARD8,+                                               first_valuator_SetDeviceValuators :: CARD8,+                                               num_valuators_SetDeviceValuators :: CARD8,+                                               valuators_SetDeviceValuators :: [INT32]}+                        deriving (Show, Typeable)+ +instance ExtensionRequest SetDeviceValuators where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 33+               let size__+                     = 4 + size (device_id_SetDeviceValuators x) ++                         size (first_valuator_SetDeviceValuators x)+                         + size (num_valuators_SetDeviceValuators x)+                         + 1+                         + sum (map size (valuators_SetDeviceValuators x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_id_SetDeviceValuators x)+               serialize (first_valuator_SetDeviceValuators x)+               serialize (num_valuators_SetDeviceValuators x)+               putSkip 1+               serializeList (valuators_SetDeviceValuators x)+               putSkip (requiredPadding size__)+ +data SetDeviceValuatorsReply = MkSetDeviceValuatorsReply{status_SetDeviceValuatorsReply+                                                         :: CARD8}+                             deriving (Show, Typeable)+ +instance Deserialize SetDeviceValuatorsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               status <- deserialize+               skip 23+               let _ = isCard32 length+               return (MkSetDeviceValuatorsReply status)+ +data GetDeviceControl = MkGetDeviceControl{control_id_GetDeviceControl+                                           :: CARD16,+                                           device_id_GetDeviceControl :: CARD8}+                      deriving (Show, Typeable)+ +instance ExtensionRequest GetDeviceControl where+        extensionId _ = "XInputExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 34+               let size__+                     = 4 + size (control_id_GetDeviceControl x) ++                         size (device_id_GetDeviceControl x)+                         + 1+               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}+                           deriving (Show, Typeable)+ +instance Deserialize GetDeviceControlReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               status <- deserialize+               skip 23+               let _ = isCard32 length+               return (MkGetDeviceControlReply status)+ +data DeviceState = MkDeviceState{control_id_DeviceState :: CARD16,+                                 len_DeviceState :: CARD16}+                 deriving (Show, Typeable)+ +instance Serialize DeviceState where+        serialize x+          = do serialize (control_id_DeviceState x)+               serialize (len_DeviceState x)+        size x = size (control_id_DeviceState x) + size (len_DeviceState x)+ +instance Deserialize DeviceState where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               return (MkDeviceState control_id len)+ +data DeviceResolutionState = MkDeviceResolutionState{control_id_DeviceResolutionState+                                                     :: CARD16,+                                                     len_DeviceResolutionState :: CARD16,+                                                     num_valuators_DeviceResolutionState :: CARD32,+                                                     resolution_values_DeviceResolutionState ::+                                                     [CARD32],+                                                     resolution_min_DeviceResolutionState ::+                                                     [CARD32],+                                                     resolution_max_DeviceResolutionState ::+                                                     [CARD32]}+                           deriving (Show, Typeable)+ +instance Serialize DeviceResolutionState where+        serialize x+          = do serialize (control_id_DeviceResolutionState x)+               serialize (len_DeviceResolutionState x)+               serialize (num_valuators_DeviceResolutionState x)+               serializeList (resolution_values_DeviceResolutionState x)+               serializeList (resolution_min_DeviceResolutionState x)+               serializeList (resolution_max_DeviceResolutionState x)+        size x+          = size (control_id_DeviceResolutionState x) ++              size (len_DeviceResolutionState x)+              + size (num_valuators_DeviceResolutionState x)+              + sum (map size (resolution_values_DeviceResolutionState x))+              + sum (map size (resolution_min_DeviceResolutionState x))+              + sum (map size (resolution_max_DeviceResolutionState x))+ +instance Deserialize DeviceResolutionState where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               num_valuators <- deserialize+               resolution_values <- deserializeList (fromIntegral num_valuators)+               resolution_min <- deserializeList (fromIntegral num_valuators)+               resolution_max <- deserializeList (fromIntegral num_valuators)+               return+                 (MkDeviceResolutionState control_id len num_valuators+                    resolution_values+                    resolution_min+                    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}+                         deriving (Show, Typeable)+ +instance Serialize DeviceAbsCalibState where+        serialize x+          = do serialize (control_id_DeviceAbsCalibState x)+               serialize (len_DeviceAbsCalibState x)+               serialize (min_x_DeviceAbsCalibState x)+               serialize (max_x_DeviceAbsCalibState x)+               serialize (min_y_DeviceAbsCalibState x)+               serialize (max_y_DeviceAbsCalibState x)+               serialize (flip_x_DeviceAbsCalibState x)+               serialize (flip_y_DeviceAbsCalibState x)+               serialize (rotation_DeviceAbsCalibState x)+               serialize (button_threshold_DeviceAbsCalibState x)+        size x+          = size (control_id_DeviceAbsCalibState x) ++              size (len_DeviceAbsCalibState x)+              + size (min_x_DeviceAbsCalibState x)+              + size (max_x_DeviceAbsCalibState x)+              + size (min_y_DeviceAbsCalibState x)+              + size (max_y_DeviceAbsCalibState x)+              + size (flip_x_DeviceAbsCalibState x)+              + size (flip_y_DeviceAbsCalibState x)+              + size (rotation_DeviceAbsCalibState x)+              + size (button_threshold_DeviceAbsCalibState x)+ +instance Deserialize DeviceAbsCalibState where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               min_x <- deserialize+               max_x <- deserialize+               min_y <- deserialize+               max_y <- deserialize+               flip_x <- deserialize+               flip_y <- deserialize+               rotation <- deserialize+               button_threshold <- deserialize+               return+                 (MkDeviceAbsCalibState control_id len min_x max_x min_y max_y+                    flip_x+                    flip_y+                    rotation+                    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}+                        deriving (Show, Typeable)+ +instance Serialize DeviceAbsAreaState where+        serialize x+          = do serialize (control_id_DeviceAbsAreaState x)+               serialize (len_DeviceAbsAreaState x)+               serialize (offset_x_DeviceAbsAreaState x)+               serialize (offset_y_DeviceAbsAreaState x)+               serialize (width_DeviceAbsAreaState x)+               serialize (height_DeviceAbsAreaState x)+               serialize (screen_DeviceAbsAreaState x)+               serialize (following_DeviceAbsAreaState x)+        size x+          = size (control_id_DeviceAbsAreaState x) ++              size (len_DeviceAbsAreaState x)+              + size (offset_x_DeviceAbsAreaState x)+              + size (offset_y_DeviceAbsAreaState x)+              + size (width_DeviceAbsAreaState x)+              + size (height_DeviceAbsAreaState x)+              + size (screen_DeviceAbsAreaState x)+              + size (following_DeviceAbsAreaState x)+ +instance Deserialize DeviceAbsAreaState where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               offset_x <- deserialize+               offset_y <- deserialize+               width <- deserialize+               height <- deserialize+               screen <- deserialize+               following <- deserialize+               return+                 (MkDeviceAbsAreaState control_id len offset_x offset_y width height+                    screen+                    following)+ +data DeviceCoreState = MkDeviceCoreState{control_id_DeviceCoreState+                                         :: CARD16,+                                         len_DeviceCoreState :: CARD16,+                                         status_DeviceCoreState :: CARD8,+                                         iscore_DeviceCoreState :: CARD8}+                     deriving (Show, Typeable)+ +instance Serialize DeviceCoreState where+        serialize x+          = do serialize (control_id_DeviceCoreState x)+               serialize (len_DeviceCoreState x)+               serialize (status_DeviceCoreState x)+               serialize (iscore_DeviceCoreState x)+               putSkip 2+        size x+          = size (control_id_DeviceCoreState x) ++              size (len_DeviceCoreState x)+              + size (status_DeviceCoreState x)+              + size (iscore_DeviceCoreState x)+              + 2+ +instance Deserialize DeviceCoreState where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               status <- deserialize+               iscore <- deserialize+               skip 2+               return (MkDeviceCoreState control_id len status iscore)+ +data DeviceEnableState = MkDeviceEnableState{control_id_DeviceEnableState+                                             :: CARD16,+                                             len_DeviceEnableState :: CARD16,+                                             enable_DeviceEnableState :: CARD8}+                       deriving (Show, Typeable)+ +instance Serialize DeviceEnableState where+        serialize x+          = do serialize (control_id_DeviceEnableState x)+               serialize (len_DeviceEnableState x)+               serialize (enable_DeviceEnableState x)+               putSkip 3+        size x+          = size (control_id_DeviceEnableState x) ++              size (len_DeviceEnableState x)+              + size (enable_DeviceEnableState x)+              + 3+ +instance Deserialize DeviceEnableState where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               enable <- deserialize+               skip 3+               return (MkDeviceEnableState control_id len enable)+ +data DeviceCtl = MkDeviceCtl{control_id_DeviceCtl :: CARD16,+                             len_DeviceCtl :: CARD16}+               deriving (Show, Typeable)+ +instance Serialize DeviceCtl where+        serialize x+          = do serialize (control_id_DeviceCtl x)+               serialize (len_DeviceCtl x)+        size x = size (control_id_DeviceCtl x) + size (len_DeviceCtl x)+ +instance Deserialize DeviceCtl where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               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]}+                         deriving (Show, Typeable)+ +instance Serialize DeviceResolutionCtl where+        serialize x+          = do serialize (control_id_DeviceResolutionCtl x)+               serialize (len_DeviceResolutionCtl x)+               serialize (first_valuator_DeviceResolutionCtl x)+               serialize (num_valuators_DeviceResolutionCtl x)+               serializeList (resolution_values_DeviceResolutionCtl x)+        size x+          = size (control_id_DeviceResolutionCtl x) ++              size (len_DeviceResolutionCtl x)+              + size (first_valuator_DeviceResolutionCtl x)+              + size (num_valuators_DeviceResolutionCtl x)+              + sum (map size (resolution_values_DeviceResolutionCtl x))+ +instance Deserialize DeviceResolutionCtl where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               first_valuator <- deserialize+               num_valuators <- deserialize+               resolution_values <- deserializeList (fromIntegral num_valuators)+               return+                 (MkDeviceResolutionCtl control_id len first_valuator num_valuators+                    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}+                       deriving (Show, Typeable)+ +instance Serialize DeviceAbsCalibCtl where+        serialize x+          = do serialize (control_id_DeviceAbsCalibCtl x)+               serialize (len_DeviceAbsCalibCtl x)+               serialize (min_x_DeviceAbsCalibCtl x)+               serialize (max_x_DeviceAbsCalibCtl x)+               serialize (min_y_DeviceAbsCalibCtl x)+               serialize (max_y_DeviceAbsCalibCtl x)+               serialize (flip_x_DeviceAbsCalibCtl x)+               serialize (flip_y_DeviceAbsCalibCtl x)+               serialize (rotation_DeviceAbsCalibCtl x)+               serialize (button_threshold_DeviceAbsCalibCtl x)+        size x+          = size (control_id_DeviceAbsCalibCtl x) ++              size (len_DeviceAbsCalibCtl x)+              + size (min_x_DeviceAbsCalibCtl x)+              + size (max_x_DeviceAbsCalibCtl x)+              + size (min_y_DeviceAbsCalibCtl x)+              + size (max_y_DeviceAbsCalibCtl x)+              + size (flip_x_DeviceAbsCalibCtl x)+              + size (flip_y_DeviceAbsCalibCtl x)+              + size (rotation_DeviceAbsCalibCtl x)+              + size (button_threshold_DeviceAbsCalibCtl x)+ +instance Deserialize DeviceAbsCalibCtl where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               min_x <- deserialize+               max_x <- deserialize+               min_y <- deserialize+               max_y <- deserialize+               flip_x <- deserialize+               flip_y <- deserialize+               rotation <- deserialize+               button_threshold <- deserialize+               return+                 (MkDeviceAbsCalibCtl control_id len min_x max_x min_y max_y flip_x+                    flip_y+                    rotation+                    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}+                       deriving (Show, Typeable)+ +instance Serialize DeviceAbsAreaCtrl where+        serialize x+          = do serialize (control_id_DeviceAbsAreaCtrl x)+               serialize (len_DeviceAbsAreaCtrl x)+               serialize (offset_x_DeviceAbsAreaCtrl x)+               serialize (offset_y_DeviceAbsAreaCtrl x)+               serialize (width_DeviceAbsAreaCtrl x)+               serialize (height_DeviceAbsAreaCtrl x)+               serialize (screen_DeviceAbsAreaCtrl x)+               serialize (following_DeviceAbsAreaCtrl x)+        size x+          = size (control_id_DeviceAbsAreaCtrl x) ++              size (len_DeviceAbsAreaCtrl x)+              + size (offset_x_DeviceAbsAreaCtrl x)+              + size (offset_y_DeviceAbsAreaCtrl x)+              + size (width_DeviceAbsAreaCtrl x)+              + size (height_DeviceAbsAreaCtrl x)+              + size (screen_DeviceAbsAreaCtrl x)+              + size (following_DeviceAbsAreaCtrl x)+ +instance Deserialize DeviceAbsAreaCtrl where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               offset_x <- deserialize+               offset_y <- deserialize+               width <- deserialize+               height <- deserialize+               screen <- deserialize+               following <- deserialize+               return+                 (MkDeviceAbsAreaCtrl control_id len offset_x offset_y width height+                    screen+                    following)+ +data DeviceCoreCtrl = MkDeviceCoreCtrl{control_id_DeviceCoreCtrl ::+                                       CARD16,+                                       len_DeviceCoreCtrl :: CARD16, status_DeviceCoreCtrl :: CARD8}+                    deriving (Show, Typeable)+ +instance Serialize DeviceCoreCtrl where+        serialize x+          = do serialize (control_id_DeviceCoreCtrl x)+               serialize (len_DeviceCoreCtrl x)+               serialize (status_DeviceCoreCtrl x)+               putSkip 3+        size x+          = size (control_id_DeviceCoreCtrl x) + size (len_DeviceCoreCtrl x)+              + size (status_DeviceCoreCtrl x)+              + 3+ +instance Deserialize DeviceCoreCtrl where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               status <- deserialize+               skip 3+               return (MkDeviceCoreCtrl control_id len status)+ +data DeviceEnableCtrl = MkDeviceEnableCtrl{control_id_DeviceEnableCtrl+                                           :: CARD16,+                                           len_DeviceEnableCtrl :: CARD16,+                                           enable_DeviceEnableCtrl :: CARD8}+                      deriving (Show, Typeable)+ +instance Serialize DeviceEnableCtrl where+        serialize x+          = do serialize (control_id_DeviceEnableCtrl x)+               serialize (len_DeviceEnableCtrl x)+               serialize (enable_DeviceEnableCtrl x)+               putSkip 3+        size x+          = size (control_id_DeviceEnableCtrl x) ++              size (len_DeviceEnableCtrl x)+              + size (enable_DeviceEnableCtrl x)+              + 3+ +instance Deserialize DeviceEnableCtrl where+        deserialize+          = do control_id <- deserialize+               len <- deserialize+               enable <- deserialize+               skip 3+               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]}+                    deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event DeviceValuator+ +instance Deserialize DeviceValuator where+        deserialize+          = do skip 1+               device_id <- deserialize+               skip 2+               device_state <- deserialize+               num_valuators <- deserialize+               first_valuator <- deserialize+               valuators <- deserializeList (fromIntegral 6)+               return+                 (MkDeviceValuator device_id device_state num_valuators+                    first_valuator+                    valuators)+ +data DeviceKeyPress = MkDeviceKeyPress{detail_DeviceKeyPress ::+                                       BYTE,+                                       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}+                    deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event DeviceKeyPress+ +instance Deserialize DeviceKeyPress 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+               device_id <- deserialize+               return+                 (MkDeviceKeyPress detail time root event child root_x root_y+                    event_x+                    event_y+                    state+                    same_screen+                    device_id)+ +data DeviceKeyRelease = MkDeviceKeyRelease{detail_DeviceKeyRelease+                                           :: BYTE,+                                           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}+                      deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event DeviceKeyRelease+ +instance Deserialize DeviceKeyRelease 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+               device_id <- deserialize+               return+                 (MkDeviceKeyRelease detail time root event child root_x root_y+                    event_x+                    event_y+                    state+                    same_screen+                    device_id)+ +data DeviceButtonPress = MkDeviceButtonPress{detail_DeviceButtonPress+                                             :: BYTE,+                                             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}+                       deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event DeviceButtonPress+ +instance Deserialize DeviceButtonPress 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+               device_id <- deserialize+               return+                 (MkDeviceButtonPress detail time root event child root_x root_y+                    event_x+                    event_y+                    state+                    same_screen+                    device_id)+ +data DeviceButtonRelease = MkDeviceButtonRelease{detail_DeviceButtonRelease+                                                 :: BYTE,+                                                 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}+                         deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event DeviceButtonRelease+ +instance Deserialize DeviceButtonRelease 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+               device_id <- deserialize+               return+                 (MkDeviceButtonRelease detail time root event child root_x root_y+                    event_x+                    event_y+                    state+                    same_screen+                    device_id)+ +data DeviceMotionNotify = MkDeviceMotionNotify{detail_DeviceMotionNotify+                                               :: BYTE,+                                               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}+                        deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event DeviceMotionNotify+ +instance Deserialize DeviceMotionNotify 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+               device_id <- deserialize+               return+                 (MkDeviceMotionNotify detail time root event child root_x root_y+                    event_x+                    event_y+                    state+                    same_screen+                    device_id)+ +data ProximityIn = MkProximityIn{detail_ProximityIn :: BYTE,+                                 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}+                 deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event ProximityIn+ +instance Deserialize ProximityIn 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+               device_id <- deserialize+               return+                 (MkProximityIn detail time root event child root_x root_y event_x+                    event_y+                    state+                    same_screen+                    device_id)+ +data ProximityOut = MkProximityOut{detail_ProximityOut :: BYTE,+                                   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}+                  deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event ProximityOut+ +instance Deserialize ProximityOut 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+               device_id <- deserialize+               return+                 (MkProximityOut detail time root event child root_x root_y event_x+                    event_y+                    state+                    same_screen+                    device_id)+ +data FocusIn = MkFocusIn{detail_FocusIn :: BYTE,+                         time_FocusIn :: TIMESTAMP, window_FocusIn :: WINDOW,+                         mode_FocusIn :: BYTE, device_id_FocusIn :: CARD8}+             deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event FocusIn+ +instance Deserialize FocusIn where+        deserialize+          = do skip 1+               detail <- deserialize+               skip 2+               time <- deserialize+               window <- deserialize+               mode <- deserialize+               device_id <- deserialize+               skip 18+               return (MkFocusIn detail time window mode device_id)+ +data FocusOut = MkFocusOut{detail_FocusOut :: BYTE,+                           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}+              deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event FocusOut+ +instance Deserialize FocusOut 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+               device_id <- deserialize+               return+                 (MkFocusOut detail time root event child root_x root_y event_x+                    event_y+                    state+                    same_screen+                    device_id)+ +data DeviceStateNotify = MkDeviceStateNotify{device_id_DeviceStateNotify+                                             :: BYTE,+                                             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]}+                       deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event DeviceStateNotify+ +instance Deserialize DeviceStateNotify where+        deserialize+          = do skip 1+               device_id <- deserialize+               skip 2+               time <- deserialize+               num_keys <- deserialize+               num_buttons <- deserialize+               num_valuators <- deserialize+               classes_reported <- deserialize+               buttons <- deserializeList (fromIntegral 4)+               keys <- deserializeList (fromIntegral 4)+               valuators <- deserializeList (fromIntegral 3)+               return+                 (MkDeviceStateNotify device_id time num_keys num_buttons+                    num_valuators+                    classes_reported+                    buttons+                    keys+                    valuators)+ +data DeviceMappingNotify = MkDeviceMappingNotify{device_id_DeviceMappingNotify+                                                 :: BYTE,+                                                 request_DeviceMappingNotify :: CARD8,+                                                 first_keycode_DeviceMappingNotify :: KeyCode,+                                                 count_DeviceMappingNotify :: CARD8,+                                                 time_DeviceMappingNotify :: TIMESTAMP}+                         deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event DeviceMappingNotify+ +instance Deserialize DeviceMappingNotify where+        deserialize+          = do skip 1+               device_id <- deserialize+               skip 2+               request <- deserialize+               first_keycode <- deserialize+               count <- deserialize+               skip 1+               time <- deserialize+               skip 20+               return+                 (MkDeviceMappingNotify device_id request first_keycode count time)+ +data ChangeDeviceNotify = MkChangeDeviceNotify{device_id_ChangeDeviceNotify+                                               :: BYTE,+                                               time_ChangeDeviceNotify :: TIMESTAMP,+                                               request_ChangeDeviceNotify :: CARD8}+                        deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event ChangeDeviceNotify+ +instance Deserialize ChangeDeviceNotify where+        deserialize+          = do skip 1+               device_id <- deserialize+               skip 2+               time <- deserialize+               request <- deserialize+               skip 23+               return (MkChangeDeviceNotify device_id time request)+ +data DeviceKeyStateNotify = MkDeviceKeyStateNotify{device_id_DeviceKeyStateNotify+                                                   :: BYTE,+                                                   keys_DeviceKeyStateNotify :: [CARD8]}+                          deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event DeviceKeyStateNotify+ +instance Deserialize DeviceKeyStateNotify where+        deserialize+          = do skip 1+               device_id <- deserialize+               skip 2+               keys <- deserializeList (fromIntegral 28)+               return (MkDeviceKeyStateNotify device_id keys)+ +data DeviceButtonStateNotify = MkDeviceButtonStateNotify{device_id_DeviceButtonStateNotify+                                                         :: BYTE,+                                                         buttons_DeviceButtonStateNotify :: [CARD8]}+                             deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event DeviceButtonStateNotify+ +instance Deserialize DeviceButtonStateNotify where+        deserialize+          = do skip 1+               device_id <- deserialize+               skip 2+               buttons <- deserializeList (fromIntegral 28)+               return (MkDeviceButtonStateNotify device_id buttons)+ +data DevicePresenceNotify = MkDevicePresenceNotify{time_DevicePresenceNotify+                                                   :: TIMESTAMP,+                                                   devchange_DevicePresenceNotify :: BYTE,+                                                   device_id_DevicePresenceNotify :: BYTE,+                                                   control_DevicePresenceNotify :: CARD16}+                          deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event DevicePresenceNotify+ +instance Deserialize DevicePresenceNotify where+        deserialize+          = do skip 1+               skip 1+               skip 2+               time <- deserialize+               devchange <- deserialize+               device_id <- deserialize+               control <- deserialize+               skip 20+               return (MkDevicePresenceNotify time devchange device_id control)
+ patched/Graphics/XHB/Gen/RandR.hs view
@@ -0,0 +1,245 @@+module Graphics.XHB.Gen.RandR+       (extension, queryVersion, setScreenConfig, selectInput,+        getScreenInfo, getScreenSizeRange, setScreenSize,+        getScreenResources, getOutputInfo, listOutputProperties,+        queryOutputProperty, configureOutputProperty, changeOutputProperty,+        deleteOutputProperty, getOutputProperty, createMode, destroyMode,+        addOutputMode, deleteOutputMode, getCrtcInfo, setCrtcConfig,+        getCrtcGammaSize, getCrtcGamma, setCrtcGamma,+        module Graphics.XHB.Gen.RandR.Types)+       where+import Graphics.XHB.Gen.RandR.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "RANDR"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)+queryVersion c major_version minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion major_version minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setScreenConfig ::+                  Graphics.XHB.Connection.Types.Connection ->+                    SetScreenConfig -> IO (Receipt SetScreenConfigReply)+setScreenConfig c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +selectInput ::+              Graphics.XHB.Connection.Types.Connection ->+                WINDOW -> CARD16 -> IO ()+selectInput c window enable+  = do let req = MkSelectInput window enable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getScreenInfo ::+                Graphics.XHB.Connection.Types.Connection ->+                  WINDOW -> IO (Receipt GetScreenInfoReply)+getScreenInfo c window+  = do receipt <- newEmptyReceiptIO+       let req = MkGetScreenInfo window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getScreenSizeRange ::+                     Graphics.XHB.Connection.Types.Connection ->+                       WINDOW -> IO (Receipt GetScreenSizeRangeReply)+getScreenSizeRange c window+  = do receipt <- newEmptyReceiptIO+       let req = MkGetScreenSizeRange window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setScreenSize ::+                Graphics.XHB.Connection.Types.Connection -> SetScreenSize -> IO ()+setScreenSize c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getScreenResources ::+                     Graphics.XHB.Connection.Types.Connection ->+                       WINDOW -> IO (Receipt GetScreenResourcesReply)+getScreenResources c window+  = do receipt <- newEmptyReceiptIO+       let req = MkGetScreenResources window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getOutputInfo ::+                Graphics.XHB.Connection.Types.Connection ->+                  OUTPUT -> TIMESTAMP -> IO (Receipt GetOutputInfoReply)+getOutputInfo c output config_timestamp+  = do receipt <- newEmptyReceiptIO+       let req = MkGetOutputInfo output config_timestamp+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +listOutputProperties ::+                       Graphics.XHB.Connection.Types.Connection ->+                         OUTPUT -> IO (Receipt ListOutputPropertiesReply)+listOutputProperties c output+  = do receipt <- newEmptyReceiptIO+       let req = MkListOutputProperties output+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryOutputProperty ::+                      Graphics.XHB.Connection.Types.Connection ->+                        OUTPUT -> ATOM -> IO (Receipt QueryOutputPropertyReply)+queryOutputProperty c output property+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryOutputProperty output property+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +configureOutputProperty ::+                          Graphics.XHB.Connection.Types.Connection ->+                            ConfigureOutputProperty -> IO ()+configureOutputProperty c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +changeOutputProperty ::+                       Graphics.XHB.Connection.Types.Connection ->+                         ChangeOutputProperty -> IO ()+changeOutputProperty c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +deleteOutputProperty ::+                       Graphics.XHB.Connection.Types.Connection -> OUTPUT -> ATOM -> IO ()+deleteOutputProperty c output property+  = do let req = MkDeleteOutputProperty output property+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getOutputProperty ::+                    Graphics.XHB.Connection.Types.Connection ->+                      GetOutputProperty -> IO (Receipt GetOutputPropertyReply)+getOutputProperty c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +createMode ::+             Graphics.XHB.Connection.Types.Connection ->+               CreateMode -> IO (Receipt CreateModeReply)+createMode c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +destroyMode ::+              Graphics.XHB.Connection.Types.Connection -> MODE -> IO ()+destroyMode c mode+  = do let req = MkDestroyMode mode+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +addOutputMode ::+                Graphics.XHB.Connection.Types.Connection -> OUTPUT -> MODE -> IO ()+addOutputMode c output mode+  = do let req = MkAddOutputMode output mode+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +deleteOutputMode ::+                   Graphics.XHB.Connection.Types.Connection -> OUTPUT -> MODE -> IO ()+deleteOutputMode c output mode+  = do let req = MkDeleteOutputMode output mode+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getCrtcInfo ::+              Graphics.XHB.Connection.Types.Connection ->+                CRTC -> TIMESTAMP -> IO (Receipt GetCrtcInfoReply)+getCrtcInfo c crtc config_timestamp+  = do receipt <- newEmptyReceiptIO+       let req = MkGetCrtcInfo crtc config_timestamp+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setCrtcConfig ::+                Graphics.XHB.Connection.Types.Connection ->+                  SetCrtcConfig -> IO (Receipt SetCrtcConfigReply)+setCrtcConfig c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getCrtcGammaSize ::+                   Graphics.XHB.Connection.Types.Connection ->+                     CRTC -> IO (Receipt GetCrtcGammaSizeReply)+getCrtcGammaSize c crtc+  = do receipt <- newEmptyReceiptIO+       let req = MkGetCrtcGammaSize crtc+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getCrtcGamma ::+               Graphics.XHB.Connection.Types.Connection ->+                 CRTC -> IO (Receipt GetCrtcGammaReply)+getCrtcGamma c crtc+  = do receipt <- newEmptyReceiptIO+       let req = MkGetCrtcGamma crtc+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setCrtcGamma ::+               Graphics.XHB.Connection.Types.Connection -> SetCrtcGamma -> IO ()+setCrtcGamma c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk
+ patched/Graphics/XHB/Gen/RandR/Types.hs view
@@ -0,0 +1,1344 @@+module Graphics.XHB.Gen.RandR.Types+       (deserializeError, deserializeEvent, MODE, CRTC, OUTPUT,+        Rotation(..), ScreenSize(..), RefreshRates(..), QueryVersion(..),+        QueryVersionReply(..), SetScreenConfig(..),+        SetScreenConfigReply(..), SetConfig(..), SelectInput(..),+        GetScreenInfo(..), GetScreenInfoReply(..), GetScreenSizeRange(..),+        GetScreenSizeRangeReply(..), SetScreenSize(..), ModeFlag(..),+        ModeInfo(..), GetScreenResources(..), GetScreenResourcesReply(..),+        Connection(..), GetOutputInfo(..), GetOutputInfoReply(..),+        ListOutputProperties(..), ListOutputPropertiesReply(..),+        QueryOutputProperty(..), QueryOutputPropertyReply(..),+        ConfigureOutputProperty(..), ChangeOutputProperty(..),+        DeleteOutputProperty(..), GetOutputProperty(..),+        GetOutputPropertyReply(..), CreateMode(..), CreateModeReply(..),+        DestroyMode(..), AddOutputMode(..), DeleteOutputMode(..),+        GetCrtcInfo(..), GetCrtcInfoReply(..), SetCrtcConfig(..),+        SetCrtcConfigReply(..), GetCrtcGammaSize(..),+        GetCrtcGammaSizeReply(..), GetCrtcGamma(..), GetCrtcGammaReply(..),+        SetCrtcGamma(..), NotifyMask(..), ScreenChangeNotify(..),+        NotifyEnum(..), CrtcChange(..), OutputChange(..), OutputProperty(..),+        Notify(..),NotifyData(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent 0+  = return (liftM toEvent (deserialize :: Get ScreenChangeNotify))+deserializeEvent 1+  = return (liftM toEvent (deserialize :: Get Notify))+deserializeEvent _ = Nothing+ +newtype MODE = MkMODE Xid+               deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype CRTC = MkCRTC Xid+               deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype OUTPUT = MkOUTPUT Xid+                 deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +data Rotation = RotationRotate_0+              | RotationRotate_90+              | RotationRotate_180+              | RotationRotate_270+              | RotationReflect_X+              | RotationReflect_Y+ +instance BitEnum Rotation where+        toBit RotationRotate_0{} = 0+        toBit RotationRotate_90{} = 1+        toBit RotationRotate_180{} = 2+        toBit RotationRotate_270{} = 3+        toBit RotationReflect_X{} = 4+        toBit RotationReflect_Y{} = 5+        fromBit 0 = RotationRotate_0+        fromBit 1 = RotationRotate_90+        fromBit 2 = RotationRotate_180+        fromBit 3 = RotationRotate_270+        fromBit 4 = RotationReflect_X+        fromBit 5 = RotationReflect_Y+ +data ScreenSize = MkScreenSize{width_ScreenSize :: CARD16,+                               height_ScreenSize :: CARD16, mwidth_ScreenSize :: CARD16,+                               mheight_ScreenSize :: CARD16}+                deriving (Show, Typeable)+ +instance Serialize ScreenSize where+        serialize x+          = do serialize (width_ScreenSize x)+               serialize (height_ScreenSize x)+               serialize (mwidth_ScreenSize x)+               serialize (mheight_ScreenSize x)+        size x+          = size (width_ScreenSize x) + size (height_ScreenSize x) ++              size (mwidth_ScreenSize x)+              + size (mheight_ScreenSize x)+ +instance Deserialize ScreenSize where+        deserialize+          = do width <- deserialize+               height <- deserialize+               mwidth <- deserialize+               mheight <- deserialize+               return (MkScreenSize width height mwidth mheight)+ +data RefreshRates = MkRefreshRates{nRates_RefreshRates :: CARD16,+                                   rates_RefreshRates :: [CARD16]}+                  deriving (Show, Typeable)+ +instance Serialize RefreshRates where+        serialize x+          = do serialize (nRates_RefreshRates x)+               serializeList (rates_RefreshRates x)+        size x+          = size (nRates_RefreshRates x) ++              sum (map size (rates_RefreshRates x))+ +instance Deserialize RefreshRates where+        deserialize+          = do nRates <- deserialize+               rates <- deserializeList (fromIntegral nRates)+               return (MkRefreshRates nRates rates)+ +data QueryVersion = MkQueryVersion{major_version_QueryVersion ::+                                   CARD32,+                                   minor_version_QueryVersion :: CARD32}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (major_version_QueryVersion x) ++                         size (minor_version_QueryVersion x)+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major_version <- deserialize+               minor_version <- deserialize+               skip 16+               let _ = isCard32 length+               return (MkQueryVersionReply major_version minor_version)+ +data SetScreenConfig = MkSetScreenConfig{window_SetScreenConfig ::+                                         WINDOW,+                                         timestamp_SetScreenConfig :: TIMESTAMP,+                                         config_timestamp_SetScreenConfig :: TIMESTAMP,+                                         sizeID_SetScreenConfig :: CARD16,+                                         rotation_SetScreenConfig :: CARD16,+                                         rate_SetScreenConfig :: CARD16}+                     deriving (Show, Typeable)+ +instance ExtensionRequest SetScreenConfig where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__+                     = 4 + size (window_SetScreenConfig x) ++                         size (timestamp_SetScreenConfig x)+                         + size (config_timestamp_SetScreenConfig x)+                         + size (sizeID_SetScreenConfig x)+                         + size (rotation_SetScreenConfig x)+                         + size (rate_SetScreenConfig x)+                         + 2+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_SetScreenConfig x)+               serialize (timestamp_SetScreenConfig x)+               serialize (config_timestamp_SetScreenConfig x)+               serialize (sizeID_SetScreenConfig x)+               serialize (rotation_SetScreenConfig x)+               serialize (rate_SetScreenConfig x)+               putSkip 2+               putSkip (requiredPadding size__)+ +data SetScreenConfigReply = MkSetScreenConfigReply{status_SetScreenConfigReply+                                                   :: CARD8,+                                                   new_timestamp_SetScreenConfigReply :: TIMESTAMP,+                                                   config_timestamp_SetScreenConfigReply ::+                                                   TIMESTAMP,+                                                   root_SetScreenConfigReply :: WINDOW,+                                                   subpixel_order_SetScreenConfigReply :: CARD16}+                          deriving (Show, Typeable)+ +instance Deserialize SetScreenConfigReply where+        deserialize+          = do skip 1+               status <- deserialize+               skip 2+               length <- deserialize+               new_timestamp <- deserialize+               config_timestamp <- deserialize+               root <- deserialize+               subpixel_order <- deserialize+               skip 10+               let _ = isCard32 length+               return+                 (MkSetScreenConfigReply status new_timestamp config_timestamp root+                    subpixel_order)+ +data SetConfig = SetConfigSuccess+               | SetConfigInvalidConfigTime+               | SetConfigInvalidTime+               | SetConfigFailed+ +instance SimpleEnum SetConfig where+        toValue SetConfigSuccess{} = 0+        toValue SetConfigInvalidConfigTime{} = 1+        toValue SetConfigInvalidTime{} = 2+        toValue SetConfigFailed{} = 3+        fromValue 0 = SetConfigSuccess+        fromValue 1 = SetConfigInvalidConfigTime+        fromValue 2 = SetConfigInvalidTime+        fromValue 3 = SetConfigFailed+ +data SelectInput = MkSelectInput{window_SelectInput :: WINDOW,+                                 enable_SelectInput :: CARD16}+                 deriving (Show, Typeable)+ +instance ExtensionRequest SelectInput where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__+                     = 4 + size (window_SelectInput x) + size (enable_SelectInput x) + 2+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_SelectInput x)+               serialize (enable_SelectInput x)+               putSkip 2+               putSkip (requiredPadding size__)+ +data GetScreenInfo = MkGetScreenInfo{window_GetScreenInfo ::+                                     WINDOW}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GetScreenInfo where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__ = 4 + size (window_GetScreenInfo x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetScreenInfo x)+               putSkip (requiredPadding size__)+ +data GetScreenInfoReply = MkGetScreenInfoReply{rotations_GetScreenInfoReply+                                               :: CARD8,+                                               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,+                                               sizes_GetScreenInfoReply :: [ScreenSize],+                                               rates_GetScreenInfoReply :: [RefreshRates]}+                        deriving (Show, Typeable)+ +instance Deserialize GetScreenInfoReply where+        deserialize+          = do skip 1+               rotations <- deserialize+               skip 2+               length <- deserialize+               root <- deserialize+               timestamp <- deserialize+               config_timestamp <- deserialize+               nSizes <- deserialize+               sizeID <- deserialize+               rotation <- deserialize+               rate <- deserialize+               nInfo <- deserialize+               skip 2+               sizes <- deserializeList (fromIntegral nSizes)+               rates <- deserializeList+                          (fromIntegral (fromIntegral (nInfo - nSizes)))+               let _ = isCard32 length+               return+                 (MkGetScreenInfoReply rotations root timestamp config_timestamp+                    nSizes+                    sizeID+                    rotation+                    rate+                    nInfo+                    sizes+                    rates)+ +data GetScreenSizeRange = MkGetScreenSizeRange{window_GetScreenSizeRange+                                               :: WINDOW}+                        deriving (Show, Typeable)+ +instance ExtensionRequest GetScreenSizeRange where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__ = 4 + size (window_GetScreenSizeRange x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetScreenSizeRange x)+               putSkip (requiredPadding size__)+ +data GetScreenSizeRangeReply = MkGetScreenSizeRangeReply{min_width_GetScreenSizeRangeReply+                                                         :: CARD16,+                                                         min_height_GetScreenSizeRangeReply ::+                                                         CARD16,+                                                         max_width_GetScreenSizeRangeReply ::+                                                         CARD16,+                                                         max_height_GetScreenSizeRangeReply ::+                                                         CARD16}+                             deriving (Show, Typeable)+ +instance Deserialize GetScreenSizeRangeReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               min_width <- deserialize+               min_height <- deserialize+               max_width <- deserialize+               max_height <- deserialize+               skip 16+               let _ = isCard32 length+               return+                 (MkGetScreenSizeRangeReply min_width min_height max_width+                    max_height)+ +data SetScreenSize = MkSetScreenSize{window_SetScreenSize ::+                                     WINDOW,+                                     width_SetScreenSize :: CARD16, height_SetScreenSize :: CARD16,+                                     mm_width_SetScreenSize :: CARD32,+                                     mm_height_SetScreenSize :: CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest SetScreenSize where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__+                     = 4 + size (window_SetScreenSize x) + size (width_SetScreenSize x)+                         + size (height_SetScreenSize x)+                         + size (mm_width_SetScreenSize x)+                         + size (mm_height_SetScreenSize x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_SetScreenSize x)+               serialize (width_SetScreenSize x)+               serialize (height_SetScreenSize x)+               serialize (mm_width_SetScreenSize x)+               serialize (mm_height_SetScreenSize x)+               putSkip (requiredPadding size__)+ +data ModeFlag = ModeFlagHsyncPositive+              | ModeFlagHsyncNegative+              | ModeFlagVsyncPositive+              | ModeFlagVsyncNegative+              | ModeFlagInterlace+              | ModeFlagDoubleScan+              | ModeFlagCsync+              | ModeFlagCsyncPositive+              | ModeFlagCsyncNegative+              | ModeFlagHskewPresent+              | ModeFlagBcast+              | ModeFlagPixelMultiplex+              | ModeFlagDoubleClock+              | ModeFlagHalveClock+ +instance BitEnum ModeFlag where+        toBit ModeFlagHsyncPositive{} = 0+        toBit ModeFlagHsyncNegative{} = 1+        toBit ModeFlagVsyncPositive{} = 2+        toBit ModeFlagVsyncNegative{} = 3+        toBit ModeFlagInterlace{} = 4+        toBit ModeFlagDoubleScan{} = 5+        toBit ModeFlagCsync{} = 6+        toBit ModeFlagCsyncPositive{} = 7+        toBit ModeFlagCsyncNegative{} = 8+        toBit ModeFlagHskewPresent{} = 9+        toBit ModeFlagBcast{} = 10+        toBit ModeFlagPixelMultiplex{} = 11+        toBit ModeFlagDoubleClock{} = 12+        toBit ModeFlagHalveClock{} = 13+        fromBit 0 = ModeFlagHsyncPositive+        fromBit 1 = ModeFlagHsyncNegative+        fromBit 2 = ModeFlagVsyncPositive+        fromBit 3 = ModeFlagVsyncNegative+        fromBit 4 = ModeFlagInterlace+        fromBit 5 = ModeFlagDoubleScan+        fromBit 6 = ModeFlagCsync+        fromBit 7 = ModeFlagCsyncPositive+        fromBit 8 = ModeFlagCsyncNegative+        fromBit 9 = ModeFlagHskewPresent+        fromBit 10 = ModeFlagBcast+        fromBit 11 = ModeFlagPixelMultiplex+        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}+              deriving (Show, Typeable)+ +instance Serialize ModeInfo where+        serialize x+          = do serialize (id_ModeInfo x)+               serialize (width_ModeInfo x)+               serialize (height_ModeInfo x)+               serialize (dot_clock_ModeInfo x)+               serialize (hsync_start_ModeInfo x)+               serialize (hsync_end_ModeInfo x)+               serialize (htotal_ModeInfo x)+               serialize (hskew_ModeInfo x)+               serialize (vsync_start_ModeInfo x)+               serialize (vsync_end_ModeInfo x)+               serialize (vtotal_ModeInfo x)+               serialize (name_len_ModeInfo x)+               serialize (mode_flags_ModeInfo x)+        size x+          = size (id_ModeInfo x) + size (width_ModeInfo x) ++              size (height_ModeInfo x)+              + size (dot_clock_ModeInfo x)+              + size (hsync_start_ModeInfo x)+              + size (hsync_end_ModeInfo x)+              + size (htotal_ModeInfo x)+              + size (hskew_ModeInfo x)+              + size (vsync_start_ModeInfo x)+              + size (vsync_end_ModeInfo x)+              + size (vtotal_ModeInfo x)+              + size (name_len_ModeInfo x)+              + size (mode_flags_ModeInfo x)+ +instance Deserialize ModeInfo where+        deserialize+          = do id <- deserialize+               width <- deserialize+               height <- deserialize+               dot_clock <- deserialize+               hsync_start <- deserialize+               hsync_end <- deserialize+               htotal <- deserialize+               hskew <- deserialize+               vsync_start <- deserialize+               vsync_end <- deserialize+               vtotal <- deserialize+               name_len <- deserialize+               mode_flags <- deserialize+               return+                 (MkModeInfo id width height dot_clock hsync_start hsync_end htotal+                    hskew+                    vsync_start+                    vsync_end+                    vtotal+                    name_len+                    mode_flags)+ +data GetScreenResources = MkGetScreenResources{window_GetScreenResources+                                               :: WINDOW}+                        deriving (Show, Typeable)+ +instance ExtensionRequest GetScreenResources where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__ = 4 + size (window_GetScreenResources x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetScreenResources x)+               putSkip (requiredPadding size__)+ +data GetScreenResourcesReply = MkGetScreenResourcesReply{timestamp_GetScreenResourcesReply+                                                         :: TIMESTAMP,+                                                         config_timestamp_GetScreenResourcesReply ::+                                                         TIMESTAMP,+                                                         num_crtcs_GetScreenResourcesReply ::+                                                         CARD16,+                                                         num_outputs_GetScreenResourcesReply ::+                                                         CARD16,+                                                         num_modes_GetScreenResourcesReply ::+                                                         CARD16,+                                                         names_len_GetScreenResourcesReply ::+                                                         CARD16,+                                                         crtcs_GetScreenResourcesReply :: [CRTC],+                                                         outputs_GetScreenResourcesReply ::+                                                         [OUTPUT],+                                                         modes_GetScreenResourcesReply ::+                                                         [ModeInfo],+                                                         names_GetScreenResourcesReply :: [BYTE]}+                             deriving (Show, Typeable)+ +instance Deserialize GetScreenResourcesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               timestamp <- deserialize+               config_timestamp <- deserialize+               num_crtcs <- deserialize+               num_outputs <- deserialize+               num_modes <- deserialize+               names_len <- deserialize+               skip 8+               crtcs <- deserializeList (fromIntegral num_crtcs)+               outputs <- deserializeList (fromIntegral num_outputs)+               modes <- deserializeList (fromIntegral num_modes)+               names <- deserializeList (fromIntegral names_len)+               let _ = isCard32 length+               return+                 (MkGetScreenResourcesReply timestamp config_timestamp num_crtcs+                    num_outputs+                    num_modes+                    names_len+                    crtcs+                    outputs+                    modes+                    names)+ +data Connection = ConnectionConnected+                | ConnectionDisconnected+                | ConnectionUnknown+ +instance SimpleEnum Connection where+        toValue ConnectionConnected{} = 0+        toValue ConnectionDisconnected{} = 1+        toValue ConnectionUnknown{} = 2+        fromValue 0 = ConnectionConnected+        fromValue 1 = ConnectionDisconnected+        fromValue 2 = ConnectionUnknown+ +data GetOutputInfo = MkGetOutputInfo{output_GetOutputInfo ::+                                     OUTPUT,+                                     config_timestamp_GetOutputInfo :: TIMESTAMP}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GetOutputInfo where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 9+               let size__+                     = 4 + size (output_GetOutputInfo x) ++                         size (config_timestamp_GetOutputInfo x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (output_GetOutputInfo x)+               serialize (config_timestamp_GetOutputInfo x)+               putSkip (requiredPadding size__)+ +data GetOutputInfoReply = MkGetOutputInfoReply{status_GetOutputInfoReply+                                               :: CARD8,+                                               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,+                                               crtcs_GetOutputInfoReply :: [CRTC],+                                               modes_GetOutputInfoReply :: [MODE],+                                               clones_GetOutputInfoReply :: [OUTPUT],+                                               name_GetOutputInfoReply :: [BYTE]}+                        deriving (Show, Typeable)+ +instance Deserialize GetOutputInfoReply where+        deserialize+          = do skip 1+               status <- deserialize+               skip 2+               length <- deserialize+               timestamp <- deserialize+               crtc <- deserialize+               mm_width <- deserialize+               mm_height <- deserialize+               connection <- deserialize+               subpixel_order <- deserialize+               num_crtcs <- deserialize+               num_modes <- deserialize+               num_preferred <- deserialize+               num_clones <- deserialize+               name_len <- deserialize+               crtcs <- deserializeList (fromIntegral num_crtcs)+               modes <- deserializeList (fromIntegral num_modes)+               clones <- deserializeList (fromIntegral num_clones)+               name <- deserializeList (fromIntegral name_len)+               let _ = isCard32 length+               return+                 (MkGetOutputInfoReply status timestamp crtc mm_width mm_height+                    connection+                    subpixel_order+                    num_crtcs+                    num_modes+                    num_preferred+                    num_clones+                    name_len+                    crtcs+                    modes+                    clones+                    name)+ +data ListOutputProperties = MkListOutputProperties{output_ListOutputProperties+                                                   :: OUTPUT}+                          deriving (Show, Typeable)+ +instance ExtensionRequest ListOutputProperties where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 10+               let size__ = 4 + size (output_ListOutputProperties x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (output_ListOutputProperties x)+               putSkip (requiredPadding size__)+ +data ListOutputPropertiesReply = MkListOutputPropertiesReply{num_atoms_ListOutputPropertiesReply+                                                             :: CARD16,+                                                             atoms_ListOutputPropertiesReply ::+                                                             [ATOM]}+                               deriving (Show, Typeable)+ +instance Deserialize ListOutputPropertiesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_atoms <- deserialize+               skip 22+               atoms <- deserializeList (fromIntegral num_atoms)+               let _ = isCard32 length+               return (MkListOutputPropertiesReply num_atoms atoms)+ +data QueryOutputProperty = MkQueryOutputProperty{output_QueryOutputProperty+                                                 :: OUTPUT,+                                                 property_QueryOutputProperty :: ATOM}+                         deriving (Show, Typeable)+ +instance ExtensionRequest QueryOutputProperty where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 11+               let size__+                     = 4 + size (output_QueryOutputProperty x) ++                         size (property_QueryOutputProperty x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (output_QueryOutputProperty x)+               serialize (property_QueryOutputProperty x)+               putSkip (requiredPadding size__)+ +data QueryOutputPropertyReply = MkQueryOutputPropertyReply{pending_QueryOutputPropertyReply+                                                           :: BOOL,+                                                           range_QueryOutputPropertyReply :: BOOL,+                                                           immutable_QueryOutputPropertyReply ::+                                                           BOOL,+                                                           validValues_QueryOutputPropertyReply ::+                                                           [INT32]}+                              deriving (Show, Typeable)+ +instance Deserialize QueryOutputPropertyReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               pending <- deserialize+               range <- deserialize+               immutable <- deserialize+               skip 21+               validValues <- deserializeList (fromIntegral length)+               let _ = isCard32 length+               return+                 (MkQueryOutputPropertyReply pending range immutable validValues)+ +data ConfigureOutputProperty = MkConfigureOutputProperty{output_ConfigureOutputProperty+                                                         :: OUTPUT,+                                                         property_ConfigureOutputProperty :: ATOM,+                                                         pending_ConfigureOutputProperty :: BOOL,+                                                         range_ConfigureOutputProperty :: BOOL,+                                                         values_ConfigureOutputProperty :: [INT32]}+                             deriving (Show, Typeable)+ +instance ExtensionRequest ConfigureOutputProperty where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 12+               let size__+                     = 4 + size (output_ConfigureOutputProperty x) ++                         size (property_ConfigureOutputProperty x)+                         + size (pending_ConfigureOutputProperty x)+                         + size (range_ConfigureOutputProperty x)+                         + 2+                         + sum (map size (values_ConfigureOutputProperty x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (output_ConfigureOutputProperty x)+               serialize (property_ConfigureOutputProperty x)+               serialize (pending_ConfigureOutputProperty x)+               serialize (range_ConfigureOutputProperty x)+               putSkip 2+               serializeList (values_ConfigureOutputProperty x)+               putSkip (requiredPadding size__)+ +data ChangeOutputProperty = MkChangeOutputProperty{output_ChangeOutputProperty+                                                   :: OUTPUT,+                                                   property_ChangeOutputProperty :: ATOM,+                                                   type_ChangeOutputProperty :: ATOM,+                                                   format_ChangeOutputProperty :: CARD8,+                                                   mode_ChangeOutputProperty :: CARD8,+                                                   num_units_ChangeOutputProperty :: CARD32,+                                                   data_ChangeOutputProperty :: [Word8]}+                          deriving (Show, Typeable)+ +instance ExtensionRequest ChangeOutputProperty where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 13+               let size__+                     = 4 + size (output_ChangeOutputProperty x) ++                         size (property_ChangeOutputProperty x)+                         + size (type_ChangeOutputProperty x)+                         + size (format_ChangeOutputProperty x)+                         + size (mode_ChangeOutputProperty x)+                         + 2+                         + size (num_units_ChangeOutputProperty x)+                         + sum (map size (data_ChangeOutputProperty x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (output_ChangeOutputProperty x)+               serialize (property_ChangeOutputProperty x)+               serialize (type_ChangeOutputProperty x)+               serialize (format_ChangeOutputProperty x)+               serialize (mode_ChangeOutputProperty x)+               putSkip 2+               serialize (num_units_ChangeOutputProperty x)+               serializeList (data_ChangeOutputProperty x)+               putSkip (requiredPadding size__)+ +data DeleteOutputProperty = MkDeleteOutputProperty{output_DeleteOutputProperty+                                                   :: OUTPUT,+                                                   property_DeleteOutputProperty :: ATOM}+                          deriving (Show, Typeable)+ +instance ExtensionRequest DeleteOutputProperty where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 14+               let size__+                     = 4 + size (output_DeleteOutputProperty x) ++                         size (property_DeleteOutputProperty x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (output_DeleteOutputProperty x)+               serialize (property_DeleteOutputProperty x)+               putSkip (requiredPadding size__)+ +data GetOutputProperty = MkGetOutputProperty{output_GetOutputProperty+                                             :: OUTPUT,+                                             property_GetOutputProperty :: ATOM,+                                             type_GetOutputProperty :: ATOM,+                                             long_offset_GetOutputProperty :: CARD32,+                                             long_length_GetOutputProperty :: CARD32,+                                             delete_GetOutputProperty :: BOOL,+                                             pending_GetOutputProperty :: BOOL}+                       deriving (Show, Typeable)+ +instance ExtensionRequest GetOutputProperty where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 15+               let size__+                     = 4 + size (output_GetOutputProperty x) ++                         size (property_GetOutputProperty x)+                         + size (type_GetOutputProperty x)+                         + size (long_offset_GetOutputProperty x)+                         + size (long_length_GetOutputProperty x)+                         + size (delete_GetOutputProperty x)+                         + size (pending_GetOutputProperty x)+                         + 2+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (output_GetOutputProperty x)+               serialize (property_GetOutputProperty x)+               serialize (type_GetOutputProperty x)+               serialize (long_offset_GetOutputProperty x)+               serialize (long_length_GetOutputProperty x)+               serialize (delete_GetOutputProperty x)+               serialize (pending_GetOutputProperty x)+               putSkip 2+               putSkip (requiredPadding size__)+ +data GetOutputPropertyReply = MkGetOutputPropertyReply{format_GetOutputPropertyReply+                                                       :: CARD8,+                                                       type_GetOutputPropertyReply :: ATOM,+                                                       bytes_after_GetOutputPropertyReply :: CARD32,+                                                       num_items_GetOutputPropertyReply :: CARD32,+                                                       data_GetOutputPropertyReply :: [BYTE]}+                            deriving (Show, Typeable)+ +instance Deserialize GetOutputPropertyReply where+        deserialize+          = do skip 1+               format <- deserialize+               skip 2+               length <- deserialize+               type_ <- deserialize+               bytes_after <- deserialize+               num_items <- deserialize+               skip 12+               data_ <- deserializeList+                          (fromIntegral+                             (fromIntegral (num_items * (fromIntegral (format `div` 8)))))+               let _ = isCard32 length+               return+                 (MkGetOutputPropertyReply format type_ bytes_after num_items data_)+ +data CreateMode = MkCreateMode{window_CreateMode :: WINDOW,+                               mode_info_CreateMode :: ModeInfo, name_CreateMode :: [CChar]}+                deriving (Show, Typeable)+ +instance ExtensionRequest CreateMode where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 16+               let size__+                     = 4 + size (window_CreateMode x) + size (mode_info_CreateMode x) ++                         sum (map size (name_CreateMode x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_CreateMode x)+               serialize (mode_info_CreateMode x)+               serializeList (name_CreateMode x)+               putSkip (requiredPadding size__)+ +data CreateModeReply = MkCreateModeReply{mode_CreateModeReply ::+                                         MODE}+                     deriving (Show, Typeable)+ +instance Deserialize CreateModeReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               mode <- deserialize+               skip 20+               let _ = isCard32 length+               return (MkCreateModeReply mode)+ +data DestroyMode = MkDestroyMode{mode_DestroyMode :: MODE}+                 deriving (Show, Typeable)+ +instance ExtensionRequest DestroyMode where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 17+               let size__ = 4 + size (mode_DestroyMode x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (mode_DestroyMode x)+               putSkip (requiredPadding size__)+ +data AddOutputMode = MkAddOutputMode{output_AddOutputMode ::+                                     OUTPUT,+                                     mode_AddOutputMode :: MODE}+                   deriving (Show, Typeable)+ +instance ExtensionRequest AddOutputMode where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 18+               let size__+                     = 4 + size (output_AddOutputMode x) + size (mode_AddOutputMode x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (output_AddOutputMode x)+               serialize (mode_AddOutputMode x)+               putSkip (requiredPadding size__)+ +data DeleteOutputMode = MkDeleteOutputMode{output_DeleteOutputMode+                                           :: OUTPUT,+                                           mode_DeleteOutputMode :: MODE}+                      deriving (Show, Typeable)+ +instance ExtensionRequest DeleteOutputMode where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 19+               let size__+                     = 4 + size (output_DeleteOutputMode x) ++                         size (mode_DeleteOutputMode x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (output_DeleteOutputMode x)+               serialize (mode_DeleteOutputMode x)+               putSkip (requiredPadding size__)+ +data GetCrtcInfo = MkGetCrtcInfo{crtc_GetCrtcInfo :: CRTC,+                                 config_timestamp_GetCrtcInfo :: TIMESTAMP}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetCrtcInfo where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 20+               let size__+                     = 4 + size (crtc_GetCrtcInfo x) ++                         size (config_timestamp_GetCrtcInfo x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (crtc_GetCrtcInfo x)+               serialize (config_timestamp_GetCrtcInfo x)+               putSkip (requiredPadding size__)+ +data GetCrtcInfoReply = MkGetCrtcInfoReply{status_GetCrtcInfoReply+                                           :: CARD8,+                                           timestamp_GetCrtcInfoReply :: TIMESTAMP,+                                           x_GetCrtcInfoReply :: INT16, y_GetCrtcInfoReply :: INT16,+                                           width_GetCrtcInfoReply :: CARD16,+                                           height_GetCrtcInfoReply :: CARD16,+                                           mode_GetCrtcInfoReply :: MODE,+                                           rotation_GetCrtcInfoReply :: CARD16,+                                           rotations_GetCrtcInfoReply :: CARD16,+                                           num_outputs_GetCrtcInfoReply :: CARD16,+                                           num_possible_outputs_GetCrtcInfoReply :: CARD16,+                                           outputs_GetCrtcInfoReply :: [OUTPUT],+                                           possible_GetCrtcInfoReply :: [OUTPUT]}+                      deriving (Show, Typeable)+ +instance Deserialize GetCrtcInfoReply where+        deserialize+          = do skip 1+               status <- deserialize+               skip 2+               length <- deserialize+               timestamp <- deserialize+               x <- deserialize+               y <- deserialize+               width <- deserialize+               height <- deserialize+               mode <- deserialize+               rotation <- deserialize+               rotations <- deserialize+               num_outputs <- deserialize+               num_possible_outputs <- deserialize+               outputs <- deserializeList (fromIntegral num_outputs)+               possible <- deserializeList (fromIntegral num_possible_outputs)+               let _ = isCard32 length+               return+                 (MkGetCrtcInfoReply status timestamp x y width height mode rotation+                    rotations+                    num_outputs+                    num_possible_outputs+                    outputs+                    possible)+ +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,+                                     outputs_SetCrtcConfig :: [OUTPUT]}+                   deriving (Show, Typeable)+ +instance ExtensionRequest SetCrtcConfig where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 21+               let size__+                     = 4 + size (crtc_SetCrtcConfig x) ++                         size (timestamp_SetCrtcConfig x)+                         + size (config_timestamp_SetCrtcConfig x)+                         + size (x_SetCrtcConfig x)+                         + size (y_SetCrtcConfig x)+                         + size (mode_SetCrtcConfig x)+                         + size (rotation_SetCrtcConfig x)+                         + 2+                         + sum (map size (outputs_SetCrtcConfig x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (crtc_SetCrtcConfig x)+               serialize (timestamp_SetCrtcConfig x)+               serialize (config_timestamp_SetCrtcConfig x)+               serialize (x_SetCrtcConfig x)+               serialize (y_SetCrtcConfig x)+               serialize (mode_SetCrtcConfig x)+               serialize (rotation_SetCrtcConfig x)+               putSkip 2+               serializeList (outputs_SetCrtcConfig x)+               putSkip (requiredPadding size__)+ +data SetCrtcConfigReply = MkSetCrtcConfigReply{status_SetCrtcConfigReply+                                               :: CARD8,+                                               timestamp_SetCrtcConfigReply :: TIMESTAMP}+                        deriving (Show, Typeable)+ +instance Deserialize SetCrtcConfigReply where+        deserialize+          = do skip 1+               status <- deserialize+               skip 2+               length <- deserialize+               timestamp <- deserialize+               skip 20+               let _ = isCard32 length+               return (MkSetCrtcConfigReply status timestamp)+ +data GetCrtcGammaSize = MkGetCrtcGammaSize{crtc_GetCrtcGammaSize ::+                                           CRTC}+                      deriving (Show, Typeable)+ +instance ExtensionRequest GetCrtcGammaSize where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 22+               let size__ = 4 + size (crtc_GetCrtcGammaSize x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (crtc_GetCrtcGammaSize x)+               putSkip (requiredPadding size__)+ +data GetCrtcGammaSizeReply = MkGetCrtcGammaSizeReply{size_GetCrtcGammaSizeReply+                                                     :: CARD16}+                           deriving (Show, Typeable)+ +instance Deserialize GetCrtcGammaSizeReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               size <- deserialize+               skip 22+               let _ = isCard32 length+               return (MkGetCrtcGammaSizeReply size)+ +data GetCrtcGamma = MkGetCrtcGamma{crtc_GetCrtcGamma :: CRTC}+                  deriving (Show, Typeable)+ +instance ExtensionRequest GetCrtcGamma where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 23+               let size__ = 4 + size (crtc_GetCrtcGamma x)+               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]}+                       deriving (Show, Typeable)+ +instance Deserialize GetCrtcGammaReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               size <- deserialize+               skip 22+               red <- deserializeList (fromIntegral size)+               green <- deserializeList (fromIntegral size)+               blue <- deserializeList (fromIntegral size)+               let _ = isCard32 length+               return (MkGetCrtcGammaReply size red green blue)+ +data SetCrtcGamma = MkSetCrtcGamma{crtc_SetCrtcGamma :: CRTC,+                                   size_SetCrtcGamma :: CARD16, red_SetCrtcGamma :: [CARD16],+                                   green_SetCrtcGamma :: [CARD16], blue_SetCrtcGamma :: [CARD16]}+                  deriving (Show, Typeable)+ +instance ExtensionRequest SetCrtcGamma where+        extensionId _ = "RANDR"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 24+               let size__+                     = 4 + size (crtc_SetCrtcGamma x) + size (size_SetCrtcGamma x) + 2 ++                         sum (map size (red_SetCrtcGamma x))+                         + sum (map size (green_SetCrtcGamma x))+                         + sum (map size (blue_SetCrtcGamma x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (crtc_SetCrtcGamma x)+               serialize (size_SetCrtcGamma x)+               putSkip 2+               serializeList (red_SetCrtcGamma x)+               serializeList (green_SetCrtcGamma x)+               serializeList (blue_SetCrtcGamma x)+               putSkip (requiredPadding size__)+ +data NotifyMask = NotifyMaskScreenChange+                | NotifyMaskCrtcChange+                | NotifyMaskOutputChange+                | NotifyMaskOutputProperty+ +instance BitEnum NotifyMask where+        toBit NotifyMaskScreenChange{} = 0+        toBit NotifyMaskCrtcChange{} = 1+        toBit NotifyMaskOutputChange{} = 2+        toBit NotifyMaskOutputProperty{} = 3+        fromBit 0 = NotifyMaskScreenChange+        fromBit 1 = NotifyMaskCrtcChange+        fromBit 2 = NotifyMaskOutputChange+        fromBit 3 = NotifyMaskOutputProperty+ +data ScreenChangeNotify = MkScreenChangeNotify{rotation_ScreenChangeNotify+                                               :: CARD8,+                                               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}+                        deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event ScreenChangeNotify+ +instance Deserialize ScreenChangeNotify where+        deserialize+          = do skip 1+               rotation <- deserialize+               skip 2+               timestamp <- deserialize+               config_timestamp <- deserialize+               root <- deserialize+               request_window <- deserialize+               sizeID <- deserialize+               subpixel_order <- deserialize+               width <- deserialize+               height <- deserialize+               mwidth <- deserialize+               mheight <- deserialize+               return+                 (MkScreenChangeNotify rotation timestamp config_timestamp root+                    request_window+                    sizeID+                    subpixel_order+                    width+                    height+                    mwidth+                    mheight)+ +data NotifyEnum = NotifyCrtcChange+                | NotifyOutputChange+                | NotifyOutputProperty+ +instance SimpleEnum NotifyEnum where+        toValue NotifyCrtcChange{} = 0+        toValue NotifyOutputChange{} = 1+        toValue NotifyOutputProperty{} = 2+        fromValue 0 = NotifyCrtcChange+        fromValue 1 = NotifyOutputChange+        fromValue 2 = NotifyOutputProperty+ +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}+                deriving (Show, Typeable)+ +instance Serialize CrtcChange where+        serialize x+          = do serialize (timestamp_CrtcChange x)+               serialize (window_CrtcChange x)+               serialize (crtc_CrtcChange x)+               serialize (mode_CrtcChange x)+               serialize (rotation_CrtcChange x)+               putSkip 2+               serialize (x_CrtcChange x)+               serialize (y_CrtcChange x)+               serialize (width_CrtcChange x)+               serialize (height_CrtcChange x)+        size x+          = size (timestamp_CrtcChange x) + size (window_CrtcChange x) ++              size (crtc_CrtcChange x)+              + size (mode_CrtcChange x)+              + size (rotation_CrtcChange x)+              + 2+              + size (x_CrtcChange x)+              + size (y_CrtcChange x)+              + size (width_CrtcChange x)+              + size (height_CrtcChange x)+ +instance Deserialize CrtcChange where+        deserialize+          = do timestamp <- deserialize+               window <- deserialize+               crtc <- deserialize+               mode <- deserialize+               rotation <- deserialize+               skip 2+               x <- deserialize+               y <- deserialize+               width <- deserialize+               height <- deserialize+               return+                 (MkCrtcChange timestamp window crtc mode rotation x y width height)+ +data OutputChange = MkOutputChange{timestamp_OutputChange ::+                                   TIMESTAMP,+                                   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}+                  deriving (Show, Typeable)+ +instance Serialize OutputChange where+        serialize x+          = do serialize (timestamp_OutputChange x)+               serialize (config_timestamp_OutputChange x)+               serialize (window_OutputChange x)+               serialize (output_OutputChange x)+               serialize (crtc_OutputChange x)+               serialize (mode_OutputChange x)+               serialize (rotation_OutputChange x)+               serialize (connection_OutputChange x)+               serialize (subpixel_order_OutputChange x)+        size x+          = size (timestamp_OutputChange x) ++              size (config_timestamp_OutputChange x)+              + size (window_OutputChange x)+              + size (output_OutputChange x)+              + size (crtc_OutputChange x)+              + size (mode_OutputChange x)+              + size (rotation_OutputChange x)+              + size (connection_OutputChange x)+              + size (subpixel_order_OutputChange x)+ +instance Deserialize OutputChange where+        deserialize+          = do timestamp <- deserialize+               config_timestamp <- deserialize+               window <- deserialize+               output <- deserialize+               crtc <- deserialize+               mode <- deserialize+               rotation <- deserialize+               connection <- deserialize+               subpixel_order <- deserialize+               return+                 (MkOutputChange timestamp config_timestamp window output crtc mode+                    rotation+                    connection+                    subpixel_order)+ +data OutputProperty = MkOutputProperty{window_OutputProperty ::+                                       WINDOW,+                                       output_OutputProperty :: OUTPUT, atom_OutputProperty :: ATOM,+                                       timestamp_OutputProperty :: TIMESTAMP,+                                       status_OutputProperty :: CARD8}+                    deriving (Show, Typeable)+ +instance Serialize OutputProperty where+        serialize x+          = do serialize (window_OutputProperty x)+               serialize (output_OutputProperty x)+               serialize (atom_OutputProperty x)+               serialize (timestamp_OutputProperty x)+               serialize (status_OutputProperty x)+               putSkip 11+        size x+          = size (window_OutputProperty x) + size (output_OutputProperty x) ++              size (atom_OutputProperty x)+              + size (timestamp_OutputProperty x)+              + size (status_OutputProperty x)+              + 11+ +instance Deserialize OutputProperty where+        deserialize+          = do window <- deserialize+               output <- deserialize+               atom <- deserialize+               timestamp <- deserialize+               status <- deserialize+               skip 11+               return (MkOutputProperty window output atom timestamp status)+ +data NotifyData = NotifyDataCrtcChange CrtcChange+                | NotifyDataOutputChange OutputChange+                | NotifyDataOutputProperty OutputProperty+     deriving (Show, Typeable)++instance Serialize NotifyData where+    serialize  (NotifyDataCrtcChange x) = serialize x+    serialize  (NotifyDataOutputChange x) = serialize x+    serialize  (NotifyDataOutputProperty x) = serialize x++    size (NotifyDataCrtcChange x) = size x+    size (NotifyDataOutputChange x) = size x+    size (NotifyDataOutputProperty x) = size x++deserializeNotifyData :: NotifyEnum -> Get NotifyData+deserializeNotifyData NotifyCrtcChange = NotifyDataCrtcChange `liftM` deserialize+deserializeNotifyData NotifyOutputChange = NotifyDataOutputChange `liftM` deserialize+deserializeNotifyData NotifyOutputProperty = NotifyDataOutputProperty `liftM` deserialize++subCodeToNotifyEnum :: CARD8 -> NotifyEnum+subCodeToNotifyEnum 0 = NotifyCrtcChange+subCodeToNotifyEnum 1 = NotifyOutputChange+subCodeToNotifyEnum 2 = NotifyOutputProperty++data Notify = MkNotify{subCode_Notify :: CARD8,+                       u_Notify :: NotifyData}+            deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event Notify+ +instance Deserialize Notify where+        deserialize+          = do skip 1+               subCode <- deserialize+               skip 2+               u <- deserializeNotifyData (subCodeToNotifyEnum subCode)+               return (MkNotify subCode u)
+ patched/Graphics/XHB/Gen/Record.hs view
@@ -0,0 +1,92 @@+module Graphics.XHB.Gen.Record+       (extension, queryVersion, createContext, registerClients,+        unregisterClients, getContext, enableContext, disableContext,+        freeContext, module Graphics.XHB.Gen.Record.Types)+       where+import Graphics.XHB.Gen.Record.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+ +extension :: ExtensionId+extension = "RECORD"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD16 -> CARD16 -> IO (Receipt QueryVersionReply)+queryVersion c major_version minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion major_version minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +createContext ::+                Graphics.XHB.Connection.Types.Connection -> CreateContext -> IO ()+createContext c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +registerClients ::+                  Graphics.XHB.Connection.Types.Connection ->+                    RegisterClients -> IO ()+registerClients c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +unregisterClients ::+                    Graphics.XHB.Connection.Types.Connection ->+                      UnregisterClients -> IO ()+unregisterClients c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getContext ::+             Graphics.XHB.Connection.Types.Connection ->+               Graphics.XHB.Gen.Record.Types.CONTEXT ->+                 IO (Receipt GetContextReply)+getContext c context+  = do receipt <- newEmptyReceiptIO+       let req = MkGetContext context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +enableContext ::+                Graphics.XHB.Connection.Types.Connection ->+                  Graphics.XHB.Gen.Record.Types.CONTEXT ->+                    IO (Receipt EnableContextReply)+enableContext c context+  = do receipt <- newEmptyReceiptIO+       let req = MkEnableContext context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +disableContext ::+                 Graphics.XHB.Connection.Types.Connection ->+                   Graphics.XHB.Gen.Record.Types.CONTEXT -> IO ()+disableContext c context+  = do let req = MkDisableContext context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +freeContext ::+              Graphics.XHB.Connection.Types.Connection ->+                Graphics.XHB.Gen.Record.Types.CONTEXT -> IO ()+freeContext c context+  = do let req = MkFreeContext context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk
+ patched/Graphics/XHB/Gen/Record/Types.hs view
@@ -0,0 +1,417 @@+module Graphics.XHB.Gen.Record.Types+       (deserializeError, deserializeEvent, CONTEXT, Range8(..),+        Range16(..), ExtRange(..), Range(..), ElementHeader, HType(..),+        ClientSpec, CS(..), ClientInfo(..), BadContext(..),+        QueryVersion(..), QueryVersionReply(..), CreateContext(..),+        RegisterClients(..), UnregisterClients(..), GetContext(..),+        GetContextReply(..), EnableContext(..), EnableContextReply(..),+        DisableContext(..), FreeContext(..))+       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 0+  = return (liftM toError (deserialize :: Get BadContext))+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +newtype CONTEXT = MkCONTEXT Xid+                  deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +data Range8 = MkRange8{first_Range8 :: CARD8, last_Range8 :: CARD8}+            deriving (Show, Typeable)+ +instance Serialize Range8 where+        serialize x+          = do serialize (first_Range8 x)+               serialize (last_Range8 x)+        size x = size (first_Range8 x) + size (last_Range8 x)+ +instance Deserialize Range8 where+        deserialize+          = do first <- deserialize+               last <- deserialize+               return (MkRange8 first last)+ +data Range16 = MkRange16{first_Range16 :: CARD16,+                         last_Range16 :: CARD16}+             deriving (Show, Typeable)+ +instance Serialize Range16 where+        serialize x+          = do serialize (first_Range16 x)+               serialize (last_Range16 x)+        size x = size (first_Range16 x) + size (last_Range16 x)+ +instance Deserialize Range16 where+        deserialize+          = do first <- deserialize+               last <- deserialize+               return (MkRange16 first last)+ +data ExtRange = MkExtRange{major_ExtRange :: Range8,+                           minor_ExtRange :: Range16}+              deriving (Show, Typeable)+ +instance Serialize ExtRange where+        serialize x+          = do serialize (major_ExtRange x)+               serialize (minor_ExtRange x)+        size x = size (major_ExtRange x) + size (minor_ExtRange x)+ +instance Deserialize ExtRange where+        deserialize+          = do major <- deserialize+               minor <- deserialize+               return (MkExtRange major minor)+ +data Range = MkRange{core_requests_Range :: Range8,+                     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}+           deriving (Show, Typeable)+ +instance Serialize Range where+        serialize x+          = do serialize (core_requests_Range x)+               serialize (core_replies_Range x)+               serialize (ext_requests_Range x)+               serialize (ext_replies_Range x)+               serialize (delivered_events_Range x)+               serialize (device_events_Range x)+               serialize (errors_Range x)+               serialize (client_started_Range x)+               serialize (client_died_Range x)+        size x+          = size (core_requests_Range x) + size (core_replies_Range x) ++              size (ext_requests_Range x)+              + size (ext_replies_Range x)+              + size (delivered_events_Range x)+              + size (device_events_Range x)+              + size (errors_Range x)+              + size (client_started_Range x)+              + size (client_died_Range x)+ +instance Deserialize Range where+        deserialize+          = do core_requests <- deserialize+               core_replies <- deserialize+               ext_requests <- deserialize+               ext_replies <- deserialize+               delivered_events <- deserialize+               device_events <- deserialize+               errors <- deserialize+               client_started <- deserialize+               client_died <- deserialize+               return+                 (MkRange core_requests core_replies ext_requests ext_replies+                    delivered_events+                    device_events+                    errors+                    client_started+                    client_died)+ +type ElementHeader = CARD8+ +data HType = HTypeFromServerTime+           | HTypeFromClientTime+           | HTypeFromClientSequence+ +instance BitEnum HType where+        toBit HTypeFromServerTime{} = 0+        toBit HTypeFromClientTime{} = 1+        toBit HTypeFromClientSequence{} = 2+        fromBit 0 = HTypeFromServerTime+        fromBit 1 = HTypeFromClientTime+        fromBit 2 = HTypeFromClientSequence+ +type ClientSpec = CARD32+ +data CS = CSCurrentClients+        | CSFutureClients+        | CSAllClients+ +instance SimpleEnum CS where+        toValue CSCurrentClients{} = 1+        toValue CSFutureClients{} = 2+        toValue CSAllClients{} = 3+        fromValue 1 = CSCurrentClients+        fromValue 2 = CSFutureClients+        fromValue 3 = CSAllClients+ +data ClientInfo = MkClientInfo{client_resource_ClientInfo ::+                               ClientSpec,+                               num_ranges_ClientInfo :: CARD32, ranges_ClientInfo :: [Range]}+                deriving (Show, Typeable)+ +instance Serialize ClientInfo where+        serialize x+          = do serialize (client_resource_ClientInfo x)+               serialize (num_ranges_ClientInfo x)+               serializeList (ranges_ClientInfo x)+        size x+          = size (client_resource_ClientInfo x) ++              size (num_ranges_ClientInfo x)+              + sum (map size (ranges_ClientInfo x))+ +instance Deserialize ClientInfo where+        deserialize+          = do client_resource <- deserialize+               num_ranges <- deserialize+               ranges <- deserializeList (fromIntegral num_ranges)+               return (MkClientInfo client_resource num_ranges ranges)+ +data BadContext = MkBadContext{invalid_record_BadContext :: CARD32}+                deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadContext+ +instance Deserialize BadContext where+        deserialize+          = do skip 4+               invalid_record <- deserialize+               return (MkBadContext invalid_record)+ +data QueryVersion = MkQueryVersion{major_version_QueryVersion ::+                                   CARD16,+                                   minor_version_QueryVersion :: CARD16}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "RECORD"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (major_version_QueryVersion x) ++                         size (minor_version_QueryVersion x)+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major_version <- deserialize+               minor_version <- deserialize+               let _ = isCard32 length+               return (MkQueryVersionReply major_version minor_version)+ +data CreateContext = MkCreateContext{context_CreateContext ::+                                     Graphics.XHB.Gen.Record.Types.CONTEXT,+                                     element_header_CreateContext :: ElementHeader,+                                     num_client_specs_CreateContext :: CARD32,+                                     num_ranges_CreateContext :: CARD32,+                                     client_specs_CreateContext :: [ClientSpec],+                                     ranges_CreateContext :: [Range]}+                   deriving (Show, Typeable)+ +instance ExtensionRequest CreateContext where+        extensionId _ = "RECORD"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__+                     = 4 + size (context_CreateContext x) ++                         size (element_header_CreateContext x)+                         + 3+                         + size (num_client_specs_CreateContext x)+                         + size (num_ranges_CreateContext x)+                         + sum (map size (client_specs_CreateContext x))+                         + sum (map size (ranges_CreateContext x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_CreateContext x)+               serialize (element_header_CreateContext x)+               putSkip 3+               serialize (num_client_specs_CreateContext x)+               serialize (num_ranges_CreateContext x)+               serializeList (client_specs_CreateContext x)+               serializeList (ranges_CreateContext x)+               putSkip (requiredPadding size__)+ +data RegisterClients = MkRegisterClients{context_RegisterClients ::+                                         Graphics.XHB.Gen.Record.Types.CONTEXT,+                                         element_header_RegisterClients :: ElementHeader,+                                         num_client_specs_RegisterClients :: CARD32,+                                         num_ranges_RegisterClients :: CARD32,+                                         client_specs_RegisterClients :: [ClientSpec],+                                         ranges_RegisterClients :: [Range]}+                     deriving (Show, Typeable)+ +instance ExtensionRequest RegisterClients where+        extensionId _ = "RECORD"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__+                     = 4 + size (context_RegisterClients x) ++                         size (element_header_RegisterClients x)+                         + 3+                         + size (num_client_specs_RegisterClients x)+                         + size (num_ranges_RegisterClients x)+                         + sum (map size (client_specs_RegisterClients x))+                         + sum (map size (ranges_RegisterClients x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_RegisterClients x)+               serialize (element_header_RegisterClients x)+               putSkip 3+               serialize (num_client_specs_RegisterClients x)+               serialize (num_ranges_RegisterClients x)+               serializeList (client_specs_RegisterClients x)+               serializeList (ranges_RegisterClients x)+               putSkip (requiredPadding size__)+ +data UnregisterClients = MkUnregisterClients{context_UnregisterClients+                                             :: Graphics.XHB.Gen.Record.Types.CONTEXT,+                                             num_client_specs_UnregisterClients :: CARD32,+                                             client_specs_UnregisterClients :: [ClientSpec]}+                       deriving (Show, Typeable)+ +instance ExtensionRequest UnregisterClients where+        extensionId _ = "RECORD"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (context_UnregisterClients x) ++                         size (num_client_specs_UnregisterClients x)+                         + sum (map size (client_specs_UnregisterClients x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_UnregisterClients x)+               serialize (num_client_specs_UnregisterClients x)+               serializeList (client_specs_UnregisterClients x)+               putSkip (requiredPadding size__)+ +data GetContext = MkGetContext{context_GetContext ::+                               Graphics.XHB.Gen.Record.Types.CONTEXT}+                deriving (Show, Typeable)+ +instance ExtensionRequest GetContext where+        extensionId _ = "RECORD"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__ = 4 + size (context_GetContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_GetContext x)+               putSkip (requiredPadding size__)+ +data GetContextReply = MkGetContextReply{enabled_GetContextReply ::+                                         BOOL,+                                         element_header_GetContextReply :: ElementHeader,+                                         num_intercepted_clients_GetContextReply :: CARD32,+                                         intercepted_clients_GetContextReply :: [ClientInfo]}+                     deriving (Show, Typeable)+ +instance Deserialize GetContextReply where+        deserialize+          = do skip 1+               enabled <- deserialize+               skip 2+               length <- deserialize+               element_header <- deserialize+               skip 3+               num_intercepted_clients <- deserialize+               skip 16+               intercepted_clients <- deserializeList+                                        (fromIntegral num_intercepted_clients)+               let _ = isCard32 length+               return+                 (MkGetContextReply enabled element_header num_intercepted_clients+                    intercepted_clients)+ +data EnableContext = MkEnableContext{context_EnableContext ::+                                     Graphics.XHB.Gen.Record.Types.CONTEXT}+                   deriving (Show, Typeable)+ +instance ExtensionRequest EnableContext where+        extensionId _ = "RECORD"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__ = 4 + size (context_EnableContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_EnableContext x)+               putSkip (requiredPadding size__)+ +data EnableContextReply = MkEnableContextReply{category_EnableContextReply+                                               :: CARD8,+                                               element_header_EnableContextReply :: ElementHeader,+                                               client_swapped_EnableContextReply :: BOOL,+                                               xid_base_EnableContextReply :: CARD32,+                                               server_time_EnableContextReply :: CARD32,+                                               rec_sequence_num_EnableContextReply :: CARD32,+                                               data_EnableContextReply :: [BYTE]}+                        deriving (Show, Typeable)+ +instance Deserialize EnableContextReply where+        deserialize+          = do skip 1+               category <- deserialize+               skip 2+               length <- deserialize+               element_header <- deserialize+               client_swapped <- deserialize+               skip 2+               xid_base <- deserialize+               server_time <- deserialize+               rec_sequence_num <- deserialize+               skip 8+               data_ <- deserializeList (fromIntegral (fromIntegral (length * 4)))+               let _ = isCard32 length+               return+                 (MkEnableContextReply category element_header client_swapped+                    xid_base+                    server_time+                    rec_sequence_num+                    data_)+ +data DisableContext = MkDisableContext{context_DisableContext ::+                                       Graphics.XHB.Gen.Record.Types.CONTEXT}+                    deriving (Show, Typeable)+ +instance ExtensionRequest DisableContext where+        extensionId _ = "RECORD"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__ = 4 + size (context_DisableContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_DisableContext x)+               putSkip (requiredPadding size__)+ +data FreeContext = MkFreeContext{context_FreeContext ::+                                 Graphics.XHB.Gen.Record.Types.CONTEXT}+                 deriving (Show, Typeable)+ +instance ExtensionRequest FreeContext where+        extensionId _ = "RECORD"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__ = 4 + size (context_FreeContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_FreeContext x)+               putSkip (requiredPadding size__)
+ patched/Graphics/XHB/Gen/Render.hs view
@@ -0,0 +1,282 @@+module Graphics.XHB.Gen.Render+       (extension, queryVersion, queryPictFormats, queryPictIndexValues,+        createPicture, changePicture, setPictureClipRectangles,+        freePicture, composite, trapezoids, triangles, triStrip, triFan,+        createGlyphSet, referenceGlyphSet, freeGlyphSet, addGlyphs,+        freeGlyphs, compositeGlyphs8, compositeGlyphs16, compositeGlyphs32,+        fillRectangles, createCursor, setPictureTransform, queryFilters,+        setPictureFilter, createAnimCursor, addTraps, createSolidFill,+        createLinearGradient, createRadialGradient, createConicalGradient,+        module Graphics.XHB.Gen.Render.Types)+       where+import Graphics.XHB.Gen.Render.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (CreateCursor(..), deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "RENDER"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)+queryVersion c client_major_version client_minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion client_major_version client_minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryPictFormats ::+                   Graphics.XHB.Connection.Types.Connection ->+                     IO (Receipt QueryPictFormatsReply)+queryPictFormats c+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryPictFormats+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryPictIndexValues ::+                       Graphics.XHB.Connection.Types.Connection ->+                         PICTFORMAT -> IO (Receipt QueryPictIndexValuesReply)+queryPictIndexValues c format+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryPictIndexValues format+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +createPicture ::+                Graphics.XHB.Connection.Types.Connection -> CreatePicture -> IO ()+createPicture c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +changePicture ::+                Graphics.XHB.Connection.Types.Connection ->+                  PICTURE -> ValueParam CARD32 -> IO ()+changePicture c picture value+  = do let req = MkChangePicture picture value+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +setPictureClipRectangles ::+                           Graphics.XHB.Connection.Types.Connection ->+                             SetPictureClipRectangles -> IO ()+setPictureClipRectangles c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +freePicture ::+              Graphics.XHB.Connection.Types.Connection -> PICTURE -> IO ()+freePicture c picture+  = do let req = MkFreePicture picture+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +composite ::+            Graphics.XHB.Connection.Types.Connection -> Composite -> IO ()+composite c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +trapezoids ::+             Graphics.XHB.Connection.Types.Connection -> Trapezoids -> IO ()+trapezoids c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +triangles ::+            Graphics.XHB.Connection.Types.Connection -> Triangles -> IO ()+triangles c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +triStrip ::+           Graphics.XHB.Connection.Types.Connection -> TriStrip -> IO ()+triStrip c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +triFan ::+         Graphics.XHB.Connection.Types.Connection -> TriFan -> IO ()+triFan c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createGlyphSet ::+                 Graphics.XHB.Connection.Types.Connection ->+                   GLYPHSET -> PICTFORMAT -> IO ()+createGlyphSet c gsid format+  = do let req = MkCreateGlyphSet gsid format+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +referenceGlyphSet ::+                    Graphics.XHB.Connection.Types.Connection ->+                      GLYPHSET -> GLYPHSET -> IO ()+referenceGlyphSet c gsid existing+  = do let req = MkReferenceGlyphSet gsid existing+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +freeGlyphSet ::+               Graphics.XHB.Connection.Types.Connection -> GLYPHSET -> IO ()+freeGlyphSet c glyphset+  = do let req = MkFreeGlyphSet glyphset+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +addGlyphs ::+            Graphics.XHB.Connection.Types.Connection -> AddGlyphs -> IO ()+addGlyphs c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +freeGlyphs ::+             Graphics.XHB.Connection.Types.Connection ->+               GLYPHSET -> [GLYPH] -> IO ()+freeGlyphs c glyphset glyphs+  = do let req = MkFreeGlyphs glyphset glyphs+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +compositeGlyphs8 ::+                   Graphics.XHB.Connection.Types.Connection ->+                     CompositeGlyphs8 -> IO ()+compositeGlyphs8 c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +compositeGlyphs16 ::+                    Graphics.XHB.Connection.Types.Connection ->+                      CompositeGlyphs16 -> IO ()+compositeGlyphs16 c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +compositeGlyphs32 ::+                    Graphics.XHB.Connection.Types.Connection ->+                      CompositeGlyphs32 -> IO ()+compositeGlyphs32 c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +fillRectangles ::+                 Graphics.XHB.Connection.Types.Connection -> FillRectangles -> IO ()+fillRectangles c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createCursor ::+               Graphics.XHB.Connection.Types.Connection -> CreateCursor -> IO ()+createCursor c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +setPictureTransform ::+                      Graphics.XHB.Connection.Types.Connection ->+                        PICTURE -> TRANSFORM -> IO ()+setPictureTransform c picture transform+  = do let req = MkSetPictureTransform picture transform+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +queryFilters ::+               Graphics.XHB.Connection.Types.Connection ->+                 DRAWABLE -> IO (Receipt QueryFiltersReply)+queryFilters c drawable+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryFilters drawable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setPictureFilter ::+                   Graphics.XHB.Connection.Types.Connection ->+                     SetPictureFilter -> IO ()+setPictureFilter c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createAnimCursor ::+                   Graphics.XHB.Connection.Types.Connection ->+                     CURSOR -> [ANIMCURSORELT] -> IO ()+createAnimCursor c cid cursors+  = do let req = MkCreateAnimCursor cid cursors+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +addTraps ::+           Graphics.XHB.Connection.Types.Connection -> AddTraps -> IO ()+addTraps c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createSolidFill ::+                  Graphics.XHB.Connection.Types.Connection ->+                    PICTURE -> COLOR -> IO ()+createSolidFill c picture color+  = do let req = MkCreateSolidFill picture color+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createLinearGradient ::+                       Graphics.XHB.Connection.Types.Connection ->+                         CreateLinearGradient -> IO ()+createLinearGradient c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createRadialGradient ::+                       Graphics.XHB.Connection.Types.Connection ->+                         CreateRadialGradient -> IO ()+createRadialGradient c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createConicalGradient ::+                        Graphics.XHB.Connection.Types.Connection ->+                          CreateConicalGradient -> IO ()+createConicalGradient c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk
+ patched/Graphics/XHB/Gen/Render/Types.hs view
@@ -0,0 +1,1497 @@+module Graphics.XHB.Gen.Render.Types+       (deserializeError, deserializeEvent, PictType(..), PictOp(..),+        PolyEdge(..), PolyMode(..), CP(..), SubPixel(..), Repeat(..),+        GLYPH, GLYPHSET, PICTURE, PICTFORMAT, FIXED, DIRECTFORMAT(..),+        PICTFORMINFO(..), PICTVISUAL(..), PICTDEPTH(..), PICTSCREEN(..),+        INDEXVALUE(..), COLOR(..), POINTFIX(..), LINEFIX(..), TRIANGLE(..),+        TRAPEZOID(..), GLYPHINFO(..), QueryVersion(..),+        QueryVersionReply(..), QueryPictFormats(..),+        QueryPictFormatsReply(..), QueryPictIndexValues(..),+        QueryPictIndexValuesReply(..), CreatePicture(..),+        ChangePicture(..), SetPictureClipRectangles(..), FreePicture(..),+        Composite(..), Trapezoids(..), Triangles(..), TriStrip(..),+        TriFan(..), CreateGlyphSet(..), ReferenceGlyphSet(..),+        FreeGlyphSet(..), AddGlyphs(..), FreeGlyphs(..),+        CompositeGlyphs8(..), CompositeGlyphs16(..), CompositeGlyphs32(..),+        FillRectangles(..), CreateCursor(..), TRANSFORM(..),+        SetPictureTransform(..), QueryFilters(..), QueryFiltersReply(..),+        SetPictureFilter(..), ANIMCURSORELT(..), CreateAnimCursor(..),+        SPANFIX(..), TRAP(..), AddTraps(..), CreateSolidFill(..),+        CreateLinearGradient(..), CreateRadialGradient(..),+        CreateConicalGradient(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (CreateCursor(..), deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +data PictType = PictTypeIndexed+              | PictTypeDirect+ +instance SimpleEnum PictType where+        toValue PictTypeIndexed{} = 0+        toValue PictTypeDirect{} = 1+        fromValue 0 = PictTypeIndexed+        fromValue 1 = PictTypeDirect+ +data PictOp = PictOpClear+            | PictOpSrc+            | PictOpDst+            | PictOpOver+            | PictOpOverReverse+            | PictOpIn+            | PictOpInReverse+            | PictOpOut+            | PictOpOutReverse+            | PictOpAtop+            | PictOpAtopReverse+            | PictOpXor+            | PictOpAdd+            | PictOpSaturate+            | PictOpDisjointClear+            | PictOpDisjointSrc+            | PictOpDisjointDst+            | PictOpDisjointOver+            | PictOpDisjointOverReverse+            | PictOpDisjointIn+            | PictOpDisjointInReverse+            | PictOpDisjointOut+            | PictOpDisjointOutReverse+            | PictOpDisjointAtop+            | PictOpDisjointAtopReverse+            | PictOpDisjointXor+            | PictOpConjointClear+            | PictOpConjointSrc+            | PictOpConjointDst+            | PictOpConjointOver+            | PictOpConjointOverReverse+            | PictOpConjointIn+            | PictOpConjointInReverse+            | PictOpConjointOut+            | PictOpConjointOutReverse+            | PictOpConjointAtop+            | PictOpConjointAtopReverse+            | PictOpConjointXor+ +instance SimpleEnum PictOp where+        toValue PictOpClear{} = 0+        toValue PictOpSrc{} = 1+        toValue PictOpDst{} = 2+        toValue PictOpOver{} = 3+        toValue PictOpOverReverse{} = 4+        toValue PictOpIn{} = 5+        toValue PictOpInReverse{} = 6+        toValue PictOpOut{} = 7+        toValue PictOpOutReverse{} = 8+        toValue PictOpAtop{} = 9+        toValue PictOpAtopReverse{} = 10+        toValue PictOpXor{} = 11+        toValue PictOpAdd{} = 12+        toValue PictOpSaturate{} = 13+        toValue PictOpDisjointClear{} = 14+        toValue PictOpDisjointSrc{} = 15+        toValue PictOpDisjointDst{} = 16+        toValue PictOpDisjointOver{} = 17+        toValue PictOpDisjointOverReverse{} = 18+        toValue PictOpDisjointIn{} = 19+        toValue PictOpDisjointInReverse{} = 20+        toValue PictOpDisjointOut{} = 21+        toValue PictOpDisjointOutReverse{} = 22+        toValue PictOpDisjointAtop{} = 23+        toValue PictOpDisjointAtopReverse{} = 24+        toValue PictOpDisjointXor{} = 25+        toValue PictOpConjointClear{} = 26+        toValue PictOpConjointSrc{} = 27+        toValue PictOpConjointDst{} = 28+        toValue PictOpConjointOver{} = 29+        toValue PictOpConjointOverReverse{} = 30+        toValue PictOpConjointIn{} = 31+        toValue PictOpConjointInReverse{} = 32+        toValue PictOpConjointOut{} = 33+        toValue PictOpConjointOutReverse{} = 34+        toValue PictOpConjointAtop{} = 35+        toValue PictOpConjointAtopReverse{} = 36+        toValue PictOpConjointXor{} = 37+        fromValue 0 = PictOpClear+        fromValue 1 = PictOpSrc+        fromValue 2 = PictOpDst+        fromValue 3 = PictOpOver+        fromValue 4 = PictOpOverReverse+        fromValue 5 = PictOpIn+        fromValue 6 = PictOpInReverse+        fromValue 7 = PictOpOut+        fromValue 8 = PictOpOutReverse+        fromValue 9 = PictOpAtop+        fromValue 10 = PictOpAtopReverse+        fromValue 11 = PictOpXor+        fromValue 12 = PictOpAdd+        fromValue 13 = PictOpSaturate+        fromValue 14 = PictOpDisjointClear+        fromValue 15 = PictOpDisjointSrc+        fromValue 16 = PictOpDisjointDst+        fromValue 17 = PictOpDisjointOver+        fromValue 18 = PictOpDisjointOverReverse+        fromValue 19 = PictOpDisjointIn+        fromValue 20 = PictOpDisjointInReverse+        fromValue 21 = PictOpDisjointOut+        fromValue 22 = PictOpDisjointOutReverse+        fromValue 23 = PictOpDisjointAtop+        fromValue 24 = PictOpDisjointAtopReverse+        fromValue 25 = PictOpDisjointXor+        fromValue 26 = PictOpConjointClear+        fromValue 27 = PictOpConjointSrc+        fromValue 28 = PictOpConjointDst+        fromValue 29 = PictOpConjointOver+        fromValue 30 = PictOpConjointOverReverse+        fromValue 31 = PictOpConjointIn+        fromValue 32 = PictOpConjointInReverse+        fromValue 33 = PictOpConjointOut+        fromValue 34 = PictOpConjointOutReverse+        fromValue 35 = PictOpConjointAtop+        fromValue 36 = PictOpConjointAtopReverse+        fromValue 37 = PictOpConjointXor+ +data PolyEdge = PolyEdgeSharp+              | PolyEdgeSmooth+ +instance SimpleEnum PolyEdge where+        toValue PolyEdgeSharp{} = 0+        toValue PolyEdgeSmooth{} = 1+        fromValue 0 = PolyEdgeSharp+        fromValue 1 = PolyEdgeSmooth+ +data PolyMode = PolyModePrecise+              | PolyModeImprecise+ +instance SimpleEnum PolyMode where+        toValue PolyModePrecise{} = 0+        toValue PolyModeImprecise{} = 1+        fromValue 0 = PolyModePrecise+        fromValue 1 = PolyModeImprecise+ +data CP = CPRepeat+        | CPAlphaMap+        | CPAlphaXOrigin+        | CPAlphaYOrigin+        | CPClipXOrigin+        | CPClipYOrigin+        | CPClipMask+        | CPGraphicsExposure+        | CPSubwindowMode+        | CPPolyEdge+        | CPPolyMode+        | CPDither+        | CPComponentAlpha+ +instance BitEnum CP where+        toBit CPRepeat{} = 0+        toBit CPAlphaMap{} = 1+        toBit CPAlphaXOrigin{} = 2+        toBit CPAlphaYOrigin{} = 3+        toBit CPClipXOrigin{} = 4+        toBit CPClipYOrigin{} = 5+        toBit CPClipMask{} = 6+        toBit CPGraphicsExposure{} = 7+        toBit CPSubwindowMode{} = 8+        toBit CPPolyEdge{} = 9+        toBit CPPolyMode{} = 10+        toBit CPDither{} = 11+        toBit CPComponentAlpha{} = 12+        fromBit 0 = CPRepeat+        fromBit 1 = CPAlphaMap+        fromBit 2 = CPAlphaXOrigin+        fromBit 3 = CPAlphaYOrigin+        fromBit 4 = CPClipXOrigin+        fromBit 5 = CPClipYOrigin+        fromBit 6 = CPClipMask+        fromBit 7 = CPGraphicsExposure+        fromBit 8 = CPSubwindowMode+        fromBit 9 = CPPolyEdge+        fromBit 10 = CPPolyMode+        fromBit 11 = CPDither+        fromBit 12 = CPComponentAlpha+ +data SubPixel = SubPixelUnknown+              | SubPixelHorizontalRGB+              | SubPixelHorizontalBGR+              | SubPixelVerticalRGB+              | SubPixelVerticalBGR+              | SubPixelNone+ +instance SimpleEnum SubPixel where+        toValue SubPixelUnknown{} = 0+        toValue SubPixelHorizontalRGB{} = 1+        toValue SubPixelHorizontalBGR{} = 2+        toValue SubPixelVerticalRGB{} = 3+        toValue SubPixelVerticalBGR{} = 4+        toValue SubPixelNone{} = 5+        fromValue 0 = SubPixelUnknown+        fromValue 1 = SubPixelHorizontalRGB+        fromValue 2 = SubPixelHorizontalBGR+        fromValue 3 = SubPixelVerticalRGB+        fromValue 4 = SubPixelVerticalBGR+        fromValue 5 = SubPixelNone+ +data Repeat = RepeatNone+            | RepeatNormal+            | RepeatPad+            | RepeatReflect+ +instance SimpleEnum Repeat where+        toValue RepeatNone{} = 0+        toValue RepeatNormal{} = 1+        toValue RepeatPad{} = 2+        toValue RepeatReflect{} = 3+        fromValue 0 = RepeatNone+        fromValue 1 = RepeatNormal+        fromValue 2 = RepeatPad+        fromValue 3 = RepeatReflect+ +type GLYPH = CARD32+ +newtype GLYPHSET = MkGLYPHSET Xid+                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype PICTURE = MkPICTURE Xid+                  deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype PICTFORMAT = MkPICTFORMAT Xid+                     deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +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}+                  deriving (Show, Typeable)+ +instance Serialize DIRECTFORMAT where+        serialize x+          = do serialize (red_shift_DIRECTFORMAT x)+               serialize (red_mask_DIRECTFORMAT x)+               serialize (green_shift_DIRECTFORMAT x)+               serialize (green_mask_DIRECTFORMAT x)+               serialize (blue_shift_DIRECTFORMAT x)+               serialize (blue_mask_DIRECTFORMAT x)+               serialize (alpha_shift_DIRECTFORMAT x)+               serialize (alpha_mask_DIRECTFORMAT x)+        size x+          = size (red_shift_DIRECTFORMAT x) + size (red_mask_DIRECTFORMAT x)+              + size (green_shift_DIRECTFORMAT x)+              + size (green_mask_DIRECTFORMAT x)+              + size (blue_shift_DIRECTFORMAT x)+              + size (blue_mask_DIRECTFORMAT x)+              + size (alpha_shift_DIRECTFORMAT x)+              + size (alpha_mask_DIRECTFORMAT x)+ +instance Deserialize DIRECTFORMAT where+        deserialize+          = do red_shift <- deserialize+               red_mask <- deserialize+               green_shift <- deserialize+               green_mask <- deserialize+               blue_shift <- deserialize+               blue_mask <- deserialize+               alpha_shift <- deserialize+               alpha_mask <- deserialize+               return+                 (MkDIRECTFORMAT red_shift red_mask green_shift green_mask+                    blue_shift+                    blue_mask+                    alpha_shift+                    alpha_mask)+ +data PICTFORMINFO = MkPICTFORMINFO{id_PICTFORMINFO :: PICTFORMAT,+                                   type_PICTFORMINFO :: CARD8, depth_PICTFORMINFO :: CARD8,+                                   direct_PICTFORMINFO :: DIRECTFORMAT,+                                   colormap_PICTFORMINFO :: COLORMAP}+                  deriving (Show, Typeable)+ +instance Serialize PICTFORMINFO where+        serialize x+          = do serialize (id_PICTFORMINFO x)+               serialize (type_PICTFORMINFO x)+               serialize (depth_PICTFORMINFO x)+               putSkip 2+               serialize (direct_PICTFORMINFO x)+               serialize (colormap_PICTFORMINFO x)+        size x+          = size (id_PICTFORMINFO x) + size (type_PICTFORMINFO x) ++              size (depth_PICTFORMINFO x)+              + 2+              + size (direct_PICTFORMINFO x)+              + size (colormap_PICTFORMINFO x)+ +instance Deserialize PICTFORMINFO where+        deserialize+          = do id <- deserialize+               type_ <- deserialize+               depth <- deserialize+               skip 2+               direct <- deserialize+               colormap <- deserialize+               return (MkPICTFORMINFO id type_ depth direct colormap)+ +data PICTVISUAL = MkPICTVISUAL{visual_PICTVISUAL :: VISUALID,+                               format_PICTVISUAL :: PICTFORMAT}+                deriving (Show, Typeable)+ +instance Serialize PICTVISUAL where+        serialize x+          = do serialize (visual_PICTVISUAL x)+               serialize (format_PICTVISUAL x)+        size x = size (visual_PICTVISUAL x) + size (format_PICTVISUAL x)+ +instance Deserialize PICTVISUAL where+        deserialize+          = do visual <- deserialize+               format <- deserialize+               return (MkPICTVISUAL visual format)+ +data PICTDEPTH = MkPICTDEPTH{depth_PICTDEPTH :: CARD8,+                             num_visuals_PICTDEPTH :: CARD16, visuals_PICTDEPTH :: [PICTVISUAL]}+               deriving (Show, Typeable)+ +instance Serialize PICTDEPTH where+        serialize x+          = do serialize (depth_PICTDEPTH x)+               putSkip 1+               serialize (num_visuals_PICTDEPTH x)+               putSkip 4+               serializeList (visuals_PICTDEPTH x)+        size x+          = size (depth_PICTDEPTH x) + 1 + size (num_visuals_PICTDEPTH x) + 4+              + sum (map size (visuals_PICTDEPTH x))+ +instance Deserialize PICTDEPTH where+        deserialize+          = do depth <- deserialize+               skip 1+               num_visuals <- deserialize+               skip 4+               visuals <- deserializeList (fromIntegral num_visuals)+               return (MkPICTDEPTH depth num_visuals visuals)+ +data PICTSCREEN = MkPICTSCREEN{num_depths_PICTSCREEN :: CARD32,+                               fallback_PICTSCREEN :: PICTFORMAT,+                               depths_PICTSCREEN :: [PICTDEPTH]}+                deriving (Show, Typeable)+ +instance Serialize PICTSCREEN where+        serialize x+          = do serialize (num_depths_PICTSCREEN x)+               serialize (fallback_PICTSCREEN x)+               serializeList (depths_PICTSCREEN x)+        size x+          = size (num_depths_PICTSCREEN x) + size (fallback_PICTSCREEN x) ++              sum (map size (depths_PICTSCREEN x))+ +instance Deserialize PICTSCREEN where+        deserialize+          = do num_depths <- deserialize+               fallback <- deserialize+               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}+                deriving (Show, Typeable)+ +instance Serialize INDEXVALUE where+        serialize x+          = do serialize (pixel_INDEXVALUE x)+               serialize (red_INDEXVALUE x)+               serialize (green_INDEXVALUE x)+               serialize (blue_INDEXVALUE x)+               serialize (alpha_INDEXVALUE x)+        size x+          = size (pixel_INDEXVALUE x) + size (red_INDEXVALUE x) ++              size (green_INDEXVALUE x)+              + size (blue_INDEXVALUE x)+              + size (alpha_INDEXVALUE x)+ +instance Deserialize INDEXVALUE where+        deserialize+          = do pixel <- deserialize+               red <- deserialize+               green <- deserialize+               blue <- deserialize+               alpha <- deserialize+               return (MkINDEXVALUE pixel red green blue alpha)+ +data COLOR = MkCOLOR{red_COLOR :: CARD16, green_COLOR :: CARD16,+                     blue_COLOR :: CARD16, alpha_COLOR :: CARD16}+           deriving (Show, Typeable)+ +instance Serialize COLOR where+        serialize x+          = do serialize (red_COLOR x)+               serialize (green_COLOR x)+               serialize (blue_COLOR x)+               serialize (alpha_COLOR x)+        size x+          = size (red_COLOR x) + size (green_COLOR x) + size (blue_COLOR x) ++              size (alpha_COLOR x)+ +instance Deserialize COLOR where+        deserialize+          = do red <- deserialize+               green <- deserialize+               blue <- deserialize+               alpha <- deserialize+               return (MkCOLOR red green blue alpha)+ +data POINTFIX = MkPOINTFIX{x_POINTFIX :: FIXED,+                           y_POINTFIX :: FIXED}+              deriving (Show, Typeable)+ +instance Serialize POINTFIX where+        serialize x+          = do serialize (x_POINTFIX x)+               serialize (y_POINTFIX x)+        size x = size (x_POINTFIX x) + size (y_POINTFIX x)+ +instance Deserialize POINTFIX where+        deserialize+          = do x <- deserialize+               y <- deserialize+               return (MkPOINTFIX x y)+ +data LINEFIX = MkLINEFIX{p1_LINEFIX :: POINTFIX,+                         p2_LINEFIX :: POINTFIX}+             deriving (Show, Typeable)+ +instance Serialize LINEFIX where+        serialize x+          = do serialize (p1_LINEFIX x)+               serialize (p2_LINEFIX x)+        size x = size (p1_LINEFIX x) + size (p2_LINEFIX x)+ +instance Deserialize LINEFIX where+        deserialize+          = do p1 <- deserialize+               p2 <- deserialize+               return (MkLINEFIX p1 p2)+ +data TRIANGLE = MkTRIANGLE{p1_TRIANGLE :: POINTFIX,+                           p2_TRIANGLE :: POINTFIX, p3_TRIANGLE :: POINTFIX}+              deriving (Show, Typeable)+ +instance Serialize TRIANGLE where+        serialize x+          = do serialize (p1_TRIANGLE x)+               serialize (p2_TRIANGLE x)+               serialize (p3_TRIANGLE x)+        size x+          = size (p1_TRIANGLE x) + size (p2_TRIANGLE x) ++              size (p3_TRIANGLE x)+ +instance Deserialize TRIANGLE where+        deserialize+          = do p1 <- deserialize+               p2 <- deserialize+               p3 <- deserialize+               return (MkTRIANGLE p1 p2 p3)+ +data TRAPEZOID = MkTRAPEZOID{top_TRAPEZOID :: FIXED,+                             bottom_TRAPEZOID :: FIXED, left_TRAPEZOID :: LINEFIX,+                             right_TRAPEZOID :: LINEFIX}+               deriving (Show, Typeable)+ +instance Serialize TRAPEZOID where+        serialize x+          = do serialize (top_TRAPEZOID x)+               serialize (bottom_TRAPEZOID x)+               serialize (left_TRAPEZOID x)+               serialize (right_TRAPEZOID x)+        size x+          = size (top_TRAPEZOID x) + size (bottom_TRAPEZOID x) ++              size (left_TRAPEZOID x)+              + size (right_TRAPEZOID x)+ +instance Deserialize TRAPEZOID where+        deserialize+          = do top <- deserialize+               bottom <- deserialize+               left <- deserialize+               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}+               deriving (Show, Typeable)+ +instance Serialize GLYPHINFO where+        serialize x+          = do serialize (width_GLYPHINFO x)+               serialize (height_GLYPHINFO x)+               serialize (x_GLYPHINFO x)+               serialize (y_GLYPHINFO x)+               serialize (x_off_GLYPHINFO x)+               serialize (y_off_GLYPHINFO x)+        size x+          = size (width_GLYPHINFO x) + size (height_GLYPHINFO x) ++              size (x_GLYPHINFO x)+              + size (y_GLYPHINFO x)+              + size (x_off_GLYPHINFO x)+              + size (y_off_GLYPHINFO x)+ +instance Deserialize GLYPHINFO where+        deserialize+          = do width <- deserialize+               height <- deserialize+               x <- deserialize+               y <- deserialize+               x_off <- deserialize+               y_off <- deserialize+               return (MkGLYPHINFO width height x y x_off y_off)+ +data QueryVersion = MkQueryVersion{client_major_version_QueryVersion+                                   :: CARD32,+                                   client_minor_version_QueryVersion :: CARD32}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (client_major_version_QueryVersion x) ++                         size (client_minor_version_QueryVersion x)+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major_version <- deserialize+               minor_version <- deserialize+               skip 16+               let _ = isCard32 length+               return (MkQueryVersionReply major_version minor_version)+ +data QueryPictFormats = MkQueryPictFormats{}+                      deriving (Show, Typeable)+ +instance ExtensionRequest QueryPictFormats where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__ = 4+               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,+                                                     formats_QueryPictFormatsReply ::+                                                     [PICTFORMINFO],+                                                     screens_QueryPictFormatsReply :: [PICTSCREEN],+                                                     subpixels_QueryPictFormatsReply :: [CARD32]}+                           deriving (Show, Typeable)+ +instance Deserialize QueryPictFormatsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_formats <- deserialize+               num_screens <- deserialize+               num_depths <- deserialize+               num_visuals <- deserialize+               num_subpixel <- deserialize+               skip 4+               formats <- deserializeList (fromIntegral num_formats)+               screens <- deserializeList (fromIntegral num_screens)+               subpixels <- deserializeList (fromIntegral num_subpixel)+               let _ = isCard32 length+               return+                 (MkQueryPictFormatsReply num_formats num_screens num_depths+                    num_visuals+                    num_subpixel+                    formats+                    screens+                    subpixels)+ +data QueryPictIndexValues = MkQueryPictIndexValues{format_QueryPictIndexValues+                                                   :: PICTFORMAT}+                          deriving (Show, Typeable)+ +instance ExtensionRequest QueryPictIndexValues where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4 + size (format_QueryPictIndexValues x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (format_QueryPictIndexValues x)+               putSkip (requiredPadding size__)+ +data QueryPictIndexValuesReply = MkQueryPictIndexValuesReply{num_values_QueryPictIndexValuesReply+                                                             :: CARD32,+                                                             values_QueryPictIndexValuesReply ::+                                                             [INDEXVALUE]}+                               deriving (Show, Typeable)+ +instance Deserialize QueryPictIndexValuesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_values <- deserialize+               skip 20+               values <- deserializeList (fromIntegral num_values)+               let _ = isCard32 length+               return (MkQueryPictIndexValuesReply num_values values)+ +data CreatePicture = MkCreatePicture{pid_CreatePicture :: PICTURE,+                                     drawable_CreatePicture :: DRAWABLE,+                                     format_CreatePicture :: PICTFORMAT,+                                     value_CreatePicture :: ValueParam CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest CreatePicture where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__+                     = 4 + size (pid_CreatePicture x) + size (drawable_CreatePicture x)+                         + size (format_CreatePicture x)+                         + size (value_CreatePicture x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (pid_CreatePicture x)+               serialize (drawable_CreatePicture x)+               serialize (format_CreatePicture x)+               serialize (value_CreatePicture x)+               putSkip (requiredPadding size__)+ +data ChangePicture = MkChangePicture{picture_ChangePicture ::+                                     PICTURE,+                                     value_ChangePicture :: ValueParam CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest ChangePicture where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__+                     = 4 + size (picture_ChangePicture x) + size (value_ChangePicture x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (picture_ChangePicture x)+               serialize (value_ChangePicture x)+               putSkip (requiredPadding size__)+ +data SetPictureClipRectangles = MkSetPictureClipRectangles{picture_SetPictureClipRectangles+                                                           :: PICTURE,+                                                           clip_x_origin_SetPictureClipRectangles ::+                                                           INT16,+                                                           clip_y_origin_SetPictureClipRectangles ::+                                                           INT16,+                                                           rectangles_SetPictureClipRectangles ::+                                                           [RECTANGLE]}+                              deriving (Show, Typeable)+ +instance ExtensionRequest SetPictureClipRectangles where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__+                     = 4 + size (picture_SetPictureClipRectangles x) ++                         size (clip_x_origin_SetPictureClipRectangles x)+                         + size (clip_y_origin_SetPictureClipRectangles x)+                         + sum (map size (rectangles_SetPictureClipRectangles x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (picture_SetPictureClipRectangles x)+               serialize (clip_x_origin_SetPictureClipRectangles x)+               serialize (clip_y_origin_SetPictureClipRectangles x)+               serializeList (rectangles_SetPictureClipRectangles x)+               putSkip (requiredPadding size__)+ +data FreePicture = MkFreePicture{picture_FreePicture :: PICTURE}+                 deriving (Show, Typeable)+ +instance ExtensionRequest FreePicture where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__ = 4 + size (picture_FreePicture x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (picture_FreePicture x)+               putSkip (requiredPadding size__)+ +data Composite = MkComposite{op_Composite :: CARD8,+                             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}+               deriving (Show, Typeable)+ +instance ExtensionRequest Composite where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__+                     = 4 + size (op_Composite x) + 3 + size (src_Composite x) ++                         size (mask_Composite x)+                         + size (dst_Composite x)+                         + size (src_x_Composite x)+                         + size (src_y_Composite x)+                         + size (mask_x_Composite x)+                         + size (mask_y_Composite x)+                         + size (dst_x_Composite x)+                         + size (dst_y_Composite x)+                         + size (width_Composite x)+                         + size (height_Composite x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (op_Composite x)+               putSkip 3+               serialize (src_Composite x)+               serialize (mask_Composite x)+               serialize (dst_Composite x)+               serialize (src_x_Composite x)+               serialize (src_y_Composite x)+               serialize (mask_x_Composite x)+               serialize (mask_y_Composite x)+               serialize (dst_x_Composite x)+               serialize (dst_y_Composite x)+               serialize (width_Composite x)+               serialize (height_Composite x)+               putSkip (requiredPadding size__)+ +data Trapezoids = MkTrapezoids{op_Trapezoids :: CARD8,+                               src_Trapezoids :: PICTURE, dst_Trapezoids :: PICTURE,+                               mask_format_Trapezoids :: PICTFORMAT, src_x_Trapezoids :: INT16,+                               src_y_Trapezoids :: INT16, traps_Trapezoids :: [TRAPEZOID]}+                deriving (Show, Typeable)+ +instance ExtensionRequest Trapezoids where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 10+               let size__+                     = 4 + size (op_Trapezoids x) + 3 + size (src_Trapezoids x) ++                         size (dst_Trapezoids x)+                         + size (mask_format_Trapezoids x)+                         + size (src_x_Trapezoids x)+                         + size (src_y_Trapezoids x)+                         + sum (map size (traps_Trapezoids x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (op_Trapezoids x)+               putSkip 3+               serialize (src_Trapezoids x)+               serialize (dst_Trapezoids x)+               serialize (mask_format_Trapezoids x)+               serialize (src_x_Trapezoids x)+               serialize (src_y_Trapezoids x)+               serializeList (traps_Trapezoids x)+               putSkip (requiredPadding size__)+ +data Triangles = MkTriangles{op_Triangles :: CARD8,+                             src_Triangles :: PICTURE, dst_Triangles :: PICTURE,+                             mask_format_Triangles :: PICTFORMAT, src_x_Triangles :: INT16,+                             src_y_Triangles :: INT16, triangles_Triangles :: [TRIANGLE]}+               deriving (Show, Typeable)+ +instance ExtensionRequest Triangles where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 11+               let size__+                     = 4 + size (op_Triangles x) + 3 + size (src_Triangles x) ++                         size (dst_Triangles x)+                         + size (mask_format_Triangles x)+                         + size (src_x_Triangles x)+                         + size (src_y_Triangles x)+                         + sum (map size (triangles_Triangles x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (op_Triangles x)+               putSkip 3+               serialize (src_Triangles x)+               serialize (dst_Triangles x)+               serialize (mask_format_Triangles x)+               serialize (src_x_Triangles x)+               serialize (src_y_Triangles x)+               serializeList (triangles_Triangles x)+               putSkip (requiredPadding size__)+ +data TriStrip = MkTriStrip{op_TriStrip :: CARD8,+                           src_TriStrip :: PICTURE, dst_TriStrip :: PICTURE,+                           mask_format_TriStrip :: PICTFORMAT, src_x_TriStrip :: INT16,+                           src_y_TriStrip :: INT16, points_TriStrip :: [POINTFIX]}+              deriving (Show, Typeable)+ +instance ExtensionRequest TriStrip where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 12+               let size__+                     = 4 + size (op_TriStrip x) + 3 + size (src_TriStrip x) ++                         size (dst_TriStrip x)+                         + size (mask_format_TriStrip x)+                         + size (src_x_TriStrip x)+                         + size (src_y_TriStrip x)+                         + sum (map size (points_TriStrip x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (op_TriStrip x)+               putSkip 3+               serialize (src_TriStrip x)+               serialize (dst_TriStrip x)+               serialize (mask_format_TriStrip x)+               serialize (src_x_TriStrip x)+               serialize (src_y_TriStrip x)+               serializeList (points_TriStrip x)+               putSkip (requiredPadding size__)+ +data TriFan = MkTriFan{op_TriFan :: CARD8, src_TriFan :: PICTURE,+                       dst_TriFan :: PICTURE, mask_format_TriFan :: PICTFORMAT,+                       src_x_TriFan :: INT16, src_y_TriFan :: INT16,+                       points_TriFan :: [POINTFIX]}+            deriving (Show, Typeable)+ +instance ExtensionRequest TriFan where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 13+               let size__+                     = 4 + size (op_TriFan x) + 3 + size (src_TriFan x) ++                         size (dst_TriFan x)+                         + size (mask_format_TriFan x)+                         + size (src_x_TriFan x)+                         + size (src_y_TriFan x)+                         + sum (map size (points_TriFan x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (op_TriFan x)+               putSkip 3+               serialize (src_TriFan x)+               serialize (dst_TriFan x)+               serialize (mask_format_TriFan x)+               serialize (src_x_TriFan x)+               serialize (src_y_TriFan x)+               serializeList (points_TriFan x)+               putSkip (requiredPadding size__)+ +data CreateGlyphSet = MkCreateGlyphSet{gsid_CreateGlyphSet ::+                                       GLYPHSET,+                                       format_CreateGlyphSet :: PICTFORMAT}+                    deriving (Show, Typeable)+ +instance ExtensionRequest CreateGlyphSet where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 17+               let size__+                     = 4 + size (gsid_CreateGlyphSet x) + size (format_CreateGlyphSet x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (gsid_CreateGlyphSet x)+               serialize (format_CreateGlyphSet x)+               putSkip (requiredPadding size__)+ +data ReferenceGlyphSet = MkReferenceGlyphSet{gsid_ReferenceGlyphSet+                                             :: GLYPHSET,+                                             existing_ReferenceGlyphSet :: GLYPHSET}+                       deriving (Show, Typeable)+ +instance ExtensionRequest ReferenceGlyphSet where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 18+               let size__+                     = 4 + size (gsid_ReferenceGlyphSet x) ++                         size (existing_ReferenceGlyphSet x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (gsid_ReferenceGlyphSet x)+               serialize (existing_ReferenceGlyphSet x)+               putSkip (requiredPadding size__)+ +data FreeGlyphSet = MkFreeGlyphSet{glyphset_FreeGlyphSet ::+                                   GLYPHSET}+                  deriving (Show, Typeable)+ +instance ExtensionRequest FreeGlyphSet where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 19+               let size__ = 4 + size (glyphset_FreeGlyphSet x)+               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]}+               deriving (Show, Typeable)+ +instance ExtensionRequest AddGlyphs where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 20+               let size__+                     = 4 + size (glyphset_AddGlyphs x) + size (glyphs_len_AddGlyphs x) ++                         sum (map size (glyphids_AddGlyphs x))+                         + sum (map size (glyphs_AddGlyphs x))+                         + sum (map size (data_AddGlyphs x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (glyphset_AddGlyphs x)+               serialize (glyphs_len_AddGlyphs x)+               serializeList (glyphids_AddGlyphs x)+               serializeList (glyphs_AddGlyphs x)+               serializeList (data_AddGlyphs x)+               putSkip (requiredPadding size__)+ +data FreeGlyphs = MkFreeGlyphs{glyphset_FreeGlyphs :: GLYPHSET,+                               glyphs_FreeGlyphs :: [GLYPH]}+                deriving (Show, Typeable)+ +instance ExtensionRequest FreeGlyphs where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 22+               let size__+                     = 4 + size (glyphset_FreeGlyphs x) ++                         sum (map size (glyphs_FreeGlyphs x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (glyphset_FreeGlyphs x)+               serializeList (glyphs_FreeGlyphs x)+               putSkip (requiredPadding size__)+ +data CompositeGlyphs8 = MkCompositeGlyphs8{op_CompositeGlyphs8 ::+                                           CARD8,+                                           src_CompositeGlyphs8 :: PICTURE,+                                           dst_CompositeGlyphs8 :: PICTURE,+                                           mask_format_CompositeGlyphs8 :: PICTFORMAT,+                                           glyphset_CompositeGlyphs8 :: GLYPHSET,+                                           src_x_CompositeGlyphs8 :: INT16,+                                           src_y_CompositeGlyphs8 :: INT16,+                                           glyphcmds_CompositeGlyphs8 :: [BYTE]}+                      deriving (Show, Typeable)+ +instance ExtensionRequest CompositeGlyphs8 where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 23+               let size__+                     = 4 + size (op_CompositeGlyphs8 x) + 3 ++                         size (src_CompositeGlyphs8 x)+                         + size (dst_CompositeGlyphs8 x)+                         + size (mask_format_CompositeGlyphs8 x)+                         + size (glyphset_CompositeGlyphs8 x)+                         + size (src_x_CompositeGlyphs8 x)+                         + size (src_y_CompositeGlyphs8 x)+                         + sum (map size (glyphcmds_CompositeGlyphs8 x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (op_CompositeGlyphs8 x)+               putSkip 3+               serialize (src_CompositeGlyphs8 x)+               serialize (dst_CompositeGlyphs8 x)+               serialize (mask_format_CompositeGlyphs8 x)+               serialize (glyphset_CompositeGlyphs8 x)+               serialize (src_x_CompositeGlyphs8 x)+               serialize (src_y_CompositeGlyphs8 x)+               serializeList (glyphcmds_CompositeGlyphs8 x)+               putSkip (requiredPadding size__)+ +data CompositeGlyphs16 = MkCompositeGlyphs16{op_CompositeGlyphs16+                                             :: CARD8,+                                             src_CompositeGlyphs16 :: PICTURE,+                                             dst_CompositeGlyphs16 :: PICTURE,+                                             mask_format_CompositeGlyphs16 :: PICTFORMAT,+                                             glyphset_CompositeGlyphs16 :: GLYPHSET,+                                             src_x_CompositeGlyphs16 :: INT16,+                                             src_y_CompositeGlyphs16 :: INT16,+                                             glyphcmds_CompositeGlyphs16 :: [BYTE]}+                       deriving (Show, Typeable)+ +instance ExtensionRequest CompositeGlyphs16 where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 24+               let size__+                     = 4 + size (op_CompositeGlyphs16 x) + 3 ++                         size (src_CompositeGlyphs16 x)+                         + size (dst_CompositeGlyphs16 x)+                         + size (mask_format_CompositeGlyphs16 x)+                         + size (glyphset_CompositeGlyphs16 x)+                         + size (src_x_CompositeGlyphs16 x)+                         + size (src_y_CompositeGlyphs16 x)+                         + sum (map size (glyphcmds_CompositeGlyphs16 x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (op_CompositeGlyphs16 x)+               putSkip 3+               serialize (src_CompositeGlyphs16 x)+               serialize (dst_CompositeGlyphs16 x)+               serialize (mask_format_CompositeGlyphs16 x)+               serialize (glyphset_CompositeGlyphs16 x)+               serialize (src_x_CompositeGlyphs16 x)+               serialize (src_y_CompositeGlyphs16 x)+               serializeList (glyphcmds_CompositeGlyphs16 x)+               putSkip (requiredPadding size__)+ +data CompositeGlyphs32 = MkCompositeGlyphs32{op_CompositeGlyphs32+                                             :: CARD8,+                                             src_CompositeGlyphs32 :: PICTURE,+                                             dst_CompositeGlyphs32 :: PICTURE,+                                             mask_format_CompositeGlyphs32 :: PICTFORMAT,+                                             glyphset_CompositeGlyphs32 :: GLYPHSET,+                                             src_x_CompositeGlyphs32 :: INT16,+                                             src_y_CompositeGlyphs32 :: INT16,+                                             glyphcmds_CompositeGlyphs32 :: [BYTE]}+                       deriving (Show, Typeable)+ +instance ExtensionRequest CompositeGlyphs32 where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 25+               let size__+                     = 4 + size (op_CompositeGlyphs32 x) + 3 ++                         size (src_CompositeGlyphs32 x)+                         + size (dst_CompositeGlyphs32 x)+                         + size (mask_format_CompositeGlyphs32 x)+                         + size (glyphset_CompositeGlyphs32 x)+                         + size (src_x_CompositeGlyphs32 x)+                         + size (src_y_CompositeGlyphs32 x)+                         + sum (map size (glyphcmds_CompositeGlyphs32 x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (op_CompositeGlyphs32 x)+               putSkip 3+               serialize (src_CompositeGlyphs32 x)+               serialize (dst_CompositeGlyphs32 x)+               serialize (mask_format_CompositeGlyphs32 x)+               serialize (glyphset_CompositeGlyphs32 x)+               serialize (src_x_CompositeGlyphs32 x)+               serialize (src_y_CompositeGlyphs32 x)+               serializeList (glyphcmds_CompositeGlyphs32 x)+               putSkip (requiredPadding size__)+ +data FillRectangles = MkFillRectangles{op_FillRectangles :: CARD8,+                                       dst_FillRectangles :: PICTURE, color_FillRectangles :: COLOR,+                                       rects_FillRectangles :: [RECTANGLE]}+                    deriving (Show, Typeable)+ +instance ExtensionRequest FillRectangles where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 26+               let size__+                     = 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 (op_FillRectangles x)+               putSkip 3+               serialize (dst_FillRectangles x)+               serialize (color_FillRectangles x)+               serializeList (rects_FillRectangles x)+               putSkip (requiredPadding size__)+ +data CreateCursor = MkCreateCursor{cid_CreateCursor :: CURSOR,+                                   source_CreateCursor :: PICTURE, x_CreateCursor :: CARD16,+                                   y_CreateCursor :: CARD16}+                  deriving (Show, Typeable)+ +instance ExtensionRequest CreateCursor where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 27+               let size__+                     = 4 + size (cid_CreateCursor x) + size (source_CreateCursor x) ++                         size (x_CreateCursor x)+                         + size (y_CreateCursor x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (cid_CreateCursor x)+               serialize (source_CreateCursor x)+               serialize (x_CreateCursor x)+               serialize (y_CreateCursor x)+               putSkip (requiredPadding size__)+ +data TRANSFORM = MkTRANSFORM{matrix11_TRANSFORM :: FIXED,+                             matrix12_TRANSFORM :: FIXED, matrix13_TRANSFORM :: FIXED,+                             matrix21_TRANSFORM :: FIXED, matrix22_TRANSFORM :: FIXED,+                             matrix23_TRANSFORM :: FIXED, matrix31_TRANSFORM :: FIXED,+                             matrix32_TRANSFORM :: FIXED, matrix33_TRANSFORM :: FIXED}+               deriving (Show, Typeable)+ +instance Serialize TRANSFORM where+        serialize x+          = do serialize (matrix11_TRANSFORM x)+               serialize (matrix12_TRANSFORM x)+               serialize (matrix13_TRANSFORM x)+               serialize (matrix21_TRANSFORM x)+               serialize (matrix22_TRANSFORM x)+               serialize (matrix23_TRANSFORM x)+               serialize (matrix31_TRANSFORM x)+               serialize (matrix32_TRANSFORM x)+               serialize (matrix33_TRANSFORM x)+        size x+          = size (matrix11_TRANSFORM x) + size (matrix12_TRANSFORM x) ++              size (matrix13_TRANSFORM x)+              + size (matrix21_TRANSFORM x)+              + size (matrix22_TRANSFORM x)+              + size (matrix23_TRANSFORM x)+              + size (matrix31_TRANSFORM x)+              + size (matrix32_TRANSFORM x)+              + size (matrix33_TRANSFORM x)+ +instance Deserialize TRANSFORM where+        deserialize+          = do matrix11 <- deserialize+               matrix12 <- deserialize+               matrix13 <- deserialize+               matrix21 <- deserialize+               matrix22 <- deserialize+               matrix23 <- deserialize+               matrix31 <- deserialize+               matrix32 <- deserialize+               matrix33 <- deserialize+               return+                 (MkTRANSFORM matrix11 matrix12 matrix13 matrix21 matrix22 matrix23+                    matrix31+                    matrix32+                    matrix33)+ +data SetPictureTransform = MkSetPictureTransform{picture_SetPictureTransform+                                                 :: PICTURE,+                                                 transform_SetPictureTransform :: TRANSFORM}+                         deriving (Show, Typeable)+ +instance ExtensionRequest SetPictureTransform where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 28+               let size__+                     = 4 + size (picture_SetPictureTransform x) ++                         size (transform_SetPictureTransform x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (picture_SetPictureTransform x)+               serialize (transform_SetPictureTransform x)+               putSkip (requiredPadding size__)+ +data QueryFilters = MkQueryFilters{drawable_QueryFilters ::+                                   DRAWABLE}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryFilters where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 29+               let size__ = 4 + size (drawable_QueryFilters x)+               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],+                                             filters_QueryFiltersReply :: [STR]}+                       deriving (Show, Typeable)+ +instance Deserialize QueryFiltersReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_aliases <- deserialize+               num_filters <- deserialize+               skip 16+               aliases <- deserializeList (fromIntegral num_aliases)+               filters <- deserializeList (fromIntegral num_filters)+               let _ = isCard32 length+               return+                 (MkQueryFiltersReply num_aliases num_filters aliases filters)+ +data SetPictureFilter = MkSetPictureFilter{picture_SetPictureFilter+                                           :: PICTURE,+                                           filter_len_SetPictureFilter :: CARD16,+                                           filter_SetPictureFilter :: [CChar],+                                           values_SetPictureFilter :: [FIXED]}+                      deriving (Show, Typeable)+ +instance ExtensionRequest SetPictureFilter where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 30+               let size__+                     = 4 + size (picture_SetPictureFilter x) ++                         size (filter_len_SetPictureFilter x)+                         + 2+                         + sum (map size (filter_SetPictureFilter x))+                         + sum (map size (values_SetPictureFilter x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (picture_SetPictureFilter x)+               serialize (filter_len_SetPictureFilter x)+               putSkip 2+               serializeList (filter_SetPictureFilter x)+               serializeList (values_SetPictureFilter x)+               putSkip (requiredPadding size__)+ +data ANIMCURSORELT = MkANIMCURSORELT{cursor_ANIMCURSORELT ::+                                     CURSOR,+                                     delay_ANIMCURSORELT :: CARD32}+                   deriving (Show, Typeable)+ +instance Serialize ANIMCURSORELT where+        serialize x+          = do serialize (cursor_ANIMCURSORELT x)+               serialize (delay_ANIMCURSORELT x)+        size x+          = size (cursor_ANIMCURSORELT x) + size (delay_ANIMCURSORELT x)+ +instance Deserialize ANIMCURSORELT where+        deserialize+          = do cursor <- deserialize+               delay <- deserialize+               return (MkANIMCURSORELT cursor delay)+ +data CreateAnimCursor = MkCreateAnimCursor{cid_CreateAnimCursor ::+                                           CURSOR,+                                           cursors_CreateAnimCursor :: [ANIMCURSORELT]}+                      deriving (Show, Typeable)+ +instance ExtensionRequest CreateAnimCursor where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 31+               let size__+                     = 4 + size (cid_CreateAnimCursor x) ++                         sum (map size (cursors_CreateAnimCursor x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (cid_CreateAnimCursor x)+               serializeList (cursors_CreateAnimCursor x)+               putSkip (requiredPadding size__)+ +data SPANFIX = MkSPANFIX{l_SPANFIX :: FIXED, r_SPANFIX :: FIXED,+                         y_SPANFIX :: FIXED}+             deriving (Show, Typeable)+ +instance Serialize SPANFIX where+        serialize x+          = do serialize (l_SPANFIX x)+               serialize (r_SPANFIX x)+               serialize (y_SPANFIX x)+        size x+          = size (l_SPANFIX x) + size (r_SPANFIX x) + size (y_SPANFIX x)+ +instance Deserialize SPANFIX where+        deserialize+          = do l <- deserialize+               r <- deserialize+               y <- deserialize+               return (MkSPANFIX l r y)+ +data TRAP = MkTRAP{top_TRAP :: SPANFIX, bot_TRAP :: SPANFIX}+          deriving (Show, Typeable)+ +instance Serialize TRAP where+        serialize x+          = do serialize (top_TRAP x)+               serialize (bot_TRAP x)+        size x = size (top_TRAP x) + size (bot_TRAP x)+ +instance Deserialize TRAP where+        deserialize+          = do top <- deserialize+               bot <- deserialize+               return (MkTRAP top bot)+ +data AddTraps = MkAddTraps{picture_AddTraps :: PICTURE,+                           x_off_AddTraps :: INT16, y_off_AddTraps :: INT16,+                           traps_AddTraps :: [TRAP]}+              deriving (Show, Typeable)+ +instance ExtensionRequest AddTraps where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 32+               let size__+                     = 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 (picture_AddTraps x)+               serialize (x_off_AddTraps x)+               serialize (y_off_AddTraps x)+               serializeList (traps_AddTraps x)+               putSkip (requiredPadding size__)+ +data CreateSolidFill = MkCreateSolidFill{picture_CreateSolidFill ::+                                         PICTURE,+                                         color_CreateSolidFill :: COLOR}+                     deriving (Show, Typeable)+ +instance ExtensionRequest CreateSolidFill where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 33+               let size__+                     = 4 + size (picture_CreateSolidFill x) ++                         size (color_CreateSolidFill x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (picture_CreateSolidFill x)+               serialize (color_CreateSolidFill x)+               putSkip (requiredPadding size__)+ +data CreateLinearGradient = MkCreateLinearGradient{picture_CreateLinearGradient+                                                   :: PICTURE,+                                                   p1_CreateLinearGradient :: POINTFIX,+                                                   p2_CreateLinearGradient :: POINTFIX,+                                                   num_stops_CreateLinearGradient :: CARD32,+                                                   stops_CreateLinearGradient :: [FIXED],+                                                   colors_CreateLinearGradient :: [COLOR]}+                          deriving (Show, Typeable)+ +instance ExtensionRequest CreateLinearGradient where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 34+               let size__+                     = 4 + size (picture_CreateLinearGradient x) ++                         size (p1_CreateLinearGradient x)+                         + size (p2_CreateLinearGradient x)+                         + size (num_stops_CreateLinearGradient x)+                         + sum (map size (stops_CreateLinearGradient x))+                         + sum (map size (colors_CreateLinearGradient x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (picture_CreateLinearGradient x)+               serialize (p1_CreateLinearGradient x)+               serialize (p2_CreateLinearGradient x)+               serialize (num_stops_CreateLinearGradient x)+               serializeList (stops_CreateLinearGradient x)+               serializeList (colors_CreateLinearGradient x)+               putSkip (requiredPadding size__)+ +data CreateRadialGradient = MkCreateRadialGradient{picture_CreateRadialGradient+                                                   :: PICTURE,+                                                   inner_CreateRadialGradient :: POINTFIX,+                                                   outer_CreateRadialGradient :: POINTFIX,+                                                   inner_radius_CreateRadialGradient :: FIXED,+                                                   outer_radius_CreateRadialGradient :: FIXED,+                                                   num_stops_CreateRadialGradient :: CARD32,+                                                   stops_CreateRadialGradient :: [FIXED],+                                                   colors_CreateRadialGradient :: [COLOR]}+                          deriving (Show, Typeable)+ +instance ExtensionRequest CreateRadialGradient where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 35+               let size__+                     = 4 + size (picture_CreateRadialGradient x) ++                         size (inner_CreateRadialGradient x)+                         + size (outer_CreateRadialGradient x)+                         + size (inner_radius_CreateRadialGradient x)+                         + size (outer_radius_CreateRadialGradient x)+                         + size (num_stops_CreateRadialGradient x)+                         + sum (map size (stops_CreateRadialGradient x))+                         + sum (map size (colors_CreateRadialGradient x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (picture_CreateRadialGradient x)+               serialize (inner_CreateRadialGradient x)+               serialize (outer_CreateRadialGradient x)+               serialize (inner_radius_CreateRadialGradient x)+               serialize (outer_radius_CreateRadialGradient x)+               serialize (num_stops_CreateRadialGradient x)+               serializeList (stops_CreateRadialGradient x)+               serializeList (colors_CreateRadialGradient x)+               putSkip (requiredPadding size__)+ +data CreateConicalGradient = MkCreateConicalGradient{picture_CreateConicalGradient+                                                     :: PICTURE,+                                                     center_CreateConicalGradient :: POINTFIX,+                                                     angle_CreateConicalGradient :: FIXED,+                                                     num_stops_CreateConicalGradient :: CARD32,+                                                     stops_CreateConicalGradient :: [FIXED],+                                                     colors_CreateConicalGradient :: [COLOR]}+                           deriving (Show, Typeable)+ +instance ExtensionRequest CreateConicalGradient where+        extensionId _ = "RENDER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 36+               let size__+                     = 4 + size (picture_CreateConicalGradient x) ++                         size (center_CreateConicalGradient x)+                         + size (angle_CreateConicalGradient x)+                         + size (num_stops_CreateConicalGradient x)+                         + sum (map size (stops_CreateConicalGradient x))+                         + sum (map size (colors_CreateConicalGradient x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (picture_CreateConicalGradient x)+               serialize (center_CreateConicalGradient x)+               serialize (angle_CreateConicalGradient x)+               serialize (num_stops_CreateConicalGradient x)+               serializeList (stops_CreateConicalGradient x)+               serializeList (colors_CreateConicalGradient x)+               putSkip (requiredPadding size__)
+ patched/Graphics/XHB/Gen/Res.hs view
@@ -0,0 +1,62 @@+module Graphics.XHB.Gen.Res+       (extension, queryVersion, queryClients, queryClientResources,+        queryClientPixmapBytes, module Graphics.XHB.Gen.Res.Types)+       where+import Graphics.XHB.Gen.Res.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "X-Resource"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD8 -> CARD8 -> IO (Receipt QueryVersionReply)+queryVersion c client_major client_minor+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion client_major client_minor+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryClients ::+               Graphics.XHB.Connection.Types.Connection ->+                 IO (Receipt QueryClientsReply)+queryClients c+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryClients+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryClientResources ::+                       Graphics.XHB.Connection.Types.Connection ->+                         CARD32 -> IO (Receipt QueryClientResourcesReply)+queryClientResources c xid+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryClientResources xid+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryClientPixmapBytes ::+                         Graphics.XHB.Connection.Types.Connection ->+                           CARD32 -> IO (Receipt QueryClientPixmapBytesReply)+queryClientPixmapBytes c xid+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryClientPixmapBytes xid+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/Res/Types.hs view
@@ -0,0 +1,186 @@+module Graphics.XHB.Gen.Res.Types+       (deserializeError, deserializeEvent, Client(..), Type(..),+        QueryVersion(..), QueryVersionReply(..), QueryClients(..),+        QueryClientsReply(..), QueryClientResources(..),+        QueryClientResourcesReply(..), QueryClientPixmapBytes(..),+        QueryClientPixmapBytesReply(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +data Client = MkClient{resource_base_Client :: CARD32,+                       resource_mask_Client :: CARD32}+            deriving (Show, Typeable)+ +instance Serialize Client where+        serialize x+          = do serialize (resource_base_Client x)+               serialize (resource_mask_Client x)+        size x+          = size (resource_base_Client x) + size (resource_mask_Client x)+ +instance Deserialize Client where+        deserialize+          = do resource_base <- deserialize+               resource_mask <- deserialize+               return (MkClient resource_base resource_mask)+ +data Type = MkType{resource_type_Type :: ATOM,+                   count_Type :: CARD32}+          deriving (Show, Typeable)+ +instance Serialize Type where+        serialize x+          = do serialize (resource_type_Type x)+               serialize (count_Type x)+        size x = size (resource_type_Type x) + size (count_Type x)+ +instance Deserialize Type where+        deserialize+          = do resource_type <- deserialize+               count <- deserialize+               return (MkType resource_type count)+ +data QueryVersion = MkQueryVersion{client_major_QueryVersion ::+                                   CARD8,+                                   client_minor_QueryVersion :: CARD8}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "X-Resource"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (client_major_QueryVersion x) ++                         size (client_minor_QueryVersion x)+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               server_major <- deserialize+               server_minor <- deserialize+               let _ = isCard32 length+               return (MkQueryVersionReply server_major server_minor)+ +data QueryClients = MkQueryClients{}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryClients where+        extensionId _ = "X-Resource"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data QueryClientsReply = MkQueryClientsReply{num_clients_QueryClientsReply+                                             :: CARD32,+                                             clients_QueryClientsReply :: [Client]}+                       deriving (Show, Typeable)+ +instance Deserialize QueryClientsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_clients <- deserialize+               skip 20+               clients <- deserializeList (fromIntegral num_clients)+               let _ = isCard32 length+               return (MkQueryClientsReply num_clients clients)+ +data QueryClientResources = MkQueryClientResources{xid_QueryClientResources+                                                   :: CARD32}+                          deriving (Show, Typeable)+ +instance ExtensionRequest QueryClientResources where+        extensionId _ = "X-Resource"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4 + size (xid_QueryClientResources x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (xid_QueryClientResources x)+               putSkip (requiredPadding size__)+ +data QueryClientResourcesReply = MkQueryClientResourcesReply{num_types_QueryClientResourcesReply+                                                             :: CARD32,+                                                             types_QueryClientResourcesReply ::+                                                             [Type]}+                               deriving (Show, Typeable)+ +instance Deserialize QueryClientResourcesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_types <- deserialize+               skip 20+               types <- deserializeList (fromIntegral num_types)+               let _ = isCard32 length+               return (MkQueryClientResourcesReply num_types types)+ +data QueryClientPixmapBytes = MkQueryClientPixmapBytes{xid_QueryClientPixmapBytes+                                                       :: CARD32}+                            deriving (Show, Typeable)+ +instance ExtensionRequest QueryClientPixmapBytes where+        extensionId _ = "X-Resource"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__ = 4 + size (xid_QueryClientPixmapBytes x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (xid_QueryClientPixmapBytes x)+               putSkip (requiredPadding size__)+ +data QueryClientPixmapBytesReply = MkQueryClientPixmapBytesReply{bytes_QueryClientPixmapBytesReply+                                                                 :: CARD32,+                                                                 bytes_overflow_QueryClientPixmapBytesReply+                                                                 :: CARD32}+                                 deriving (Show, Typeable)+ +instance Deserialize QueryClientPixmapBytesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               bytes <- deserialize+               bytes_overflow <- deserialize+               let _ = isCard32 length+               return (MkQueryClientPixmapBytesReply bytes bytes_overflow)
+ patched/Graphics/XHB/Gen/SELinux.hs view
@@ -0,0 +1,265 @@+module Graphics.XHB.Gen.SELinux+       (extension, queryVersion, setDeviceCreateContext,+        getDeviceCreateContext, setDeviceContext, getDeviceContext,+        setWindowCreateContext, getWindowCreateContext, getWindowContext,+        setPropertyCreateContext, getPropertyCreateContext,+        setPropertyUseContext, getPropertyUseContext, getPropertyContext,+        getPropertyDataContext, listProperties, setSelectionCreateContext,+        getSelectionCreateContext, setSelectionUseContext,+        getSelectionUseContext, getSelectionContext,+        getSelectionDataContext, listSelections, getClientContext,+        module Graphics.XHB.Gen.SELinux.Types)+       where+import Graphics.XHB.Gen.SELinux.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (ListProperties(..), ListPropertiesReply(..),+               deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "SELinux"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD8 -> CARD8 -> IO (Receipt QueryVersionReply)+queryVersion c client_major client_minor+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion client_major client_minor+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setDeviceCreateContext ::+                         Graphics.XHB.Connection.Types.Connection ->+                           CARD32 -> [CChar] -> IO ()+setDeviceCreateContext c context_len context+  = do let req = MkSetDeviceCreateContext context_len context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getDeviceCreateContext ::+                         Graphics.XHB.Connection.Types.Connection ->+                           IO (Receipt GetDeviceCreateContextReply)+getDeviceCreateContext c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetDeviceCreateContext+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setDeviceContext ::+                   Graphics.XHB.Connection.Types.Connection ->+                     SetDeviceContext -> IO ()+setDeviceContext c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getDeviceContext ::+                   Graphics.XHB.Connection.Types.Connection ->+                     CARD32 -> IO (Receipt GetDeviceContextReply)+getDeviceContext c device+  = do receipt <- newEmptyReceiptIO+       let req = MkGetDeviceContext device+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setWindowCreateContext ::+                         Graphics.XHB.Connection.Types.Connection ->+                           CARD32 -> [CChar] -> IO ()+setWindowCreateContext c context_len context+  = do let req = MkSetWindowCreateContext context_len context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getWindowCreateContext ::+                         Graphics.XHB.Connection.Types.Connection ->+                           IO (Receipt GetWindowCreateContextReply)+getWindowCreateContext c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetWindowCreateContext+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getWindowContext ::+                   Graphics.XHB.Connection.Types.Connection ->+                     WINDOW -> IO (Receipt GetWindowContextReply)+getWindowContext c window+  = do receipt <- newEmptyReceiptIO+       let req = MkGetWindowContext window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setPropertyCreateContext ::+                           Graphics.XHB.Connection.Types.Connection ->+                             CARD32 -> [CChar] -> IO ()+setPropertyCreateContext c context_len context+  = do let req = MkSetPropertyCreateContext context_len context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getPropertyCreateContext ::+                           Graphics.XHB.Connection.Types.Connection ->+                             IO (Receipt GetPropertyCreateContextReply)+getPropertyCreateContext c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPropertyCreateContext+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setPropertyUseContext ::+                        Graphics.XHB.Connection.Types.Connection ->+                          CARD32 -> [CChar] -> IO ()+setPropertyUseContext c context_len context+  = do let req = MkSetPropertyUseContext context_len context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getPropertyUseContext ::+                        Graphics.XHB.Connection.Types.Connection ->+                          IO (Receipt GetPropertyUseContextReply)+getPropertyUseContext c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPropertyUseContext+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getPropertyContext ::+                     Graphics.XHB.Connection.Types.Connection ->+                       WINDOW -> ATOM -> IO (Receipt GetPropertyContextReply)+getPropertyContext c window property+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPropertyContext window property+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getPropertyDataContext ::+                         Graphics.XHB.Connection.Types.Connection ->+                           WINDOW -> ATOM -> IO (Receipt GetPropertyDataContextReply)+getPropertyDataContext c window property+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPropertyDataContext window property+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +listProperties ::+                 Graphics.XHB.Connection.Types.Connection ->+                   WINDOW -> IO (Receipt ListPropertiesReply)+listProperties c window+  = do receipt <- newEmptyReceiptIO+       let req = MkListProperties window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setSelectionCreateContext ::+                            Graphics.XHB.Connection.Types.Connection ->+                              CARD32 -> [CChar] -> IO ()+setSelectionCreateContext c context_len context+  = do let req = MkSetSelectionCreateContext context_len context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getSelectionCreateContext ::+                            Graphics.XHB.Connection.Types.Connection ->+                              IO (Receipt GetSelectionCreateContextReply)+getSelectionCreateContext c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetSelectionCreateContext+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setSelectionUseContext ::+                         Graphics.XHB.Connection.Types.Connection ->+                           CARD32 -> [CChar] -> IO ()+setSelectionUseContext c context_len context+  = do let req = MkSetSelectionUseContext context_len context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getSelectionUseContext ::+                         Graphics.XHB.Connection.Types.Connection ->+                           IO (Receipt GetSelectionUseContextReply)+getSelectionUseContext c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetSelectionUseContext+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getSelectionContext ::+                      Graphics.XHB.Connection.Types.Connection ->+                        ATOM -> IO (Receipt GetSelectionContextReply)+getSelectionContext c selection+  = do receipt <- newEmptyReceiptIO+       let req = MkGetSelectionContext selection+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getSelectionDataContext ::+                          Graphics.XHB.Connection.Types.Connection ->+                            ATOM -> IO (Receipt GetSelectionDataContextReply)+getSelectionDataContext c selection+  = do receipt <- newEmptyReceiptIO+       let req = MkGetSelectionDataContext selection+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +listSelections ::+                 Graphics.XHB.Connection.Types.Connection ->+                   IO (Receipt ListSelectionsReply)+listSelections c+  = do receipt <- newEmptyReceiptIO+       let req = MkListSelections+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getClientContext ::+                   Graphics.XHB.Connection.Types.Connection ->+                     CARD32 -> IO (Receipt GetClientContextReply)+getClientContext c resource+  = do receipt <- newEmptyReceiptIO+       let req = MkGetClientContext resource+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/SELinux/Types.hs view
@@ -0,0 +1,707 @@+module Graphics.XHB.Gen.SELinux.Types+       (deserializeError, deserializeEvent, QueryVersion(..),+        QueryVersionReply(..), SetDeviceCreateContext(..),+        GetDeviceCreateContext(..), GetDeviceCreateContextReply(..),+        SetDeviceContext(..), GetDeviceContext(..),+        GetDeviceContextReply(..), SetWindowCreateContext(..),+        GetWindowCreateContext(..), GetWindowCreateContextReply(..),+        GetWindowContext(..), GetWindowContextReply(..), ListItem(..),+        SetPropertyCreateContext(..), GetPropertyCreateContext(..),+        GetPropertyCreateContextReply(..), SetPropertyUseContext(..),+        GetPropertyUseContext(..), GetPropertyUseContextReply(..),+        GetPropertyContext(..), GetPropertyContextReply(..),+        GetPropertyDataContext(..), GetPropertyDataContextReply(..),+        ListProperties(..), ListPropertiesReply(..),+        SetSelectionCreateContext(..), GetSelectionCreateContext(..),+        GetSelectionCreateContextReply(..), SetSelectionUseContext(..),+        GetSelectionUseContext(..), GetSelectionUseContextReply(..),+        GetSelectionContext(..), GetSelectionContextReply(..),+        GetSelectionDataContext(..), GetSelectionDataContextReply(..),+        ListSelections(..), ListSelectionsReply(..), GetClientContext(..),+        GetClientContextReply(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (ListProperties(..), ListPropertiesReply(..),+               deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +data QueryVersion = MkQueryVersion{client_major_QueryVersion ::+                                   CARD8,+                                   client_minor_QueryVersion :: CARD8}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (client_major_QueryVersion x) ++                         size (client_minor_QueryVersion x)+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               server_major <- deserialize+               server_minor <- deserialize+               let _ = isCard32 length+               return (MkQueryVersionReply server_major server_minor)+ +data SetDeviceCreateContext = MkSetDeviceCreateContext{context_len_SetDeviceCreateContext+                                                       :: CARD32,+                                                       context_SetDeviceCreateContext :: [CChar]}+                            deriving (Show, Typeable)+ +instance ExtensionRequest SetDeviceCreateContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__+                     = 4 + size (context_len_SetDeviceCreateContext x) ++                         sum (map size (context_SetDeviceCreateContext x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_len_SetDeviceCreateContext x)+               serializeList (context_SetDeviceCreateContext x)+               putSkip (requiredPadding size__)+ +data GetDeviceCreateContext = MkGetDeviceCreateContext{}+                            deriving (Show, Typeable)+ +instance ExtensionRequest GetDeviceCreateContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data GetDeviceCreateContextReply = MkGetDeviceCreateContextReply{context_len_GetDeviceCreateContextReply+                                                                 :: CARD32,+                                                                 context_GetDeviceCreateContextReply+                                                                 :: [CChar]}+                                 deriving (Show, Typeable)+ +instance Deserialize GetDeviceCreateContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetDeviceCreateContextReply context_len context)+ +data SetDeviceContext = MkSetDeviceContext{device_SetDeviceContext+                                           :: CARD32,+                                           context_len_SetDeviceContext :: CARD32,+                                           context_SetDeviceContext :: [CChar]}+                      deriving (Show, Typeable)+ +instance ExtensionRequest SetDeviceContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (device_SetDeviceContext x) ++                         size (context_len_SetDeviceContext x)+                         + sum (map size (context_SetDeviceContext x))+               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}+                      deriving (Show, Typeable)+ +instance ExtensionRequest GetDeviceContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__ = 4 + size (device_GetDeviceContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (device_GetDeviceContext x)+               putSkip (requiredPadding size__)+ +data GetDeviceContextReply = MkGetDeviceContextReply{context_len_GetDeviceContextReply+                                                     :: CARD32,+                                                     context_GetDeviceContextReply :: [CChar]}+                           deriving (Show, Typeable)+ +instance Deserialize GetDeviceContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetDeviceContextReply context_len context)+ +data SetWindowCreateContext = MkSetWindowCreateContext{context_len_SetWindowCreateContext+                                                       :: CARD32,+                                                       context_SetWindowCreateContext :: [CChar]}+                            deriving (Show, Typeable)+ +instance ExtensionRequest SetWindowCreateContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__+                     = 4 + size (context_len_SetWindowCreateContext x) ++                         sum (map size (context_SetWindowCreateContext x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_len_SetWindowCreateContext x)+               serializeList (context_SetWindowCreateContext x)+               putSkip (requiredPadding size__)+ +data GetWindowCreateContext = MkGetWindowCreateContext{}+                            deriving (Show, Typeable)+ +instance ExtensionRequest GetWindowCreateContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data GetWindowCreateContextReply = MkGetWindowCreateContextReply{context_len_GetWindowCreateContextReply+                                                                 :: CARD32,+                                                                 context_GetWindowCreateContextReply+                                                                 :: [CChar]}+                                 deriving (Show, Typeable)+ +instance Deserialize GetWindowCreateContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetWindowCreateContextReply context_len context)+ +data GetWindowContext = MkGetWindowContext{window_GetWindowContext+                                           :: WINDOW}+                      deriving (Show, Typeable)+ +instance ExtensionRequest GetWindowContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__ = 4 + size (window_GetWindowContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetWindowContext x)+               putSkip (requiredPadding size__)+ +data GetWindowContextReply = MkGetWindowContextReply{context_len_GetWindowContextReply+                                                     :: CARD32,+                                                     context_GetWindowContextReply :: [CChar]}+                           deriving (Show, Typeable)+ +instance Deserialize GetWindowContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetWindowContextReply context_len context)+ +data ListItem = MkListItem{name_ListItem :: ATOM,+                           object_context_len_ListItem :: CARD32,+                           data_context_len_ListItem :: CARD32,+                           object_context_ListItem :: [CChar],+                           data_context_ListItem :: [CChar]}+              deriving (Show, Typeable)+ +instance Serialize ListItem where+        serialize x+          = do serialize (name_ListItem x)+               serialize (object_context_len_ListItem x)+               serialize (data_context_len_ListItem x)+               serializeList (object_context_ListItem x)+               serializeList (data_context_ListItem x)+        size x+          = size (name_ListItem x) + size (object_context_len_ListItem x) ++              size (data_context_len_ListItem x)+              + sum (map size (object_context_ListItem x))+              + sum (map size (data_context_ListItem x))+ +instance Deserialize ListItem where+        deserialize+          = do name <- deserialize+               object_context_len <- deserialize+               data_context_len <- deserialize+               object_context <- deserializeList (fromIntegral object_context_len)+               data_context <- deserializeList (fromIntegral data_context_len)+               return+                 (MkListItem name object_context_len data_context_len object_context+                    data_context)+ +data SetPropertyCreateContext = MkSetPropertyCreateContext{context_len_SetPropertyCreateContext+                                                           :: CARD32,+                                                           context_SetPropertyCreateContext ::+                                                           [CChar]}+                              deriving (Show, Typeable)+ +instance ExtensionRequest SetPropertyCreateContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__+                     = 4 + size (context_len_SetPropertyCreateContext x) ++                         sum (map size (context_SetPropertyCreateContext x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_len_SetPropertyCreateContext x)+               serializeList (context_SetPropertyCreateContext x)+               putSkip (requiredPadding size__)+ +data GetPropertyCreateContext = MkGetPropertyCreateContext{}+                              deriving (Show, Typeable)+ +instance ExtensionRequest GetPropertyCreateContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 9+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data GetPropertyCreateContextReply = MkGetPropertyCreateContextReply{context_len_GetPropertyCreateContextReply+                                                                     :: CARD32,+                                                                     context_GetPropertyCreateContextReply+                                                                     :: [CChar]}+                                   deriving (Show, Typeable)+ +instance Deserialize GetPropertyCreateContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetPropertyCreateContextReply context_len context)+ +data SetPropertyUseContext = MkSetPropertyUseContext{context_len_SetPropertyUseContext+                                                     :: CARD32,+                                                     context_SetPropertyUseContext :: [CChar]}+                           deriving (Show, Typeable)+ +instance ExtensionRequest SetPropertyUseContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 10+               let size__+                     = 4 + size (context_len_SetPropertyUseContext x) ++                         sum (map size (context_SetPropertyUseContext x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_len_SetPropertyUseContext x)+               serializeList (context_SetPropertyUseContext x)+               putSkip (requiredPadding size__)+ +data GetPropertyUseContext = MkGetPropertyUseContext{}+                           deriving (Show, Typeable)+ +instance ExtensionRequest GetPropertyUseContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 11+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data GetPropertyUseContextReply = MkGetPropertyUseContextReply{context_len_GetPropertyUseContextReply+                                                               :: CARD32,+                                                               context_GetPropertyUseContextReply ::+                                                               [CChar]}+                                deriving (Show, Typeable)+ +instance Deserialize GetPropertyUseContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetPropertyUseContextReply context_len context)+ +data GetPropertyContext = MkGetPropertyContext{window_GetPropertyContext+                                               :: WINDOW,+                                               property_GetPropertyContext :: ATOM}+                        deriving (Show, Typeable)+ +instance ExtensionRequest GetPropertyContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 12+               let size__+                     = 4 + size (window_GetPropertyContext x) ++                         size (property_GetPropertyContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetPropertyContext x)+               serialize (property_GetPropertyContext x)+               putSkip (requiredPadding size__)+ +data GetPropertyContextReply = MkGetPropertyContextReply{context_len_GetPropertyContextReply+                                                         :: CARD32,+                                                         context_GetPropertyContextReply :: [CChar]}+                             deriving (Show, Typeable)+ +instance Deserialize GetPropertyContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetPropertyContextReply context_len context)+ +data GetPropertyDataContext = MkGetPropertyDataContext{window_GetPropertyDataContext+                                                       :: WINDOW,+                                                       property_GetPropertyDataContext :: ATOM}+                            deriving (Show, Typeable)+ +instance ExtensionRequest GetPropertyDataContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 13+               let size__+                     = 4 + size (window_GetPropertyDataContext x) ++                         size (property_GetPropertyDataContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetPropertyDataContext x)+               serialize (property_GetPropertyDataContext x)+               putSkip (requiredPadding size__)+ +data GetPropertyDataContextReply = MkGetPropertyDataContextReply{context_len_GetPropertyDataContextReply+                                                                 :: CARD32,+                                                                 context_GetPropertyDataContextReply+                                                                 :: [CChar]}+                                 deriving (Show, Typeable)+ +instance Deserialize GetPropertyDataContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetPropertyDataContextReply context_len context)+ +data ListProperties = MkListProperties{window_ListProperties ::+                                       WINDOW}+                    deriving (Show, Typeable)+ +instance ExtensionRequest ListProperties where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 14+               let size__ = 4 + size (window_ListProperties x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_ListProperties x)+               putSkip (requiredPadding size__)+ +data ListPropertiesReply = MkListPropertiesReply{properties_len_ListPropertiesReply+                                                 :: CARD32,+                                                 properties_ListPropertiesReply :: [ListItem]}+                         deriving (Show, Typeable)+ +instance Deserialize ListPropertiesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               properties_len <- deserialize+               skip 20+               properties <- deserializeList (fromIntegral properties_len)+               let _ = isCard32 length+               return (MkListPropertiesReply properties_len properties)+ +data SetSelectionCreateContext = MkSetSelectionCreateContext{context_len_SetSelectionCreateContext+                                                             :: CARD32,+                                                             context_SetSelectionCreateContext ::+                                                             [CChar]}+                               deriving (Show, Typeable)+ +instance ExtensionRequest SetSelectionCreateContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 15+               let size__+                     = 4 + size (context_len_SetSelectionCreateContext x) ++                         sum (map size (context_SetSelectionCreateContext x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_len_SetSelectionCreateContext x)+               serializeList (context_SetSelectionCreateContext x)+               putSkip (requiredPadding size__)+ +data GetSelectionCreateContext = MkGetSelectionCreateContext{}+                               deriving (Show, Typeable)+ +instance ExtensionRequest GetSelectionCreateContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 16+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data GetSelectionCreateContextReply = MkGetSelectionCreateContextReply{context_len_GetSelectionCreateContextReply+                                                                       :: CARD32,+                                                                       context_GetSelectionCreateContextReply+                                                                       :: [CChar]}+                                    deriving (Show, Typeable)+ +instance Deserialize GetSelectionCreateContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetSelectionCreateContextReply context_len context)+ +data SetSelectionUseContext = MkSetSelectionUseContext{context_len_SetSelectionUseContext+                                                       :: CARD32,+                                                       context_SetSelectionUseContext :: [CChar]}+                            deriving (Show, Typeable)+ +instance ExtensionRequest SetSelectionUseContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 17+               let size__+                     = 4 + size (context_len_SetSelectionUseContext x) ++                         sum (map size (context_SetSelectionUseContext x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_len_SetSelectionUseContext x)+               serializeList (context_SetSelectionUseContext x)+               putSkip (requiredPadding size__)+ +data GetSelectionUseContext = MkGetSelectionUseContext{}+                            deriving (Show, Typeable)+ +instance ExtensionRequest GetSelectionUseContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 18+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data GetSelectionUseContextReply = MkGetSelectionUseContextReply{context_len_GetSelectionUseContextReply+                                                                 :: CARD32,+                                                                 context_GetSelectionUseContextReply+                                                                 :: [CChar]}+                                 deriving (Show, Typeable)+ +instance Deserialize GetSelectionUseContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetSelectionUseContextReply context_len context)+ +data GetSelectionContext = MkGetSelectionContext{selection_GetSelectionContext+                                                 :: ATOM}+                         deriving (Show, Typeable)+ +instance ExtensionRequest GetSelectionContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 19+               let size__ = 4 + size (selection_GetSelectionContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (selection_GetSelectionContext x)+               putSkip (requiredPadding size__)+ +data GetSelectionContextReply = MkGetSelectionContextReply{context_len_GetSelectionContextReply+                                                           :: CARD32,+                                                           context_GetSelectionContextReply ::+                                                           [CChar]}+                              deriving (Show, Typeable)+ +instance Deserialize GetSelectionContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetSelectionContextReply context_len context)+ +data GetSelectionDataContext = MkGetSelectionDataContext{selection_GetSelectionDataContext+                                                         :: ATOM}+                             deriving (Show, Typeable)+ +instance ExtensionRequest GetSelectionDataContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 20+               let size__ = 4 + size (selection_GetSelectionDataContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (selection_GetSelectionDataContext x)+               putSkip (requiredPadding size__)+ +data GetSelectionDataContextReply = MkGetSelectionDataContextReply{context_len_GetSelectionDataContextReply+                                                                   :: CARD32,+                                                                   context_GetSelectionDataContextReply+                                                                   :: [CChar]}+                                  deriving (Show, Typeable)+ +instance Deserialize GetSelectionDataContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetSelectionDataContextReply context_len context)+ +data ListSelections = MkListSelections{}+                    deriving (Show, Typeable)+ +instance ExtensionRequest ListSelections where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 21+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data ListSelectionsReply = MkListSelectionsReply{selections_len_ListSelectionsReply+                                                 :: CARD32,+                                                 selections_ListSelectionsReply :: [ListItem]}+                         deriving (Show, Typeable)+ +instance Deserialize ListSelectionsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               selections_len <- deserialize+               skip 20+               selections <- deserializeList (fromIntegral selections_len)+               let _ = isCard32 length+               return (MkListSelectionsReply selections_len selections)+ +data GetClientContext = MkGetClientContext{resource_GetClientContext+                                           :: CARD32}+                      deriving (Show, Typeable)+ +instance ExtensionRequest GetClientContext where+        extensionId _ = "SELinux"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 22+               let size__ = 4 + size (resource_GetClientContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (resource_GetClientContext x)+               putSkip (requiredPadding size__)+ +data GetClientContextReply = MkGetClientContextReply{context_len_GetClientContextReply+                                                     :: CARD32,+                                                     context_GetClientContextReply :: [CChar]}+                           deriving (Show, Typeable)+ +instance Deserialize GetClientContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context_len <- deserialize+               skip 20+               context <- deserializeList (fromIntegral context_len)+               let _ = isCard32 length+               return (MkGetClientContextReply context_len context)
+ patched/Graphics/XHB/Gen/ScreenSaver.hs view
@@ -0,0 +1,73 @@+module Graphics.XHB.Gen.ScreenSaver+       (extension, queryVersion, queryInfo, selectInput, setAttributes,+        unsetAttributes, suspend,+        module Graphics.XHB.Gen.ScreenSaver.Types)+       where+import Graphics.XHB.Gen.ScreenSaver.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "MIT-SCREEN-SAVER"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD8 -> CARD8 -> IO (Receipt QueryVersionReply)+queryVersion c client_major_version client_minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion client_major_version client_minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryInfo ::+            Graphics.XHB.Connection.Types.Connection ->+              DRAWABLE -> IO (Receipt QueryInfoReply)+queryInfo c drawable+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryInfo drawable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +selectInput ::+              Graphics.XHB.Connection.Types.Connection ->+                DRAWABLE -> CARD32 -> IO ()+selectInput c drawable event_mask+  = do let req = MkSelectInput drawable event_mask+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +setAttributes ::+                Graphics.XHB.Connection.Types.Connection -> SetAttributes -> IO ()+setAttributes c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +unsetAttributes ::+                  Graphics.XHB.Connection.Types.Connection -> DRAWABLE -> IO ()+unsetAttributes c drawable+  = do let req = MkUnsetAttributes drawable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +suspend ::+          Graphics.XHB.Connection.Types.Connection -> BOOL -> IO ()+suspend c suspend+  = do let req = MkSuspend suspend+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk
+ patched/Graphics/XHB/Gen/ScreenSaver/Types.hs view
@@ -0,0 +1,251 @@+module Graphics.XHB.Gen.ScreenSaver.Types+       (deserializeError, deserializeEvent, Kind(..), Event(..),+        State(..), QueryVersion(..), QueryVersionReply(..), QueryInfo(..),+        QueryInfoReply(..), SelectInput(..), SetAttributes(..),+        UnsetAttributes(..), Suspend(..), Notify(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent 0+  = return (liftM toEvent (deserialize :: Get Notify))+deserializeEvent _ = Nothing+ +data Kind = KindBlanked+          | KindInternal+          | KindExternal+ +instance SimpleEnum Kind where+        toValue KindBlanked{} = 0+        toValue KindInternal{} = 1+        toValue KindExternal{} = 2+        fromValue 0 = KindBlanked+        fromValue 1 = KindInternal+        fromValue 2 = KindExternal+ +data Event = EventNotifyMask+           | EventCycleMask+ +instance BitEnum Event where+        toBit EventNotifyMask{} = 0+        toBit EventCycleMask{} = 1+        fromBit 0 = EventNotifyMask+        fromBit 1 = EventCycleMask+ +data State = StateOff+           | StateOn+           | StateCycle+           | StateDisabled+ +instance SimpleEnum State where+        toValue StateOff{} = 0+        toValue StateOn{} = 1+        toValue StateCycle{} = 2+        toValue StateDisabled{} = 3+        fromValue 0 = StateOff+        fromValue 1 = StateOn+        fromValue 2 = StateCycle+        fromValue 3 = StateDisabled+ +data QueryVersion = MkQueryVersion{client_major_version_QueryVersion+                                   :: CARD8,+                                   client_minor_version_QueryVersion :: CARD8}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "MIT-SCREEN-SAVER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (client_major_version_QueryVersion x) ++                         size (client_minor_version_QueryVersion x)+                         + 2+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               server_major_version <- deserialize+               server_minor_version <- deserialize+               skip 20+               let _ = isCard32 length+               return+                 (MkQueryVersionReply server_major_version server_minor_version)+ +data QueryInfo = MkQueryInfo{drawable_QueryInfo :: DRAWABLE}+               deriving (Show, Typeable)+ +instance ExtensionRequest QueryInfo where+        extensionId _ = "MIT-SCREEN-SAVER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__ = 4 + size (drawable_QueryInfo x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (drawable_QueryInfo x)+               putSkip (requiredPadding size__)+ +data QueryInfoReply = MkQueryInfoReply{state_QueryInfoReply ::+                                       CARD8,+                                       saver_window_QueryInfoReply :: WINDOW,+                                       ms_until_server_QueryInfoReply :: CARD32,+                                       ms_since_user_input_QueryInfoReply :: CARD32,+                                       event_mask_QueryInfoReply :: CARD32,+                                       kind_QueryInfoReply :: BYTE}+                    deriving (Show, Typeable)+ +instance Deserialize QueryInfoReply where+        deserialize+          = do skip 1+               state <- deserialize+               skip 2+               length <- deserialize+               saver_window <- deserialize+               ms_until_server <- deserialize+               ms_since_user_input <- deserialize+               event_mask <- deserialize+               kind <- deserialize+               skip 7+               let _ = isCard32 length+               return+                 (MkQueryInfoReply state saver_window ms_until_server+                    ms_since_user_input+                    event_mask+                    kind)+ +data SelectInput = MkSelectInput{drawable_SelectInput :: DRAWABLE,+                                 event_mask_SelectInput :: CARD32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest SelectInput where+        extensionId _ = "MIT-SCREEN-SAVER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__+                     = 4 + size (drawable_SelectInput x) ++                         size (event_mask_SelectInput x)+               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,+                                     visual_SetAttributes :: VISUALID,+                                     value_SetAttributes :: ValueParam CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest SetAttributes where+        extensionId _ = "MIT-SCREEN-SAVER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (drawable_SetAttributes x) + size (x_SetAttributes x) ++                         size (y_SetAttributes x)+                         + size (width_SetAttributes x)+                         + size (height_SetAttributes x)+                         + size (border_width_SetAttributes x)+                         + size (class_SetAttributes x)+                         + size (depth_SetAttributes x)+                         + size (visual_SetAttributes x)+                         + size (value_SetAttributes x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (drawable_SetAttributes x)+               serialize (x_SetAttributes x)+               serialize (y_SetAttributes x)+               serialize (width_SetAttributes x)+               serialize (height_SetAttributes x)+               serialize (border_width_SetAttributes x)+               serialize (class_SetAttributes x)+               serialize (depth_SetAttributes x)+               serialize (visual_SetAttributes x)+               serialize (value_SetAttributes x)+               putSkip (requiredPadding size__)+ +data UnsetAttributes = MkUnsetAttributes{drawable_UnsetAttributes+                                         :: DRAWABLE}+                     deriving (Show, Typeable)+ +instance ExtensionRequest UnsetAttributes where+        extensionId _ = "MIT-SCREEN-SAVER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__ = 4 + size (drawable_UnsetAttributes x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (drawable_UnsetAttributes x)+               putSkip (requiredPadding size__)+ +data Suspend = MkSuspend{suspend_Suspend :: BOOL}+             deriving (Show, Typeable)+ +instance ExtensionRequest Suspend where+        extensionId _ = "MIT-SCREEN-SAVER"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__ = 4 + size (suspend_Suspend x) + 3+               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,+                       root_Notify :: WINDOW, window_Notify :: WINDOW,+                       kind_Notify :: BYTE, forced_Notify :: BOOL}+            deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event Notify+ +instance Deserialize Notify where+        deserialize+          = do skip 1+               code <- deserialize+               skip 2+               state <- deserialize+               skip 1+               sequence_number <- deserialize+               time <- deserialize+               root <- deserialize+               window <- deserialize+               kind <- deserialize+               forced <- deserialize+               skip 14+               return+                 (MkNotify code state sequence_number time root window kind forced)
+ patched/Graphics/XHB/Gen/Shape.hs view
@@ -0,0 +1,98 @@+module Graphics.XHB.Gen.Shape+       (extension, queryVersion, rectangles, mask, combine, offset,+        queryExtents, selectInput, inputSelected, getRectangles,+        module Graphics.XHB.Gen.Shape.Types)+       where+import Graphics.XHB.Gen.Shape.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "SHAPE"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 IO (Receipt QueryVersionReply)+queryVersion c+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +rectangles ::+             Graphics.XHB.Connection.Types.Connection -> Rectangles -> IO ()+rectangles c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +mask :: Graphics.XHB.Connection.Types.Connection -> Mask -> IO ()+mask c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +combine ::+          Graphics.XHB.Connection.Types.Connection -> Combine -> IO ()+combine c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +offset ::+         Graphics.XHB.Connection.Types.Connection -> Offset -> IO ()+offset c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +queryExtents ::+               Graphics.XHB.Connection.Types.Connection ->+                 WINDOW -> IO (Receipt QueryExtentsReply)+queryExtents c destination_window+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryExtents destination_window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +selectInput ::+              Graphics.XHB.Connection.Types.Connection -> WINDOW -> BOOL -> IO ()+selectInput c destination_window enable+  = do let req = MkSelectInput destination_window enable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +inputSelected ::+                Graphics.XHB.Connection.Types.Connection ->+                  WINDOW -> IO (Receipt InputSelectedReply)+inputSelected c destination_window+  = do receipt <- newEmptyReceiptIO+       let req = MkInputSelected destination_window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getRectangles ::+                Graphics.XHB.Connection.Types.Connection ->+                  WINDOW -> KIND -> IO (Receipt GetRectanglesReply)+getRectangles c window source_kind+  = do receipt <- newEmptyReceiptIO+       let req = MkGetRectangles window source_kind+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/Shape/Types.hs view
@@ -0,0 +1,376 @@+module Graphics.XHB.Gen.Shape.Types+       (deserializeError, deserializeEvent, OP, KIND, SO(..), SK(..),+        Notify(..), QueryVersion(..), QueryVersionReply(..),+        Rectangles(..), Mask(..), Combine(..), Offset(..),+        QueryExtents(..), QueryExtentsReply(..), SelectInput(..),+        InputSelected(..), InputSelectedReply(..), GetRectangles(..),+        GetRectanglesReply(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent 0+  = return (liftM toEvent (deserialize :: Get Notify))+deserializeEvent _ = Nothing+ +type OP = CARD8+ +type KIND = CARD8+ +data SO = SOSet+        | SOUnion+        | SOIntersect+        | SOSubtract+        | SOInvert+ +instance SimpleEnum SO where+        toValue SOSet{} = 0+        toValue SOUnion{} = 1+        toValue SOIntersect{} = 2+        toValue SOSubtract{} = 3+        toValue SOInvert{} = 4+        fromValue 0 = SOSet+        fromValue 1 = SOUnion+        fromValue 2 = SOIntersect+        fromValue 3 = SOSubtract+        fromValue 4 = SOInvert+ +data SK = SKBounding+        | SKClip+        | SKInput+ +instance SimpleEnum SK where+        toValue SKBounding{} = 0+        toValue SKClip{} = 1+        toValue SKInput{} = 2+        fromValue 0 = SKBounding+        fromValue 1 = SKClip+        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}+            deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event Notify+ +instance Deserialize Notify where+        deserialize+          = do skip 1+               shape_kind <- deserialize+               skip 2+               affected_window <- deserialize+               extents_x <- deserialize+               extents_y <- deserialize+               extents_width <- deserialize+               extents_height <- deserialize+               server_time <- deserialize+               shaped <- deserialize+               skip 11+               return+                 (MkNotify shape_kind affected_window extents_x extents_y+                    extents_width+                    extents_height+                    server_time+                    shaped)+ +data QueryVersion = MkQueryVersion{}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "SHAPE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data QueryVersionReply = MkQueryVersionReply{major_version_QueryVersionReply+                                             :: CARD16,+                                             minor_version_QueryVersionReply :: CARD16}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major_version <- deserialize+               minor_version <- deserialize+               let _ = isCard32 length+               return (MkQueryVersionReply major_version minor_version)+ +data Rectangles = MkRectangles{operation_Rectangles :: OP,+                               destination_kind_Rectangles :: KIND, ordering_Rectangles :: BYTE,+                               destination_window_Rectangles :: WINDOW,+                               x_offset_Rectangles :: INT16, y_offset_Rectangles :: INT16,+                               rectangles_Rectangles :: [RECTANGLE]}+                deriving (Show, Typeable)+ +instance ExtensionRequest Rectangles where+        extensionId _ = "SHAPE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__+                     = 4 + size (operation_Rectangles x) ++                         size (destination_kind_Rectangles x)+                         + size (ordering_Rectangles x)+                         + 1+                         + size (destination_window_Rectangles x)+                         + size (x_offset_Rectangles x)+                         + size (y_offset_Rectangles x)+                         + sum (map size (rectangles_Rectangles x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (operation_Rectangles x)+               serialize (destination_kind_Rectangles x)+               serialize (ordering_Rectangles x)+               putSkip 1+               serialize (destination_window_Rectangles x)+               serialize (x_offset_Rectangles x)+               serialize (y_offset_Rectangles x)+               serializeList (rectangles_Rectangles x)+               putSkip (requiredPadding size__)+ +data Mask = MkMask{operation_Mask :: OP,+                   destination_kind_Mask :: KIND, destination_window_Mask :: WINDOW,+                   x_offset_Mask :: INT16, y_offset_Mask :: INT16,+                   source_bitmap_Mask :: PIXMAP}+          deriving (Show, Typeable)+ +instance ExtensionRequest Mask where+        extensionId _ = "SHAPE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__+                     = 4 + size (operation_Mask x) + size (destination_kind_Mask x) + 2+                         + size (destination_window_Mask x)+                         + size (x_offset_Mask x)+                         + size (y_offset_Mask x)+                         + size (source_bitmap_Mask x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (operation_Mask x)+               serialize (destination_kind_Mask x)+               putSkip 2+               serialize (destination_window_Mask x)+               serialize (x_offset_Mask x)+               serialize (y_offset_Mask x)+               serialize (source_bitmap_Mask x)+               putSkip (requiredPadding size__)+ +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}+             deriving (Show, Typeable)+ +instance ExtensionRequest Combine where+        extensionId _ = "SHAPE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (operation_Combine x) ++                         size (destination_kind_Combine x)+                         + size (source_kind_Combine x)+                         + 1+                         + size (destination_window_Combine x)+                         + size (x_offset_Combine x)+                         + size (y_offset_Combine x)+                         + size (source_window_Combine x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (operation_Combine x)+               serialize (destination_kind_Combine x)+               serialize (source_kind_Combine x)+               putSkip 1+               serialize (destination_window_Combine x)+               serialize (x_offset_Combine x)+               serialize (y_offset_Combine x)+               serialize (source_window_Combine x)+               putSkip (requiredPadding size__)+ +data Offset = MkOffset{destination_kind_Offset :: KIND,+                       destination_window_Offset :: WINDOW, x_offset_Offset :: INT16,+                       y_offset_Offset :: INT16}+            deriving (Show, Typeable)+ +instance ExtensionRequest Offset where+        extensionId _ = "SHAPE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__+                     = 4 + size (destination_kind_Offset x) + 3 ++                         size (destination_window_Offset x)+                         + size (x_offset_Offset x)+                         + size (y_offset_Offset x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (destination_kind_Offset x)+               putSkip 3+               serialize (destination_window_Offset x)+               serialize (x_offset_Offset x)+               serialize (y_offset_Offset x)+               putSkip (requiredPadding size__)+ +data QueryExtents = MkQueryExtents{destination_window_QueryExtents+                                   :: WINDOW}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryExtents where+        extensionId _ = "SHAPE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__ = 4 + size (destination_window_QueryExtents x)+               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,+                                             bounding_shape_extents_width_QueryExtentsReply ::+                                             CARD16,+                                             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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryExtentsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               bounding_shaped <- deserialize+               clip_shaped <- deserialize+               skip 2+               bounding_shape_extents_x <- deserialize+               bounding_shape_extents_y <- deserialize+               bounding_shape_extents_width <- deserialize+               bounding_shape_extents_height <- deserialize+               clip_shape_extents_x <- deserialize+               clip_shape_extents_y <- deserialize+               clip_shape_extents_width <- deserialize+               clip_shape_extents_height <- deserialize+               let _ = isCard32 length+               return+                 (MkQueryExtentsReply bounding_shaped clip_shaped+                    bounding_shape_extents_x+                    bounding_shape_extents_y+                    bounding_shape_extents_width+                    bounding_shape_extents_height+                    clip_shape_extents_x+                    clip_shape_extents_y+                    clip_shape_extents_width+                    clip_shape_extents_height)+ +data SelectInput = MkSelectInput{destination_window_SelectInput ::+                                 WINDOW,+                                 enable_SelectInput :: BOOL}+                 deriving (Show, Typeable)+ +instance ExtensionRequest SelectInput where+        extensionId _ = "SHAPE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__+                     = 4 + size (destination_window_SelectInput x) ++                         size (enable_SelectInput x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (destination_window_SelectInput x)+               serialize (enable_SelectInput x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data InputSelected = MkInputSelected{destination_window_InputSelected+                                     :: WINDOW}+                   deriving (Show, Typeable)+ +instance ExtensionRequest InputSelected where+        extensionId _ = "SHAPE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__ = 4 + size (destination_window_InputSelected x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (destination_window_InputSelected x)+               putSkip (requiredPadding size__)+ +data InputSelectedReply = MkInputSelectedReply{enabled_InputSelectedReply+                                               :: BOOL}+                        deriving (Show, Typeable)+ +instance Deserialize InputSelectedReply where+        deserialize+          = do skip 1+               enabled <- deserialize+               skip 2+               length <- deserialize+               let _ = isCard32 length+               return (MkInputSelectedReply enabled)+ +data GetRectangles = MkGetRectangles{window_GetRectangles ::+                                     WINDOW,+                                     source_kind_GetRectangles :: KIND}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GetRectangles where+        extensionId _ = "SHAPE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__+                     = 4 + size (window_GetRectangles x) ++                         size (source_kind_GetRectangles x)+                         + 3+               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,+                                               rectangles_GetRectanglesReply :: [RECTANGLE]}+                        deriving (Show, Typeable)+ +instance Deserialize GetRectanglesReply where+        deserialize+          = do skip 1+               ordering <- deserialize+               skip 2+               length <- deserialize+               rectangles_len <- deserialize+               rectangles <- deserializeList (fromIntegral rectangles_len)+               let _ = isCard32 length+               return (MkGetRectanglesReply ordering rectangles_len rectangles)
+ patched/Graphics/XHB/Gen/Shm.hs view
@@ -0,0 +1,68 @@+module Graphics.XHB.Gen.Shm+       (extension, queryVersion, attach, detach, putImage, getImage,+        createPixmap, module Graphics.XHB.Gen.Shm.Types)+       where+import Graphics.XHB.Gen.Shm.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (PutImage(..), GetImage(..), GetImageReply(..),+               CreatePixmap(..), deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "MIT-SHM"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 IO (Receipt QueryVersionReply)+queryVersion c+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +attach ::+         Graphics.XHB.Connection.Types.Connection -> Attach -> IO ()+attach c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +detach :: Graphics.XHB.Connection.Types.Connection -> SEG -> IO ()+detach c shmseg+  = do let req = MkDetach shmseg+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +putImage ::+           Graphics.XHB.Connection.Types.Connection -> PutImage -> IO ()+putImage c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getImage ::+           Graphics.XHB.Connection.Types.Connection ->+             GetImage -> IO (Receipt GetImageReply)+getImage c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +createPixmap ::+               Graphics.XHB.Connection.Types.Connection -> CreatePixmap -> IO ()+createPixmap c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk
+ patched/Graphics/XHB/Gen/Shm/Types.hs view
@@ -0,0 +1,272 @@+module Graphics.XHB.Gen.Shm.Types+       (deserializeError, deserializeEvent, SEG, Completion(..),+        BadSeg(..), QueryVersion(..), QueryVersionReply(..), Attach(..),+        Detach(..), PutImage(..), GetImage(..), GetImageReply(..),+        CreatePixmap(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (PutImage(..), GetImage(..), GetImageReply(..),+               CreatePixmap(..), deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError 0+  = return (liftM toError (deserialize :: Get BadSeg))+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent 0+  = return (liftM toEvent (deserialize :: Get Completion))+deserializeEvent _ = Nothing+ +newtype SEG = MkSEG Xid+              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}+                deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event Completion+ +instance Deserialize Completion where+        deserialize+          = do skip 1+               skip 1+               skip 2+               drawable <- deserialize+               shmseg <- deserialize+               minor_event <- deserialize+               major_event <- deserialize+               skip 1+               offset <- deserialize+               return+                 (MkCompletion drawable shmseg minor_event major_event offset)+ +data BadSeg = MkBadSeg{bad_value_BadSeg :: CARD32,+                       minor_opcode_BadSeg :: CARD16, major_opcode_BadSeg :: CARD8}+            deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error BadSeg+ +instance Deserialize BadSeg where+        deserialize+          = do skip 4+               bad_value <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               skip 1+               return (MkBadSeg bad_value minor_opcode major_opcode)+ +data QueryVersion = MkQueryVersion{}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "MIT-SHM"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__ = 4+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               shared_pixmaps <- deserialize+               skip 2+               length <- deserialize+               major_version <- deserialize+               minor_version <- deserialize+               uid <- deserialize+               gid <- deserialize+               pixmap_format <- deserialize+               skip 15+               let _ = isCard32 length+               return+                 (MkQueryVersionReply shared_pixmaps major_version minor_version uid+                    gid+                    pixmap_format)+ +data Attach = MkAttach{shmseg_Attach :: SEG,+                       shmid_Attach :: CARD32, read_only_Attach :: BOOL}+            deriving (Show, Typeable)+ +instance ExtensionRequest Attach where+        extensionId _ = "MIT-SHM"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__+                     = 4 + size (shmseg_Attach x) + size (shmid_Attach x) ++                         size (read_only_Attach x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (shmseg_Attach x)+               serialize (shmid_Attach x)+               serialize (read_only_Attach x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data Detach = MkDetach{shmseg_Detach :: SEG}+            deriving (Show, Typeable)+ +instance ExtensionRequest Detach where+        extensionId _ = "MIT-SHM"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4 + size (shmseg_Detach x)+               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}+              deriving (Show, Typeable)+ +instance ExtensionRequest PutImage where+        extensionId _ = "MIT-SHM"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (drawable_PutImage x) + size (gc_PutImage x) ++                         size (total_width_PutImage x)+                         + size (total_height_PutImage x)+                         + size (src_x_PutImage x)+                         + size (src_y_PutImage x)+                         + size (src_width_PutImage x)+                         + size (src_height_PutImage x)+                         + size (dst_x_PutImage x)+                         + size (dst_y_PutImage x)+                         + size (depth_PutImage x)+                         + size (format_PutImage x)+                         + size (send_event_PutImage x)+                         + 1+                         + size (shmseg_PutImage x)+                         + size (offset_PutImage x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (drawable_PutImage x)+               serialize (gc_PutImage x)+               serialize (total_width_PutImage x)+               serialize (total_height_PutImage x)+               serialize (src_x_PutImage x)+               serialize (src_y_PutImage x)+               serialize (src_width_PutImage x)+               serialize (src_height_PutImage x)+               serialize (dst_x_PutImage x)+               serialize (dst_y_PutImage x)+               serialize (depth_PutImage x)+               serialize (format_PutImage x)+               serialize (send_event_PutImage x)+               putSkip 1+               serialize (shmseg_PutImage x)+               serialize (offset_PutImage x)+               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}+              deriving (Show, Typeable)+ +instance ExtensionRequest GetImage where+        extensionId _ = "MIT-SHM"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__+                     = 4 + 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)+                         + size (format_GetImage x)+                         + 3+                         + size (shmseg_GetImage x)+                         + size (offset_GetImage x)+               serialize (convertBytesToRequestSize size__ :: 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)+               serialize (format_GetImage x)+               putSkip 3+               serialize (shmseg_GetImage x)+               serialize (offset_GetImage x)+               putSkip (requiredPadding size__)+ +data GetImageReply = MkGetImageReply{depth_GetImageReply :: CARD8,+                                     visual_GetImageReply :: VISUALID, size_GetImageReply :: CARD32}+                   deriving (Show, Typeable)+ +instance Deserialize GetImageReply where+        deserialize+          = do skip 1+               depth <- deserialize+               skip 2+               length <- deserialize+               visual <- deserialize+               size <- deserialize+               let _ = isCard32 length+               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}+                  deriving (Show, Typeable)+ +instance ExtensionRequest CreatePixmap where+        extensionId _ = "MIT-SHM"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__+                     = 4 + size (pid_CreatePixmap x) + size (drawable_CreatePixmap x) ++                         size (width_CreatePixmap x)+                         + size (height_CreatePixmap x)+                         + size (depth_CreatePixmap x)+                         + 3+                         + size (shmseg_CreatePixmap x)+                         + size (offset_CreatePixmap x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (pid_CreatePixmap x)+               serialize (drawable_CreatePixmap x)+               serialize (width_CreatePixmap x)+               serialize (height_CreatePixmap x)+               serialize (depth_CreatePixmap x)+               putSkip 3+               serialize (shmseg_CreatePixmap x)+               serialize (offset_CreatePixmap x)+               putSkip (requiredPadding size__)
+ patched/Graphics/XHB/Gen/Sync.hs view
@@ -0,0 +1,154 @@+module Graphics.XHB.Gen.Sync+       (extension, initialize, listSystemCounters, createCounter,+        destroyCounter, queryCounter, await, changeCounter, setCounter,+        createAlarm, changeAlarm, destroyAlarm, queryAlarm, setPriority,+        getPriority, module Graphics.XHB.Gen.Sync.Types)+       where+import Graphics.XHB.Gen.Sync.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "SYNC"+ +initialize ::+             Graphics.XHB.Connection.Types.Connection ->+               CARD8 -> CARD8 -> IO (Receipt InitializeReply)+initialize c desired_major_version desired_minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkInitialize desired_major_version desired_minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +listSystemCounters ::+                     Graphics.XHB.Connection.Types.Connection ->+                       IO (Receipt ListSystemCountersReply)+listSystemCounters c+  = do receipt <- newEmptyReceiptIO+       let req = MkListSystemCounters+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +createCounter ::+                Graphics.XHB.Connection.Types.Connection ->+                  COUNTER -> INT64 -> IO ()+createCounter c id initial_value+  = do let req = MkCreateCounter id initial_value+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +destroyCounter ::+                 Graphics.XHB.Connection.Types.Connection -> COUNTER -> IO ()+destroyCounter c counter+  = do let req = MkDestroyCounter counter+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +queryCounter ::+               Graphics.XHB.Connection.Types.Connection ->+                 COUNTER -> IO (Receipt QueryCounterReply)+queryCounter c counter+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryCounter counter+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +await ::+        Graphics.XHB.Connection.Types.Connection ->+          [WAITCONDITION] -> IO ()+await c wait_list+  = do let req = MkAwait wait_list+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +changeCounter ::+                Graphics.XHB.Connection.Types.Connection ->+                  COUNTER -> INT64 -> IO ()+changeCounter c counter amount+  = do let req = MkChangeCounter counter amount+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +setCounter ::+             Graphics.XHB.Connection.Types.Connection ->+               COUNTER -> INT64 -> IO ()+setCounter c counter value+  = do let req = MkSetCounter counter value+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createAlarm ::+              Graphics.XHB.Connection.Types.Connection ->+                ALARM -> ValueParam CARD32 -> IO ()+createAlarm c id value+  = do let req = MkCreateAlarm id value+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +changeAlarm ::+              Graphics.XHB.Connection.Types.Connection ->+                ALARM -> ValueParam CARD32 -> IO ()+changeAlarm c id value+  = do let req = MkChangeAlarm id value+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +destroyAlarm ::+               Graphics.XHB.Connection.Types.Connection -> ALARM -> IO ()+destroyAlarm c alarm+  = do let req = MkDestroyAlarm alarm+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +queryAlarm ::+             Graphics.XHB.Connection.Types.Connection ->+               ALARM -> IO (Receipt QueryAlarmReply)+queryAlarm c alarm+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryAlarm alarm+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setPriority ::+              Graphics.XHB.Connection.Types.Connection ->+                CARD32 -> INT32 -> IO ()+setPriority c id priority+  = do let req = MkSetPriority id priority+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getPriority ::+              Graphics.XHB.Connection.Types.Connection ->+                CARD32 -> IO (Receipt GetPriorityReply)+getPriority c id+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPriority id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/Sync/Types.hs view
@@ -0,0 +1,556 @@+module Graphics.XHB.Gen.Sync.Types+       (deserializeError, deserializeEvent, ALARM, ALARMSTATE(..),+        COUNTER, TESTTYPE(..), VALUETYPE(..), CA(..), INT64(..),+        SYSTEMCOUNTER(..), TRIGGER(..), WAITCONDITION(..), Counter(..),+        Alarm(..), Initialize(..), InitializeReply(..),+        ListSystemCounters(..), ListSystemCountersReply(..),+        CreateCounter(..), DestroyCounter(..), QueryCounter(..),+        QueryCounterReply(..), Await(..), ChangeCounter(..),+        SetCounter(..), CreateAlarm(..), ChangeAlarm(..), DestroyAlarm(..),+        QueryAlarm(..), QueryAlarmReply(..), SetPriority(..),+        GetPriority(..), GetPriorityReply(..), CounterNotify(..),+        AlarmNotify(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError 0+  = return (liftM toError (deserialize :: Get Counter))+deserializeError 1+  = return (liftM toError (deserialize :: Get Alarm))+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent 0+  = return (liftM toEvent (deserialize :: Get CounterNotify))+deserializeEvent 1+  = return (liftM toEvent (deserialize :: Get AlarmNotify))+deserializeEvent _ = Nothing+ +newtype ALARM = MkALARM Xid+                deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +data ALARMSTATE = ALARMSTATEActive+                | ALARMSTATEInactive+                | ALARMSTATEDestroyed+ +instance SimpleEnum ALARMSTATE where+        toValue ALARMSTATEActive{} = 0+        toValue ALARMSTATEInactive{} = 1+        toValue ALARMSTATEDestroyed{} = 2+        fromValue 0 = ALARMSTATEActive+        fromValue 1 = ALARMSTATEInactive+        fromValue 2 = ALARMSTATEDestroyed+ +newtype COUNTER = MkCOUNTER Xid+                  deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +data TESTTYPE = TESTTYPEPositiveTransition+              | TESTTYPENegativeTransition+              | TESTTYPEPositiveComparison+              | TESTTYPENegativeComparison+ +instance SimpleEnum TESTTYPE where+        toValue TESTTYPEPositiveTransition{} = 0+        toValue TESTTYPENegativeTransition{} = 1+        toValue TESTTYPEPositiveComparison{} = 2+        toValue TESTTYPENegativeComparison{} = 3+        fromValue 0 = TESTTYPEPositiveTransition+        fromValue 1 = TESTTYPENegativeTransition+        fromValue 2 = TESTTYPEPositiveComparison+        fromValue 3 = TESTTYPENegativeComparison+ +data VALUETYPE = VALUETYPEAbsolute+               | VALUETYPERelative+ +instance SimpleEnum VALUETYPE where+        toValue VALUETYPEAbsolute{} = 0+        toValue VALUETYPERelative{} = 1+        fromValue 0 = VALUETYPEAbsolute+        fromValue 1 = VALUETYPERelative+ +data CA = CACounter+        | CAValueType+        | CAValue+        | CATestType+        | CADelta+        | CAEvents+ +instance BitEnum CA where+        toBit CACounter{} = 0+        toBit CAValueType{} = 1+        toBit CAValue{} = 2+        toBit CATestType{} = 3+        toBit CADelta{} = 4+        toBit CAEvents{} = 5+        fromBit 0 = CACounter+        fromBit 1 = CAValueType+        fromBit 2 = CAValue+        fromBit 3 = CATestType+        fromBit 4 = CADelta+        fromBit 5 = CAEvents+ +data INT64 = MkINT64{hi_INT64 :: INT32, lo_INT64 :: CARD32}+           deriving (Show, Typeable)+ +instance Serialize INT64 where+        serialize x+          = do serialize (hi_INT64 x)+               serialize (lo_INT64 x)+        size x = size (hi_INT64 x) + size (lo_INT64 x)+ +instance Deserialize INT64 where+        deserialize+          = do hi <- deserialize+               lo <- deserialize+               return (MkINT64 hi lo)+ +data SYSTEMCOUNTER = MkSYSTEMCOUNTER{counter_SYSTEMCOUNTER ::+                                     COUNTER,+                                     resolution_SYSTEMCOUNTER :: INT64,+                                     name_len_SYSTEMCOUNTER :: CARD16,+                                     name_SYSTEMCOUNTER :: [CChar]}+                   deriving (Show, Typeable)+ +instance Serialize SYSTEMCOUNTER where+        serialize x+          = do serialize (counter_SYSTEMCOUNTER x)+               serialize (resolution_SYSTEMCOUNTER x)+               serialize (name_len_SYSTEMCOUNTER x)+               serializeList (name_SYSTEMCOUNTER x)+        size x+          = size (counter_SYSTEMCOUNTER x) ++              size (resolution_SYSTEMCOUNTER x)+              + size (name_len_SYSTEMCOUNTER x)+              + sum (map size (name_SYSTEMCOUNTER x))+ +instance Deserialize SYSTEMCOUNTER where+        deserialize+          = do counter <- deserialize+               resolution <- deserialize+               name_len <- deserialize+               name <- deserializeList (fromIntegral name_len)+               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}+             deriving (Show, Typeable)+ +instance Serialize TRIGGER where+        serialize x+          = do serialize (counter_TRIGGER x)+               serialize (wait_type_TRIGGER x)+               serialize (wait_value_TRIGGER x)+               serialize (test_type_TRIGGER x)+        size x+          = size (counter_TRIGGER x) + size (wait_type_TRIGGER x) ++              size (wait_value_TRIGGER x)+              + size (test_type_TRIGGER x)+ +instance Deserialize TRIGGER where+        deserialize+          = do counter <- deserialize+               wait_type <- deserialize+               wait_value <- deserialize+               test_type <- deserialize+               return (MkTRIGGER counter wait_type wait_value test_type)+ +data WAITCONDITION = MkWAITCONDITION{trigger_WAITCONDITION ::+                                     TRIGGER,+                                     event_threshold_WAITCONDITION :: INT64}+                   deriving (Show, Typeable)+ +instance Serialize WAITCONDITION where+        serialize x+          = do serialize (trigger_WAITCONDITION x)+               serialize (event_threshold_WAITCONDITION x)+        size x+          = size (trigger_WAITCONDITION x) ++              size (event_threshold_WAITCONDITION x)+ +instance Deserialize WAITCONDITION where+        deserialize+          = do trigger <- deserialize+               event_threshold <- deserialize+               return (MkWAITCONDITION trigger event_threshold)+ +data Counter = MkCounter{bad_counter_Counter :: CARD32,+                         minor_opcode_Counter :: CARD16, major_opcode_Counter :: CARD8}+             deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error Counter+ +instance Deserialize Counter where+        deserialize+          = do skip 4+               bad_counter <- deserialize+               minor_opcode <- deserialize+               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}+           deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Error Alarm+ +instance Deserialize Alarm where+        deserialize+          = do skip 4+               bad_alarm <- deserialize+               minor_opcode <- deserialize+               major_opcode <- deserialize+               return (MkAlarm bad_alarm minor_opcode major_opcode)+ +data Initialize = MkInitialize{desired_major_version_Initialize ::+                               CARD8,+                               desired_minor_version_Initialize :: CARD8}+                deriving (Show, Typeable)+ +instance ExtensionRequest Initialize where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (desired_major_version_Initialize x) ++                         size (desired_minor_version_Initialize x)+               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}+                     deriving (Show, Typeable)+ +instance Deserialize InitializeReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major_version <- deserialize+               minor_version <- deserialize+               skip 22+               let _ = isCard32 length+               return (MkInitializeReply major_version minor_version)+ +data ListSystemCounters = MkListSystemCounters{}+                        deriving (Show, Typeable)+ +instance ExtensionRequest ListSystemCounters where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data ListSystemCountersReply = MkListSystemCountersReply{counters_len_ListSystemCountersReply+                                                         :: CARD32,+                                                         counters_ListSystemCountersReply ::+                                                         [SYSTEMCOUNTER]}+                             deriving (Show, Typeable)+ +instance Deserialize ListSystemCountersReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               counters_len <- deserialize+               skip 20+               counters <- deserializeList (fromIntegral counters_len)+               let _ = isCard32 length+               return (MkListSystemCountersReply counters_len counters)+ +data CreateCounter = MkCreateCounter{id_CreateCounter :: COUNTER,+                                     initial_value_CreateCounter :: INT64}+                   deriving (Show, Typeable)+ +instance ExtensionRequest CreateCounter where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__+                     = 4 + size (id_CreateCounter x) ++                         size (initial_value_CreateCounter x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (id_CreateCounter x)+               serialize (initial_value_CreateCounter x)+               putSkip (requiredPadding size__)+ +data DestroyCounter = MkDestroyCounter{counter_DestroyCounter ::+                                       COUNTER}+                    deriving (Show, Typeable)+ +instance ExtensionRequest DestroyCounter where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__ = 4 + size (counter_DestroyCounter x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (counter_DestroyCounter x)+               putSkip (requiredPadding size__)+ +data QueryCounter = MkQueryCounter{counter_QueryCounter :: COUNTER}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryCounter where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__ = 4 + size (counter_QueryCounter x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (counter_QueryCounter x)+               putSkip (requiredPadding size__)+ +data QueryCounterReply = MkQueryCounterReply{counter_value_QueryCounterReply+                                             :: INT64}+                       deriving (Show, Typeable)+ +instance Deserialize QueryCounterReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               counter_value <- deserialize+               let _ = isCard32 length+               return (MkQueryCounterReply counter_value)+ +data Await = MkAwait{wait_list_Await :: [WAITCONDITION]}+           deriving (Show, Typeable)+ +instance ExtensionRequest Await where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__ = 4 + sum (map size (wait_list_Await x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serializeList (wait_list_Await x)+               putSkip (requiredPadding size__)+ +data ChangeCounter = MkChangeCounter{counter_ChangeCounter ::+                                     COUNTER,+                                     amount_ChangeCounter :: INT64}+                   deriving (Show, Typeable)+ +instance ExtensionRequest ChangeCounter where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__+                     = 4 + size (counter_ChangeCounter x) ++                         size (amount_ChangeCounter x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (counter_ChangeCounter x)+               serialize (amount_ChangeCounter x)+               putSkip (requiredPadding size__)+ +data SetCounter = MkSetCounter{counter_SetCounter :: COUNTER,+                               value_SetCounter :: INT64}+                deriving (Show, Typeable)+ +instance ExtensionRequest SetCounter where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (counter_SetCounter x) + size (value_SetCounter x)+               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}+                 deriving (Show, Typeable)+ +instance ExtensionRequest CreateAlarm where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__+                     = 4 + size (id_CreateAlarm x) + size (value_CreateAlarm x)+               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}+                 deriving (Show, Typeable)+ +instance ExtensionRequest ChangeAlarm where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 9+               let size__+                     = 4 + size (id_ChangeAlarm x) + size (value_ChangeAlarm x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (id_ChangeAlarm x)+               serialize (value_ChangeAlarm x)+               putSkip (requiredPadding size__)+ +data DestroyAlarm = MkDestroyAlarm{alarm_DestroyAlarm :: ALARM}+                  deriving (Show, Typeable)+ +instance ExtensionRequest DestroyAlarm where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 11+               let size__ = 4 + size (alarm_DestroyAlarm x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (alarm_DestroyAlarm x)+               putSkip (requiredPadding size__)+ +data QueryAlarm = MkQueryAlarm{alarm_QueryAlarm :: ALARM}+                deriving (Show, Typeable)+ +instance ExtensionRequest QueryAlarm where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 10+               let size__ = 4 + size (alarm_QueryAlarm x)+               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}+                     deriving (Show, Typeable)+ +instance Deserialize QueryAlarmReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               trigger <- deserialize+               delta <- deserialize+               events <- deserialize+               state <- deserialize+               skip 2+               let _ = isCard32 length+               return (MkQueryAlarmReply trigger delta events state)+ +data SetPriority = MkSetPriority{id_SetPriority :: CARD32,+                                 priority_SetPriority :: INT32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest SetPriority where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 12+               let size__+                     = 4 + size (id_SetPriority x) + size (priority_SetPriority x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (id_SetPriority x)+               serialize (priority_SetPriority x)+               putSkip (requiredPadding size__)+ +data GetPriority = MkGetPriority{id_GetPriority :: CARD32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetPriority where+        extensionId _ = "SYNC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 13+               let size__ = 4 + size (id_GetPriority x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (id_GetPriority x)+               putSkip (requiredPadding size__)+ +data GetPriorityReply = MkGetPriorityReply{priority_GetPriorityReply+                                           :: INT32}+                      deriving (Show, Typeable)+ +instance Deserialize GetPriorityReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               priority <- deserialize+               let _ = isCard32 length+               return (MkGetPriorityReply priority)+ +data CounterNotify = MkCounterNotify{kind_CounterNotify :: CARD8,+                                     counter_CounterNotify :: COUNTER,+                                     wait_value_CounterNotify :: INT64,+                                     counter_value_CounterNotify :: INT64,+                                     timestamp_CounterNotify :: TIMESTAMP,+                                     count_CounterNotify :: CARD16, destroyed_CounterNotify :: BOOL}+                   deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event CounterNotify+ +instance Deserialize CounterNotify where+        deserialize+          = do skip 1+               kind <- deserialize+               skip 2+               counter <- deserialize+               wait_value <- deserialize+               counter_value <- deserialize+               timestamp <- deserialize+               count <- deserialize+               destroyed <- deserialize+               skip 1+               return+                 (MkCounterNotify kind counter wait_value counter_value timestamp+                    count+                    destroyed)+ +data AlarmNotify = MkAlarmNotify{kind_AlarmNotify :: CARD8,+                                 alarm_AlarmNotify :: ALARM, counter_value_AlarmNotify :: INT64,+                                 alarm_value_AlarmNotify :: INT64,+                                 timestamp_AlarmNotify :: TIMESTAMP}+                 deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event AlarmNotify+ +instance Deserialize AlarmNotify where+        deserialize+          = do skip 1+               kind <- deserialize+               skip 2+               alarm <- deserialize+               counter_value <- deserialize+               alarm_value <- deserialize+               timestamp <- deserialize+               return+                 (MkAlarmNotify kind alarm counter_value alarm_value timestamp)
+ patched/Graphics/XHB/Gen/Test.hs view
@@ -0,0 +1,55 @@+module Graphics.XHB.Gen.Test+       (extension, getVersion, compareCursor, fakeInput, grabControl,+        module Graphics.XHB.Gen.Test.Types)+       where+import Graphics.XHB.Gen.Test.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (Cursor(..), deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "XTEST"+ +getVersion ::+             Graphics.XHB.Connection.Types.Connection ->+               CARD8 -> CARD16 -> IO (Receipt GetVersionReply)+getVersion c major_version minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkGetVersion major_version minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +compareCursor ::+                Graphics.XHB.Connection.Types.Connection ->+                  WINDOW -> CURSOR -> IO (Receipt CompareCursorReply)+compareCursor c window cursor+  = do receipt <- newEmptyReceiptIO+       let req = MkCompareCursor window cursor+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +fakeInput ::+            Graphics.XHB.Connection.Types.Connection -> FakeInput -> IO ()+fakeInput c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +grabControl ::+              Graphics.XHB.Connection.Types.Connection -> BOOL -> IO ()+grabControl c impervious+  = do let req = MkGrabControl impervious+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk
+ patched/Graphics/XHB/Gen/Test/Types.hs view
@@ -0,0 +1,144 @@+module Graphics.XHB.Gen.Test.Types+       (deserializeError, deserializeEvent, GetVersion(..),+        GetVersionReply(..), Cursor(..), CompareCursor(..),+        CompareCursorReply(..), FakeInput(..), GrabControl(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (Cursor(..), deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +data GetVersion = MkGetVersion{major_version_GetVersion :: CARD8,+                               minor_version_GetVersion :: CARD16}+                deriving (Show, Typeable)+ +instance ExtensionRequest GetVersion where+        extensionId _ = "XTEST"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (major_version_GetVersion x) + 1 ++                         size (minor_version_GetVersion x)+               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}+                     deriving (Show, Typeable)+ +instance Deserialize GetVersionReply where+        deserialize+          = do skip 1+               major_version <- deserialize+               skip 2+               length <- deserialize+               minor_version <- deserialize+               let _ = isCard32 length+               return (MkGetVersionReply major_version minor_version)+ +data Cursor = CursorNone+            | CursorCurrent+ +instance SimpleEnum Cursor where+        toValue CursorNone{} = 0+        toValue CursorCurrent{} = 1+        fromValue 0 = CursorNone+        fromValue 1 = CursorCurrent+ +data CompareCursor = MkCompareCursor{window_CompareCursor ::+                                     WINDOW,+                                     cursor_CompareCursor :: CURSOR}+                   deriving (Show, Typeable)+ +instance ExtensionRequest CompareCursor where+        extensionId _ = "XTEST"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__+                     = 4 + size (window_CompareCursor x) + size (cursor_CompareCursor x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_CompareCursor x)+               serialize (cursor_CompareCursor x)+               putSkip (requiredPadding size__)+ +data CompareCursorReply = MkCompareCursorReply{same_CompareCursorReply+                                               :: BOOL}+                        deriving (Show, Typeable)+ +instance Deserialize CompareCursorReply where+        deserialize+          = do skip 1+               same <- deserialize+               skip 2+               length <- deserialize+               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}+               deriving (Show, Typeable)+ +instance ExtensionRequest FakeInput where+        extensionId _ = "XTEST"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__+                     = 4 + size (type_FakeInput x) + size (detail_FakeInput x) + 2 ++                         size (time_FakeInput x)+                         + size (window_FakeInput x)+                         + 8+                         + size (rootX_FakeInput x)+                         + size (rootY_FakeInput x)+                         + 7+                         + size (deviceid_FakeInput x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (type_FakeInput x)+               serialize (detail_FakeInput x)+               putSkip 2+               serialize (time_FakeInput x)+               serialize (window_FakeInput x)+               putSkip 8+               serialize (rootX_FakeInput x)+               serialize (rootY_FakeInput x)+               putSkip 7+               serialize (deviceid_FakeInput x)+               putSkip (requiredPadding size__)+ +data GrabControl = MkGrabControl{impervious_GrabControl :: BOOL}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GrabControl where+        extensionId _ = "XTEST"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__ = 4 + size (impervious_GrabControl x) + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (impervious_GrabControl x)+               putSkip 3+               putSkip (requiredPadding size__)
+ patched/Graphics/XHB/Gen/XCMisc.hs view
@@ -0,0 +1,48 @@+module Graphics.XHB.Gen.XCMisc+       (extension, getVersion, getXIDRange, getXIDList,+        module Graphics.XHB.Gen.XCMisc.Types)+       where+import Graphics.XHB.Gen.XCMisc.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+ +extension :: ExtensionId+extension = "XC-MISC"+ +getVersion ::+             Graphics.XHB.Connection.Types.Connection ->+               CARD16 -> CARD16 -> IO (Receipt GetVersionReply)+getVersion c client_major_version client_minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkGetVersion client_major_version client_minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getXIDRange ::+              Graphics.XHB.Connection.Types.Connection ->+                IO (Receipt GetXIDRangeReply)+getXIDRange c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetXIDRange+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getXIDList ::+             Graphics.XHB.Connection.Types.Connection ->+               CARD32 -> IO (Receipt GetXIDListReply)+getXIDList c count+  = do receipt <- newEmptyReceiptIO+       let req = MkGetXIDList count+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/XCMisc/Types.hs view
@@ -0,0 +1,115 @@+module Graphics.XHB.Gen.XCMisc.Types+       (deserializeError, deserializeEvent, GetVersion(..),+        GetVersionReply(..), GetXIDRange(..), GetXIDRangeReply(..),+        GetXIDList(..), GetXIDListReply(..))+       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 _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +data GetVersion = MkGetVersion{client_major_version_GetVersion ::+                               CARD16,+                               client_minor_version_GetVersion :: CARD16}+                deriving (Show, Typeable)+ +instance ExtensionRequest GetVersion where+        extensionId _ = "XC-MISC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (client_major_version_GetVersion x) ++                         size (client_minor_version_GetVersion x)+               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}+                     deriving (Show, Typeable)+ +instance Deserialize GetVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               server_major_version <- deserialize+               server_minor_version <- deserialize+               let _ = isCard32 length+               return+                 (MkGetVersionReply server_major_version server_minor_version)+ +data GetXIDRange = MkGetXIDRange{}+                 deriving (Show, Typeable)+ +instance ExtensionRequest GetXIDRange where+        extensionId _ = "XC-MISC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data GetXIDRangeReply = MkGetXIDRangeReply{start_id_GetXIDRangeReply+                                           :: CARD32,+                                           count_GetXIDRangeReply :: CARD32}+                      deriving (Show, Typeable)+ +instance Deserialize GetXIDRangeReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               start_id <- deserialize+               count <- deserialize+               let _ = isCard32 length+               return (MkGetXIDRangeReply start_id count)+ +data GetXIDList = MkGetXIDList{count_GetXIDList :: CARD32}+                deriving (Show, Typeable)+ +instance ExtensionRequest GetXIDList where+        extensionId _ = "XC-MISC"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4 + size (count_GetXIDList x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (count_GetXIDList x)+               putSkip (requiredPadding size__)+ +data GetXIDListReply = MkGetXIDListReply{ids_len_GetXIDListReply ::+                                         CARD32,+                                         ids_GetXIDListReply :: [CARD32]}+                     deriving (Show, Typeable)+ +instance Deserialize GetXIDListReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               ids_len <- deserialize+               skip 20+               ids <- deserializeList (fromIntegral ids_len)+               let _ = isCard32 length+               return (MkGetXIDListReply ids_len ids)
+ patched/Graphics/XHB/Gen/XF86Dri.hs view
@@ -0,0 +1,142 @@+module Graphics.XHB.Gen.XF86Dri+       (extension, queryVersion, queryDirectRenderingCapable,+        openConnection, closeConnection, getClientDriverName,+        createContext, destroyContext, createDrawable, destroyDrawable,+        getDrawableInfo, getDeviceInfo, authConnection,+        module Graphics.XHB.Gen.XF86Dri.Types)+       where+import Graphics.XHB.Gen.XF86Dri.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+ +extension :: ExtensionId+extension = "XFree86-DRI"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 IO (Receipt QueryVersionReply)+queryVersion c+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryDirectRenderingCapable ::+                              Graphics.XHB.Connection.Types.Connection ->+                                CARD32 -> IO (Receipt QueryDirectRenderingCapableReply)+queryDirectRenderingCapable c screen+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryDirectRenderingCapable screen+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +openConnection ::+                 Graphics.XHB.Connection.Types.Connection ->+                   CARD32 -> IO (Receipt OpenConnectionReply)+openConnection c screen+  = do receipt <- newEmptyReceiptIO+       let req = MkOpenConnection screen+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +closeConnection ::+                  Graphics.XHB.Connection.Types.Connection -> CARD32 -> IO ()+closeConnection c screen+  = do let req = MkCloseConnection screen+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getClientDriverName ::+                      Graphics.XHB.Connection.Types.Connection ->+                        CARD32 -> IO (Receipt GetClientDriverNameReply)+getClientDriverName c screen+  = do receipt <- newEmptyReceiptIO+       let req = MkGetClientDriverName screen+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +createContext ::+                Graphics.XHB.Connection.Types.Connection ->+                  CreateContext -> IO (Receipt CreateContextReply)+createContext c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +destroyContext ::+                 Graphics.XHB.Connection.Types.Connection ->+                   CARD32 -> CARD32 -> IO ()+destroyContext c screen context+  = do let req = MkDestroyContext screen context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createDrawable ::+                 Graphics.XHB.Connection.Types.Connection ->+                   CARD32 -> CARD32 -> IO (Receipt CreateDrawableReply)+createDrawable c screen drawable+  = do receipt <- newEmptyReceiptIO+       let req = MkCreateDrawable screen drawable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +destroyDrawable ::+                  Graphics.XHB.Connection.Types.Connection ->+                    CARD32 -> CARD32 -> IO ()+destroyDrawable c screen drawable+  = do let req = MkDestroyDrawable screen drawable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getDrawableInfo ::+                  Graphics.XHB.Connection.Types.Connection ->+                    CARD32 -> CARD32 -> IO (Receipt GetDrawableInfoReply)+getDrawableInfo c screen drawable+  = do receipt <- newEmptyReceiptIO+       let req = MkGetDrawableInfo screen drawable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getDeviceInfo ::+                Graphics.XHB.Connection.Types.Connection ->+                  CARD32 -> IO (Receipt GetDeviceInfoReply)+getDeviceInfo c screen+  = do receipt <- newEmptyReceiptIO+       let req = MkGetDeviceInfo screen+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +authConnection ::+                 Graphics.XHB.Connection.Types.Connection ->+                   CARD32 -> CARD32 -> IO (Receipt AuthConnectionReply)+authConnection c screen magic+  = do receipt <- newEmptyReceiptIO+       let req = MkAuthConnection screen magic+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/XF86Dri/Types.hs view
@@ -0,0 +1,457 @@+module Graphics.XHB.Gen.XF86Dri.Types+       (deserializeError, deserializeEvent, DrmClipRect(..),+        QueryVersion(..), QueryVersionReply(..),+        QueryDirectRenderingCapable(..),+        QueryDirectRenderingCapableReply(..), OpenConnection(..),+        OpenConnectionReply(..), CloseConnection(..),+        GetClientDriverName(..), GetClientDriverNameReply(..),+        CreateContext(..), CreateContextReply(..), DestroyContext(..),+        CreateDrawable(..), CreateDrawableReply(..), DestroyDrawable(..),+        GetDrawableInfo(..), GetDrawableInfoReply(..), GetDeviceInfo(..),+        GetDeviceInfoReply(..), AuthConnection(..),+        AuthConnectionReply(..))+       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 _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +data DrmClipRect = MkDrmClipRect{x1_DrmClipRect :: INT16,+                                 y1_DrmClipRect :: INT16, x2_DrmClipRect :: INT16,+                                 x3_DrmClipRect :: INT16}+                 deriving (Show, Typeable)+ +instance Serialize DrmClipRect where+        serialize x+          = do serialize (x1_DrmClipRect x)+               serialize (y1_DrmClipRect x)+               serialize (x2_DrmClipRect x)+               serialize (x3_DrmClipRect x)+        size x+          = size (x1_DrmClipRect x) + size (y1_DrmClipRect x) ++              size (x2_DrmClipRect x)+              + size (x3_DrmClipRect x)+ +instance Deserialize DrmClipRect where+        deserialize+          = do x1 <- deserialize+               y1 <- deserialize+               x2 <- deserialize+               x3 <- deserialize+               return (MkDrmClipRect x1 y1 x2 x3)+ +data QueryVersion = MkQueryVersion{}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__ = 4+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               dri_major_version <- deserialize+               dri_minor_version <- deserialize+               dri_minor_patch <- deserialize+               let _ = isCard32 length+               return+                 (MkQueryVersionReply dri_major_version dri_minor_version+                    dri_minor_patch)+ +data QueryDirectRenderingCapable = MkQueryDirectRenderingCapable{screen_QueryDirectRenderingCapable+                                                                 :: CARD32}+                                 deriving (Show, Typeable)+ +instance ExtensionRequest QueryDirectRenderingCapable where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__ = 4 + size (screen_QueryDirectRenderingCapable x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_QueryDirectRenderingCapable x)+               putSkip (requiredPadding size__)+ +data QueryDirectRenderingCapableReply = MkQueryDirectRenderingCapableReply{is_capable_QueryDirectRenderingCapableReply+                                                                           :: BOOL}+                                      deriving (Show, Typeable)+ +instance Deserialize QueryDirectRenderingCapableReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               is_capable <- deserialize+               let _ = isCard32 length+               return (MkQueryDirectRenderingCapableReply is_capable)+ +data OpenConnection = MkOpenConnection{screen_OpenConnection ::+                                       CARD32}+                    deriving (Show, Typeable)+ +instance ExtensionRequest OpenConnection where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4 + size (screen_OpenConnection x)+               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,+                                                 bus_id_OpenConnectionReply :: [CChar]}+                         deriving (Show, Typeable)+ +instance Deserialize OpenConnectionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               drm_client_key_low <- deserialize+               drm_client_key_high <- deserialize+               sarea_handle_low <- deserialize+               sarea_handle_high <- deserialize+               bus_id_len <- deserialize+               skip 12+               bus_id <- deserializeList (fromIntegral bus_id_len)+               let _ = isCard32 length+               return+                 (MkOpenConnectionReply drm_client_key_low drm_client_key_high+                    sarea_handle_low+                    sarea_handle_high+                    bus_id_len+                    bus_id)+ +data CloseConnection = MkCloseConnection{screen_CloseConnection ::+                                         CARD32}+                     deriving (Show, Typeable)+ +instance ExtensionRequest CloseConnection where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__ = 4 + size (screen_CloseConnection x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_CloseConnection x)+               putSkip (requiredPadding size__)+ +data GetClientDriverName = MkGetClientDriverName{screen_GetClientDriverName+                                                 :: CARD32}+                         deriving (Show, Typeable)+ +instance ExtensionRequest GetClientDriverName where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__ = 4 + size (screen_GetClientDriverName x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_GetClientDriverName x)+               putSkip (requiredPadding size__)+ +data GetClientDriverNameReply = MkGetClientDriverNameReply{client_driver_major_version_GetClientDriverNameReply+                                                           :: CARD32,+                                                           client_driver_minor_version_GetClientDriverNameReply+                                                           :: CARD32,+                                                           client_driver_patch_version_GetClientDriverNameReply+                                                           :: CARD32,+                                                           client_driver_name_len_GetClientDriverNameReply+                                                           :: CARD32,+                                                           client_driver_name_GetClientDriverNameReply+                                                           :: [CChar]}+                              deriving (Show, Typeable)+ +instance Deserialize GetClientDriverNameReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               client_driver_major_version <- deserialize+               client_driver_minor_version <- deserialize+               client_driver_patch_version <- deserialize+               client_driver_name_len <- deserialize+               skip 8+               client_driver_name <- deserializeList+                                       (fromIntegral client_driver_name_len)+               let _ = isCard32 length+               return+                 (MkGetClientDriverNameReply client_driver_major_version+                    client_driver_minor_version+                    client_driver_patch_version+                    client_driver_name_len+                    client_driver_name)+ +data CreateContext = MkCreateContext{visual_CreateContext ::+                                     CARD32,+                                     screen_CreateContext :: CARD32,+                                     context_CreateContext :: CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest CreateContext where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__+                     = 4 + size (visual_CreateContext x) + size (screen_CreateContext x)+                         + size (context_CreateContext x)+               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}+                        deriving (Show, Typeable)+ +instance Deserialize CreateContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               hw_context <- deserialize+               let _ = isCard32 length+               return (MkCreateContextReply hw_context)+ +data DestroyContext = MkDestroyContext{screen_DestroyContext ::+                                       CARD32,+                                       context_DestroyContext :: CARD32}+                    deriving (Show, Typeable)+ +instance ExtensionRequest DestroyContext where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__+                     = 4 + size (screen_DestroyContext x) ++                         size (context_DestroyContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_DestroyContext x)+               serialize (context_DestroyContext x)+               putSkip (requiredPadding size__)+ +data CreateDrawable = MkCreateDrawable{screen_CreateDrawable ::+                                       CARD32,+                                       drawable_CreateDrawable :: CARD32}+                    deriving (Show, Typeable)+ +instance ExtensionRequest CreateDrawable where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__+                     = 4 + size (screen_CreateDrawable x) ++                         size (drawable_CreateDrawable x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_CreateDrawable x)+               serialize (drawable_CreateDrawable x)+               putSkip (requiredPadding size__)+ +data CreateDrawableReply = MkCreateDrawableReply{hw_drawable_handle_CreateDrawableReply+                                                 :: CARD32}+                         deriving (Show, Typeable)+ +instance Deserialize CreateDrawableReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               hw_drawable_handle <- deserialize+               let _ = isCard32 length+               return (MkCreateDrawableReply hw_drawable_handle)+ +data DestroyDrawable = MkDestroyDrawable{screen_DestroyDrawable ::+                                         CARD32,+                                         drawable_DestroyDrawable :: CARD32}+                     deriving (Show, Typeable)+ +instance ExtensionRequest DestroyDrawable where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__+                     = 4 + size (screen_DestroyDrawable x) ++                         size (drawable_DestroyDrawable x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_DestroyDrawable x)+               serialize (drawable_DestroyDrawable x)+               putSkip (requiredPadding size__)+ +data GetDrawableInfo = MkGetDrawableInfo{screen_GetDrawableInfo ::+                                         CARD32,+                                         drawable_GetDrawableInfo :: CARD32}+                     deriving (Show, Typeable)+ +instance ExtensionRequest GetDrawableInfo where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 9+               let size__+                     = 4 + size (screen_GetDrawableInfo x) ++                         size (drawable_GetDrawableInfo x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_GetDrawableInfo x)+               serialize (drawable_GetDrawableInfo x)+               putSkip (requiredPadding size__)+ +data GetDrawableInfoReply = MkGetDrawableInfoReply{drawable_table_index_GetDrawableInfoReply+                                                   :: CARD32,+                                                   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,+                                                   clip_rects_GetDrawableInfoReply :: [DrmClipRect]}+                          deriving (Show, Typeable)+ +instance Deserialize GetDrawableInfoReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               drawable_table_index <- deserialize+               drawable_table_stamp <- deserialize+               drawable_origin_X <- deserialize+               drawable_origin_Y <- deserialize+               drawable_size_W <- deserialize+               drawable_size_H <- deserialize+               num_clip_rects <- deserialize+               skip 4+               clip_rects <- deserializeList (fromIntegral num_clip_rects)+               let _ = isCard32 length+               return+                 (MkGetDrawableInfoReply drawable_table_index drawable_table_stamp+                    drawable_origin_X+                    drawable_origin_Y+                    drawable_size_W+                    drawable_size_H+                    num_clip_rects+                    clip_rects)+ +data GetDeviceInfo = MkGetDeviceInfo{screen_GetDeviceInfo ::+                                     CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GetDeviceInfo where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 10+               let size__ = 4 + size (screen_GetDeviceInfo x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_GetDeviceInfo x)+               putSkip (requiredPadding size__)+ +data GetDeviceInfoReply = MkGetDeviceInfoReply{framebuffer_handle_low_GetDeviceInfoReply+                                               :: CARD32,+                                               framebuffer_handle_high_GetDeviceInfoReply :: CARD32,+                                               framebuffer_origin_offset_GetDeviceInfoReply ::+                                               CARD32,+                                               framebuffer_size_GetDeviceInfoReply :: CARD32,+                                               framebuffer_stride_GetDeviceInfoReply :: CARD32,+                                               device_private_size_GetDeviceInfoReply :: CARD32,+                                               device_private_GetDeviceInfoReply :: [CARD32]}+                        deriving (Show, Typeable)+ +instance Deserialize GetDeviceInfoReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               framebuffer_handle_low <- deserialize+               framebuffer_handle_high <- deserialize+               framebuffer_origin_offset <- deserialize+               framebuffer_size <- deserialize+               framebuffer_stride <- deserialize+               device_private_size <- deserialize+               device_private <- deserializeList+                                   (fromIntegral device_private_size)+               let _ = isCard32 length+               return+                 (MkGetDeviceInfoReply framebuffer_handle_low+                    framebuffer_handle_high+                    framebuffer_origin_offset+                    framebuffer_size+                    framebuffer_stride+                    device_private_size+                    device_private)+ +data AuthConnection = MkAuthConnection{screen_AuthConnection ::+                                       CARD32,+                                       magic_AuthConnection :: CARD32}+                    deriving (Show, Typeable)+ +instance ExtensionRequest AuthConnection where+        extensionId _ = "XFree86-DRI"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 11+               let size__+                     = 4 + size (screen_AuthConnection x) ++                         size (magic_AuthConnection x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_AuthConnection x)+               serialize (magic_AuthConnection x)+               putSkip (requiredPadding size__)+ +data AuthConnectionReply = MkAuthConnectionReply{authenticated_AuthConnectionReply+                                                 :: CARD32}+                         deriving (Show, Typeable)+ +instance Deserialize AuthConnectionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               authenticated <- deserialize+               let _ = isCard32 length+               return (MkAuthConnectionReply authenticated)
+ patched/Graphics/XHB/Gen/XFixes.hs view
@@ -0,0 +1,301 @@+module Graphics.XHB.Gen.XFixes+       (extension, queryVersion, changeSaveSet, selectSelectionInput,+        selectCursorInput, getCursorImage, createRegion,+        createRegionFromBitmap, createRegionFromWindow, createRegionFromGC,+        createRegionFromPicture, destroyRegion, setRegion, copyRegion,+        unionRegion, intersectRegion, subtractRegion, invertRegion,+        translateRegion, regionExtents, fetchRegion, setGCClipRegion,+        setWindowShapeRegion, setPictureClipRegion, setCursorName,+        getCursorName, getCursorImageAndName, changeCursor,+        changeCursorByName, expandRegion, hideCursor, showCursor,+        module Graphics.XHB.Gen.XFixes.Types)+       where+import Graphics.XHB.Gen.XFixes.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (ChangeSaveSet(..), SelectionNotify(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+import Graphics.XHB.Gen.Render.Types+       hiding (QueryVersion(..), QueryVersionReply(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.Render.Types+import Graphics.XHB.Gen.Shape.Types+       hiding (QueryVersion(..), QueryVersionReply(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.Shape.Types+ +extension :: ExtensionId+extension = "XFIXES"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD32 -> CARD32 -> IO (Receipt QueryVersionReply)+queryVersion c client_major_version client_minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion client_major_version client_minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +changeSaveSet ::+                Graphics.XHB.Connection.Types.Connection -> ChangeSaveSet -> IO ()+changeSaveSet c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +selectSelectionInput ::+                       Graphics.XHB.Connection.Types.Connection ->+                         SelectSelectionInput -> IO ()+selectSelectionInput c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +selectCursorInput ::+                    Graphics.XHB.Connection.Types.Connection ->+                      WINDOW -> CARD32 -> IO ()+selectCursorInput c window event_mask+  = do let req = MkSelectCursorInput window event_mask+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getCursorImage ::+                 Graphics.XHB.Connection.Types.Connection ->+                   IO (Receipt GetCursorImageReply)+getCursorImage c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetCursorImage+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +createRegion ::+               Graphics.XHB.Connection.Types.Connection ->+                 REGION -> [RECTANGLE] -> IO ()+createRegion c region rectangles+  = do let req = MkCreateRegion region rectangles+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createRegionFromBitmap ::+                         Graphics.XHB.Connection.Types.Connection ->+                           REGION -> PIXMAP -> IO ()+createRegionFromBitmap c region bitmap+  = do let req = MkCreateRegionFromBitmap region bitmap+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createRegionFromWindow ::+                         Graphics.XHB.Connection.Types.Connection ->+                           CreateRegionFromWindow -> IO ()+createRegionFromWindow c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createRegionFromGC ::+                     Graphics.XHB.Connection.Types.Connection ->+                       REGION -> GCONTEXT -> IO ()+createRegionFromGC c region gc+  = do let req = MkCreateRegionFromGC region gc+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createRegionFromPicture ::+                          Graphics.XHB.Connection.Types.Connection ->+                            REGION -> PICTURE -> IO ()+createRegionFromPicture c region picture+  = do let req = MkCreateRegionFromPicture region picture+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +destroyRegion ::+                Graphics.XHB.Connection.Types.Connection -> REGION -> IO ()+destroyRegion c region+  = do let req = MkDestroyRegion region+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +setRegion ::+            Graphics.XHB.Connection.Types.Connection ->+              REGION -> [RECTANGLE] -> IO ()+setRegion c region rectangles+  = do let req = MkSetRegion region rectangles+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +copyRegion ::+             Graphics.XHB.Connection.Types.Connection ->+               REGION -> REGION -> IO ()+copyRegion c source destination+  = do let req = MkCopyRegion source destination+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +unionRegion ::+              Graphics.XHB.Connection.Types.Connection -> UnionRegion -> IO ()+unionRegion c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +intersectRegion ::+                  Graphics.XHB.Connection.Types.Connection ->+                    IntersectRegion -> IO ()+intersectRegion c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +subtractRegion ::+                 Graphics.XHB.Connection.Types.Connection -> SubtractRegion -> IO ()+subtractRegion c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +invertRegion ::+               Graphics.XHB.Connection.Types.Connection -> InvertRegion -> IO ()+invertRegion c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +translateRegion ::+                  Graphics.XHB.Connection.Types.Connection ->+                    TranslateRegion -> IO ()+translateRegion c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +regionExtents ::+                Graphics.XHB.Connection.Types.Connection ->+                  REGION -> REGION -> IO ()+regionExtents c source destination+  = do let req = MkRegionExtents source destination+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +fetchRegion ::+              Graphics.XHB.Connection.Types.Connection ->+                REGION -> IO (Receipt FetchRegionReply)+fetchRegion c region+  = do receipt <- newEmptyReceiptIO+       let req = MkFetchRegion region+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setGCClipRegion ::+                  Graphics.XHB.Connection.Types.Connection ->+                    SetGCClipRegion -> IO ()+setGCClipRegion c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +setWindowShapeRegion ::+                       Graphics.XHB.Connection.Types.Connection ->+                         SetWindowShapeRegion -> IO ()+setWindowShapeRegion c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +setPictureClipRegion ::+                       Graphics.XHB.Connection.Types.Connection ->+                         SetPictureClipRegion -> IO ()+setPictureClipRegion c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +setCursorName ::+                Graphics.XHB.Connection.Types.Connection -> SetCursorName -> IO ()+setCursorName c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getCursorName ::+                Graphics.XHB.Connection.Types.Connection ->+                  CURSOR -> IO (Receipt GetCursorNameReply)+getCursorName c cursor+  = do receipt <- newEmptyReceiptIO+       let req = MkGetCursorName cursor+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getCursorImageAndName ::+                        Graphics.XHB.Connection.Types.Connection ->+                          IO (Receipt GetCursorImageAndNameReply)+getCursorImageAndName c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetCursorImageAndName+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +changeCursor ::+               Graphics.XHB.Connection.Types.Connection ->+                 CURSOR -> CURSOR -> IO ()+changeCursor c source destination+  = do let req = MkChangeCursor source destination+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +changeCursorByName ::+                     Graphics.XHB.Connection.Types.Connection ->+                       ChangeCursorByName -> IO ()+changeCursorByName c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +expandRegion ::+               Graphics.XHB.Connection.Types.Connection -> ExpandRegion -> IO ()+expandRegion c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +hideCursor ::+             Graphics.XHB.Connection.Types.Connection -> WINDOW -> IO ()+hideCursor c window+  = do let req = MkHideCursor window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +showCursor ::+             Graphics.XHB.Connection.Types.Connection -> WINDOW -> IO ()+showCursor c window+  = do let req = MkShowCursor window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk
+ patched/Graphics/XHB/Gen/XFixes/Types.hs view
@@ -0,0 +1,882 @@+module Graphics.XHB.Gen.XFixes.Types+       (deserializeError, deserializeEvent, QueryVersion(..),+        QueryVersionReply(..), SaveSetMode(..), SaveSetTarget(..),+        SaveSetMapping(..), ChangeSaveSet(..), SelectionEvent(..),+        SelectionEventMask(..), SelectionNotify(..),+        SelectSelectionInput(..), CursorNotifyEnum(..), CursorNotifyMask(..),+        CursorNotify(..), SelectCursorInput(..), GetCursorImage(..),+        GetCursorImageReply(..), REGION, CreateRegion(..),+        CreateRegionFromBitmap(..), CreateRegionFromWindow(..),+        CreateRegionFromGC(..), CreateRegionFromPicture(..),+        DestroyRegion(..), SetRegion(..), CopyRegion(..), UnionRegion(..),+        IntersectRegion(..), SubtractRegion(..), InvertRegion(..),+        TranslateRegion(..), RegionExtents(..), FetchRegion(..),+        FetchRegionReply(..), SetGCClipRegion(..),+        SetWindowShapeRegion(..), SetPictureClipRegion(..),+        SetCursorName(..), GetCursorName(..), GetCursorNameReply(..),+        GetCursorImageAndName(..), GetCursorImageAndNameReply(..),+        ChangeCursor(..), ChangeCursorByName(..), ExpandRegion(..),+        HideCursor(..), ShowCursor(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (ChangeSaveSet(..), SelectionNotify(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+import Graphics.XHB.Gen.Render.Types+       hiding (QueryVersion(..), QueryVersionReply(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.Render.Types+import Graphics.XHB.Gen.Shape.Types+       hiding (QueryVersion(..), QueryVersionReply(..), deserializeError,+               deserializeEvent)+import qualified Graphics.XHB.Gen.Shape.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent 0+  = return (liftM toEvent (deserialize :: Get SelectionNotify))+deserializeEvent 1+  = return (liftM toEvent (deserialize :: Get CursorNotify))+deserializeEvent _ = Nothing+ +data QueryVersion = MkQueryVersion{client_major_version_QueryVersion+                                   :: CARD32,+                                   client_minor_version_QueryVersion :: CARD32}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (client_major_version_QueryVersion x) ++                         size (client_minor_version_QueryVersion x)+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major_version <- deserialize+               minor_version <- deserialize+               skip 16+               let _ = isCard32 length+               return (MkQueryVersionReply major_version minor_version)+ +data SaveSetMode = SaveSetModeInsert+                 | SaveSetModeDelete+ +instance SimpleEnum SaveSetMode where+        toValue SaveSetModeInsert{} = 0+        toValue SaveSetModeDelete{} = 1+        fromValue 0 = SaveSetModeInsert+        fromValue 1 = SaveSetModeDelete+ +data SaveSetTarget = SaveSetTargetNearest+                   | SaveSetTargetRoot+ +instance SimpleEnum SaveSetTarget where+        toValue SaveSetTargetNearest{} = 0+        toValue SaveSetTargetRoot{} = 1+        fromValue 0 = SaveSetTargetNearest+        fromValue 1 = SaveSetTargetRoot+ +data SaveSetMapping = SaveSetMappingMap+                    | SaveSetMappingUnmap+ +instance SimpleEnum SaveSetMapping where+        toValue SaveSetMappingMap{} = 0+        toValue SaveSetMappingUnmap{} = 1+        fromValue 0 = SaveSetMappingMap+        fromValue 1 = SaveSetMappingUnmap+ +data ChangeSaveSet = MkChangeSaveSet{mode_ChangeSaveSet :: BYTE,+                                     target_ChangeSaveSet :: BYTE, map_ChangeSaveSet :: BYTE,+                                     window_ChangeSaveSet :: WINDOW}+                   deriving (Show, Typeable)+ +instance ExtensionRequest ChangeSaveSet where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__+                     = 4 + size (mode_ChangeSaveSet x) + size (target_ChangeSaveSet x) ++                         size (map_ChangeSaveSet x)+                         + 1+                         + size (window_ChangeSaveSet x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (mode_ChangeSaveSet x)+               serialize (target_ChangeSaveSet x)+               serialize (map_ChangeSaveSet x)+               putSkip 1+               serialize (window_ChangeSaveSet x)+               putSkip (requiredPadding size__)+ +data SelectionEvent = SelectionEventSetSelectionOwner+                    | SelectionEventSelectionWindowDestroy+                    | SelectionEventSelectionClientClose+ +instance SimpleEnum SelectionEvent where+        toValue SelectionEventSetSelectionOwner{} = 0+        toValue SelectionEventSelectionWindowDestroy{} = 1+        toValue SelectionEventSelectionClientClose{} = 2+        fromValue 0 = SelectionEventSetSelectionOwner+        fromValue 1 = SelectionEventSelectionWindowDestroy+        fromValue 2 = SelectionEventSelectionClientClose+ +data SelectionEventMask = SelectionEventMaskSetSelectionOwner+                        | SelectionEventMaskSelectionWindowDestroy+                        | SelectionEventMaskSelectionClientClose+ +instance BitEnum SelectionEventMask where+        toBit SelectionEventMaskSetSelectionOwner{} = 0+        toBit SelectionEventMaskSelectionWindowDestroy{} = 1+        toBit SelectionEventMaskSelectionClientClose{} = 2+        fromBit 0 = SelectionEventMaskSetSelectionOwner+        fromBit 1 = SelectionEventMaskSelectionWindowDestroy+        fromBit 2 = SelectionEventMaskSelectionClientClose+ +data SelectionNotify = MkSelectionNotify{subtype_SelectionNotify ::+                                         CARD8,+                                         window_SelectionNotify :: WINDOW,+                                         owner_SelectionNotify :: WINDOW,+                                         selection_SelectionNotify :: ATOM,+                                         timestamp_SelectionNotify :: TIMESTAMP,+                                         selection_timestamp_SelectionNotify :: TIMESTAMP}+                     deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event SelectionNotify+ +instance Deserialize SelectionNotify where+        deserialize+          = do skip 1+               subtype <- deserialize+               skip 2+               window <- deserialize+               owner <- deserialize+               selection <- deserialize+               timestamp <- deserialize+               selection_timestamp <- deserialize+               skip 8+               return+                 (MkSelectionNotify subtype window owner selection timestamp+                    selection_timestamp)+ +data SelectSelectionInput = MkSelectSelectionInput{window_SelectSelectionInput+                                                   :: WINDOW,+                                                   selection_SelectSelectionInput :: ATOM,+                                                   event_mask_SelectSelectionInput :: CARD32}+                          deriving (Show, Typeable)+ +instance ExtensionRequest SelectSelectionInput where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__+                     = 4 + size (window_SelectSelectionInput x) ++                         size (selection_SelectSelectionInput x)+                         + size (event_mask_SelectSelectionInput x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_SelectSelectionInput x)+               serialize (selection_SelectSelectionInput x)+               serialize (event_mask_SelectSelectionInput x)+               putSkip (requiredPadding size__)+ +data CursorNotifyEnum = CursorNotifyDisplayCursor+ +instance SimpleEnum CursorNotifyEnum where+        toValue CursorNotifyDisplayCursor{} = 0+        fromValue 0 = CursorNotifyDisplayCursor+ +data CursorNotifyMask = CursorNotifyMaskDisplayCursor+ +instance BitEnum CursorNotifyMask where+        toBit CursorNotifyMaskDisplayCursor{} = 0+        fromBit 0 = CursorNotifyMaskDisplayCursor+ +data CursorNotify = MkCursorNotify{subtype_CursorNotify :: CARD8,+                                   window_CursorNotify :: WINDOW,+                                   cursor_serial_CursorNotify :: CARD32,+                                   timestamp_CursorNotify :: TIMESTAMP, name_CursorNotify :: ATOM}+                  deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event CursorNotify+ +instance Deserialize CursorNotify where+        deserialize+          = do skip 1+               subtype <- deserialize+               skip 2+               window <- deserialize+               cursor_serial <- deserialize+               timestamp <- deserialize+               name <- deserialize+               skip 12+               return (MkCursorNotify subtype window cursor_serial timestamp name)+ +data SelectCursorInput = MkSelectCursorInput{window_SelectCursorInput+                                             :: WINDOW,+                                             event_mask_SelectCursorInput :: CARD32}+                       deriving (Show, Typeable)+ +instance ExtensionRequest SelectCursorInput where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (window_SelectCursorInput x) ++                         size (event_mask_SelectCursorInput x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_SelectCursorInput x)+               serialize (event_mask_SelectCursorInput x)+               putSkip (requiredPadding size__)+ +data GetCursorImage = MkGetCursorImage{}+                    deriving (Show, Typeable)+ +instance ExtensionRequest GetCursorImage where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__ = 4+               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]}+                         deriving (Show, Typeable)+ +instance Deserialize GetCursorImageReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               x <- deserialize+               y <- deserialize+               width <- deserialize+               height <- deserialize+               xhot <- deserialize+               yhot <- deserialize+               cursor_serial <- deserialize+               skip 8+               cursor_image <- deserializeList+                                 (fromIntegral (fromIntegral (width * height)))+               let _ = isCard32 length+               return+                 (MkGetCursorImageReply x y width height xhot yhot cursor_serial+                    cursor_image)+ +newtype REGION = MkREGION Xid+                 deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +data CreateRegion = MkCreateRegion{region_CreateRegion :: REGION,+                                   rectangles_CreateRegion :: [RECTANGLE]}+                  deriving (Show, Typeable)+ +instance ExtensionRequest CreateRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__+                     = 4 + size (region_CreateRegion x) ++                         sum (map size (rectangles_CreateRegion x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (region_CreateRegion x)+               serializeList (rectangles_CreateRegion x)+               putSkip (requiredPadding size__)+ +data CreateRegionFromBitmap = MkCreateRegionFromBitmap{region_CreateRegionFromBitmap+                                                       :: REGION,+                                                       bitmap_CreateRegionFromBitmap :: PIXMAP}+                            deriving (Show, Typeable)+ +instance ExtensionRequest CreateRegionFromBitmap where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__+                     = 4 + size (region_CreateRegionFromBitmap x) ++                         size (bitmap_CreateRegionFromBitmap x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (region_CreateRegionFromBitmap x)+               serialize (bitmap_CreateRegionFromBitmap x)+               putSkip (requiredPadding size__)+ +data CreateRegionFromWindow = MkCreateRegionFromWindow{region_CreateRegionFromWindow+                                                       :: REGION,+                                                       window_CreateRegionFromWindow :: WINDOW,+                                                       kind_CreateRegionFromWindow ::+                                                       Graphics.XHB.Gen.Shape.Types.KIND}+                            deriving (Show, Typeable)+ +instance ExtensionRequest CreateRegionFromWindow where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__+                     = 4 + size (region_CreateRegionFromWindow x) ++                         size (window_CreateRegionFromWindow x)+                         + size (kind_CreateRegionFromWindow x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (region_CreateRegionFromWindow x)+               serialize (window_CreateRegionFromWindow x)+               serialize (kind_CreateRegionFromWindow x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data CreateRegionFromGC = MkCreateRegionFromGC{region_CreateRegionFromGC+                                               :: REGION,+                                               gc_CreateRegionFromGC :: GCONTEXT}+                        deriving (Show, Typeable)+ +instance ExtensionRequest CreateRegionFromGC where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__+                     = 4 + size (region_CreateRegionFromGC x) ++                         size (gc_CreateRegionFromGC x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (region_CreateRegionFromGC x)+               serialize (gc_CreateRegionFromGC x)+               putSkip (requiredPadding size__)+ +data CreateRegionFromPicture = MkCreateRegionFromPicture{region_CreateRegionFromPicture+                                                         :: REGION,+                                                         picture_CreateRegionFromPicture :: PICTURE}+                             deriving (Show, Typeable)+ +instance ExtensionRequest CreateRegionFromPicture where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 9+               let size__+                     = 4 + size (region_CreateRegionFromPicture x) ++                         size (picture_CreateRegionFromPicture x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (region_CreateRegionFromPicture x)+               serialize (picture_CreateRegionFromPicture x)+               putSkip (requiredPadding size__)+ +data DestroyRegion = MkDestroyRegion{region_DestroyRegion ::+                                     REGION}+                   deriving (Show, Typeable)+ +instance ExtensionRequest DestroyRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 10+               let size__ = 4 + size (region_DestroyRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (region_DestroyRegion x)+               putSkip (requiredPadding size__)+ +data SetRegion = MkSetRegion{region_SetRegion :: REGION,+                             rectangles_SetRegion :: [RECTANGLE]}+               deriving (Show, Typeable)+ +instance ExtensionRequest SetRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 11+               let size__+                     = 4 + size (region_SetRegion x) ++                         sum (map size (rectangles_SetRegion x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (region_SetRegion x)+               serializeList (rectangles_SetRegion x)+               putSkip (requiredPadding size__)+ +data CopyRegion = MkCopyRegion{source_CopyRegion :: REGION,+                               destination_CopyRegion :: REGION}+                deriving (Show, Typeable)+ +instance ExtensionRequest CopyRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 12+               let size__+                     = 4 + size (source_CopyRegion x) + size (destination_CopyRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (source_CopyRegion x)+               serialize (destination_CopyRegion x)+               putSkip (requiredPadding size__)+ +data UnionRegion = MkUnionRegion{source1_UnionRegion :: REGION,+                                 source2_UnionRegion :: REGION, destination_UnionRegion :: REGION}+                 deriving (Show, Typeable)+ +instance ExtensionRequest UnionRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 13+               let size__+                     = 4 + size (source1_UnionRegion x) + size (source2_UnionRegion x) ++                         size (destination_UnionRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (source1_UnionRegion x)+               serialize (source2_UnionRegion x)+               serialize (destination_UnionRegion x)+               putSkip (requiredPadding size__)+ +data IntersectRegion = MkIntersectRegion{source1_IntersectRegion ::+                                         REGION,+                                         source2_IntersectRegion :: REGION,+                                         destination_IntersectRegion :: REGION}+                     deriving (Show, Typeable)+ +instance ExtensionRequest IntersectRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 14+               let size__+                     = 4 + size (source1_IntersectRegion x) ++                         size (source2_IntersectRegion x)+                         + size (destination_IntersectRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (source1_IntersectRegion x)+               serialize (source2_IntersectRegion x)+               serialize (destination_IntersectRegion x)+               putSkip (requiredPadding size__)+ +data SubtractRegion = MkSubtractRegion{source1_SubtractRegion ::+                                       REGION,+                                       source2_SubtractRegion :: REGION,+                                       destination_SubtractRegion :: REGION}+                    deriving (Show, Typeable)+ +instance ExtensionRequest SubtractRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 15+               let size__+                     = 4 + size (source1_SubtractRegion x) ++                         size (source2_SubtractRegion x)+                         + size (destination_SubtractRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (source1_SubtractRegion x)+               serialize (source2_SubtractRegion x)+               serialize (destination_SubtractRegion x)+               putSkip (requiredPadding size__)+ +data InvertRegion = MkInvertRegion{source_InvertRegion :: REGION,+                                   bounds_InvertRegion :: RECTANGLE,+                                   destination_InvertRegion :: REGION}+                  deriving (Show, Typeable)+ +instance ExtensionRequest InvertRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 16+               let size__+                     = 4 + size (source_InvertRegion x) + size (bounds_InvertRegion x) ++                         size (destination_InvertRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (source_InvertRegion x)+               serialize (bounds_InvertRegion x)+               serialize (destination_InvertRegion x)+               putSkip (requiredPadding size__)+ +data TranslateRegion = MkTranslateRegion{region_TranslateRegion ::+                                         REGION,+                                         dx_TranslateRegion :: INT16, dy_TranslateRegion :: INT16}+                     deriving (Show, Typeable)+ +instance ExtensionRequest TranslateRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 17+               let size__+                     = 4 + size (region_TranslateRegion x) + size (dx_TranslateRegion x)+                         + size (dy_TranslateRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (region_TranslateRegion x)+               serialize (dx_TranslateRegion x)+               serialize (dy_TranslateRegion x)+               putSkip (requiredPadding size__)+ +data RegionExtents = MkRegionExtents{source_RegionExtents ::+                                     REGION,+                                     destination_RegionExtents :: REGION}+                   deriving (Show, Typeable)+ +instance ExtensionRequest RegionExtents where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 18+               let size__+                     = 4 + size (source_RegionExtents x) ++                         size (destination_RegionExtents x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (source_RegionExtents x)+               serialize (destination_RegionExtents x)+               putSkip (requiredPadding size__)+ +data FetchRegion = MkFetchRegion{region_FetchRegion :: REGION}+                 deriving (Show, Typeable)+ +instance ExtensionRequest FetchRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 19+               let size__ = 4 + size (region_FetchRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (region_FetchRegion x)+               putSkip (requiredPadding size__)+ +data FetchRegionReply = MkFetchRegionReply{extents_FetchRegionReply+                                           :: RECTANGLE,+                                           rectangles_FetchRegionReply :: [RECTANGLE]}+                      deriving (Show, Typeable)+ +instance Deserialize FetchRegionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               extents <- deserialize+               skip 16+               rectangles <- deserializeList (fromIntegral length)+               let _ = isCard32 length+               return (MkFetchRegionReply extents rectangles)+ +data SetGCClipRegion = MkSetGCClipRegion{gc_SetGCClipRegion ::+                                         GCONTEXT,+                                         region_SetGCClipRegion :: REGION,+                                         x_origin_SetGCClipRegion :: INT16,+                                         y_origin_SetGCClipRegion :: INT16}+                     deriving (Show, Typeable)+ +instance ExtensionRequest SetGCClipRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 20+               let size__+                     = 4 + size (gc_SetGCClipRegion x) + size (region_SetGCClipRegion x)+                         + size (x_origin_SetGCClipRegion x)+                         + size (y_origin_SetGCClipRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (gc_SetGCClipRegion x)+               serialize (region_SetGCClipRegion x)+               serialize (x_origin_SetGCClipRegion x)+               serialize (y_origin_SetGCClipRegion x)+               putSkip (requiredPadding size__)+ +data SetWindowShapeRegion = MkSetWindowShapeRegion{dest_SetWindowShapeRegion+                                                   :: WINDOW,+                                                   dest_kind_SetWindowShapeRegion ::+                                                   Graphics.XHB.Gen.Shape.Types.KIND,+                                                   x_offset_SetWindowShapeRegion :: INT16,+                                                   y_offset_SetWindowShapeRegion :: INT16,+                                                   region_SetWindowShapeRegion :: REGION}+                          deriving (Show, Typeable)+ +instance ExtensionRequest SetWindowShapeRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 21+               let size__+                     = 4 + size (dest_SetWindowShapeRegion x) ++                         size (dest_kind_SetWindowShapeRegion x)+                         + 3+                         + size (x_offset_SetWindowShapeRegion x)+                         + size (y_offset_SetWindowShapeRegion x)+                         + size (region_SetWindowShapeRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (dest_SetWindowShapeRegion x)+               serialize (dest_kind_SetWindowShapeRegion x)+               putSkip 3+               serialize (x_offset_SetWindowShapeRegion x)+               serialize (y_offset_SetWindowShapeRegion x)+               serialize (region_SetWindowShapeRegion x)+               putSkip (requiredPadding size__)+ +data SetPictureClipRegion = MkSetPictureClipRegion{picture_SetPictureClipRegion+                                                   :: PICTURE,+                                                   region_SetPictureClipRegion :: REGION,+                                                   x_origin_SetPictureClipRegion :: INT16,+                                                   y_origin_SetPictureClipRegion :: INT16}+                          deriving (Show, Typeable)+ +instance ExtensionRequest SetPictureClipRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 22+               let size__+                     = 4 + size (picture_SetPictureClipRegion x) ++                         size (region_SetPictureClipRegion x)+                         + size (x_origin_SetPictureClipRegion x)+                         + size (y_origin_SetPictureClipRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (picture_SetPictureClipRegion x)+               serialize (region_SetPictureClipRegion x)+               serialize (x_origin_SetPictureClipRegion x)+               serialize (y_origin_SetPictureClipRegion x)+               putSkip (requiredPadding size__)+ +data SetCursorName = MkSetCursorName{cursor_SetCursorName ::+                                     CURSOR,+                                     nbytes_SetCursorName :: CARD16, name_SetCursorName :: [CChar]}+                   deriving (Show, Typeable)+ +instance ExtensionRequest SetCursorName where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 23+               let size__+                     = 4 + size (cursor_SetCursorName x) + size (nbytes_SetCursorName x)+                         + 2+                         + sum (map size (name_SetCursorName x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (cursor_SetCursorName x)+               serialize (nbytes_SetCursorName x)+               putSkip 2+               serializeList (name_SetCursorName x)+               putSkip (requiredPadding size__)+ +data GetCursorName = MkGetCursorName{cursor_GetCursorName ::+                                     CURSOR}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GetCursorName where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 24+               let size__ = 4 + size (cursor_GetCursorName x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (cursor_GetCursorName x)+               putSkip (requiredPadding size__)+ +data GetCursorNameReply = MkGetCursorNameReply{atom_GetCursorNameReply+                                               :: ATOM,+                                               nbytes_GetCursorNameReply :: CARD16,+                                               name_GetCursorNameReply :: [CChar]}+                        deriving (Show, Typeable)+ +instance Deserialize GetCursorNameReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               atom <- deserialize+               nbytes <- deserialize+               skip 18+               name <- deserializeList (fromIntegral nbytes)+               let _ = isCard32 length+               return (MkGetCursorNameReply atom nbytes name)+ +data GetCursorImageAndName = MkGetCursorImageAndName{}+                           deriving (Show, Typeable)+ +instance ExtensionRequest GetCursorImageAndName where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 25+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data GetCursorImageAndNameReply = MkGetCursorImageAndNameReply{x_GetCursorImageAndNameReply+                                                               :: INT16,+                                                               y_GetCursorImageAndNameReply ::+                                                               INT16,+                                                               width_GetCursorImageAndNameReply ::+                                                               CARD16,+                                                               height_GetCursorImageAndNameReply ::+                                                               CARD16,+                                                               xhot_GetCursorImageAndNameReply ::+                                                               CARD16,+                                                               yhot_GetCursorImageAndNameReply ::+                                                               CARD16,+                                                               cursor_serial_GetCursorImageAndNameReply+                                                               :: CARD32,+                                                               cursor_atom_GetCursorImageAndNameReply+                                                               :: ATOM,+                                                               nbytes_GetCursorImageAndNameReply ::+                                                               CARD16,+                                                               name_GetCursorImageAndNameReply ::+                                                               [CChar],+                                                               cursor_image_GetCursorImageAndNameReply+                                                               :: [CARD32]}+                                deriving (Show, Typeable)+ +instance Deserialize GetCursorImageAndNameReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               x <- deserialize+               y <- deserialize+               width <- deserialize+               height <- deserialize+               xhot <- deserialize+               yhot <- deserialize+               cursor_serial <- deserialize+               cursor_atom <- deserialize+               nbytes <- deserialize+               skip 2+               name <- deserializeList (fromIntegral nbytes)+               cursor_image <- deserializeList+                                 (fromIntegral (fromIntegral (width * height)))+               let _ = isCard32 length+               return+                 (MkGetCursorImageAndNameReply x y width height xhot yhot+                    cursor_serial+                    cursor_atom+                    nbytes+                    name+                    cursor_image)+ +data ChangeCursor = MkChangeCursor{source_ChangeCursor :: CURSOR,+                                   destination_ChangeCursor :: CURSOR}+                  deriving (Show, Typeable)+ +instance ExtensionRequest ChangeCursor where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 26+               let size__+                     = 4 + size (source_ChangeCursor x) ++                         size (destination_ChangeCursor x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (source_ChangeCursor x)+               serialize (destination_ChangeCursor x)+               putSkip (requiredPadding size__)+ +data ChangeCursorByName = MkChangeCursorByName{src_ChangeCursorByName+                                               :: CURSOR,+                                               nbytes_ChangeCursorByName :: CARD16,+                                               name_ChangeCursorByName :: [CChar]}+                        deriving (Show, Typeable)+ +instance ExtensionRequest ChangeCursorByName where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 27+               let size__+                     = 4 + size (src_ChangeCursorByName x) ++                         size (nbytes_ChangeCursorByName x)+                         + 2+                         + sum (map size (name_ChangeCursorByName x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (src_ChangeCursorByName x)+               serialize (nbytes_ChangeCursorByName x)+               putSkip 2+               serializeList (name_ChangeCursorByName x)+               putSkip (requiredPadding size__)+ +data ExpandRegion = MkExpandRegion{source_ExpandRegion :: REGION,+                                   destination_ExpandRegion :: REGION, left_ExpandRegion :: CARD16,+                                   right_ExpandRegion :: CARD16, top_ExpandRegion :: CARD16,+                                   bottom_ExpandRegion :: CARD16}+                  deriving (Show, Typeable)+ +instance ExtensionRequest ExpandRegion where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 28+               let size__+                     = 4 + size (source_ExpandRegion x) ++                         size (destination_ExpandRegion x)+                         + size (left_ExpandRegion x)+                         + size (right_ExpandRegion x)+                         + size (top_ExpandRegion x)+                         + size (bottom_ExpandRegion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (source_ExpandRegion x)+               serialize (destination_ExpandRegion x)+               serialize (left_ExpandRegion x)+               serialize (right_ExpandRegion x)+               serialize (top_ExpandRegion x)+               serialize (bottom_ExpandRegion x)+               putSkip (requiredPadding size__)+ +data HideCursor = MkHideCursor{window_HideCursor :: WINDOW}+                deriving (Show, Typeable)+ +instance ExtensionRequest HideCursor where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 29+               let size__ = 4 + size (window_HideCursor x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_HideCursor x)+               putSkip (requiredPadding size__)+ +data ShowCursor = MkShowCursor{window_ShowCursor :: WINDOW}+                deriving (Show, Typeable)+ +instance ExtensionRequest ShowCursor where+        extensionId _ = "XFIXES"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 30+               let size__ = 4 + size (window_ShowCursor x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_ShowCursor x)+               putSkip (requiredPadding size__)
+ patched/Graphics/XHB/Gen/XPrint.hs view
@@ -0,0 +1,250 @@+module Graphics.XHB.Gen.XPrint+       (extension, printQueryVersion, printGetPrinterList, createContext,+        printSetContext, printGetContext, printDestroyContext,+        printGetScreenOfContext, printStartJob, printEndJob, printStartDoc,+        printEndDoc, printPutDocumentData, printGetDocumentData,+        printStartPage, printEndPage, printSelectInput, printInputSelected,+        printGetAttributes, printGetOneAttributes, printSetAttributes,+        printGetPageDimensions, printQueryScreens, printSetImageResolution,+        printGetImageResolution, module Graphics.XHB.Gen.XPrint.Types)+       where+import Graphics.XHB.Gen.XPrint.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "XpExtension"+ +printQueryVersion ::+                    Graphics.XHB.Connection.Types.Connection ->+                      IO (Receipt PrintQueryVersionReply)+printQueryVersion c+  = do receipt <- newEmptyReceiptIO+       let req = MkPrintQueryVersion+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +printGetPrinterList ::+                      Graphics.XHB.Connection.Types.Connection ->+                        PrintGetPrinterList -> IO (Receipt PrintGetPrinterListReply)+printGetPrinterList c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +createContext ::+                Graphics.XHB.Connection.Types.Connection -> CreateContext -> IO ()+createContext c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printSetContext ::+                  Graphics.XHB.Connection.Types.Connection -> CARD32 -> IO ()+printSetContext c context+  = do let req = MkPrintSetContext context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printGetContext ::+                  Graphics.XHB.Connection.Types.Connection ->+                    IO (Receipt PrintGetContextReply)+printGetContext c+  = do receipt <- newEmptyReceiptIO+       let req = MkPrintGetContext+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +printDestroyContext ::+                      Graphics.XHB.Connection.Types.Connection -> CARD32 -> IO ()+printDestroyContext c context+  = do let req = MkPrintDestroyContext context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printGetScreenOfContext ::+                          Graphics.XHB.Connection.Types.Connection ->+                            IO (Receipt PrintGetScreenOfContextReply)+printGetScreenOfContext c+  = do receipt <- newEmptyReceiptIO+       let req = MkPrintGetScreenOfContext+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +printStartJob ::+                Graphics.XHB.Connection.Types.Connection -> CARD8 -> IO ()+printStartJob c output_mode+  = do let req = MkPrintStartJob output_mode+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printEndJob ::+              Graphics.XHB.Connection.Types.Connection -> BOOL -> IO ()+printEndJob c cancel+  = do let req = MkPrintEndJob cancel+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printStartDoc ::+                Graphics.XHB.Connection.Types.Connection -> CARD8 -> IO ()+printStartDoc c driver_mode+  = do let req = MkPrintStartDoc driver_mode+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printEndDoc ::+              Graphics.XHB.Connection.Types.Connection -> BOOL -> IO ()+printEndDoc c cancel+  = do let req = MkPrintEndDoc cancel+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printPutDocumentData ::+                       Graphics.XHB.Connection.Types.Connection ->+                         PrintPutDocumentData -> IO ()+printPutDocumentData c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printGetDocumentData ::+                       Graphics.XHB.Connection.Types.Connection ->+                         PCONTEXT -> CARD32 -> IO (Receipt PrintGetDocumentDataReply)+printGetDocumentData c context max_bytes+  = do receipt <- newEmptyReceiptIO+       let req = MkPrintGetDocumentData context max_bytes+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +printStartPage ::+                 Graphics.XHB.Connection.Types.Connection -> WINDOW -> IO ()+printStartPage c window+  = do let req = MkPrintStartPage window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printEndPage ::+               Graphics.XHB.Connection.Types.Connection -> BOOL -> IO ()+printEndPage c cancel+  = do let req = MkPrintEndPage cancel+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printSelectInput ::+                   Graphics.XHB.Connection.Types.Connection ->+                     PCONTEXT -> ValueParam CARD32 -> IO ()+printSelectInput c context event+  = do let req = MkPrintSelectInput context event+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printInputSelected ::+                     Graphics.XHB.Connection.Types.Connection ->+                       PCONTEXT -> IO (Receipt PrintInputSelectedReply)+printInputSelected c context+  = do receipt <- newEmptyReceiptIO+       let req = MkPrintInputSelected context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +printGetAttributes ::+                     Graphics.XHB.Connection.Types.Connection ->+                       PCONTEXT -> CARD8 -> IO (Receipt PrintGetAttributesReply)+printGetAttributes c context pool+  = do receipt <- newEmptyReceiptIO+       let req = MkPrintGetAttributes context pool+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +printGetOneAttributes ::+                        Graphics.XHB.Connection.Types.Connection ->+                          PrintGetOneAttributes -> IO (Receipt PrintGetOneAttributesReply)+printGetOneAttributes c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +printSetAttributes ::+                     Graphics.XHB.Connection.Types.Connection ->+                       PrintSetAttributes -> IO ()+printSetAttributes c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +printGetPageDimensions ::+                         Graphics.XHB.Connection.Types.Connection ->+                           PCONTEXT -> IO (Receipt PrintGetPageDimensionsReply)+printGetPageDimensions c context+  = do receipt <- newEmptyReceiptIO+       let req = MkPrintGetPageDimensions context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +printQueryScreens ::+                    Graphics.XHB.Connection.Types.Connection ->+                      IO (Receipt PrintQueryScreensReply)+printQueryScreens c+  = do receipt <- newEmptyReceiptIO+       let req = MkPrintQueryScreens+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +printSetImageResolution ::+                          Graphics.XHB.Connection.Types.Connection ->+                            PCONTEXT -> CARD16 -> IO (Receipt PrintSetImageResolutionReply)+printSetImageResolution c context image_resolution+  = do receipt <- newEmptyReceiptIO+       let req = MkPrintSetImageResolution context image_resolution+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +printGetImageResolution ::+                          Graphics.XHB.Connection.Types.Connection ->+                            PCONTEXT -> IO (Receipt PrintGetImageResolutionReply)+printGetImageResolution c context+  = do receipt <- newEmptyReceiptIO+       let req = MkPrintGetImageResolution context+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/XPrint/Types.hs view
@@ -0,0 +1,802 @@+module Graphics.XHB.Gen.XPrint.Types+       (deserializeError, deserializeEvent, STRING8, PRINTER(..),+        PCONTEXT, GetDoc(..), EvMask(..), Detail(..), Attr(..),+        PrintQueryVersion(..), PrintQueryVersionReply(..),+        PrintGetPrinterList(..), PrintGetPrinterListReply(..),+        CreateContext(..), PrintSetContext(..), PrintGetContext(..),+        PrintGetContextReply(..), PrintDestroyContext(..),+        PrintGetScreenOfContext(..), PrintGetScreenOfContextReply(..),+        PrintStartJob(..), PrintEndJob(..), PrintStartDoc(..),+        PrintEndDoc(..), PrintPutDocumentData(..),+        PrintGetDocumentData(..), PrintGetDocumentDataReply(..),+        PrintStartPage(..), PrintEndPage(..), PrintSelectInput(..),+        PrintInputSelected(..), PrintInputSelectedReply(..),+        PrintGetAttributes(..), PrintGetAttributesReply(..),+        PrintGetOneAttributes(..), PrintGetOneAttributesReply(..),+        PrintSetAttributes(..), PrintGetPageDimensions(..),+        PrintGetPageDimensionsReply(..), PrintQueryScreens(..),+        PrintQueryScreensReply(..), PrintSetImageResolution(..),+        PrintSetImageResolutionReply(..), PrintGetImageResolution(..),+        PrintGetImageResolutionReply(..), Notify(..), AttributNotify(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent 0+  = return (liftM toEvent (deserialize :: Get Notify))+deserializeEvent 1+  = return (liftM toEvent (deserialize :: Get AttributNotify))+deserializeEvent _ = Nothing+ +type STRING8 = CChar+ +data PRINTER = MkPRINTER{nameLen_PRINTER :: CARD32,+                         name_PRINTER :: [STRING8], descLen_PRINTER :: CARD32,+                         description_PRINTER :: [STRING8]}+             deriving (Show, Typeable)+ +instance Serialize PRINTER where+        serialize x+          = do serialize (nameLen_PRINTER x)+               serializeList (name_PRINTER x)+               serialize (descLen_PRINTER x)+               serializeList (description_PRINTER x)+        size x+          = size (nameLen_PRINTER x) + sum (map size (name_PRINTER x)) ++              size (descLen_PRINTER x)+              + sum (map size (description_PRINTER x))+ +instance Deserialize PRINTER where+        deserialize+          = do nameLen <- deserialize+               name <- deserializeList (fromIntegral nameLen)+               descLen <- deserialize+               description <- deserializeList (fromIntegral descLen)+               return (MkPRINTER nameLen name descLen description)+ +newtype PCONTEXT = MkPCONTEXT Xid+                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +data GetDoc = GetDocFinished+            | GetDocSecondConsumer+ +instance SimpleEnum GetDoc where+        toValue GetDocFinished{} = 0+        toValue GetDocSecondConsumer{} = 1+        fromValue 0 = GetDocFinished+        fromValue 1 = GetDocSecondConsumer+ +data EvMask = EvMaskPrintMask+            | EvMaskAttributeMask+ +instance BitEnum EvMask where+        toBit EvMaskPrintMask{} = 0+        toBit EvMaskAttributeMask{} = 1+        fromBit 0 = EvMaskPrintMask+        fromBit 1 = EvMaskAttributeMask+ +data Detail = DetailStartJobNotify+            | DetailEndJobNotify+            | DetailStartDocNotify+            | DetailEndDocNotify+            | DetailStartPageNotify+            | DetailEndPageNotify+ +instance SimpleEnum Detail where+        toValue DetailStartJobNotify{} = 1+        toValue DetailEndJobNotify{} = 2+        toValue DetailStartDocNotify{} = 3+        toValue DetailEndDocNotify{} = 4+        toValue DetailStartPageNotify{} = 5+        toValue DetailEndPageNotify{} = 6+        fromValue 1 = DetailStartJobNotify+        fromValue 2 = DetailEndJobNotify+        fromValue 3 = DetailStartDocNotify+        fromValue 4 = DetailEndDocNotify+        fromValue 5 = DetailStartPageNotify+        fromValue 6 = DetailEndPageNotify+ +data Attr = AttrJobAttr+          | AttrDocAttr+          | AttrPageAttr+          | AttrPrinterAttr+          | AttrServerAttr+          | AttrMediumAttr+          | AttrSpoolerAttr+ +instance SimpleEnum Attr where+        toValue AttrJobAttr{} = 1+        toValue AttrDocAttr{} = 2+        toValue AttrPageAttr{} = 3+        toValue AttrPrinterAttr{} = 4+        toValue AttrServerAttr{} = 5+        toValue AttrMediumAttr{} = 6+        toValue AttrSpoolerAttr{} = 7+        fromValue 1 = AttrJobAttr+        fromValue 2 = AttrDocAttr+        fromValue 3 = AttrPageAttr+        fromValue 4 = AttrPrinterAttr+        fromValue 5 = AttrServerAttr+        fromValue 6 = AttrMediumAttr+        fromValue 7 = AttrSpoolerAttr+ +data PrintQueryVersion = MkPrintQueryVersion{}+                       deriving (Show, Typeable)+ +instance ExtensionRequest PrintQueryVersion where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data PrintQueryVersionReply = MkPrintQueryVersionReply{major_version_PrintQueryVersionReply+                                                       :: CARD16,+                                                       minor_version_PrintQueryVersionReply ::+                                                       CARD16}+                            deriving (Show, Typeable)+ +instance Deserialize PrintQueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major_version <- deserialize+               minor_version <- deserialize+               let _ = isCard32 length+               return (MkPrintQueryVersionReply major_version minor_version)+ +data PrintGetPrinterList = MkPrintGetPrinterList{printerNameLen_PrintGetPrinterList+                                                 :: CARD32,+                                                 localeLen_PrintGetPrinterList :: CARD32,+                                                 printer_name_PrintGetPrinterList :: [STRING8],+                                                 locale_PrintGetPrinterList :: [STRING8]}+                         deriving (Show, Typeable)+ +instance ExtensionRequest PrintGetPrinterList where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__+                     = 4 + size (printerNameLen_PrintGetPrinterList x) ++                         size (localeLen_PrintGetPrinterList x)+                         + sum (map size (printer_name_PrintGetPrinterList x))+                         + sum (map size (locale_PrintGetPrinterList x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (printerNameLen_PrintGetPrinterList x)+               serialize (localeLen_PrintGetPrinterList x)+               serializeList (printer_name_PrintGetPrinterList x)+               serializeList (locale_PrintGetPrinterList x)+               putSkip (requiredPadding size__)+ +data PrintGetPrinterListReply = MkPrintGetPrinterListReply{listCount_PrintGetPrinterListReply+                                                           :: CARD32,+                                                           printers_PrintGetPrinterListReply ::+                                                           [PRINTER]}+                              deriving (Show, Typeable)+ +instance Deserialize PrintGetPrinterListReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               listCount <- deserialize+               skip 20+               printers <- deserializeList (fromIntegral listCount)+               let _ = isCard32 length+               return (MkPrintGetPrinterListReply listCount printers)+ +data CreateContext = MkCreateContext{context_id_CreateContext ::+                                     CARD32,+                                     printerNameLen_CreateContext :: CARD32,+                                     localeLen_CreateContext :: CARD32,+                                     printerName_CreateContext :: [STRING8],+                                     locale_CreateContext :: [STRING8]}+                   deriving (Show, Typeable)+ +instance ExtensionRequest CreateContext where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__+                     = 4 + size (context_id_CreateContext x) ++                         size (printerNameLen_CreateContext x)+                         + size (localeLen_CreateContext x)+                         + sum (map size (printerName_CreateContext x))+                         + sum (map size (locale_CreateContext x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_id_CreateContext x)+               serialize (printerNameLen_CreateContext x)+               serialize (localeLen_CreateContext x)+               serializeList (printerName_CreateContext x)+               serializeList (locale_CreateContext x)+               putSkip (requiredPadding size__)+ +data PrintSetContext = MkPrintSetContext{context_PrintSetContext ::+                                         CARD32}+                     deriving (Show, Typeable)+ +instance ExtensionRequest PrintSetContext where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__ = 4 + size (context_PrintSetContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_PrintSetContext x)+               putSkip (requiredPadding size__)+ +data PrintGetContext = MkPrintGetContext{}+                     deriving (Show, Typeable)+ +instance ExtensionRequest PrintGetContext where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data PrintGetContextReply = MkPrintGetContextReply{context_PrintGetContextReply+                                                   :: CARD32}+                          deriving (Show, Typeable)+ +instance Deserialize PrintGetContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               context <- deserialize+               let _ = isCard32 length+               return (MkPrintGetContextReply context)+ +data PrintDestroyContext = MkPrintDestroyContext{context_PrintDestroyContext+                                                 :: CARD32}+                         deriving (Show, Typeable)+ +instance ExtensionRequest PrintDestroyContext where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__ = 4 + size (context_PrintDestroyContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_PrintDestroyContext x)+               putSkip (requiredPadding size__)+ +data PrintGetScreenOfContext = MkPrintGetScreenOfContext{}+                             deriving (Show, Typeable)+ +instance ExtensionRequest PrintGetScreenOfContext where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data PrintGetScreenOfContextReply = MkPrintGetScreenOfContextReply{root_PrintGetScreenOfContextReply+                                                                   :: WINDOW}+                                  deriving (Show, Typeable)+ +instance Deserialize PrintGetScreenOfContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               root <- deserialize+               let _ = isCard32 length+               return (MkPrintGetScreenOfContextReply root)+ +data PrintStartJob = MkPrintStartJob{output_mode_PrintStartJob ::+                                     CARD8}+                   deriving (Show, Typeable)+ +instance ExtensionRequest PrintStartJob where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__ = 4 + size (output_mode_PrintStartJob x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (output_mode_PrintStartJob x)+               putSkip (requiredPadding size__)+ +data PrintEndJob = MkPrintEndJob{cancel_PrintEndJob :: BOOL}+                 deriving (Show, Typeable)+ +instance ExtensionRequest PrintEndJob where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__ = 4 + size (cancel_PrintEndJob x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (cancel_PrintEndJob x)+               putSkip (requiredPadding size__)+ +data PrintStartDoc = MkPrintStartDoc{driver_mode_PrintStartDoc ::+                                     CARD8}+                   deriving (Show, Typeable)+ +instance ExtensionRequest PrintStartDoc where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 9+               let size__ = 4 + size (driver_mode_PrintStartDoc x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (driver_mode_PrintStartDoc x)+               putSkip (requiredPadding size__)+ +data PrintEndDoc = MkPrintEndDoc{cancel_PrintEndDoc :: BOOL}+                 deriving (Show, Typeable)+ +instance ExtensionRequest PrintEndDoc where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 10+               let size__ = 4 + size (cancel_PrintEndDoc x)+               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],+                                                   doc_format_PrintPutDocumentData :: [STRING8],+                                                   options_PrintPutDocumentData :: [STRING8]}+                          deriving (Show, Typeable)+ +instance ExtensionRequest PrintPutDocumentData where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 11+               let size__+                     = 4 + size (drawable_PrintPutDocumentData x) ++                         size (len_data_PrintPutDocumentData x)+                         + size (len_fmt_PrintPutDocumentData x)+                         + size (len_options_PrintPutDocumentData x)+                         + sum (map size (data_PrintPutDocumentData x))+                         + sum (map size (doc_format_PrintPutDocumentData x))+                         + sum (map size (options_PrintPutDocumentData x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (drawable_PrintPutDocumentData x)+               serialize (len_data_PrintPutDocumentData x)+               serialize (len_fmt_PrintPutDocumentData x)+               serialize (len_options_PrintPutDocumentData x)+               serializeList (data_PrintPutDocumentData x)+               serializeList (doc_format_PrintPutDocumentData x)+               serializeList (options_PrintPutDocumentData x)+               putSkip (requiredPadding size__)+ +data PrintGetDocumentData = MkPrintGetDocumentData{context_PrintGetDocumentData+                                                   :: PCONTEXT,+                                                   max_bytes_PrintGetDocumentData :: CARD32}+                          deriving (Show, Typeable)+ +instance ExtensionRequest PrintGetDocumentData where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 12+               let size__+                     = 4 + size (context_PrintGetDocumentData x) ++                         size (max_bytes_PrintGetDocumentData x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_PrintGetDocumentData x)+               serialize (max_bytes_PrintGetDocumentData x)+               putSkip (requiredPadding size__)+ +data PrintGetDocumentDataReply = MkPrintGetDocumentDataReply{status_code_PrintGetDocumentDataReply+                                                             :: CARD32,+                                                             finished_flag_PrintGetDocumentDataReply+                                                             :: CARD32,+                                                             dataLen_PrintGetDocumentDataReply ::+                                                             CARD32,+                                                             data_PrintGetDocumentDataReply ::+                                                             [BYTE]}+                               deriving (Show, Typeable)+ +instance Deserialize PrintGetDocumentDataReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               status_code <- deserialize+               finished_flag <- deserialize+               dataLen <- deserialize+               skip 12+               data_ <- deserializeList (fromIntegral dataLen)+               let _ = isCard32 length+               return+                 (MkPrintGetDocumentDataReply status_code finished_flag dataLen+                    data_)+ +data PrintStartPage = MkPrintStartPage{window_PrintStartPage ::+                                       WINDOW}+                    deriving (Show, Typeable)+ +instance ExtensionRequest PrintStartPage where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 13+               let size__ = 4 + size (window_PrintStartPage x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_PrintStartPage x)+               putSkip (requiredPadding size__)+ +data PrintEndPage = MkPrintEndPage{cancel_PrintEndPage :: BOOL}+                  deriving (Show, Typeable)+ +instance ExtensionRequest PrintEndPage where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 14+               let size__ = 4 + size (cancel_PrintEndPage x) + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (cancel_PrintEndPage x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data PrintSelectInput = MkPrintSelectInput{context_PrintSelectInput+                                           :: PCONTEXT,+                                           event_PrintSelectInput :: ValueParam CARD32}+                      deriving (Show, Typeable)+ +instance ExtensionRequest PrintSelectInput where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 15+               let size__+                     = 4 + size (context_PrintSelectInput x) ++                         size (event_PrintSelectInput x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_PrintSelectInput x)+               serialize (event_PrintSelectInput x)+               putSkip (requiredPadding size__)+ +data PrintInputSelected = MkPrintInputSelected{context_PrintInputSelected+                                               :: PCONTEXT}+                        deriving (Show, Typeable)+ +instance ExtensionRequest PrintInputSelected where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 16+               let size__ = 4 + size (context_PrintInputSelected x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_PrintInputSelected x)+               putSkip (requiredPadding size__)+ +data PrintInputSelectedReply = MkPrintInputSelectedReply{event_PrintInputSelectedReply+                                                         :: ValueParam CARD32,+                                                         all_events_PrintInputSelectedReply ::+                                                         ValueParam CARD32}+                             deriving (Show, Typeable)+ +instance Deserialize PrintInputSelectedReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               event <- deserialize+               all_events <- deserialize+               let _ = isCard32 length+               return (MkPrintInputSelectedReply event all_events)+ +data PrintGetAttributes = MkPrintGetAttributes{context_PrintGetAttributes+                                               :: PCONTEXT,+                                               pool_PrintGetAttributes :: CARD8}+                        deriving (Show, Typeable)+ +instance ExtensionRequest PrintGetAttributes where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 17+               let size__+                     = 4 + size (context_PrintGetAttributes x) ++                         size (pool_PrintGetAttributes x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_PrintGetAttributes x)+               serialize (pool_PrintGetAttributes x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data PrintGetAttributesReply = MkPrintGetAttributesReply{stringLen_PrintGetAttributesReply+                                                         :: CARD32,+                                                         attributes_PrintGetAttributesReply ::+                                                         STRING8}+                             deriving (Show, Typeable)+ +instance Deserialize PrintGetAttributesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               stringLen <- deserialize+               skip 20+               attributes <- deserialize+               let _ = isCard32 length+               return (MkPrintGetAttributesReply stringLen attributes)+ +data PrintGetOneAttributes = MkPrintGetOneAttributes{context_PrintGetOneAttributes+                                                     :: PCONTEXT,+                                                     nameLen_PrintGetOneAttributes :: CARD32,+                                                     pool_PrintGetOneAttributes :: CARD8,+                                                     name_PrintGetOneAttributes :: [STRING8]}+                           deriving (Show, Typeable)+ +instance ExtensionRequest PrintGetOneAttributes where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 19+               let size__+                     = 4 + size (context_PrintGetOneAttributes x) ++                         size (nameLen_PrintGetOneAttributes x)+                         + size (pool_PrintGetOneAttributes x)+                         + 3+                         + sum (map size (name_PrintGetOneAttributes x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_PrintGetOneAttributes x)+               serialize (nameLen_PrintGetOneAttributes x)+               serialize (pool_PrintGetOneAttributes x)+               putSkip 3+               serializeList (name_PrintGetOneAttributes x)+               putSkip (requiredPadding size__)+ +data PrintGetOneAttributesReply = MkPrintGetOneAttributesReply{valueLen_PrintGetOneAttributesReply+                                                               :: CARD32,+                                                               value_PrintGetOneAttributesReply ::+                                                               [STRING8]}+                                deriving (Show, Typeable)+ +instance Deserialize PrintGetOneAttributesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               valueLen <- deserialize+               skip 20+               value <- deserializeList (fromIntegral valueLen)+               let _ = isCard32 length+               return (MkPrintGetOneAttributesReply valueLen value)+ +data PrintSetAttributes = MkPrintSetAttributes{context_PrintSetAttributes+                                               :: PCONTEXT,+                                               stringLen_PrintSetAttributes :: CARD32,+                                               pool_PrintSetAttributes :: CARD8,+                                               rule_PrintSetAttributes :: CARD8,+                                               attributes_PrintSetAttributes :: [STRING8]}+                        deriving (Show, Typeable)+ +instance ExtensionRequest PrintSetAttributes where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 18+               let size__+                     = 4 + size (context_PrintSetAttributes x) ++                         size (stringLen_PrintSetAttributes x)+                         + size (pool_PrintSetAttributes x)+                         + size (rule_PrintSetAttributes x)+                         + 2+                         + sum (map size (attributes_PrintSetAttributes x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_PrintSetAttributes x)+               serialize (stringLen_PrintSetAttributes x)+               serialize (pool_PrintSetAttributes x)+               serialize (rule_PrintSetAttributes x)+               putSkip 2+               serializeList (attributes_PrintSetAttributes x)+               putSkip (requiredPadding size__)+ +data PrintGetPageDimensions = MkPrintGetPageDimensions{context_PrintGetPageDimensions+                                                       :: PCONTEXT}+                            deriving (Show, Typeable)+ +instance ExtensionRequest PrintGetPageDimensions where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 21+               let size__ = 4 + size (context_PrintGetPageDimensions x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_PrintGetPageDimensions x)+               putSkip (requiredPadding size__)+ +data PrintGetPageDimensionsReply = MkPrintGetPageDimensionsReply{width_PrintGetPageDimensionsReply+                                                                 :: CARD16,+                                                                 height_PrintGetPageDimensionsReply+                                                                 :: CARD16,+                                                                 offset_x_PrintGetPageDimensionsReply+                                                                 :: CARD16,+                                                                 offset_y_PrintGetPageDimensionsReply+                                                                 :: CARD16,+                                                                 reproducible_width_PrintGetPageDimensionsReply+                                                                 :: CARD16,+                                                                 reproducible_height_PrintGetPageDimensionsReply+                                                                 :: CARD16}+                                 deriving (Show, Typeable)+ +instance Deserialize PrintGetPageDimensionsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               width <- deserialize+               height <- deserialize+               offset_x <- deserialize+               offset_y <- deserialize+               reproducible_width <- deserialize+               reproducible_height <- deserialize+               let _ = isCard32 length+               return+                 (MkPrintGetPageDimensionsReply width height offset_x offset_y+                    reproducible_width+                    reproducible_height)+ +data PrintQueryScreens = MkPrintQueryScreens{}+                       deriving (Show, Typeable)+ +instance ExtensionRequest PrintQueryScreens where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 22+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data PrintQueryScreensReply = MkPrintQueryScreensReply{listCount_PrintQueryScreensReply+                                                       :: CARD32,+                                                       roots_PrintQueryScreensReply :: [WINDOW]}+                            deriving (Show, Typeable)+ +instance Deserialize PrintQueryScreensReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               listCount <- deserialize+               skip 20+               roots <- deserializeList (fromIntegral listCount)+               let _ = isCard32 length+               return (MkPrintQueryScreensReply listCount roots)+ +data PrintSetImageResolution = MkPrintSetImageResolution{context_PrintSetImageResolution+                                                         :: PCONTEXT,+                                                         image_resolution_PrintSetImageResolution ::+                                                         CARD16}+                             deriving (Show, Typeable)+ +instance ExtensionRequest PrintSetImageResolution where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 23+               let size__+                     = 4 + size (context_PrintSetImageResolution x) ++                         size (image_resolution_PrintSetImageResolution x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_PrintSetImageResolution x)+               serialize (image_resolution_PrintSetImageResolution x)+               putSkip (requiredPadding size__)+ +data PrintSetImageResolutionReply = MkPrintSetImageResolutionReply{status_PrintSetImageResolutionReply+                                                                   :: BOOL,+                                                                   previous_resolutions_PrintSetImageResolutionReply+                                                                   :: CARD16}+                                  deriving (Show, Typeable)+ +instance Deserialize PrintSetImageResolutionReply where+        deserialize+          = do skip 1+               status <- deserialize+               skip 2+               length <- deserialize+               previous_resolutions <- deserialize+               let _ = isCard32 length+               return (MkPrintSetImageResolutionReply status previous_resolutions)+ +data PrintGetImageResolution = MkPrintGetImageResolution{context_PrintGetImageResolution+                                                         :: PCONTEXT}+                             deriving (Show, Typeable)+ +instance ExtensionRequest PrintGetImageResolution where+        extensionId _ = "XpExtension"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 24+               let size__ = 4 + size (context_PrintGetImageResolution x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_PrintGetImageResolution x)+               putSkip (requiredPadding size__)+ +data PrintGetImageResolutionReply = MkPrintGetImageResolutionReply{image_resolution_PrintGetImageResolutionReply+                                                                   :: CARD16}+                                  deriving (Show, Typeable)+ +instance Deserialize PrintGetImageResolutionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               image_resolution <- deserialize+               let _ = isCard32 length+               return (MkPrintGetImageResolutionReply image_resolution)+ +data Notify = MkNotify{detail_Notify :: CARD8,+                       context_Notify :: PCONTEXT, cancel_Notify :: BOOL}+            deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event Notify+ +instance Deserialize Notify where+        deserialize+          = do skip 1+               detail <- deserialize+               skip 2+               context <- deserialize+               cancel <- deserialize+               return (MkNotify detail context cancel)+ +data AttributNotify = MkAttributNotify{detail_AttributNotify ::+                                       CARD8,+                                       context_AttributNotify :: PCONTEXT}+                    deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event AttributNotify+ +instance Deserialize AttributNotify where+        deserialize+          = do skip 1+               detail <- deserialize+               skip 2+               context <- deserialize+               return (MkAttributNotify detail context)
+ patched/Graphics/XHB/Gen/Xevie.hs view
@@ -0,0 +1,70 @@+module Graphics.XHB.Gen.Xevie+       (extension, queryVersion, start, end, send, selectInput,+        module Graphics.XHB.Gen.Xevie.Types)+       where+import Graphics.XHB.Gen.Xevie.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+ +extension :: ExtensionId+extension = "XEVIE"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD16 -> CARD16 -> IO (Receipt QueryVersionReply)+queryVersion c client_major_version client_minor_version+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion client_major_version client_minor_version+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +start ::+        Graphics.XHB.Connection.Types.Connection ->+          CARD32 -> IO (Receipt StartReply)+start c screen+  = do receipt <- newEmptyReceiptIO+       let req = MkStart screen+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +end ::+      Graphics.XHB.Connection.Types.Connection ->+        CARD32 -> IO (Receipt EndReply)+end c cmap+  = do receipt <- newEmptyReceiptIO+       let req = MkEnd cmap+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +send ::+       Graphics.XHB.Connection.Types.Connection ->+         Event -> CARD32 -> IO (Receipt SendReply)+send c event data_type+  = do receipt <- newEmptyReceiptIO+       let req = MkSend event data_type+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +selectInput ::+              Graphics.XHB.Connection.Types.Connection ->+                CARD32 -> IO (Receipt SelectInputReply)+selectInput c event_mask+  = do receipt <- newEmptyReceiptIO+       let req = MkSelectInput event_mask+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/Xevie/Types.hs view
@@ -0,0 +1,186 @@+module Graphics.XHB.Gen.Xevie.Types+       (deserializeError, deserializeEvent, QueryVersion(..),+        QueryVersionReply(..), Start(..), StartReply(..), End(..),+        EndReply(..), Datatype(..), Event(..), Send(..), SendReply(..),+        SelectInput(..), SelectInputReply(..))+       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 _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +data QueryVersion = MkQueryVersion{client_major_version_QueryVersion+                                   :: CARD16,+                                   client_minor_version_QueryVersion :: CARD16}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "XEVIE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (client_major_version_QueryVersion x) ++                         size (client_minor_version_QueryVersion x)+               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}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               server_major_version <- deserialize+               server_minor_version <- deserialize+               skip 20+               let _ = isCard32 length+               return+                 (MkQueryVersionReply server_major_version server_minor_version)+ +data Start = MkStart{screen_Start :: CARD32}+           deriving (Show, Typeable)+ +instance ExtensionRequest Start where+        extensionId _ = "XEVIE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__ = 4 + size (screen_Start x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (screen_Start x)+               putSkip (requiredPadding size__)+ +data StartReply = MkStartReply{}+                deriving (Show, Typeable)+ +instance Deserialize StartReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 24+               let _ = isCard32 length+               return (MkStartReply)+ +data End = MkEnd{cmap_End :: CARD32}+         deriving (Show, Typeable)+ +instance ExtensionRequest End where+        extensionId _ = "XEVIE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4 + size (cmap_End x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (cmap_End x)+               putSkip (requiredPadding size__)+ +data EndReply = MkEndReply{}+              deriving (Show, Typeable)+ +instance Deserialize EndReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 24+               let _ = isCard32 length+               return (MkEndReply)+ +data Datatype = DatatypeUnmodified+              | DatatypeModified+ +instance SimpleEnum Datatype where+        toValue DatatypeUnmodified{} = 0+        toValue DatatypeModified{} = 1+        fromValue 0 = DatatypeUnmodified+        fromValue 1 = DatatypeModified+ +data Event = MkEvent{}+           deriving (Show, Typeable)+ +instance Serialize Event where+        serialize x = do putSkip 32+        size x = 32+ +instance Deserialize Event where+        deserialize+          = do skip 32+               return (MkEvent)+ +data Send = MkSend{event_Send :: Event, data_type_Send :: CARD32}+          deriving (Show, Typeable)+ +instance ExtensionRequest Send where+        extensionId _ = "XEVIE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__ = 4 + size (event_Send x) + size (data_type_Send x) + 64+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (event_Send x)+               serialize (data_type_Send x)+               putSkip 64+               putSkip (requiredPadding size__)+ +data SendReply = MkSendReply{}+               deriving (Show, Typeable)+ +instance Deserialize SendReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 24+               let _ = isCard32 length+               return (MkSendReply)+ +data SelectInput = MkSelectInput{event_mask_SelectInput :: CARD32}+                 deriving (Show, Typeable)+ +instance ExtensionRequest SelectInput where+        extensionId _ = "XEVIE"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__ = 4 + size (event_mask_SelectInput x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (event_mask_SelectInput x)+               putSkip (requiredPadding size__)+ +data SelectInputReply = MkSelectInputReply{}+                      deriving (Show, Typeable)+ +instance Deserialize SelectInputReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 24+               let _ = isCard32 length+               return (MkSelectInputReply)
+ patched/Graphics/XHB/Gen/Xinerama.hs view
@@ -0,0 +1,84 @@+module Graphics.XHB.Gen.Xinerama+       (extension, queryVersion, getState, getScreenCount, getScreenSize,+        isActive, queryScreens, module Graphics.XHB.Gen.Xinerama.Types)+       where+import Graphics.XHB.Gen.Xinerama.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +extension :: ExtensionId+extension = "XINERAMA"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 CARD8 -> CARD8 -> IO (Receipt QueryVersionReply)+queryVersion c major minor+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion major minor+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getState ::+           Graphics.XHB.Connection.Types.Connection ->+             WINDOW -> IO (Receipt GetStateReply)+getState c window+  = do receipt <- newEmptyReceiptIO+       let req = MkGetState window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getScreenCount ::+                 Graphics.XHB.Connection.Types.Connection ->+                   WINDOW -> IO (Receipt GetScreenCountReply)+getScreenCount c window+  = do receipt <- newEmptyReceiptIO+       let req = MkGetScreenCount window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +getScreenSize ::+                Graphics.XHB.Connection.Types.Connection ->+                  WINDOW -> CARD32 -> IO (Receipt GetScreenSizeReply)+getScreenSize c window screen+  = do receipt <- newEmptyReceiptIO+       let req = MkGetScreenSize window screen+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +isActive ::+           Graphics.XHB.Connection.Types.Connection ->+             IO (Receipt IsActiveReply)+isActive c+  = do receipt <- newEmptyReceiptIO+       let req = MkIsActive+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryScreens ::+               Graphics.XHB.Connection.Types.Connection ->+                 IO (Receipt QueryScreensReply)+queryScreens c+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryScreens+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/Xinerama/Types.hs view
@@ -0,0 +1,230 @@+module Graphics.XHB.Gen.Xinerama.Types+       (deserializeError, deserializeEvent, ScreenInfo(..),+        QueryVersion(..), QueryVersionReply(..), GetState(..),+        GetStateReply(..), GetScreenCount(..), GetScreenCountReply(..),+        GetScreenSize(..), GetScreenSizeReply(..), IsActive(..),+        IsActiveReply(..), QueryScreens(..), QueryScreensReply(..))+       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+import Graphics.XHB.Gen.Xproto.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +data ScreenInfo = MkScreenInfo{x_org_ScreenInfo :: INT16,+                               y_org_ScreenInfo :: INT16, width_ScreenInfo :: CARD16,+                               height_ScreenInfo :: CARD16}+                deriving (Show, Typeable)+ +instance Serialize ScreenInfo where+        serialize x+          = do serialize (x_org_ScreenInfo x)+               serialize (y_org_ScreenInfo x)+               serialize (width_ScreenInfo x)+               serialize (height_ScreenInfo x)+        size x+          = size (x_org_ScreenInfo x) + size (y_org_ScreenInfo x) ++              size (width_ScreenInfo x)+              + size (height_ScreenInfo x)+ +instance Deserialize ScreenInfo where+        deserialize+          = do x_org <- deserialize+               y_org <- deserialize+               width <- deserialize+               height <- deserialize+               return (MkScreenInfo x_org y_org width height)+ +data QueryVersion = MkQueryVersion{major_QueryVersion :: CARD8,+                                   minor_QueryVersion :: CARD8}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "XINERAMA"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__+                     = 4 + size (major_QueryVersion x) + size (minor_QueryVersion x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (major_QueryVersion x)+               serialize (minor_QueryVersion x)+               putSkip (requiredPadding size__)+ +data QueryVersionReply = MkQueryVersionReply{major_QueryVersionReply+                                             :: CARD16,+                                             minor_QueryVersionReply :: CARD16}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major <- deserialize+               minor <- deserialize+               let _ = isCard32 length+               return (MkQueryVersionReply major minor)+ +data GetState = MkGetState{window_GetState :: WINDOW}+              deriving (Show, Typeable)+ +instance ExtensionRequest GetState where+        extensionId _ = "XINERAMA"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__ = 4 + size (window_GetState x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetState x)+               putSkip (requiredPadding size__)+ +data GetStateReply = MkGetStateReply{state_GetStateReply :: BYTE,+                                     window_GetStateReply :: WINDOW}+                   deriving (Show, Typeable)+ +instance Deserialize GetStateReply where+        deserialize+          = do skip 1+               state <- deserialize+               skip 2+               length <- deserialize+               window <- deserialize+               let _ = isCard32 length+               return (MkGetStateReply state window)+ +data GetScreenCount = MkGetScreenCount{window_GetScreenCount ::+                                       WINDOW}+                    deriving (Show, Typeable)+ +instance ExtensionRequest GetScreenCount where+        extensionId _ = "XINERAMA"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4 + size (window_GetScreenCount x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetScreenCount x)+               putSkip (requiredPadding size__)+ +data GetScreenCountReply = MkGetScreenCountReply{screen_count_GetScreenCountReply+                                                 :: BYTE,+                                                 window_GetScreenCountReply :: WINDOW}+                         deriving (Show, Typeable)+ +instance Deserialize GetScreenCountReply where+        deserialize+          = do skip 1+               screen_count <- deserialize+               skip 2+               length <- deserialize+               window <- deserialize+               let _ = isCard32 length+               return (MkGetScreenCountReply screen_count window)+ +data GetScreenSize = MkGetScreenSize{window_GetScreenSize ::+                                     WINDOW,+                                     screen_GetScreenSize :: CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest GetScreenSize where+        extensionId _ = "XINERAMA"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__+                     = 4 + size (window_GetScreenSize x) + size (screen_GetScreenSize x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_GetScreenSize x)+               serialize (screen_GetScreenSize x)+               putSkip (requiredPadding size__)+ +data GetScreenSizeReply = MkGetScreenSizeReply{width_GetScreenSizeReply+                                               :: CARD32,+                                               height_GetScreenSizeReply :: CARD32,+                                               window_GetScreenSizeReply :: WINDOW,+                                               screen_GetScreenSizeReply :: CARD32}+                        deriving (Show, Typeable)+ +instance Deserialize GetScreenSizeReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               width <- deserialize+               height <- deserialize+               window <- deserialize+               screen <- deserialize+               let _ = isCard32 length+               return (MkGetScreenSizeReply width height window screen)+ +data IsActive = MkIsActive{}+              deriving (Show, Typeable)+ +instance ExtensionRequest IsActive where+        extensionId _ = "XINERAMA"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data IsActiveReply = MkIsActiveReply{state_IsActiveReply :: CARD32}+                   deriving (Show, Typeable)+ +instance Deserialize IsActiveReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               state <- deserialize+               let _ = isCard32 length+               return (MkIsActiveReply state)+ +data QueryScreens = MkQueryScreens{}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryScreens where+        extensionId _ = "XINERAMA"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data QueryScreensReply = MkQueryScreensReply{number_QueryScreensReply+                                             :: CARD32,+                                             screen_info_QueryScreensReply :: [ScreenInfo]}+                       deriving (Show, Typeable)+ +instance Deserialize QueryScreensReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               number <- deserialize+               skip 20+               screen_info <- deserializeList (fromIntegral number)+               let _ = isCard32 length+               return (MkQueryScreensReply number screen_info)
+ patched/Graphics/XHB/Gen/Xproto.hs view
@@ -0,0 +1,935 @@+module Graphics.XHB.Gen.Xproto+       (createWindow, changeWindowAttributes, getWindowAttributes,+        destroyWindow, destroySubwindows, changeSaveSet, reparentWindow,+        mapWindow, mapSubwindows, unmapWindow, unmapSubwindows,+        configureWindow, circulateWindow, getGeometry, queryTree,+        internAtom, getAtomName, changeProperty, deleteProperty,+        getProperty, listProperties, setSelectionOwner, getSelectionOwner,+        convertSelection, sendEvent, grabPointer, ungrabPointer,+        grabButton, ungrabButton, changeActivePointerGrab, grabKeyboard,+        ungrabKeyboard, grabKey, ungrabKey, allowEvents, queryPointer,+        getMotionEvents, translateCoordinates, warpPointer, setInputFocus,+        getInputFocus, queryKeymap, openFont, closeFont, queryFont,+        queryTextExtents, listFonts, listFontsWithInfo, setFontPath,+        getFontPath, createPixmap, freePixmap, createGC, changeGC, copyGC,+        setDashes, setClipRectangles, freeGC, clearArea, copyArea,+        copyPlane, polyPoint, polyLine, polySegment, polyRectangle,+        polyArc, fillPoly, polyFillRectangle, polyFillArc, putImage,+        getImage, polyText8, polyText16, imageText8, imageText16,+        createColormap, freeColormap, copyColormapAndFree, installColormap,+        uninstallColormap, listInstalledColormaps, allocColor,+        allocNamedColor, allocColorCells, allocColorPlanes, freeColors,+        storeColors, storeNamedColor, queryColors, lookupColor,+        createCursor, createGlyphCursor, freeCursor, recolorCursor,+        queryBestSize, queryExtension, listExtensions,+        changeKeyboardMapping, getKeyboardMapping, changeKeyboardControl,+        getKeyboardControl, bell, changePointerControl, getPointerControl,+        setScreenSaver, getScreenSaver, changeHosts, listHosts,+        setAccessControl, setCloseDownMode, killClient, rotateProperties,+        forceScreenSaver, setPointerMapping, getPointerMapping,+        setModifierMapping, getModifierMapping,+        module Graphics.XHB.Gen.Xproto.Types)+       where+import Graphics.XHB.Gen.Xproto.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Shared+import Data.Binary.Put+import Control.Concurrent.STM+import Foreign.C.Types+import qualified Graphics.XHB.Connection.Types+ +createWindow ::+               Graphics.XHB.Connection.Types.Connection -> CreateWindow -> IO ()+createWindow c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +changeWindowAttributes ::+                         Graphics.XHB.Connection.Types.Connection ->+                           WINDOW -> ValueParam CARD32 -> IO ()+changeWindowAttributes c window value+  = do let req = MkChangeWindowAttributes window value+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +getWindowAttributes ::+                      Graphics.XHB.Connection.Types.Connection ->+                        WINDOW -> IO (Receipt GetWindowAttributesReply)+getWindowAttributes c window+  = do receipt <- newEmptyReceiptIO+       let req = MkGetWindowAttributes window+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +destroyWindow ::+                Graphics.XHB.Connection.Types.Connection -> WINDOW -> IO ()+destroyWindow c window+  = do let req = MkDestroyWindow window+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +destroySubwindows ::+                    Graphics.XHB.Connection.Types.Connection -> WINDOW -> IO ()+destroySubwindows c window+  = do let req = MkDestroySubwindows window+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +changeSaveSet ::+                Graphics.XHB.Connection.Types.Connection -> BYTE -> WINDOW -> IO ()+changeSaveSet c mode window+  = do let req = MkChangeSaveSet mode window+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +reparentWindow ::+                 Graphics.XHB.Connection.Types.Connection -> ReparentWindow -> IO ()+reparentWindow c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +mapWindow ::+            Graphics.XHB.Connection.Types.Connection -> WINDOW -> IO ()+mapWindow c window+  = do let req = MkMapWindow window+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +mapSubwindows ::+                Graphics.XHB.Connection.Types.Connection -> WINDOW -> IO ()+mapSubwindows c window+  = do let req = MkMapSubwindows window+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +unmapWindow ::+              Graphics.XHB.Connection.Types.Connection -> WINDOW -> IO ()+unmapWindow c window+  = do let req = MkUnmapWindow window+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +unmapSubwindows ::+                  Graphics.XHB.Connection.Types.Connection -> WINDOW -> IO ()+unmapSubwindows c window+  = do let req = MkUnmapSubwindows window+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +configureWindow ::+                  Graphics.XHB.Connection.Types.Connection ->+                    WINDOW -> ValueParam CARD16 -> IO ()+configureWindow c window value+  = do let req = MkConfigureWindow window value+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +circulateWindow ::+                  Graphics.XHB.Connection.Types.Connection ->+                    CARD8 -> WINDOW -> IO ()+circulateWindow c direction window+  = do let req = MkCirculateWindow direction window+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +getGeometry ::+              Graphics.XHB.Connection.Types.Connection ->+                DRAWABLE -> IO (Receipt GetGeometryReply)+getGeometry c drawable+  = do receipt <- newEmptyReceiptIO+       let req = MkGetGeometry drawable+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +queryTree ::+            Graphics.XHB.Connection.Types.Connection ->+              WINDOW -> IO (Receipt QueryTreeReply)+queryTree c window+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryTree window+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +internAtom ::+             Graphics.XHB.Connection.Types.Connection ->+               InternAtom -> IO (Receipt InternAtomReply)+internAtom c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +getAtomName ::+              Graphics.XHB.Connection.Types.Connection ->+                ATOM -> IO (Receipt GetAtomNameReply)+getAtomName c atom+  = do receipt <- newEmptyReceiptIO+       let req = MkGetAtomName atom+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +changeProperty ::+                 Graphics.XHB.Connection.Types.Connection -> ChangeProperty -> IO ()+changeProperty c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +deleteProperty ::+                 Graphics.XHB.Connection.Types.Connection -> WINDOW -> ATOM -> IO ()+deleteProperty c window property+  = do let req = MkDeleteProperty window property+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +getProperty ::+              Graphics.XHB.Connection.Types.Connection ->+                GetProperty -> IO (Receipt GetPropertyReply)+getProperty c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +listProperties ::+                 Graphics.XHB.Connection.Types.Connection ->+                   WINDOW -> IO (Receipt ListPropertiesReply)+listProperties c window+  = do receipt <- newEmptyReceiptIO+       let req = MkListProperties window+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +setSelectionOwner ::+                    Graphics.XHB.Connection.Types.Connection ->+                      SetSelectionOwner -> IO ()+setSelectionOwner c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +getSelectionOwner ::+                    Graphics.XHB.Connection.Types.Connection ->+                      ATOM -> IO (Receipt GetSelectionOwnerReply)+getSelectionOwner c selection+  = do receipt <- newEmptyReceiptIO+       let req = MkGetSelectionOwner selection+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +convertSelection ::+                   Graphics.XHB.Connection.Types.Connection ->+                     ConvertSelection -> IO ()+convertSelection c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +sendEvent ::+            Graphics.XHB.Connection.Types.Connection -> SendEvent -> IO ()+sendEvent c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +grabPointer ::+              Graphics.XHB.Connection.Types.Connection ->+                GrabPointer -> IO (Receipt GrabPointerReply)+grabPointer c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +ungrabPointer ::+                Graphics.XHB.Connection.Types.Connection -> TIMESTAMP -> IO ()+ungrabPointer c time+  = do let req = MkUngrabPointer time+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +grabButton ::+             Graphics.XHB.Connection.Types.Connection -> GrabButton -> IO ()+grabButton c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +ungrabButton ::+               Graphics.XHB.Connection.Types.Connection -> UngrabButton -> IO ()+ungrabButton c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +changeActivePointerGrab ::+                          Graphics.XHB.Connection.Types.Connection ->+                            ChangeActivePointerGrab -> IO ()+changeActivePointerGrab c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +grabKeyboard ::+               Graphics.XHB.Connection.Types.Connection ->+                 GrabKeyboard -> IO (Receipt GrabKeyboardReply)+grabKeyboard c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +ungrabKeyboard ::+                 Graphics.XHB.Connection.Types.Connection -> TIMESTAMP -> IO ()+ungrabKeyboard c time+  = do let req = MkUngrabKeyboard time+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +grabKey ::+          Graphics.XHB.Connection.Types.Connection -> GrabKey -> IO ()+grabKey c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +ungrabKey ::+            Graphics.XHB.Connection.Types.Connection -> UngrabKey -> IO ()+ungrabKey c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +allowEvents ::+              Graphics.XHB.Connection.Types.Connection ->+                CARD8 -> TIMESTAMP -> IO ()+allowEvents c mode time+  = do let req = MkAllowEvents mode time+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +queryPointer ::+               Graphics.XHB.Connection.Types.Connection ->+                 WINDOW -> IO (Receipt QueryPointerReply)+queryPointer c window+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryPointer window+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +getMotionEvents ::+                  Graphics.XHB.Connection.Types.Connection ->+                    GetMotionEvents -> IO (Receipt GetMotionEventsReply)+getMotionEvents c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +translateCoordinates ::+                       Graphics.XHB.Connection.Types.Connection ->+                         TranslateCoordinates -> IO (Receipt TranslateCoordinatesReply)+translateCoordinates c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +warpPointer ::+              Graphics.XHB.Connection.Types.Connection -> WarpPointer -> IO ()+warpPointer c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +setInputFocus ::+                Graphics.XHB.Connection.Types.Connection -> SetInputFocus -> IO ()+setInputFocus c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +getInputFocus ::+                Graphics.XHB.Connection.Types.Connection ->+                  IO (Receipt GetInputFocusReply)+getInputFocus c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetInputFocus+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +queryKeymap ::+              Graphics.XHB.Connection.Types.Connection ->+                IO (Receipt QueryKeymapReply)+queryKeymap c+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryKeymap+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +openFont ::+           Graphics.XHB.Connection.Types.Connection -> OpenFont -> IO ()+openFont c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +closeFont ::+            Graphics.XHB.Connection.Types.Connection -> FONT -> IO ()+closeFont c font+  = do let req = MkCloseFont font+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +queryFont ::+            Graphics.XHB.Connection.Types.Connection ->+              FONTABLE -> IO (Receipt QueryFontReply)+queryFont c font+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryFont font+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +queryTextExtents ::+                   Graphics.XHB.Connection.Types.Connection ->+                     FONTABLE -> [CHAR2B] -> IO (Receipt QueryTextExtentsReply)+queryTextExtents c font string+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryTextExtents font string+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +listFonts ::+            Graphics.XHB.Connection.Types.Connection ->+              ListFonts -> IO (Receipt ListFontsReply)+listFonts c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +listFontsWithInfo ::+                    Graphics.XHB.Connection.Types.Connection ->+                      ListFontsWithInfo -> IO (Receipt ListFontsWithInfoReply)+listFontsWithInfo c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +setFontPath ::+              Graphics.XHB.Connection.Types.Connection ->+                CARD16 -> [CChar] -> IO ()+setFontPath c font_qty path+  = do let req = MkSetFontPath font_qty path+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +getFontPath ::+              Graphics.XHB.Connection.Types.Connection ->+                IO (Receipt GetFontPathReply)+getFontPath c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetFontPath+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +createPixmap ::+               Graphics.XHB.Connection.Types.Connection -> CreatePixmap -> IO ()+createPixmap c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +freePixmap ::+             Graphics.XHB.Connection.Types.Connection -> PIXMAP -> IO ()+freePixmap c pixmap+  = do let req = MkFreePixmap pixmap+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +createGC ::+           Graphics.XHB.Connection.Types.Connection -> CreateGC -> IO ()+createGC c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +changeGC ::+           Graphics.XHB.Connection.Types.Connection ->+             GCONTEXT -> ValueParam CARD32 -> IO ()+changeGC c gc value+  = do let req = MkChangeGC gc value+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +copyGC ::+         Graphics.XHB.Connection.Types.Connection -> CopyGC -> IO ()+copyGC c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +setDashes ::+            Graphics.XHB.Connection.Types.Connection -> SetDashes -> IO ()+setDashes c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +setClipRectangles ::+                    Graphics.XHB.Connection.Types.Connection ->+                      SetClipRectangles -> IO ()+setClipRectangles c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +freeGC ::+         Graphics.XHB.Connection.Types.Connection -> GCONTEXT -> IO ()+freeGC c gc+  = do let req = MkFreeGC gc+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +clearArea ::+            Graphics.XHB.Connection.Types.Connection -> ClearArea -> IO ()+clearArea c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +copyArea ::+           Graphics.XHB.Connection.Types.Connection -> CopyArea -> IO ()+copyArea c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +copyPlane ::+            Graphics.XHB.Connection.Types.Connection -> CopyPlane -> IO ()+copyPlane c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +polyPoint ::+            Graphics.XHB.Connection.Types.Connection -> PolyPoint -> IO ()+polyPoint c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +polyLine ::+           Graphics.XHB.Connection.Types.Connection -> PolyLine -> IO ()+polyLine c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +polySegment ::+              Graphics.XHB.Connection.Types.Connection -> PolySegment -> IO ()+polySegment c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +polyRectangle ::+                Graphics.XHB.Connection.Types.Connection -> PolyRectangle -> IO ()+polyRectangle c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +polyArc ::+          Graphics.XHB.Connection.Types.Connection -> PolyArc -> IO ()+polyArc c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +fillPoly ::+           Graphics.XHB.Connection.Types.Connection -> FillPoly -> IO ()+fillPoly c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +polyFillRectangle ::+                    Graphics.XHB.Connection.Types.Connection ->+                      PolyFillRectangle -> IO ()+polyFillRectangle c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +polyFillArc ::+              Graphics.XHB.Connection.Types.Connection -> PolyFillArc -> IO ()+polyFillArc c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +putImage ::+           Graphics.XHB.Connection.Types.Connection -> PutImage -> IO ()+putImage c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +getImage ::+           Graphics.XHB.Connection.Types.Connection ->+             GetImage -> IO (Receipt GetImageReply)+getImage c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +polyText8 ::+            Graphics.XHB.Connection.Types.Connection -> PolyText8 -> IO ()+polyText8 c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +polyText16 ::+             Graphics.XHB.Connection.Types.Connection -> PolyText16 -> IO ()+polyText16 c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +imageText8 ::+             Graphics.XHB.Connection.Types.Connection -> ImageText8 -> IO ()+imageText8 c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +imageText16 ::+              Graphics.XHB.Connection.Types.Connection -> ImageText16 -> IO ()+imageText16 c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +createColormap ::+                 Graphics.XHB.Connection.Types.Connection -> CreateColormap -> IO ()+createColormap c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +freeColormap ::+               Graphics.XHB.Connection.Types.Connection -> COLORMAP -> IO ()+freeColormap c cmap+  = do let req = MkFreeColormap cmap+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +copyColormapAndFree ::+                      Graphics.XHB.Connection.Types.Connection ->+                        COLORMAP -> COLORMAP -> IO ()+copyColormapAndFree c mid src_cmap+  = do let req = MkCopyColormapAndFree mid src_cmap+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +installColormap ::+                  Graphics.XHB.Connection.Types.Connection -> COLORMAP -> IO ()+installColormap c cmap+  = do let req = MkInstallColormap cmap+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +uninstallColormap ::+                    Graphics.XHB.Connection.Types.Connection -> COLORMAP -> IO ()+uninstallColormap c cmap+  = do let req = MkUninstallColormap cmap+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +listInstalledColormaps ::+                         Graphics.XHB.Connection.Types.Connection ->+                           WINDOW -> IO (Receipt ListInstalledColormapsReply)+listInstalledColormaps c window+  = do receipt <- newEmptyReceiptIO+       let req = MkListInstalledColormaps window+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +allocColor ::+             Graphics.XHB.Connection.Types.Connection ->+               AllocColor -> IO (Receipt AllocColorReply)+allocColor c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +allocNamedColor ::+                  Graphics.XHB.Connection.Types.Connection ->+                    AllocNamedColor -> IO (Receipt AllocNamedColorReply)+allocNamedColor c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +allocColorCells ::+                  Graphics.XHB.Connection.Types.Connection ->+                    AllocColorCells -> IO (Receipt AllocColorCellsReply)+allocColorCells c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +allocColorPlanes ::+                   Graphics.XHB.Connection.Types.Connection ->+                     AllocColorPlanes -> IO (Receipt AllocColorPlanesReply)+allocColorPlanes c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +freeColors ::+             Graphics.XHB.Connection.Types.Connection -> FreeColors -> IO ()+freeColors c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +storeColors ::+              Graphics.XHB.Connection.Types.Connection ->+                COLORMAP -> [COLORITEM] -> IO ()+storeColors c cmap items+  = do let req = MkStoreColors cmap items+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +storeNamedColor ::+                  Graphics.XHB.Connection.Types.Connection ->+                    StoreNamedColor -> IO ()+storeNamedColor c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +queryColors ::+              Graphics.XHB.Connection.Types.Connection ->+                COLORMAP -> [CARD32] -> IO (Receipt QueryColorsReply)+queryColors c cmap pixels+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryColors cmap pixels+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +lookupColor ::+              Graphics.XHB.Connection.Types.Connection ->+                LookupColor -> IO (Receipt LookupColorReply)+lookupColor c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +createCursor ::+               Graphics.XHB.Connection.Types.Connection -> CreateCursor -> IO ()+createCursor c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +createGlyphCursor ::+                    Graphics.XHB.Connection.Types.Connection ->+                      CreateGlyphCursor -> IO ()+createGlyphCursor c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +freeCursor ::+             Graphics.XHB.Connection.Types.Connection -> CURSOR -> IO ()+freeCursor c cursor+  = do let req = MkFreeCursor cursor+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +recolorCursor ::+                Graphics.XHB.Connection.Types.Connection -> RecolorCursor -> IO ()+recolorCursor c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +queryBestSize ::+                Graphics.XHB.Connection.Types.Connection ->+                  QueryBestSize -> IO (Receipt QueryBestSizeReply)+queryBestSize c req+  = do receipt <- newEmptyReceiptIO+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +queryExtension ::+                 Graphics.XHB.Connection.Types.Connection ->+                   CARD16 -> [CChar] -> IO (Receipt QueryExtensionReply)+queryExtension c name_len name+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryExtension name_len name+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +listExtensions ::+                 Graphics.XHB.Connection.Types.Connection ->+                   IO (Receipt ListExtensionsReply)+listExtensions c+  = do receipt <- newEmptyReceiptIO+       let req = MkListExtensions+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +changeKeyboardMapping ::+                        Graphics.XHB.Connection.Types.Connection ->+                          ChangeKeyboardMapping -> IO ()+changeKeyboardMapping c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +getKeyboardMapping ::+                     Graphics.XHB.Connection.Types.Connection ->+                       KEYCODE -> CARD8 -> IO (Receipt GetKeyboardMappingReply)+getKeyboardMapping c first_keycode count+  = do receipt <- newEmptyReceiptIO+       let req = MkGetKeyboardMapping first_keycode count+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +changeKeyboardControl ::+                        Graphics.XHB.Connection.Types.Connection ->+                          ValueParam CARD32 -> IO ()+changeKeyboardControl c value+  = do let req = MkChangeKeyboardControl value+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +getKeyboardControl ::+                     Graphics.XHB.Connection.Types.Connection ->+                       IO (Receipt GetKeyboardControlReply)+getKeyboardControl c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetKeyboardControl+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +bell :: Graphics.XHB.Connection.Types.Connection -> INT8 -> IO ()+bell c percent+  = do let req = MkBell percent+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +changePointerControl ::+                       Graphics.XHB.Connection.Types.Connection ->+                         ChangePointerControl -> IO ()+changePointerControl c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +getPointerControl ::+                    Graphics.XHB.Connection.Types.Connection ->+                      IO (Receipt GetPointerControlReply)+getPointerControl c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPointerControl+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +setScreenSaver ::+                 Graphics.XHB.Connection.Types.Connection -> SetScreenSaver -> IO ()+setScreenSaver c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +getScreenSaver ::+                 Graphics.XHB.Connection.Types.Connection ->+                   IO (Receipt GetScreenSaverReply)+getScreenSaver c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetScreenSaver+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +changeHosts ::+              Graphics.XHB.Connection.Types.Connection -> ChangeHosts -> IO ()+changeHosts c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +listHosts ::+            Graphics.XHB.Connection.Types.Connection ->+              IO (Receipt ListHostsReply)+listHosts c+  = do receipt <- newEmptyReceiptIO+       let req = MkListHosts+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +setAccessControl ::+                   Graphics.XHB.Connection.Types.Connection -> CARD8 -> 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 ()+setCloseDownMode c mode+  = do let req = MkSetCloseDownMode mode+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +killClient ::+             Graphics.XHB.Connection.Types.Connection -> CARD32 -> IO ()+killClient c resource+  = do let req = MkKillClient resource+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +rotateProperties ::+                   Graphics.XHB.Connection.Types.Connection ->+                     RotateProperties -> IO ()+rotateProperties c req+  = do let chunk = runPut (serialize req)+       sendRequest c chunk+ +forceScreenSaver ::+                   Graphics.XHB.Connection.Types.Connection -> CARD8 -> IO ()+forceScreenSaver c mode+  = do let req = MkForceScreenSaver mode+       let chunk = runPut (serialize req)+       sendRequest c chunk+ +setPointerMapping ::+                    Graphics.XHB.Connection.Types.Connection ->+                      CARD8 -> [CARD8] -> IO (Receipt SetPointerMappingReply)+setPointerMapping c map_len map+  = do receipt <- newEmptyReceiptIO+       let req = MkSetPointerMapping map_len map+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +getPointerMapping ::+                    Graphics.XHB.Connection.Types.Connection ->+                      IO (Receipt GetPointerMappingReply)+getPointerMapping c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPointerMapping+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +setModifierMapping ::+                     Graphics.XHB.Connection.Types.Connection ->+                       CARD8 -> [KEYCODE] -> IO (Receipt SetModifierMappingReply)+setModifierMapping c keycodes_per_modifier keycodes+  = do receipt <- newEmptyReceiptIO+       let req = MkSetModifierMapping keycodes_per_modifier keycodes+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt+ +getModifierMapping ::+                     Graphics.XHB.Connection.Types.Connection ->+                       IO (Receipt GetModifierMappingReply)+getModifierMapping c+  = do receipt <- newEmptyReceiptIO+       let req = MkGetModifierMapping+       let chunk = runPut (serialize req)+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/Xproto/Types.hs view
@@ -0,0 +1,6146 @@+module Graphics.XHB.Gen.Xproto.Types+       (deserializeError, deserializeEvent, CHAR2B(..), WINDOW, PIXMAP,+        CURSOR, FONT, GCONTEXT, COLORMAP, ATOM, DRAWABLE, FONTABLE,+        VISUALID, TIMESTAMP, KEYSYM, KEYCODE, BUTTON, POINT(..),+        RECTANGLE(..), ARC(..), FORMAT(..), VisualClass(..),+        VISUALTYPE(..), DEPTH(..), SCREEN(..), SetupRequest(..),+        SetupFailed(..), SetupAuthenticate(..), ImageOrder(..), Setup(..),+        ModMask(..), KeyPress(..), KeyRelease(..), ButtonMask(..),+        ButtonPress(..), ButtonRelease(..), Motion(..), MotionNotify(..),+        NotifyDetail(..), NotifyMode(..), EnterNotify(..), LeaveNotify(..),+        FocusIn(..), FocusOut(..), KeymapNotify(..), Expose(..),+        GraphicsExposure(..), NoExposure(..), Visibility(..),+        VisibilityNotify(..), CreateNotify(..), DestroyNotify(..),+        UnmapNotify(..), MapNotify(..), MapRequest(..), ReparentNotify(..),+        ConfigureNotify(..), ConfigureRequest(..), GravityNotify(..),+        ResizeRequest(..), Place(..), CirculateNotify(..),+        CirculateRequest(..), Property(..), PropertyNotify(..),+        SelectionClear(..), SelectionRequest(..), SelectionNotify(..),+        ColormapState(..), ColormapNotify(..), ClientMessage(..),ClientMessageData(..),+        Mapping(..), MappingNotify(..), Request(..), Value(..), Window(..),+        Pixmap(..), Atom(..), Cursor(..), Font(..), Match(..),+        Drawable(..), Access(..), Alloc(..), Colormap(..), GContext(..),+        IDChoice(..), Name(..), Length(..), Implementation(..),+        WindowClass(..), CW(..), BackPixmap(..), Gravity(..),+        BackingStore(..), EventMask(..), CreateWindow(..),+        ChangeWindowAttributes(..), MapState(..), GetWindowAttributes(..),+        GetWindowAttributesReply(..), DestroyWindow(..),+        DestroySubwindows(..), SetMode(..), ChangeSaveSet(..),+        ReparentWindow(..), MapWindow(..), MapSubwindows(..),+        UnmapWindow(..), UnmapSubwindows(..), ConfigWindow(..),+        StackMode(..), ConfigureWindow(..), Circulate(..),+        CirculateWindow(..), GetGeometry(..), GetGeometryReply(..),+        QueryTree(..), QueryTreeReply(..), InternAtom(..),+        InternAtomReply(..), GetAtomName(..), GetAtomNameReply(..),+        PropMode(..), ChangeProperty(..), DeleteProperty(..),+        GetPropertyType(..), GetProperty(..), GetPropertyReply(..),+        ListProperties(..), ListPropertiesReply(..), SetSelectionOwner(..),+        GetSelectionOwner(..), GetSelectionOwnerReply(..),+        ConvertSelection(..), SendEventDest(..), SendEvent(..),+        GrabMode(..), GrabStatus(..), GrabPointer(..),+        GrabPointerReply(..), UngrabPointer(..), ButtonIndex(..),+        GrabButton(..), UngrabButton(..), ChangeActivePointerGrab(..),+        GrabKeyboard(..), GrabKeyboardReply(..), UngrabKeyboard(..),+        Grab(..), GrabKey(..), UngrabKey(..), Allow(..), AllowEvents(..),+        QueryPointer(..), QueryPointerReply(..), TIMECOORD(..),+        GetMotionEvents(..), GetMotionEventsReply(..),+        TranslateCoordinates(..), TranslateCoordinatesReply(..),+        WarpPointer(..), InputFocus(..), SetInputFocus(..),+        GetInputFocus(..), GetInputFocusReply(..), QueryKeymap(..),+        QueryKeymapReply(..), OpenFont(..), CloseFont(..), FontDraw(..),+        FONTPROP(..), CHARINFO(..), QueryFont(..), QueryFontReply(..),+        odd_length_QueryTextExtents, QueryTextExtents(..),+        QueryTextExtentsReply(..), STR(..), ListFonts(..),+        ListFontsReply(..), ListFontsWithInfo(..),+        ListFontsWithInfoReply(..), SetFontPath(..), GetFontPath(..),+        GetFontPathReply(..), CreatePixmap(..), FreePixmap(..), GC(..),+        GX(..), LineStyle(..), CapStyle(..), JoinStyle(..), FillStyle(..),+        FillRule(..), SubwindowMode(..), ArcMode(..), CreateGC(..),+        ChangeGC(..), CopyGC(..), SetDashes(..), ClipOrdering(..),+        SetClipRectangles(..), FreeGC(..), ClearArea(..), CopyArea(..),+        CopyPlane(..), CoordMode(..), PolyPoint(..), PolyLine(..),+        SEGMENT(..), PolySegment(..), PolyRectangle(..), PolyArc(..),+        PolyShape(..), FillPoly(..), PolyFillRectangle(..),+        PolyFillArc(..), ImageFormat(..), PutImage(..), GetImage(..),+        GetImageReply(..), PolyText8(..), PolyText16(..), ImageText8(..),+        ImageText16(..), ColormapAlloc(..), CreateColormap(..),+        FreeColormap(..), CopyColormapAndFree(..), InstallColormap(..),+        UninstallColormap(..), ListInstalledColormaps(..),+        ListInstalledColormapsReply(..), AllocColor(..),+        AllocColorReply(..), AllocNamedColor(..), AllocNamedColorReply(..),+        AllocColorCells(..), AllocColorCellsReply(..),+        AllocColorPlanes(..), AllocColorPlanesReply(..), FreeColors(..),+        ColorFlag(..), COLORITEM(..), StoreColors(..), StoreNamedColor(..),+        RGB(..), QueryColors(..), QueryColorsReply(..), LookupColor(..),+        LookupColorReply(..), CreateCursor(..), CreateGlyphCursor(..),+        FreeCursor(..), RecolorCursor(..), QueryShapeOf(..),+        QueryBestSize(..), QueryBestSizeReply(..), QueryExtension(..),+        QueryExtensionReply(..), ListExtensions(..),+        ListExtensionsReply(..), ChangeKeyboardMapping(..),+        GetKeyboardMapping(..), GetKeyboardMappingReply(..), KB(..),+        LedMode(..), AutoRepeatMode(..), ChangeKeyboardControl(..),+        GetKeyboardControl(..), GetKeyboardControlReply(..), Bell(..),+        ChangePointerControl(..), GetPointerControl(..),+        GetPointerControlReply(..), Blanking(..), Exposures(..),+        SetScreenSaver(..), GetScreenSaver(..), GetScreenSaverReply(..),+        HostMode(..), Family(..), ChangeHosts(..), HOST(..), ListHosts(..),+        ListHostsReply(..), AccessControl(..), SetAccessControl(..),+        CloseDown(..), SetCloseDownMode(..), Kill(..), KillClient(..),+        RotateProperties(..), ScreenSaver(..), ForceScreenSaver(..),+        MappingStatus(..), SetPointerMapping(..),+        SetPointerMappingReply(..), GetPointerMapping(..),+        GetPointerMappingReply(..), MapIndex(..), SetModifierMapping(..),+        SetModifierMappingReply(..), GetModifierMapping(..),+        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,+                                                         keycodes_GetModifierMappingReply ::+                                                         [KEYCODE]}+                             deriving (Show, Typeable)+ +instance Deserialize GetModifierMappingReply where+        deserialize+          = do skip 1+               keycodes_per_modifier <- deserialize+               skip 2+               length <- deserialize+               skip 24+               keycodes <- deserializeList+                             (fromIntegral (fromIntegral (keycodes_per_modifier * 8)))+               let _ = isCard32 length+               return (MkGetModifierMappingReply keycodes_per_modifier keycodes)
+ patched/Graphics/XHB/Gen/Xv.hs view
@@ -0,0 +1,209 @@+module Graphics.XHB.Gen.Xv+       (extension, queryExtension, queryAdaptors, queryEncodings,+        grabPort, ungrabPort, putVideo, putStill, getVideo, getStill,+        stopVideo, selectVideoNotify, selectPortNotify, queryBestSize,+        setPortAttribute, getPortAttribute, queryPortAttributes,+        listImageFormats, queryImageAttributes, putImage, shmPutImage,+        module Graphics.XHB.Gen.Xv.Types)+       where+import Graphics.XHB.Gen.Xv.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xproto.Types+       hiding (QueryExtension(..), QueryExtensionReply(..),+               QueryBestSize(..), QueryBestSizeReply(..), PutImage(..),+               deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+import Graphics.XHB.Gen.Shm.Types+       hiding (PutImage(..), deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Shm.Types+ +extension :: ExtensionId+extension = "XVideo"+ +queryExtension ::+                 Graphics.XHB.Connection.Types.Connection ->+                   IO (Receipt QueryExtensionReply)+queryExtension c+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryExtension+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryAdaptors ::+                Graphics.XHB.Connection.Types.Connection ->+                  WINDOW -> IO (Receipt QueryAdaptorsReply)+queryAdaptors c window+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryAdaptors window+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryEncodings ::+                 Graphics.XHB.Connection.Types.Connection ->+                   PORT -> IO (Receipt QueryEncodingsReply)+queryEncodings c port+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryEncodings port+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +grabPort ::+           Graphics.XHB.Connection.Types.Connection ->+             PORT -> TIMESTAMP -> IO (Receipt GrabPortReply)+grabPort c port time+  = do receipt <- newEmptyReceiptIO+       let req = MkGrabPort port time+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +ungrabPort ::+             Graphics.XHB.Connection.Types.Connection ->+               PORT -> TIMESTAMP -> IO ()+ungrabPort c port time+  = do let req = MkUngrabPort port time+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +putVideo ::+           Graphics.XHB.Connection.Types.Connection -> PutVideo -> IO ()+putVideo c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +putStill ::+           Graphics.XHB.Connection.Types.Connection -> PutStill -> IO ()+putStill c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getVideo ::+           Graphics.XHB.Connection.Types.Connection -> GetVideo -> IO ()+getVideo c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getStill ::+           Graphics.XHB.Connection.Types.Connection -> GetStill -> IO ()+getStill c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +stopVideo ::+            Graphics.XHB.Connection.Types.Connection ->+              PORT -> DRAWABLE -> IO ()+stopVideo c port drawable+  = do let req = MkStopVideo port drawable+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +selectVideoNotify ::+                    Graphics.XHB.Connection.Types.Connection ->+                      DRAWABLE -> BOOL -> IO ()+selectVideoNotify c drawable onoff+  = do let req = MkSelectVideoNotify drawable onoff+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +selectPortNotify ::+                   Graphics.XHB.Connection.Types.Connection -> PORT -> BOOL -> IO ()+selectPortNotify c port onoff+  = do let req = MkSelectPortNotify port onoff+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +queryBestSize ::+                Graphics.XHB.Connection.Types.Connection ->+                  QueryBestSize -> IO (Receipt QueryBestSizeReply)+queryBestSize c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +setPortAttribute ::+                   Graphics.XHB.Connection.Types.Connection ->+                     SetPortAttribute -> IO ()+setPortAttribute c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +getPortAttribute ::+                   Graphics.XHB.Connection.Types.Connection ->+                     PORT -> ATOM -> IO (Receipt GetPortAttributeReply)+getPortAttribute c port attribute+  = do receipt <- newEmptyReceiptIO+       let req = MkGetPortAttribute port attribute+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryPortAttributes ::+                      Graphics.XHB.Connection.Types.Connection ->+                        PORT -> IO (Receipt QueryPortAttributesReply)+queryPortAttributes c port+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryPortAttributes port+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +listImageFormats ::+                   Graphics.XHB.Connection.Types.Connection ->+                     PORT -> IO (Receipt ListImageFormatsReply)+listImageFormats c port+  = do receipt <- newEmptyReceiptIO+       let req = MkListImageFormats port+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +queryImageAttributes ::+                       Graphics.XHB.Connection.Types.Connection ->+                         QueryImageAttributes -> IO (Receipt QueryImageAttributesReply)+queryImageAttributes c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +putImage ::+           Graphics.XHB.Connection.Types.Connection -> PutImage -> IO ()+putImage c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +shmPutImage ::+              Graphics.XHB.Connection.Types.Connection -> ShmPutImage -> IO ()+shmPutImage c req+  = do putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk
+ patched/Graphics/XHB/Gen/Xv/Types.hs view
@@ -0,0 +1,1102 @@+module Graphics.XHB.Gen.Xv.Types+       (deserializeError, deserializeEvent, PORT, ENCODING, Type(..),+        ImageFormatInfoType(..), ImageFormatInfoFormat(..),+        AttributeFlag(..), Rational(..), Format(..), AdaptorInfo(..),+        EncodingInfo(..), Image(..), AttributeInfo(..),+        ImageFormatInfo(..), VideoNotify(..), PortNotify(..),+        QueryExtension(..), QueryExtensionReply(..), QueryAdaptors(..),+        QueryAdaptorsReply(..), QueryEncodings(..),+        QueryEncodingsReply(..), GrabPort(..), GrabPortReply(..),+        UngrabPort(..), PutVideo(..), PutStill(..), GetVideo(..),+        GetStill(..), StopVideo(..), SelectVideoNotify(..),+        SelectPortNotify(..), QueryBestSize(..), QueryBestSizeReply(..),+        SetPortAttribute(..), GetPortAttribute(..),+        GetPortAttributeReply(..), QueryPortAttributes(..),+        QueryPortAttributesReply(..), ListImageFormats(..),+        ListImageFormatsReply(..), QueryImageAttributes(..),+        QueryImageAttributesReply(..), PutImage(..), ShmPutImage(..))+       where+import Prelude hiding (Rational)+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+import Graphics.XHB.Gen.Xproto.Types+       hiding (QueryExtension(..), QueryExtensionReply(..),+               QueryBestSize(..), QueryBestSizeReply(..), PutImage(..),+               deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xproto.Types+import Graphics.XHB.Gen.Shm.Types+       hiding (PutImage(..), deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Shm.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent 0+  = return (liftM toEvent (deserialize :: Get VideoNotify))+deserializeEvent 1+  = return (liftM toEvent (deserialize :: Get PortNotify))+deserializeEvent _ = Nothing+ +newtype PORT = MkPORT Xid+               deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype ENCODING = MkENCODING Xid+                   deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +data Type = TypeInputMask+          | TypeOutputMask+          | TypeVideoMask+          | TypeStillMask+          | TypeImageMask+ +instance BitEnum Type where+        toBit TypeInputMask{} = 0+        toBit TypeOutputMask{} = 1+        toBit TypeVideoMask{} = 2+        toBit TypeStillMask{} = 3+        toBit TypeImageMask{} = 4+        fromBit 0 = TypeInputMask+        fromBit 1 = TypeOutputMask+        fromBit 2 = TypeVideoMask+        fromBit 3 = TypeStillMask+        fromBit 4 = TypeImageMask+ +data ImageFormatInfoType = ImageFormatInfoTypeRGB+                         | ImageFormatInfoTypeYUV+ +instance SimpleEnum ImageFormatInfoType where+        toValue ImageFormatInfoTypeRGB{} = 0+        toValue ImageFormatInfoTypeYUV{} = 1+        fromValue 0 = ImageFormatInfoTypeRGB+        fromValue 1 = ImageFormatInfoTypeYUV+ +data ImageFormatInfoFormat = ImageFormatInfoFormatPacked+                           | ImageFormatInfoFormatPlanar+ +instance SimpleEnum ImageFormatInfoFormat where+        toValue ImageFormatInfoFormatPacked{} = 0+        toValue ImageFormatInfoFormatPlanar{} = 1+        fromValue 0 = ImageFormatInfoFormatPacked+        fromValue 1 = ImageFormatInfoFormatPlanar+ +data AttributeFlag = AttributeFlagGettable+                   | AttributeFlagSettable+ +instance BitEnum AttributeFlag where+        toBit AttributeFlagGettable{} = 0+        toBit AttributeFlagSettable{} = 1+        fromBit 0 = AttributeFlagGettable+        fromBit 1 = AttributeFlagSettable+ +data Rational = MkRational{numerator_Rational :: INT32,+                           denominator_Rational :: INT32}+              deriving (Show, Typeable)+ +instance Serialize Rational where+        serialize x+          = do serialize (numerator_Rational x)+               serialize (denominator_Rational x)+        size x+          = size (numerator_Rational x) + size (denominator_Rational x)+ +instance Deserialize Rational where+        deserialize+          = do numerator <- deserialize+               denominator <- deserialize+               return (MkRational numerator denominator)+ +data Format = MkFormat{visual_Format :: VISUALID,+                       depth_Format :: CARD8}+            deriving (Show, Typeable)+ +instance Serialize Format where+        serialize x+          = do serialize (visual_Format x)+               serialize (depth_Format x)+               putSkip 3+        size x = size (visual_Format x) + size (depth_Format x) + 3+ +instance Deserialize Format where+        deserialize+          = do visual <- deserialize+               depth <- deserialize+               skip 3+               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_AdaptorInfo :: [CChar], formats_AdaptorInfo :: [Format]}+                 deriving (Show, Typeable)+ +instance Serialize AdaptorInfo where+        serialize x+          = do serialize (base_id_AdaptorInfo x)+               serialize (name_size_AdaptorInfo x)+               serialize (num_ports_AdaptorInfo x)+               serialize (num_formats_AdaptorInfo x)+               serialize (type_AdaptorInfo x)+               putSkip 1+               serializeList (name_AdaptorInfo x)+               serializeList (formats_AdaptorInfo x)+        size x+          = size (base_id_AdaptorInfo x) + size (name_size_AdaptorInfo x) ++              size (num_ports_AdaptorInfo x)+              + size (num_formats_AdaptorInfo x)+              + size (type_AdaptorInfo x)+              + 1+              + sum (map size (name_AdaptorInfo x))+              + sum (map size (formats_AdaptorInfo x))+ +instance Deserialize AdaptorInfo where+        deserialize+          = do base_id <- deserialize+               name_size <- deserialize+               num_ports <- deserialize+               num_formats <- deserialize+               type_ <- deserialize+               skip 1+               name <- deserializeList (fromIntegral name_size)+               formats <- deserializeList (fromIntegral num_formats)+               return+                 (MkAdaptorInfo base_id name_size num_ports num_formats type_ name+                    formats)+ +data EncodingInfo = MkEncodingInfo{encoding_EncodingInfo ::+                                   ENCODING,+                                   name_size_EncodingInfo :: CARD16, width_EncodingInfo :: CARD16,+                                   height_EncodingInfo :: CARD16, rate_EncodingInfo :: Rational,+                                   name_EncodingInfo :: [CChar]}+                  deriving (Show, Typeable)+ +instance Serialize EncodingInfo where+        serialize x+          = do serialize (encoding_EncodingInfo x)+               serialize (name_size_EncodingInfo x)+               serialize (width_EncodingInfo x)+               serialize (height_EncodingInfo x)+               putSkip 2+               serialize (rate_EncodingInfo x)+               serializeList (name_EncodingInfo x)+        size x+          = size (encoding_EncodingInfo x) + size (name_size_EncodingInfo x)+              + size (width_EncodingInfo x)+              + size (height_EncodingInfo x)+              + 2+              + size (rate_EncodingInfo x)+              + sum (map size (name_EncodingInfo x))+ +instance Deserialize EncodingInfo where+        deserialize+          = do encoding <- deserialize+               name_size <- deserialize+               width <- deserialize+               height <- deserialize+               skip 2+               rate <- deserialize+               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]}+           deriving (Show, Typeable)+ +instance Serialize Image where+        serialize x+          = do serialize (id_Image x)+               serialize (width_Image x)+               serialize (height_Image x)+               serialize (data_size_Image x)+               serialize (num_planes_Image x)+               serializeList (pitches_Image x)+               serializeList (offsets_Image x)+               serializeList (data_Image x)+        size x+          = size (id_Image x) + size (width_Image x) + size (height_Image x)+              + size (data_size_Image x)+              + size (num_planes_Image x)+              + sum (map size (pitches_Image x))+              + sum (map size (offsets_Image x))+              + sum (map size (data_Image x))+ +instance Deserialize Image where+        deserialize+          = do id <- deserialize+               width <- deserialize+               height <- deserialize+               data_size <- deserialize+               num_planes <- deserialize+               pitches <- deserializeList (fromIntegral num_planes)+               offsets <- deserializeList (fromIntegral num_planes)+               data_ <- deserializeList (fromIntegral data_size)+               return+                 (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]}+                   deriving (Show, Typeable)+ +instance Serialize AttributeInfo where+        serialize x+          = do serialize (flags_AttributeInfo x)+               serialize (min_AttributeInfo x)+               serialize (max_AttributeInfo x)+               serialize (size_AttributeInfo x)+               serializeList (name_AttributeInfo x)+        size x+          = size (flags_AttributeInfo x) + size (min_AttributeInfo x) ++              size (max_AttributeInfo x)+              + size (size_AttributeInfo x)+              + sum (map size (name_AttributeInfo x))+ +instance Deserialize AttributeInfo where+        deserialize+          = do flags <- deserialize+               min <- deserialize+               max <- deserialize+               size <- deserialize+               name <- deserializeList (fromIntegral size)+               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}+                     deriving (Show, Typeable)+ +instance Serialize ImageFormatInfo where+        serialize x+          = do serialize (id_ImageFormatInfo x)+               serialize (type_ImageFormatInfo x)+               serialize (byte_order_ImageFormatInfo x)+               putSkip 2+               serializeList (guid_ImageFormatInfo x)+               serialize (bpp_ImageFormatInfo x)+               serialize (num_planes_ImageFormatInfo x)+               putSkip 2+               serialize (depth_ImageFormatInfo x)+               putSkip 3+               serialize (red_mask_ImageFormatInfo x)+               serialize (green_mask_ImageFormatInfo x)+               serialize (blue_mask_ImageFormatInfo x)+               serialize (format_ImageFormatInfo x)+               putSkip 3+               serialize (y_sample_bits_ImageFormatInfo x)+               serialize (u_sample_bits_ImageFormatInfo x)+               serialize (v_sample_bits_ImageFormatInfo x)+               serialize (vhorz_y_period_ImageFormatInfo x)+               serialize (vhorz_u_period_ImageFormatInfo x)+               serialize (vhorz_v_period_ImageFormatInfo x)+               serialize (vvert_y_period_ImageFormatInfo x)+               serialize (vvert_u_period_ImageFormatInfo x)+               serialize (vvert_v_period_ImageFormatInfo x)+               serializeList (vcomp_order_ImageFormatInfo x)+               serialize (vscanline_order_ImageFormatInfo x)+               putSkip 11+        size x+          = size (id_ImageFormatInfo x) + size (type_ImageFormatInfo x) ++              size (byte_order_ImageFormatInfo x)+              + 2+              + sum (map size (guid_ImageFormatInfo x))+              + size (bpp_ImageFormatInfo x)+              + size (num_planes_ImageFormatInfo x)+              + 2+              + size (depth_ImageFormatInfo x)+              + 3+              + size (red_mask_ImageFormatInfo x)+              + size (green_mask_ImageFormatInfo x)+              + size (blue_mask_ImageFormatInfo x)+              + size (format_ImageFormatInfo x)+              + 3+              + size (y_sample_bits_ImageFormatInfo x)+              + size (u_sample_bits_ImageFormatInfo x)+              + size (v_sample_bits_ImageFormatInfo x)+              + size (vhorz_y_period_ImageFormatInfo x)+              + size (vhorz_u_period_ImageFormatInfo x)+              + size (vhorz_v_period_ImageFormatInfo x)+              + size (vvert_y_period_ImageFormatInfo x)+              + size (vvert_u_period_ImageFormatInfo x)+              + size (vvert_v_period_ImageFormatInfo x)+              + sum (map size (vcomp_order_ImageFormatInfo x))+              + size (vscanline_order_ImageFormatInfo x)+              + 11+ +instance Deserialize ImageFormatInfo where+        deserialize+          = do id <- deserialize+               type_ <- deserialize+               byte_order <- deserialize+               skip 2+               guid <- deserializeList (fromIntegral 16)+               bpp <- deserialize+               num_planes <- deserialize+               skip 2+               depth <- deserialize+               skip 3+               red_mask <- deserialize+               green_mask <- deserialize+               blue_mask <- deserialize+               format <- deserialize+               skip 3+               y_sample_bits <- deserialize+               u_sample_bits <- deserialize+               v_sample_bits <- deserialize+               vhorz_y_period <- deserialize+               vhorz_u_period <- deserialize+               vhorz_v_period <- deserialize+               vvert_y_period <- deserialize+               vvert_u_period <- deserialize+               vvert_v_period <- deserialize+               vcomp_order <- deserializeList (fromIntegral 32)+               vscanline_order <- deserialize+               skip 11+               return+                 (MkImageFormatInfo id type_ byte_order guid bpp num_planes depth+                    red_mask+                    green_mask+                    blue_mask+                    format+                    y_sample_bits+                    u_sample_bits+                    v_sample_bits+                    vhorz_y_period+                    vhorz_u_period+                    vhorz_v_period+                    vvert_y_period+                    vvert_u_period+                    vvert_v_period+                    vcomp_order+                    vscanline_order)+ +data VideoNotify = MkVideoNotify{reason_VideoNotify :: BYTE,+                                 time_VideoNotify :: TIMESTAMP, drawable_VideoNotify :: DRAWABLE,+                                 port_VideoNotify :: PORT}+                 deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event VideoNotify+ +instance Deserialize VideoNotify where+        deserialize+          = do skip 1+               reason <- deserialize+               skip 2+               time <- deserialize+               drawable <- deserialize+               port <- deserialize+               return (MkVideoNotify reason time drawable port)+ +data PortNotify = MkPortNotify{time_PortNotify :: TIMESTAMP,+                               port_PortNotify :: PORT, attribute_PortNotify :: ATOM,+                               value_PortNotify :: INT32}+                deriving (Show, Typeable)+ +instance Graphics.XHB.Shared.Event PortNotify+ +instance Deserialize PortNotify where+        deserialize+          = do skip 1+               skip 1+               skip 2+               time <- deserialize+               port <- deserialize+               attribute <- deserialize+               value <- deserialize+               return (MkPortNotify time port attribute value)+ +data QueryExtension = MkQueryExtension{}+                    deriving (Show, Typeable)+ +instance ExtensionRequest QueryExtension where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data QueryExtensionReply = MkQueryExtensionReply{major_QueryExtensionReply+                                                 :: CARD16,+                                                 minor_QueryExtensionReply :: CARD16}+                         deriving (Show, Typeable)+ +instance Deserialize QueryExtensionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major <- deserialize+               minor <- deserialize+               let _ = isCard32 length+               return (MkQueryExtensionReply major minor)+ +data QueryAdaptors = MkQueryAdaptors{window_QueryAdaptors ::+                                     WINDOW}+                   deriving (Show, Typeable)+ +instance ExtensionRequest QueryAdaptors where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__ = 4 + size (window_QueryAdaptors x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (window_QueryAdaptors x)+               putSkip (requiredPadding size__)+ +data QueryAdaptorsReply = MkQueryAdaptorsReply{num_adaptors_QueryAdaptorsReply+                                               :: CARD16,+                                               info_QueryAdaptorsReply :: [AdaptorInfo]}+                        deriving (Show, Typeable)+ +instance Deserialize QueryAdaptorsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_adaptors <- deserialize+               skip 22+               info <- deserializeList (fromIntegral num_adaptors)+               let _ = isCard32 length+               return (MkQueryAdaptorsReply num_adaptors info)+ +data QueryEncodings = MkQueryEncodings{port_QueryEncodings :: PORT}+                    deriving (Show, Typeable)+ +instance ExtensionRequest QueryEncodings where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__ = 4 + size (port_QueryEncodings x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_QueryEncodings x)+               putSkip (requiredPadding size__)+ +data QueryEncodingsReply = MkQueryEncodingsReply{num_encodings_QueryEncodingsReply+                                                 :: CARD16,+                                                 info_QueryEncodingsReply :: [EncodingInfo]}+                         deriving (Show, Typeable)+ +instance Deserialize QueryEncodingsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_encodings <- deserialize+               skip 22+               info <- deserializeList (fromIntegral num_encodings)+               let _ = isCard32 length+               return (MkQueryEncodingsReply num_encodings info)+ +data GrabPort = MkGrabPort{port_GrabPort :: PORT,+                           time_GrabPort :: TIMESTAMP}+              deriving (Show, Typeable)+ +instance ExtensionRequest GrabPort where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__ = 4 + size (port_GrabPort x) + size (time_GrabPort x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_GrabPort x)+               serialize (time_GrabPort x)+               putSkip (requiredPadding size__)+ +data GrabPortReply = MkGrabPortReply{result_GrabPortReply :: BYTE}+                   deriving (Show, Typeable)+ +instance Deserialize GrabPortReply where+        deserialize+          = do skip 1+               result <- deserialize+               skip 2+               length <- deserialize+               let _ = isCard32 length+               return (MkGrabPortReply result)+ +data UngrabPort = MkUngrabPort{port_UngrabPort :: PORT,+                               time_UngrabPort :: TIMESTAMP}+                deriving (Show, Typeable)+ +instance ExtensionRequest UngrabPort where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__+                     = 4 + size (port_UngrabPort x) + size (time_UngrabPort x)+               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}+              deriving (Show, Typeable)+ +instance ExtensionRequest PutVideo where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__+                     = 4 + size (port_PutVideo x) + size (drawable_PutVideo x) ++                         size (gc_PutVideo x)+                         + size (vid_x_PutVideo x)+                         + size (vid_y_PutVideo x)+                         + size (vid_w_PutVideo x)+                         + size (vid_h_PutVideo x)+                         + size (drw_x_PutVideo x)+                         + size (drw_y_PutVideo x)+                         + size (drw_w_PutVideo x)+                         + size (drw_h_PutVideo x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_PutVideo x)+               serialize (drawable_PutVideo x)+               serialize (gc_PutVideo x)+               serialize (vid_x_PutVideo x)+               serialize (vid_y_PutVideo x)+               serialize (vid_w_PutVideo x)+               serialize (vid_h_PutVideo x)+               serialize (drw_x_PutVideo x)+               serialize (drw_y_PutVideo x)+               serialize (drw_w_PutVideo x)+               serialize (drw_h_PutVideo x)+               putSkip (requiredPadding size__)+ +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}+              deriving (Show, Typeable)+ +instance ExtensionRequest PutStill where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__+                     = 4 + size (port_PutStill x) + size (drawable_PutStill x) ++                         size (gc_PutStill x)+                         + size (vid_x_PutStill x)+                         + size (vid_y_PutStill x)+                         + size (vid_w_PutStill x)+                         + size (vid_h_PutStill x)+                         + size (drw_x_PutStill x)+                         + size (drw_y_PutStill x)+                         + size (drw_w_PutStill x)+                         + size (drw_h_PutStill x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_PutStill x)+               serialize (drawable_PutStill x)+               serialize (gc_PutStill x)+               serialize (vid_x_PutStill x)+               serialize (vid_y_PutStill x)+               serialize (vid_w_PutStill x)+               serialize (vid_h_PutStill x)+               serialize (drw_x_PutStill x)+               serialize (drw_y_PutStill x)+               serialize (drw_w_PutStill x)+               serialize (drw_h_PutStill x)+               putSkip (requiredPadding size__)+ +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}+              deriving (Show, Typeable)+ +instance ExtensionRequest GetVideo where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__+                     = 4 + size (port_GetVideo x) + size (drawable_GetVideo x) ++                         size (gc_GetVideo x)+                         + size (vid_x_GetVideo x)+                         + size (vid_y_GetVideo x)+                         + size (vid_w_GetVideo x)+                         + size (vid_h_GetVideo x)+                         + size (drw_x_GetVideo x)+                         + size (drw_y_GetVideo x)+                         + size (drw_w_GetVideo x)+                         + size (drw_h_GetVideo x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_GetVideo x)+               serialize (drawable_GetVideo x)+               serialize (gc_GetVideo x)+               serialize (vid_x_GetVideo x)+               serialize (vid_y_GetVideo x)+               serialize (vid_w_GetVideo x)+               serialize (vid_h_GetVideo x)+               serialize (drw_x_GetVideo x)+               serialize (drw_y_GetVideo x)+               serialize (drw_w_GetVideo x)+               serialize (drw_h_GetVideo x)+               putSkip (requiredPadding size__)+ +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}+              deriving (Show, Typeable)+ +instance ExtensionRequest GetStill where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__+                     = 4 + size (port_GetStill x) + size (drawable_GetStill x) ++                         size (gc_GetStill x)+                         + size (vid_x_GetStill x)+                         + size (vid_y_GetStill x)+                         + size (vid_w_GetStill x)+                         + size (vid_h_GetStill x)+                         + size (drw_x_GetStill x)+                         + size (drw_y_GetStill x)+                         + size (drw_w_GetStill x)+                         + size (drw_h_GetStill x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_GetStill x)+               serialize (drawable_GetStill x)+               serialize (gc_GetStill x)+               serialize (vid_x_GetStill x)+               serialize (vid_y_GetStill x)+               serialize (vid_w_GetStill x)+               serialize (vid_h_GetStill x)+               serialize (drw_x_GetStill x)+               serialize (drw_y_GetStill x)+               serialize (drw_w_GetStill x)+               serialize (drw_h_GetStill x)+               putSkip (requiredPadding size__)+ +data StopVideo = MkStopVideo{port_StopVideo :: PORT,+                             drawable_StopVideo :: DRAWABLE}+               deriving (Show, Typeable)+ +instance ExtensionRequest StopVideo where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 9+               let size__+                     = 4 + size (port_StopVideo x) + size (drawable_StopVideo x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_StopVideo x)+               serialize (drawable_StopVideo x)+               putSkip (requiredPadding size__)+ +data SelectVideoNotify = MkSelectVideoNotify{drawable_SelectVideoNotify+                                             :: DRAWABLE,+                                             onoff_SelectVideoNotify :: BOOL}+                       deriving (Show, Typeable)+ +instance ExtensionRequest SelectVideoNotify where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 10+               let size__+                     = 4 + size (drawable_SelectVideoNotify x) ++                         size (onoff_SelectVideoNotify x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (drawable_SelectVideoNotify x)+               serialize (onoff_SelectVideoNotify x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data SelectPortNotify = MkSelectPortNotify{port_SelectPortNotify ::+                                           PORT,+                                           onoff_SelectPortNotify :: BOOL}+                      deriving (Show, Typeable)+ +instance ExtensionRequest SelectPortNotify where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 11+               let size__+                     = 4 + size (port_SelectPortNotify x) ++                         size (onoff_SelectPortNotify x)+                         + 3+               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}+                   deriving (Show, Typeable)+ +instance ExtensionRequest QueryBestSize where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 12+               let size__+                     = 4 + size (port_QueryBestSize x) + size (vid_w_QueryBestSize x) ++                         size (vid_h_QueryBestSize x)+                         + size (drw_w_QueryBestSize x)+                         + size (drw_h_QueryBestSize x)+                         + size (motion_QueryBestSize x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_QueryBestSize x)+               serialize (vid_w_QueryBestSize x)+               serialize (vid_h_QueryBestSize x)+               serialize (drw_w_QueryBestSize x)+               serialize (drw_h_QueryBestSize x)+               serialize (motion_QueryBestSize x)+               putSkip 3+               putSkip (requiredPadding size__)+ +data QueryBestSizeReply = MkQueryBestSizeReply{actual_width_QueryBestSizeReply+                                               :: CARD16,+                                               actual_height_QueryBestSizeReply :: CARD16}+                        deriving (Show, Typeable)+ +instance Deserialize QueryBestSizeReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               actual_width <- deserialize+               actual_height <- deserialize+               let _ = isCard32 length+               return (MkQueryBestSizeReply actual_width actual_height)+ +data SetPortAttribute = MkSetPortAttribute{port_SetPortAttribute ::+                                           PORT,+                                           attribute_SetPortAttribute :: ATOM,+                                           value_SetPortAttribute :: INT32}+                      deriving (Show, Typeable)+ +instance ExtensionRequest SetPortAttribute where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 13+               let size__+                     = 4 + size (port_SetPortAttribute x) ++                         size (attribute_SetPortAttribute x)+                         + size (value_SetPortAttribute x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_SetPortAttribute x)+               serialize (attribute_SetPortAttribute x)+               serialize (value_SetPortAttribute x)+               putSkip (requiredPadding size__)+ +data GetPortAttribute = MkGetPortAttribute{port_GetPortAttribute ::+                                           PORT,+                                           attribute_GetPortAttribute :: ATOM}+                      deriving (Show, Typeable)+ +instance ExtensionRequest GetPortAttribute where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 14+               let size__+                     = 4 + size (port_GetPortAttribute x) ++                         size (attribute_GetPortAttribute x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_GetPortAttribute x)+               serialize (attribute_GetPortAttribute x)+               putSkip (requiredPadding size__)+ +data GetPortAttributeReply = MkGetPortAttributeReply{value_GetPortAttributeReply+                                                     :: INT32}+                           deriving (Show, Typeable)+ +instance Deserialize GetPortAttributeReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               value <- deserialize+               let _ = isCard32 length+               return (MkGetPortAttributeReply value)+ +data QueryPortAttributes = MkQueryPortAttributes{port_QueryPortAttributes+                                                 :: PORT}+                         deriving (Show, Typeable)+ +instance ExtensionRequest QueryPortAttributes where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 15+               let size__ = 4 + size (port_QueryPortAttributes x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_QueryPortAttributes x)+               putSkip (requiredPadding size__)+ +data QueryPortAttributesReply = MkQueryPortAttributesReply{num_attributes_QueryPortAttributesReply+                                                           :: CARD32,+                                                           text_size_QueryPortAttributesReply ::+                                                           CARD32,+                                                           attributes_QueryPortAttributesReply ::+                                                           [AttributeInfo]}+                              deriving (Show, Typeable)+ +instance Deserialize QueryPortAttributesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_attributes <- deserialize+               text_size <- deserialize+               skip 16+               attributes <- deserializeList (fromIntegral num_attributes)+               let _ = isCard32 length+               return+                 (MkQueryPortAttributesReply num_attributes text_size attributes)+ +data ListImageFormats = MkListImageFormats{port_ListImageFormats ::+                                           PORT}+                      deriving (Show, Typeable)+ +instance ExtensionRequest ListImageFormats where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 16+               let size__ = 4 + size (port_ListImageFormats x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_ListImageFormats x)+               putSkip (requiredPadding size__)+ +data ListImageFormatsReply = MkListImageFormatsReply{num_formats_ListImageFormatsReply+                                                     :: CARD32,+                                                     format_ListImageFormatsReply ::+                                                     [ImageFormatInfo]}+                           deriving (Show, Typeable)+ +instance Deserialize ListImageFormatsReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_formats <- deserialize+               skip 20+               format <- deserializeList (fromIntegral num_formats)+               let _ = isCard32 length+               return (MkListImageFormatsReply num_formats format)+ +data QueryImageAttributes = MkQueryImageAttributes{port_QueryImageAttributes+                                                   :: PORT,+                                                   id_QueryImageAttributes :: CARD32,+                                                   width_QueryImageAttributes :: CARD16,+                                                   height_QueryImageAttributes :: CARD16}+                          deriving (Show, Typeable)+ +instance ExtensionRequest QueryImageAttributes where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 17+               let size__+                     = 4 + size (port_QueryImageAttributes x) ++                         size (id_QueryImageAttributes x)+                         + size (width_QueryImageAttributes x)+                         + size (height_QueryImageAttributes x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_QueryImageAttributes x)+               serialize (id_QueryImageAttributes x)+               serialize (width_QueryImageAttributes x)+               serialize (height_QueryImageAttributes x)+               putSkip (requiredPadding size__)+ +data QueryImageAttributesReply = MkQueryImageAttributesReply{num_planes_QueryImageAttributesReply+                                                             :: CARD32,+                                                             data_size_QueryImageAttributesReply ::+                                                             CARD32,+                                                             width_QueryImageAttributesReply ::+                                                             CARD16,+                                                             height_QueryImageAttributesReply ::+                                                             CARD16,+                                                             pitches_QueryImageAttributesReply ::+                                                             [CARD32],+                                                             offsets_QueryImageAttributesReply ::+                                                             [CARD32]}+                               deriving (Show, Typeable)+ +instance Deserialize QueryImageAttributesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num_planes <- deserialize+               data_size <- deserialize+               width <- deserialize+               height <- deserialize+               skip 12+               pitches <- deserializeList (fromIntegral num_planes)+               offsets <- deserializeList (fromIntegral num_planes)+               let _ = isCard32 length+               return+                 (MkQueryImageAttributesReply num_planes data_size width height+                    pitches+                    offsets)+ +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]}+              deriving (Show, Typeable)+ +instance ExtensionRequest PutImage where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 18+               let size__+                     = 4 + size (port_PutImage x) + size (drawable_PutImage x) ++                         size (gc_PutImage x)+                         + size (id_PutImage x)+                         + size (src_x_PutImage x)+                         + size (src_y_PutImage x)+                         + size (src_w_PutImage x)+                         + size (src_h_PutImage x)+                         + size (drw_x_PutImage x)+                         + size (drw_y_PutImage x)+                         + size (drw_w_PutImage x)+                         + size (drw_h_PutImage x)+                         + size (width_PutImage x)+                         + size (height_PutImage x)+                         + sum (map size (data_PutImage x))+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_PutImage x)+               serialize (drawable_PutImage x)+               serialize (gc_PutImage x)+               serialize (id_PutImage x)+               serialize (src_x_PutImage x)+               serialize (src_y_PutImage x)+               serialize (src_w_PutImage x)+               serialize (src_h_PutImage x)+               serialize (drw_x_PutImage x)+               serialize (drw_y_PutImage x)+               serialize (drw_w_PutImage x)+               serialize (drw_h_PutImage x)+               serialize (width_PutImage x)+               serialize (height_PutImage x)+               serializeList (data_PutImage x)+               putSkip (requiredPadding size__)+ +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}+                 deriving (Show, Typeable)+ +instance ExtensionRequest ShmPutImage where+        extensionId _ = "XVideo"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 19+               let size__+                     = 4 + size (port_ShmPutImage x) + size (drawable_ShmPutImage x) ++                         size (gc_ShmPutImage x)+                         + size (shmseg_ShmPutImage x)+                         + size (id_ShmPutImage x)+                         + size (offset_ShmPutImage x)+                         + size (src_x_ShmPutImage x)+                         + size (src_y_ShmPutImage x)+                         + size (src_w_ShmPutImage x)+                         + size (src_h_ShmPutImage x)+                         + size (drw_x_ShmPutImage x)+                         + size (drw_y_ShmPutImage x)+                         + size (drw_w_ShmPutImage x)+                         + size (drw_h_ShmPutImage x)+                         + size (width_ShmPutImage x)+                         + size (height_ShmPutImage x)+                         + size (send_event_ShmPutImage x)+                         + 3+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_ShmPutImage x)+               serialize (drawable_ShmPutImage x)+               serialize (gc_ShmPutImage x)+               serialize (shmseg_ShmPutImage x)+               serialize (id_ShmPutImage x)+               serialize (offset_ShmPutImage x)+               serialize (src_x_ShmPutImage x)+               serialize (src_y_ShmPutImage x)+               serialize (src_w_ShmPutImage x)+               serialize (src_h_ShmPutImage x)+               serialize (drw_x_ShmPutImage x)+               serialize (drw_y_ShmPutImage x)+               serialize (drw_w_ShmPutImage x)+               serialize (drw_h_ShmPutImage x)+               serialize (width_ShmPutImage x)+               serialize (height_ShmPutImage x)+               serialize (send_event_ShmPutImage x)+               putSkip 3+               putSkip (requiredPadding size__)
+ patched/Graphics/XHB/Gen/XvMC.hs view
@@ -0,0 +1,108 @@+module Graphics.XHB.Gen.XvMC+       (extension, queryVersion, listSurfaceTypes, createContext,+        destroyContext, createSurface, destroySurface, createSubpicture,+        destroySubpicture, listSubpictureTypes,+        module Graphics.XHB.Gen.XvMC.Types)+       where+import Graphics.XHB.Gen.XvMC.Types+import Graphics.XHB.Connection.Internal+import Graphics.XHB.Connection.Extension+import Graphics.XHB.Connection.Types+import Control.Concurrent.STM+import Foreign.C.Types+import Data.Binary.Put (runPut)+import Graphics.XHB.Shared hiding (Event(..), Error(..))+import Graphics.XHB.Gen.Xv.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xv.Types+ +extension :: ExtensionId+extension = "XVideo-MotionCompensation"+ +queryVersion ::+               Graphics.XHB.Connection.Types.Connection ->+                 IO (Receipt QueryVersionReply)+queryVersion c+  = do receipt <- newEmptyReceiptIO+       let req = MkQueryVersion+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +listSurfaceTypes ::+                   Graphics.XHB.Connection.Types.Connection ->+                     PORT -> IO (Receipt ListSurfaceTypesReply)+listSurfaceTypes c port_id+  = do receipt <- newEmptyReceiptIO+       let req = MkListSurfaceTypes port_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +createContext ::+                Graphics.XHB.Connection.Types.Connection ->+                  CreateContext -> IO (Receipt CreateContextReply)+createContext c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +destroyContext ::+                 Graphics.XHB.Connection.Types.Connection -> CONTEXT -> IO ()+destroyContext c context_id+  = do let req = MkDestroyContext context_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createSurface ::+                Graphics.XHB.Connection.Types.Connection ->+                  SURFACE -> CONTEXT -> IO (Receipt CreateSurfaceReply)+createSurface c surface_id context_id+  = do receipt <- newEmptyReceiptIO+       let req = MkCreateSurface surface_id context_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +destroySurface ::+                 Graphics.XHB.Connection.Types.Connection -> SURFACE -> IO ()+destroySurface c surface_id+  = do let req = MkDestroySurface surface_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +createSubpicture ::+                   Graphics.XHB.Connection.Types.Connection ->+                     CreateSubpicture -> IO (Receipt CreateSubpictureReply)+createSubpicture c req+  = do receipt <- newEmptyReceiptIO+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt+ +destroySubpicture ::+                    Graphics.XHB.Connection.Types.Connection -> SUBPICTURE -> IO ()+destroySubpicture c subpicture_id+  = do let req = MkDestroySubpicture subpicture_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequest c chunk+ +listSubpictureTypes ::+                      Graphics.XHB.Connection.Types.Connection ->+                        PORT -> SURFACE -> IO (Receipt ListSubpictureTypesReply)+listSubpictureTypes c port_id surface_id+  = do receipt <- newEmptyReceiptIO+       let req = MkListSubpictureTypes port_id surface_id+       putAction <- serializeExtensionRequest c req+       let chunk = runPut putAction+       sendRequestWithReply c chunk receipt+       return receipt
+ patched/Graphics/XHB/Gen/XvMC/Types.hs view
@@ -0,0 +1,367 @@+module Graphics.XHB.Gen.XvMC.Types+       (deserializeError, deserializeEvent, CONTEXT, SURFACE, SUBPICTURE,+        SurfaceInfo(..), QueryVersion(..), QueryVersionReply(..),+        ListSurfaceTypes(..), ListSurfaceTypesReply(..), CreateContext(..),+        CreateContextReply(..), DestroyContext(..), CreateSurface(..),+        CreateSurfaceReply(..), DestroySurface(..), CreateSubpicture(..),+        CreateSubpictureReply(..), DestroySubpicture(..),+        ListSubpictureTypes(..), ListSubpictureTypesReply(..))+       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+import Graphics.XHB.Gen.Xv.Types+       hiding (deserializeError, deserializeEvent)+import qualified Graphics.XHB.Gen.Xv.Types+ +deserializeError :: Word8 -> Maybe (Get SomeError)+deserializeError _ = Nothing+ +deserializeEvent :: Word8 -> Maybe (Get SomeEvent)+deserializeEvent _ = Nothing+ +newtype CONTEXT = MkCONTEXT Xid+                  deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype SURFACE = MkSURFACE Xid+                  deriving (Eq, Ord, Show, Serialize, Deserialize, XidLike)+ +newtype SUBPICTURE = MkSUBPICTURE Xid+                     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}+                 deriving (Show, Typeable)+ +instance Serialize SurfaceInfo where+        serialize x+          = do serialize (id_SurfaceInfo x)+               serialize (chroma_format_SurfaceInfo x)+               serialize (pad0_SurfaceInfo x)+               serialize (max_width_SurfaceInfo x)+               serialize (max_height_SurfaceInfo x)+               serialize (subpicture_max_width_SurfaceInfo x)+               serialize (subpicture_max_height_SurfaceInfo x)+               serialize (mc_type_SurfaceInfo x)+               serialize (flags_SurfaceInfo x)+        size x+          = size (id_SurfaceInfo x) + size (chroma_format_SurfaceInfo x) ++              size (pad0_SurfaceInfo x)+              + size (max_width_SurfaceInfo x)+              + size (max_height_SurfaceInfo x)+              + size (subpicture_max_width_SurfaceInfo x)+              + size (subpicture_max_height_SurfaceInfo x)+              + size (mc_type_SurfaceInfo x)+              + size (flags_SurfaceInfo x)+ +instance Deserialize SurfaceInfo where+        deserialize+          = do id <- deserialize+               chroma_format <- deserialize+               pad0 <- deserialize+               max_width <- deserialize+               max_height <- deserialize+               subpicture_max_width <- deserialize+               subpicture_max_height <- deserialize+               mc_type <- deserialize+               flags <- deserialize+               return+                 (MkSurfaceInfo id chroma_format pad0 max_width max_height+                    subpicture_max_width+                    subpicture_max_height+                    mc_type+                    flags)+ +data QueryVersion = MkQueryVersion{}+                  deriving (Show, Typeable)+ +instance ExtensionRequest QueryVersion where+        extensionId _ = "XVideo-MotionCompensation"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 0+               let size__ = 4+               serialize (convertBytesToRequestSize size__ :: INT16)+               putSkip (requiredPadding size__)+ +data QueryVersionReply = MkQueryVersionReply{major_QueryVersionReply+                                             :: CARD32,+                                             minor_QueryVersionReply :: CARD32}+                       deriving (Show, Typeable)+ +instance Deserialize QueryVersionReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               major <- deserialize+               minor <- deserialize+               let _ = isCard32 length+               return (MkQueryVersionReply major minor)+ +data ListSurfaceTypes = MkListSurfaceTypes{port_id_ListSurfaceTypes+                                           :: PORT}+                      deriving (Show, Typeable)+ +instance ExtensionRequest ListSurfaceTypes where+        extensionId _ = "XVideo-MotionCompensation"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 1+               let size__ = 4 + size (port_id_ListSurfaceTypes x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_id_ListSurfaceTypes x)+               putSkip (requiredPadding size__)+ +data ListSurfaceTypesReply = MkListSurfaceTypesReply{num_ListSurfaceTypesReply+                                                     :: CARD32,+                                                     surfaces_ListSurfaceTypesReply ::+                                                     [SurfaceInfo]}+                           deriving (Show, Typeable)+ +instance Deserialize ListSurfaceTypesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num <- deserialize+               skip 20+               surfaces <- deserializeList (fromIntegral num)+               let _ = isCard32 length+               return (MkListSurfaceTypesReply num surfaces)+ +data CreateContext = MkCreateContext{context_id_CreateContext ::+                                     CONTEXT,+                                     port_id_CreateContext :: PORT,+                                     surface_id_CreateContext :: SURFACE,+                                     width_CreateContext :: CARD16, height_CreateContext :: CARD16,+                                     flags_CreateContext :: CARD32}+                   deriving (Show, Typeable)+ +instance ExtensionRequest CreateContext where+        extensionId _ = "XVideo-MotionCompensation"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 2+               let size__+                     = 4 + size (context_id_CreateContext x) ++                         size (port_id_CreateContext x)+                         + size (surface_id_CreateContext x)+                         + size (width_CreateContext x)+                         + size (height_CreateContext x)+                         + size (flags_CreateContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_id_CreateContext x)+               serialize (port_id_CreateContext x)+               serialize (surface_id_CreateContext x)+               serialize (width_CreateContext x)+               serialize (height_CreateContext x)+               serialize (flags_CreateContext x)+               putSkip (requiredPadding size__)+ +data CreateContextReply = MkCreateContextReply{width_actual_CreateContextReply+                                               :: CARD16,+                                               height_actual_CreateContextReply :: CARD16,+                                               flags_return_CreateContextReply :: CARD32,+                                               priv_data_CreateContextReply :: [CARD32]}+                        deriving (Show, Typeable)+ +instance Deserialize CreateContextReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               width_actual <- deserialize+               height_actual <- deserialize+               flags_return <- deserialize+               skip 20+               priv_data <- deserializeList (fromIntegral length)+               let _ = isCard32 length+               return+                 (MkCreateContextReply width_actual height_actual flags_return+                    priv_data)+ +data DestroyContext = MkDestroyContext{context_id_DestroyContext ::+                                       CONTEXT}+                    deriving (Show, Typeable)+ +instance ExtensionRequest DestroyContext where+        extensionId _ = "XVideo-MotionCompensation"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 3+               let size__ = 4 + size (context_id_DestroyContext x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (context_id_DestroyContext x)+               putSkip (requiredPadding size__)+ +data CreateSurface = MkCreateSurface{surface_id_CreateSurface ::+                                     SURFACE,+                                     context_id_CreateSurface :: CONTEXT}+                   deriving (Show, Typeable)+ +instance ExtensionRequest CreateSurface where+        extensionId _ = "XVideo-MotionCompensation"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 4+               let size__+                     = 4 + size (surface_id_CreateSurface x) ++                         size (context_id_CreateSurface x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (surface_id_CreateSurface x)+               serialize (context_id_CreateSurface x)+               putSkip (requiredPadding size__)+ +data CreateSurfaceReply = MkCreateSurfaceReply{priv_data_CreateSurfaceReply+                                               :: [CARD32]}+                        deriving (Show, Typeable)+ +instance Deserialize CreateSurfaceReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               skip 24+               priv_data <- deserializeList (fromIntegral length)+               let _ = isCard32 length+               return (MkCreateSurfaceReply priv_data)+ +data DestroySurface = MkDestroySurface{surface_id_DestroySurface ::+                                       SURFACE}+                    deriving (Show, Typeable)+ +instance ExtensionRequest DestroySurface where+        extensionId _ = "XVideo-MotionCompensation"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 5+               let size__ = 4 + size (surface_id_DestroySurface x)+               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}+                      deriving (Show, Typeable)+ +instance ExtensionRequest CreateSubpicture where+        extensionId _ = "XVideo-MotionCompensation"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 6+               let size__+                     = 4 + size (subpicture_id_CreateSubpicture x) ++                         size (context_CreateSubpicture x)+                         + size (xvimage_id_CreateSubpicture x)+                         + size (width_CreateSubpicture x)+                         + size (height_CreateSubpicture x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (subpicture_id_CreateSubpicture x)+               serialize (context_CreateSubpicture x)+               serialize (xvimage_id_CreateSubpicture x)+               serialize (width_CreateSubpicture x)+               serialize (height_CreateSubpicture x)+               putSkip (requiredPadding size__)+ +data CreateSubpictureReply = MkCreateSubpictureReply{width_actual_CreateSubpictureReply+                                                     :: CARD16,+                                                     height_actual_CreateSubpictureReply :: CARD16,+                                                     num_palette_entries_CreateSubpictureReply ::+                                                     CARD16,+                                                     entry_bytes_CreateSubpictureReply :: CARD16,+                                                     component_order_CreateSubpictureReply ::+                                                     [CARD8],+                                                     priv_data_CreateSubpictureReply :: [CARD32]}+                           deriving (Show, Typeable)+ +instance Deserialize CreateSubpictureReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               width_actual <- deserialize+               height_actual <- deserialize+               num_palette_entries <- deserialize+               entry_bytes <- deserialize+               component_order <- deserializeList (fromIntegral 4)+               skip 12+               priv_data <- deserializeList (fromIntegral length)+               let _ = isCard32 length+               return+                 (MkCreateSubpictureReply width_actual height_actual+                    num_palette_entries+                    entry_bytes+                    component_order+                    priv_data)+ +data DestroySubpicture = MkDestroySubpicture{subpicture_id_DestroySubpicture+                                             :: SUBPICTURE}+                       deriving (Show, Typeable)+ +instance ExtensionRequest DestroySubpicture where+        extensionId _ = "XVideo-MotionCompensation"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 7+               let size__ = 4 + size (subpicture_id_DestroySubpicture x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (subpicture_id_DestroySubpicture x)+               putSkip (requiredPadding size__)+ +data ListSubpictureTypes = MkListSubpictureTypes{port_id_ListSubpictureTypes+                                                 :: PORT,+                                                 surface_id_ListSubpictureTypes :: SURFACE}+                         deriving (Show, Typeable)+ +instance ExtensionRequest ListSubpictureTypes where+        extensionId _ = "XVideo-MotionCompensation"+        serializeRequest x extOpCode+          = do putWord8 extOpCode+               putWord8 8+               let size__+                     = 4 + size (port_id_ListSubpictureTypes x) ++                         size (surface_id_ListSubpictureTypes x)+               serialize (convertBytesToRequestSize size__ :: INT16)+               serialize (port_id_ListSubpictureTypes x)+               serialize (surface_id_ListSubpictureTypes x)+               putSkip (requiredPadding size__)+ +data ListSubpictureTypesReply = MkListSubpictureTypesReply{num_ListSubpictureTypesReply+                                                           :: CARD32,+                                                           types_ListSubpictureTypesReply ::+                                                           [ImageFormatInfo]}+                              deriving (Show, Typeable)+ +instance Deserialize ListSubpictureTypesReply where+        deserialize+          = do skip 1+               skip 1+               skip 2+               length <- deserialize+               num <- deserialize+               skip 20+               types <- deserializeList (fromIntegral num)+               let _ = isCard32 length+               return (MkListSubpictureTypesReply num types)
+ xhb.cabal view
@@ -0,0 +1,99 @@+Name:         xhb+Version:      0.0.2009.1.6+Cabal-Version:  >= 1.2.3+Synopsis:     X Haskell Bindings+Description:+  Provides low-level bindings to the X11 protocol.+  .+  Similar to XCB - the X C Bindings.+  .+  This library is based on version 1.3 of the xcb-proto+  package.  See http:\/\/xcb.freedesktop.org\/XmlXcb\/ and+  http:\/\/xcb.freedesktop.org\/dist\/ .++License:      BSD3+License-file: LICENSE+Author:       See CONTRIBUTORS file+Maintainer:   Antoine Latter <aslatter@gmail.com>+Homepage: http://community.haskell.org/~aslatter/code/xhb+Build-type: Simple++Category: Graphics++Extra-source-files: CONTRIBUTORS++Library++ Build-depends: base, stm, Xauth, binary, bytestring, containers,+      parsec, network, byteorder++ Extensions: ExistentialQuantification,+             DeriveDataTypeable,+             GeneralizedNewtypeDeriving++ Exposed-modules:+   Graphics.XHB,+   Graphics.XHB.Connection,+   Graphics.XHB.Connection.Extension,+   Graphics.XHB.Connection.Open,+   Graphics.XHB.Gen.BigRequests,+   Graphics.XHB.Gen.Composite,+   Graphics.XHB.Gen.Damage,+   Graphics.XHB.Gen.DPMS,+   Graphics.XHB.Gen.Glx,+   Graphics.XHB.Gen.RandR,+   Graphics.XHB.Gen.Record,+   Graphics.XHB.Gen.Render,+   Graphics.XHB.Gen.Res,+   Graphics.XHB.Gen.ScreenSaver,+   Graphics.XHB.Gen.Shape,+   Graphics.XHB.Gen.Shm,+   Graphics.XHB.Gen.Sync,+   Graphics.XHB.Gen.XCMisc,+   Graphics.XHB.Gen.Xevie,+   Graphics.XHB.Gen.XF86Dri,+   Graphics.XHB.Gen.XFixes,+   Graphics.XHB.Gen.Xinerama,+   Graphics.XHB.Gen.Input,+   Graphics.XHB.Gen.XPrint,+   Graphics.XHB.Gen.Xproto,+   Graphics.XHB.Gen.SELinux,+   Graphics.XHB.Gen.Test,+   Graphics.XHB.Gen.Xv,+   Graphics.XHB.Gen.XvMC++ Other-modules:+   Graphics.XHB.Shared,+   Graphics.XHB.Connection.Auth,+   Graphics.XHB.Connection.Internal,+   Graphics.XHB.Connection.Types,+   Graphics.XHB.Gen.BigRequests.Types,+   Graphics.XHB.Gen.Composite.Types,+   Graphics.XHB.Gen.Damage.Types,+   Graphics.XHB.Gen.DPMS.Types,+   Graphics.XHB.Gen.Glx.Types,+   Graphics.XHB.Gen.RandR.Types,+   Graphics.XHB.Gen.Record.Types,+   Graphics.XHB.Gen.Render.Types,+   Graphics.XHB.Gen.Res.Types,+   Graphics.XHB.Gen.ScreenSaver.Types,+   Graphics.XHB.Gen.Shape.Types,+   Graphics.XHB.Gen.Shm.Types,+   Graphics.XHB.Gen.Sync.Types,+   Graphics.XHB.Gen.XCMisc.Types,+   Graphics.XHB.Gen.Xevie.Types,+   Graphics.XHB.Gen.XF86Dri.Types,+   Graphics.XHB.Gen.XFixes.Types,+   Graphics.XHB.Gen.Xinerama.Types,+   Graphics.XHB.Gen.Input.Types,+   Graphics.XHB.Gen.XPrint.Types,+   Graphics.XHB.Gen.Xproto.Types,+   Graphics.XHB.Gen.SELinux.Types,+   Graphics.XHB.Gen.Test.Types,+   Graphics.XHB.Gen.Xv.Types,+   Graphics.XHB.Gen.XvMC.Types,+   Graphics.XHB.Gen.Extension++ hs-source-dirs: . patched++