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

instance RequestWithReply QueryExtension QueryExtensionReply where
        requestWithReplyIO (MkQueryExtension) conn
          = fmap getReply (queryExtension conn)

instance RequestWithReply QueryAdaptors QueryAdaptorsReply where
        requestWithReplyIO (MkQueryAdaptors a) conn
          = fmap getReply (queryAdaptors conn a)

instance RequestWithReply QueryEncodings QueryEncodingsReply where
        requestWithReplyIO (MkQueryEncodings a) conn
          = fmap getReply (queryEncodings conn a)

instance RequestWithReply GrabPort GrabPortReply where
        requestWithReplyIO (MkGrabPort a b) conn
          = fmap (fmap (second MkGrabPortReply))
              (fmap getReply (grabPort conn a b))

instance Request UngrabPort where
        requestIO (MkUngrabPort a b) conn = ungrabPort conn a b

instance Request PutVideo where
        requestIO req conn = putVideo conn req

instance Request PutStill where
        requestIO req conn = putStill conn req

instance Request GetVideo where
        requestIO req conn = getVideo conn req

instance Request GetStill where
        requestIO req conn = getStill conn req

instance Request StopVideo where
        requestIO (MkStopVideo a b) conn = stopVideo conn a b

instance Request SelectVideoNotify where
        requestIO (MkSelectVideoNotify a b) conn
          = selectVideoNotify conn a b

instance Request SelectPortNotify where
        requestIO (MkSelectPortNotify a b) conn = selectPortNotify conn a b

instance RequestWithReply QueryBestSize QueryBestSizeReply where
        requestWithReplyIO req conn
          = fmap getReply (queryBestSize conn req)

instance Request SetPortAttribute where
        requestIO req conn = setPortAttribute conn req

instance RequestWithReply GetPortAttribute GetPortAttributeReply
         where
        requestWithReplyIO (MkGetPortAttribute a b) conn
          = fmap (fmap (second MkGetPortAttributeReply))
              (fmap getReply (getPortAttribute conn a b))

instance RequestWithReply QueryPortAttributes
         QueryPortAttributesReply where
        requestWithReplyIO (MkQueryPortAttributes a) conn
          = fmap getReply (queryPortAttributes conn a)

instance RequestWithReply ListImageFormats ListImageFormatsReply
         where
        requestWithReplyIO (MkListImageFormats a) conn
          = fmap getReply (listImageFormats conn a)

instance RequestWithReply QueryImageAttributes
         QueryImageAttributesReply where
        requestWithReplyIO req conn
          = fmap getReply (queryImageAttributes conn req)

instance Request PutImage where
        requestIO req conn = putImage conn req

instance Request ShmPutImage where
        requestIO req conn = shmPutImage conn req