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

instance Request CreateWindow where
        requestIO req conn = createWindow conn req

instance Request ChangeWindowAttributes where
        requestIO (MkChangeWindowAttributes a b) conn
          = changeWindowAttributes conn a b

instance RequestWithReply GetWindowAttributes
         GetWindowAttributesReply where
        requestWithReplyIO (MkGetWindowAttributes a) conn
          = fmap getReply (getWindowAttributes conn a)

instance Request DestroyWindow where
        requestIO (MkDestroyWindow a) conn = destroyWindow conn a

instance Request DestroySubwindows where
        requestIO (MkDestroySubwindows a) conn = destroySubwindows conn a

instance Request ChangeSaveSet where
        requestIO (MkChangeSaveSet a b) conn = changeSaveSet conn a b

instance Request ReparentWindow where
        requestIO req conn = reparentWindow conn req

instance Request MapWindow where
        requestIO (MkMapWindow a) conn = mapWindow conn a

instance Request MapSubwindows where
        requestIO (MkMapSubwindows a) conn = mapSubwindows conn a

instance Request UnmapWindow where
        requestIO (MkUnmapWindow a) conn = unmapWindow conn a

instance Request UnmapSubwindows where
        requestIO (MkUnmapSubwindows a) conn = unmapSubwindows conn a

instance Request ConfigureWindow where
        requestIO (MkConfigureWindow a b) conn = configureWindow conn a b

instance Request CirculateWindow where
        requestIO (MkCirculateWindow a b) conn = circulateWindow conn a b

instance RequestWithReply GetGeometry GetGeometryReply where
        requestWithReplyIO (MkGetGeometry a) conn
          = fmap getReply (getGeometry conn a)

instance RequestWithReply QueryTree QueryTreeReply where
        requestWithReplyIO (MkQueryTree a) conn
          = fmap getReply (queryTree conn a)

instance RequestWithReply InternAtom InternAtomReply where
        requestWithReplyIO req conn
          = fmap (fmap (second MkInternAtomReply))
              (fmap getReply (internAtom conn req))

instance RequestWithReply GetAtomName GetAtomNameReply where
        requestWithReplyIO (MkGetAtomName a) conn
          = fmap getReply (getAtomName conn a)

instance Request ChangeProperty where
        requestIO req conn = changeProperty conn req

instance Request DeleteProperty where
        requestIO (MkDeleteProperty a b) conn = deleteProperty conn a b

instance RequestWithReply GetProperty GetPropertyReply where
        requestWithReplyIO req conn = fmap getReply (getProperty conn req)

instance RequestWithReply ListProperties ListPropertiesReply where
        requestWithReplyIO (MkListProperties a) conn
          = fmap getReply (listProperties conn a)

instance Request SetSelectionOwner where
        requestIO req conn = setSelectionOwner conn req

instance RequestWithReply GetSelectionOwner GetSelectionOwnerReply
         where
        requestWithReplyIO (MkGetSelectionOwner a) conn
          = fmap (fmap (second MkGetSelectionOwnerReply))
              (fmap getReply (getSelectionOwner conn a))

instance Request ConvertSelection where
        requestIO req conn = convertSelection conn req

instance Request SendEvent where
        requestIO req conn = sendEvent conn req

instance RequestWithReply GrabPointer GrabPointerReply where
        requestWithReplyIO req conn
          = fmap (fmap (second MkGrabPointerReply))
              (fmap getReply (grabPointer conn req))

instance Request UngrabPointer where
        requestIO (MkUngrabPointer a) conn = ungrabPointer conn a

instance Request GrabButton where
        requestIO req conn = grabButton conn req

instance Request UngrabButton where
        requestIO req conn = ungrabButton conn req

instance Request ChangeActivePointerGrab where
        requestIO req conn = changeActivePointerGrab conn req

instance RequestWithReply GrabKeyboard GrabKeyboardReply where
        requestWithReplyIO req conn
          = fmap (fmap (second MkGrabKeyboardReply))
              (fmap getReply (grabKeyboard conn req))

instance Request UngrabKeyboard where
        requestIO (MkUngrabKeyboard a) conn = ungrabKeyboard conn a

instance Request GrabKey where
        requestIO req conn = grabKey conn req

instance Request UngrabKey where
        requestIO req conn = ungrabKey conn req

instance Request AllowEvents where
        requestIO (MkAllowEvents a b) conn = allowEvents conn a b

instance Request GrabServer where
        requestIO (MkGrabServer) conn = grabServer conn

instance Request UngrabServer where
        requestIO (MkUngrabServer) conn = ungrabServer conn

instance RequestWithReply QueryPointer QueryPointerReply where
        requestWithReplyIO (MkQueryPointer a) conn
          = fmap getReply (queryPointer conn a)

