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

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

instance RequestWithReply SetScreenConfig SetScreenConfigReply
         where
        requestWithReplyIO req conn
          = fmap getReply (setScreenConfig conn req)

instance Request SelectInput where
        requestIO (MkSelectInput a b) conn = selectInput conn a b

instance RequestWithReply GetScreenInfo GetScreenInfoReply where
        requestWithReplyIO (MkGetScreenInfo a) conn
          = fmap getReply (getScreenInfo conn a)

instance RequestWithReply GetScreenSizeRange
         GetScreenSizeRangeReply where
        requestWithReplyIO (MkGetScreenSizeRange a) conn
          = fmap getReply (getScreenSizeRange conn a)

instance Request SetScreenSize where
        requestIO req conn = setScreenSize conn req

instance RequestWithReply GetScreenResources
         GetScreenResourcesReply where
        requestWithReplyIO (MkGetScreenResources a) conn
          = fmap getReply (getScreenResources conn a)

instance RequestWithReply GetOutputInfo GetOutputInfoReply where
        requestWithReplyIO (MkGetOutputInfo a b) conn
          = fmap getReply (getOutputInfo conn a b)

instance RequestWithReply ListOutputProperties
         ListOutputPropertiesReply where
        requestWithReplyIO (MkListOutputProperties a) conn
          = fmap getReply (listOutputProperties conn a)

instance RequestWithReply QueryOutputProperty
         QueryOutputPropertyReply where
        requestWithReplyIO (MkQueryOutputProperty a b) conn
          = fmap getReply (queryOutputProperty conn a b)

instance Request ConfigureOutputProperty where
        requestIO req conn = configureOutputProperty conn req

instance Request ChangeOutputProperty where
        requestIO req conn = changeOutputProperty conn req

instance Request DeleteOutputProperty where
        requestIO (MkDeleteOutputProperty a b) conn
          = deleteOutputProperty conn a b

instance RequestWithReply GetOutputProperty GetOutputPropertyReply
         where
        requestWithReplyIO req conn
          = fmap getReply (getOutputProperty conn req)

instance RequestWithReply CreateMode CreateModeReply where
        requestWithReplyIO req conn
          = fmap (fmap (second MkCreateModeReply))
              (fmap getReply (createMode conn req))

instance Request DestroyMode where
        requestIO (MkDestroyMode a) conn = destroyMode conn a

instance Request AddOutputMode where
        requestIO (MkAddOutputMode a b) conn = addOutputMode conn a b

instance Request DeleteOutputMode where
        requestIO (MkDeleteOutputMode a b) conn = deleteOutputMode conn a b

instance RequestWithReply GetCrtcInfo GetCrtcInfoReply where
        requestWithReplyIO (MkGetCrtcInfo a b) conn
          = fmap getReply (getCrtcInfo conn a b)

instance RequestWithReply SetCrtcConfig SetCrtcConfigReply where
        requestWithReplyIO req conn
          = fmap getReply (setCrtcConfig conn req)

instance RequestWithReply GetCrtcGammaSize GetCrtcGammaSizeReply
         where
        requestWithReplyIO (MkGetCrtcGammaSize a) conn
          = fmap (fmap (second MkGetCrtcGammaSizeReply))
              (fmap getReply (getCrtcGammaSize conn a))

instance RequestWithReply GetCrtcGamma GetCrtcGammaReply where
        requestWithReplyIO (MkGetCrtcGamma a) conn
          = fmap getReply (getCrtcGamma conn a)

instance Request SetCrtcGamma where
        requestIO req conn = setCrtcGamma conn req

instance RequestWithReply GetScreenResourcesCurrent
         GetScreenResourcesCurrentReply where
        requestWithReplyIO (MkGetScreenResourcesCurrent a) conn
          = fmap getReply (getScreenResourcesCurrent conn a)

instance Request SetCrtcTransform where
        requestIO req conn = setCrtcTransform conn req

instance RequestWithReply GetCrtcTransform GetCrtcTransformReply
         where
        requestWithReplyIO (MkGetCrtcTransform a) conn
          = fmap getReply (getCrtcTransform conn a)

instance RequestWithReply GetPanning GetPanningReply where
        requestWithReplyIO (MkGetPanning a) conn
          = fmap getReply (getPanning conn a)

instance RequestWithReply SetPanning SetPanningReply where
        requestWithReplyIO req conn = fmap getReply (setPanning conn req)

instance Request SetOutputPrimary where
        requestIO (MkSetOutputPrimary a b) conn = setOutputPrimary conn a b

instance RequestWithReply GetOutputPrimary GetOutputPrimaryReply
         where
        requestWithReplyIO (MkGetOutputPrimary a) conn
          = fmap (fmap (second MkGetOutputPrimaryReply))
              (fmap getReply (getOutputPrimary conn a))