{-# LANGUAGE MultiParamTypeClasses #-}
module Graphics.XHB.Requests.Internal.Instances.XF86Dri () where
import Graphics.XHB.Gen.XF86Dri
import Graphics.XHB.Requests.Internal.Classes
import Prelude (fmap)
import Data.Bifunctor (second)
import Graphics.XHB (getReply)

instance RequestWithReply QueryVersion QueryVersionReply where
        requestWithReplyIO (MkQueryVersion) conn
          = fmap getReply (queryVersion conn)

instance RequestWithReply QueryDirectRenderingCapable
         QueryDirectRenderingCapableReply where
        requestWithReplyIO (MkQueryDirectRenderingCapable a) conn
          = fmap (fmap (second MkQueryDirectRenderingCapableReply))
              (fmap getReply (queryDirectRenderingCapable conn a))

instance RequestWithReply OpenConnection OpenConnectionReply where
        requestWithReplyIO (MkOpenConnection a) conn
          = fmap getReply (openConnection conn a)

instance Request CloseConnection where
        requestIO (MkCloseConnection a) conn = closeConnection conn a

instance RequestWithReply GetClientDriverName
         GetClientDriverNameReply where
        requestWithReplyIO (MkGetClientDriverName a) conn
          = fmap getReply (getClientDriverName conn a)

instance RequestWithReply CreateContext CreateContextReply where
        requestWithReplyIO req conn
          = fmap (fmap (second MkCreateContextReply))
              (fmap getReply (createContext conn req))

instance Request DestroyContext where
        requestIO (MkDestroyContext a b) conn = destroyContext conn a b

instance RequestWithReply CreateDrawable CreateDrawableReply where
        requestWithReplyIO (MkCreateDrawable a b) conn
          = fmap (fmap (second MkCreateDrawableReply))
              (fmap getReply (createDrawable conn a b))

instance Request DestroyDrawable where
        requestIO (MkDestroyDrawable a b) conn = destroyDrawable conn a b

instance RequestWithReply GetDrawableInfo GetDrawableInfoReply
         where
        requestWithReplyIO (MkGetDrawableInfo a b) conn
          = fmap getReply (getDrawableInfo conn a b)

instance RequestWithReply GetDeviceInfo GetDeviceInfoReply where
        requestWithReplyIO (MkGetDeviceInfo a) conn
          = fmap getReply (getDeviceInfo conn a)

instance RequestWithReply AuthConnection AuthConnectionReply where
        requestWithReplyIO (MkAuthConnection a b) conn
          = fmap (fmap (second MkAuthConnectionReply))
              (fmap getReply (authConnection conn a b))