instance RequestWithReply GetMotionEvents GetMotionEventsReply
         where
        requestWithReplyIO req conn
          = fmap getReply (getMotionEvents conn req)

instance RequestWithReply TranslateCoordinates
         TranslateCoordinatesReply where
        requestWithReplyIO req conn
          = fmap getReply (translateCoordinates conn req)

instance Request WarpPointer where
        requestIO req conn = warpPointer conn req

instance Request SetInputFocus where
        requestIO req conn = setInputFocus conn req

instance RequestWithReply GetInputFocus GetInputFocusReply where
        requestWithReplyIO (MkGetInputFocus) conn
          = fmap getReply (getInputFocus conn)

instance RequestWithReply QueryKeymap QueryKeymapReply where
        requestWithReplyIO (MkQueryKeymap) conn
          = fmap (fmap (second MkQueryKeymapReply))
              (fmap getReply (queryKeymap conn))

instance Request OpenFont where
        requestIO req conn = openFont conn req

instance Request CloseFont where
        requestIO (MkCloseFont a) conn = closeFont conn a

instance RequestWithReply QueryFont QueryFontReply where
        requestWithReplyIO (MkQueryFont a) conn
          = fmap getReply (queryFont conn a)

instance RequestWithReply QueryTextExtents QueryTextExtentsReply
         where
        requestWithReplyIO (MkQueryTextExtents a b) conn
          = fmap getReply (queryTextExtents conn a b)

instance RequestWithReply ListFonts ListFontsReply where
        requestWithReplyIO req conn = fmap getReply (listFonts conn req)

instance RequestWithReply ListFontsWithInfo ListFontsWithInfoReply
         where
        requestWithReplyIO req conn
          = fmap getReply (listFontsWithInfo conn req)

instance Request SetFontPath where
        requestIO (MkSetFontPath a b) conn = setFontPath conn a b

instance RequestWithReply GetFontPath GetFontPathReply where
        requestWithReplyIO (MkGetFontPath) conn
          = fmap getReply (getFontPath conn)

instance Request CreatePixmap where
        requestIO req conn = createPixmap conn req

instance Request FreePixmap where
        requestIO (MkFreePixmap a) conn = freePixmap conn a

instance Request CreateGC where
        requestIO req conn = createGC conn req

instance Request ChangeGC where
        requestIO (MkChangeGC a b) conn = changeGC conn a b

instance Request CopyGC where
        requestIO req conn = copyGC conn req

instance Request SetDashes where
        requestIO req conn = setDashes conn req

instance Request SetClipRectangles where
        requestIO req conn = setClipRectangles conn req

instance Request FreeGC where
        requestIO (MkFreeGC a) conn = freeGC conn a

instance Request ClearArea where
        requestIO req conn = clearArea conn req

instance Request CopyArea where
        requestIO req conn = copyArea conn req

instance Request CopyPlane where
        requestIO req conn = copyPlane conn req

instance Request PolyPoint where
        requestIO req conn = polyPoint conn req

instance Request PolyLine where
        requestIO req conn = polyLine conn req

instance Request PolySegment where
        requestIO req conn = polySegment conn req

instance Request PolyRectangle where
        requestIO req conn = polyRectangle conn req

instance Request PolyArc where
        requestIO req conn = polyArc conn req

instance Request FillPoly where
        requestIO req conn = fillPoly conn req

instance Request PolyFillRectangle where
        requestIO req conn = polyFillRectangle conn req

instance Request PolyFillArc where
        requestIO req conn = polyFillArc conn req

instance Request PutImage where
        requestIO req conn = putImage conn req

instance RequestWithReply GetImage GetImageReply where
        requestWithReplyIO req conn = fmap getReply (getImage conn req)

instance Request PolyText8 where
        requestIO req conn = polyText8 conn req

instance Request PolyText16 where
        requestIO req conn = polyText16 conn req

instance Request ImageText8 where
        requestIO req conn = imageText8 conn req

instance Request ImageText16 where
        requestIO req conn = imageText16 conn req

instance Request CreateColormap where
        requestIO req conn = createColormap conn req

instance Request FreeColormap where
        requestIO (MkFreeColormap a) conn = freeColormap conn a

instance Request CopyColormapAndFree where
        requestIO (MkCopyColormapAndFree a b) conn
          = copyColormapAndFree conn a b

instance Request InstallColormap where
        requestIO (MkInstallColormap a) conn = installColormap conn a

instance Request UninstallColormap where
        requestIO (MkUninstallColormap a) conn = uninstallColormap conn a

instance RequestWithReply ListInstalledColormaps
         ListInstalledColormapsReply where
        requestWithReplyIO (MkListInstalledColormaps a) conn
          = fmap getReply (listInstalledColormaps conn a)

