-- GENERATED by C->Haskell Compiler, version 0.28.5 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/X.chs" #-}
{-# LANGUAGE CPP, FlexibleContexts #-}

module Graphics.UI.FLTK.LowLevel.X (flcOpenDisplay, flcXid) where
import qualified Foreign.Ptr as C2HSImp


import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Hierarchy
import Graphics.UI.FLTK.LowLevel.Dispatch
import Foreign.Ptr



flcOpenDisplay :: IO ()
flcOpenDisplay =
  flcOpenDisplay'_ >>
  return ()

{-# LINE 11 "src/Graphics/UI/FLTK/LowLevel/X.chs" #-}


flcXid' :: (Ptr ()) -> IO ((Ptr ()))
flcXid' a1 =
  let {a1' = id a1} in
  flcXid''_ a1' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 13 "src/Graphics/UI/FLTK/LowLevel/X.chs" #-}

flcXid :: (Parent a WindowBase) => Ref a -> IO (Maybe WindowHandle)
flcXid win =
  withRef
    win
    (
      \winPtr -> do
         res <- flcXid' winPtr
         if (res == nullPtr)
         then return Nothing
         else return (Just (WindowHandle res))
    )

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/X.chs.h flc_open_display"
  flcOpenDisplay'_ :: (IO ())

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/X.chs.h flc_xid"
  flcXid''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))