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

instance RequestWithReply GetExtensionVersion
         GetExtensionVersionReply where
        requestWithReplyIO (MkGetExtensionVersion a b) conn
          = fmap getReply (getExtensionVersion conn a b)

instance RequestWithReply ListInputDevices ListInputDevicesReply
         where
        requestWithReplyIO (MkListInputDevices) conn
          = fmap getReply (listInputDevices conn)

instance RequestWithReply OpenDevice OpenDeviceReply where
        requestWithReplyIO (MkOpenDevice a) conn
          = fmap getReply (openDevice conn a)

instance Request CloseDevice where
        requestIO (MkCloseDevice a) conn = closeDevice conn a

instance RequestWithReply SetDeviceMode SetDeviceModeReply where
        requestWithReplyIO (MkSetDeviceMode a b) conn
          = fmap (fmap (second MkSetDeviceModeReply))
              (fmap getReply (setDeviceMode conn a b))

instance Request SelectExtensionEvent where
        requestIO req conn = selectExtensionEvent conn req

instance RequestWithReply GetSelectedExtensionEvents
         GetSelectedExtensionEventsReply where
        requestWithReplyIO (MkGetSelectedExtensionEvents a) conn
          = fmap getReply (getSelectedExtensionEvents conn a)

instance Request ChangeDeviceDontPropagateList where
        requestIO req conn = changeDeviceDontPropagateList conn req

instance RequestWithReply GetDeviceDontPropagateList
         GetDeviceDontPropagateListReply where
        requestWithReplyIO (MkGetDeviceDontPropagateList a) conn
          = fmap getReply (getDeviceDontPropagateList conn a)

instance RequestWithReply GetDeviceMotionEvents
         GetDeviceMotionEventsReply where
        requestWithReplyIO req conn
          = fmap getReply (getDeviceMotionEvents conn req)

instance RequestWithReply ChangeKeyboardDevice
         ChangeKeyboardDeviceReply where
        requestWithReplyIO (MkChangeKeyboardDevice a) conn
          = fmap (fmap (second MkChangeKeyboardDeviceReply))
              (fmap getReply (changeKeyboardDevice conn a))

instance RequestWithReply ChangePointerDevice
         ChangePointerDeviceReply where
        requestWithReplyIO req conn
          = fmap (fmap (second MkChangePointerDeviceReply))
              (fmap getReply (changePointerDevice conn req))

instance RequestWithReply GrabDevice GrabDeviceReply where
        requestWithReplyIO req conn
          = fmap (fmap (second MkGrabDeviceReply))
              (fmap getReply (grabDevice conn req))

instance Request UngrabDevice where
        requestIO (MkUngrabDevice a b) conn = ungrabDevice conn a b

instance Request GrabDeviceKey where
        requestIO req conn = grabDeviceKey conn req

instance Request UngrabDeviceKey where
        requestIO req conn = ungrabDeviceKey conn req

instance Request GrabDeviceButton where
        requestIO req conn = grabDeviceButton conn req

instance Request UngrabDeviceButton where
        requestIO req conn = ungrabDeviceButton conn req

instance Request AllowDeviceEvents where
        requestIO req conn = allowDeviceEvents conn req

instance RequestWithReply GetDeviceFocus GetDeviceFocusReply where
        requestWithReplyIO (MkGetDeviceFocus a) conn
          = fmap getReply (getDeviceFocus conn a)

instance Request SetDeviceFocus where
        requestIO req conn = setDeviceFocus conn req

instance RequestWithReply GetFeedbackControl
         GetFeedbackControlReply where
        requestWithReplyIO (MkGetFeedbackControl a) conn
          = fmap (fmap (second MkGetFeedbackControlReply))
              (fmap getReply (getFeedbackControl conn a))

instance RequestWithReply GetDeviceKeyMapping
         GetDeviceKeyMappingReply where
        requestWithReplyIO req conn
          = fmap getReply (getDeviceKeyMapping conn req)

instance Request ChangeDeviceKeyMapping where
        requestIO req conn = changeDeviceKeyMapping conn req

instance RequestWithReply GetDeviceModifierMapping
         GetDeviceModifierMappingReply where
        requestWithReplyIO (MkGetDeviceModifierMapping a) conn
          = fmap getReply (getDeviceModifierMapping conn a)

instance RequestWithReply SetDeviceModifierMapping
         SetDeviceModifierMappingReply where
        requestWithReplyIO req conn
          = fmap (fmap (second MkSetDeviceModifierMappingReply))
              (fmap getReply (setDeviceModifierMapping conn req))

instance RequestWithReply GetDeviceButtonMapping
         GetDeviceButtonMappingReply where
        requestWithReplyIO (MkGetDeviceButtonMapping a) conn
          = fmap getReply (getDeviceButtonMapping conn a)

instance RequestWithReply SetDeviceButtonMapping
         SetDeviceButtonMappingReply where
        requestWithReplyIO req conn
          = fmap (fmap (second MkSetDeviceButtonMappingReply))
              (fmap getReply (setDeviceButtonMapping conn req))

instance RequestWithReply QueryDeviceState QueryDeviceStateReply
         where
        requestWithReplyIO (MkQueryDeviceState a) conn
          = fmap (fmap (second MkQueryDeviceStateReply))
              (fmap getReply (queryDeviceState conn a))

instance Request SendExtensionEvent where
        requestIO req conn = sendExtensionEvent conn req

instance Request DeviceBell where
        requestIO req conn = deviceBell conn req

instance RequestWithReply SetDeviceValuators
         SetDeviceValuatorsReply where
        requestWithReplyIO req conn
          = fmap (fmap (second MkSetDeviceValuatorsReply))
              (fmap getReply (setDeviceValuators conn req))

instance RequestWithReply GetDeviceControl GetDeviceControlReply
         where
        requestWithReplyIO (MkGetDeviceControl a b) conn
          = fmap (fmap (second MkGetDeviceControlReply))
              (fmap getReply (getDeviceControl conn a b))