instance RequestWithReply AllocColor AllocColorReply where
        requestWithReplyIO req conn = fmap getReply (allocColor conn req)

instance RequestWithReply AllocNamedColor AllocNamedColorReply
         where
        requestWithReplyIO req conn
          = fmap getReply (allocNamedColor conn req)

instance RequestWithReply AllocColorCells AllocColorCellsReply
         where
        requestWithReplyIO req conn
          = fmap getReply (allocColorCells conn req)

instance RequestWithReply AllocColorPlanes AllocColorPlanesReply
         where
        requestWithReplyIO req conn
          = fmap getReply (allocColorPlanes conn req)

instance Request FreeColors where
        requestIO req conn = freeColors conn req

instance Request StoreColors where
        requestIO (MkStoreColors a b) conn = storeColors conn a b

instance Request StoreNamedColor where
        requestIO req conn = storeNamedColor conn req

instance RequestWithReply QueryColors QueryColorsReply where
        requestWithReplyIO (MkQueryColors a b) conn
          = fmap getReply (queryColors conn a b)

instance RequestWithReply LookupColor LookupColorReply where
        requestWithReplyIO req conn = fmap getReply (lookupColor conn req)

instance Request CreateCursor where
        requestIO req conn = createCursor conn req

instance Request CreateGlyphCursor where
        requestIO req conn = createGlyphCursor conn req

instance Request FreeCursor where
        requestIO (MkFreeCursor a) conn = freeCursor conn a

instance Request RecolorCursor where
        requestIO req conn = recolorCursor conn req

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

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

instance RequestWithReply ListExtensions ListExtensionsReply where
        requestWithReplyIO (MkListExtensions) conn
          = fmap getReply (listExtensions conn)

instance Request ChangeKeyboardMapping where
        requestIO req conn = changeKeyboardMapping conn req

instance RequestWithReply GetKeyboardMapping
         GetKeyboardMappingReply where
        requestWithReplyIO (MkGetKeyboardMapping a b) conn
          = fmap getReply (getKeyboardMapping conn a b)

instance Request ChangeKeyboardControl where
        requestIO (MkChangeKeyboardControl a) conn
          = changeKeyboardControl conn a

instance RequestWithReply GetKeyboardControl
         GetKeyboardControlReply where
        requestWithReplyIO (MkGetKeyboardControl) conn
          = fmap getReply (getKeyboardControl conn)

instance Request Bell where
        requestIO (MkBell a) conn = bell conn a

instance Request ChangePointerControl where
        requestIO req conn = changePointerControl conn req

instance RequestWithReply GetPointerControl GetPointerControlReply
         where
        requestWithReplyIO (MkGetPointerControl) conn
          = fmap getReply (getPointerControl conn)

instance Request SetScreenSaver where
        requestIO req conn = setScreenSaver conn req

instance RequestWithReply GetScreenSaver GetScreenSaverReply where
        requestWithReplyIO (MkGetScreenSaver) conn
          = fmap getReply (getScreenSaver conn)

instance Request ChangeHosts where
        requestIO req conn = changeHosts conn req

instance RequestWithReply ListHosts ListHostsReply where
        requestWithReplyIO (MkListHosts) conn
          = fmap getReply (listHosts conn)

instance Request SetAccessControl where
        requestIO (MkSetAccessControl a) conn = setAccessControl conn a

instance Request SetCloseDownMode where
        requestIO (MkSetCloseDownMode a) conn = setCloseDownMode conn a

instance Request KillClient where
        requestIO (MkKillClient a) conn = killClient conn a

instance Request RotateProperties where
        requestIO req conn = rotateProperties conn req

instance Request ForceScreenSaver where
        requestIO (MkForceScreenSaver a) conn = forceScreenSaver conn a

instance RequestWithReply SetPointerMapping SetPointerMappingReply
         where
        requestWithReplyIO (MkSetPointerMapping a b) conn
          = fmap (fmap (second MkSetPointerMappingReply))
              (fmap getReply (setPointerMapping conn a b))

instance RequestWithReply GetPointerMapping GetPointerMappingReply
         where
        requestWithReplyIO (MkGetPointerMapping) conn
          = fmap getReply (getPointerMapping conn)

instance RequestWithReply SetModifierMapping
         SetModifierMappingReply where
        requestWithReplyIO (MkSetModifierMapping a b) conn
          = fmap (fmap (second MkSetModifierMappingReply))
              (fmap getReply (setModifierMapping conn a b))

instance RequestWithReply GetModifierMapping
         GetModifierMappingReply where
        requestWithReplyIO (MkGetModifierMapping) conn
          = fmap getReply (getModifierMapping conn)

instance Request NoOperation where
        requestIO (MkNoOperation) conn = noOperation conn