    -- | Copyright  : Will Thompson and Iñaki García Etxebarria
    -- License    : LGPL-2.1
    -- Maintainer : Iñaki García Etxebarria

    #if !defined(__HADDOCK_VERSION__)
    #define ENABLE_OVERLOADING
    #endif

    module GI.Gdk.Callbacks
        (

     -- * Signals

    -- ** ContentDeserializeFunc #signal:ContentDeserializeFunc#

        C_ContentDeserializeFunc                ,
        ContentDeserializeFunc                  ,
        dynamic_ContentDeserializeFunc          ,
        genClosure_ContentDeserializeFunc       ,
        mk_ContentDeserializeFunc               ,
        noContentDeserializeFunc                ,
        wrap_ContentDeserializeFunc             ,

    -- ** ContentSerializeFunc #signal:ContentSerializeFunc#

        C_ContentSerializeFunc                  ,
        ContentSerializeFunc                    ,
        dynamic_ContentSerializeFunc            ,
        genClosure_ContentSerializeFunc         ,
        mk_ContentSerializeFunc                 ,
        noContentSerializeFunc                  ,
        wrap_ContentSerializeFunc               ,

    -- ** CursorGetTextureCallback #signal:CursorGetTextureCallback#

        C_CursorGetTextureCallback              ,
        CursorGetTextureCallback                ,
        dynamic_CursorGetTextureCallback        ,
        genClosure_CursorGetTextureCallback     ,
        mk_CursorGetTextureCallback             ,
        noCursorGetTextureCallback              ,
        wrap_CursorGetTextureCallback           ,

        ) where

    import Data.GI.Base.ShortPrelude
    import qualified Data.GI.Base.ShortPrelude as SP
    import qualified Data.GI.Base.Overloading as O
    import qualified Prelude as P

    import qualified Data.GI.Base.Attributes as GI.Attributes
    import qualified Data.GI.Base.BasicTypes as B.Types
    import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
    import qualified Data.GI.Base.GArray as B.GArray
    import qualified Data.GI.Base.GClosure as B.GClosure
    import qualified Data.GI.Base.GError as B.GError
    import qualified Data.GI.Base.GHashTable as B.GHT
    import qualified Data.GI.Base.GVariant as B.GVariant
    import qualified Data.GI.Base.GValue as B.GValue
    import qualified Data.GI.Base.GParamSpec as B.GParamSpec
    import qualified Data.GI.Base.CallStack as B.CallStack
    import qualified Data.GI.Base.Properties as B.Properties
    import qualified Data.GI.Base.Signals as B.Signals
    import qualified Control.Monad.IO.Class as MIO
    import qualified Data.Coerce as Coerce
    import qualified Data.Text as T
    import qualified Data.Kind as DK
    import qualified Data.ByteString.Char8 as B
    import qualified Data.Map as Map
    import qualified Foreign.Ptr as FP
    import qualified GHC.OverloadedLabels as OL
    import qualified GHC.Records as R
    import qualified Data.Word as DW
    import qualified Data.Int as DI
    import qualified System.Posix.Types as SPT
    import qualified Foreign.C.Types as FCT

    -- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
    #if MIN_VERSION_base(4,18,0)
    import qualified GI.GLib.Callbacks as GLib.Callbacks
    import qualified GI.GLib.Structs.Bytes as GLib.Bytes
    import qualified GI.GObject.Objects.Object as GObject.Object
    import {-# SOURCE #-} qualified GI.Gdk.Enums as Gdk.Enums
    import {-# SOURCE #-} qualified GI.Gdk.Flags as Gdk.Flags
    import {-# SOURCE #-} qualified GI.Gdk.Interfaces.Paintable as Gdk.Paintable
    import {-# SOURCE #-} qualified GI.Gdk.Objects.CicpParams as Gdk.CicpParams
    import {-# SOURCE #-} qualified GI.Gdk.Objects.ContentDeserializer as Gdk.ContentDeserializer
    import {-# SOURCE #-} qualified GI.Gdk.Objects.ContentSerializer as Gdk.ContentSerializer
    import {-# SOURCE #-} qualified GI.Gdk.Objects.Cursor as Gdk.Cursor
    import {-# SOURCE #-} qualified GI.Gdk.Objects.Snapshot as Gdk.Snapshot
    import {-# SOURCE #-} qualified GI.Gdk.Objects.Texture as Gdk.Texture
    import {-# SOURCE #-} qualified GI.Gdk.Structs.ColorState as Gdk.ColorState
    import qualified GI.GdkPixbuf.Objects.Pixbuf as GdkPixbuf.Pixbuf
    import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
    import qualified GI.Gio.Interfaces.File as Gio.File
    import qualified GI.Gio.Interfaces.Icon as Gio.Icon
    import qualified GI.Gio.Interfaces.LoadableIcon as Gio.LoadableIcon
    import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
    import qualified GI.Gio.Objects.InputStream as Gio.InputStream
    import qualified GI.Gio.Objects.OutputStream as Gio.OutputStream

    #else
    import {-# SOURCE #-} qualified GI.Gdk.Objects.ContentDeserializer as Gdk.ContentDeserializer
    import {-# SOURCE #-} qualified GI.Gdk.Objects.ContentSerializer as Gdk.ContentSerializer
    import {-# SOURCE #-} qualified GI.Gdk.Objects.Cursor as Gdk.Cursor
    import {-# SOURCE #-} qualified GI.Gdk.Objects.Texture as Gdk.Texture

    #endif

    -- callback CursorGetTextureCallback
    {- Callable
      { returnType =
          Just (TInterface Name { namespace = "Gdk" , name = "Texture" })
      , returnMayBeNull = True
      , returnTransfer = TransferEverything
      , returnDocumentation =
          Documentation
            { rawDocText =
                Just "the cursor image, or\n  `NULL` if none could be produced."
            , sinceVersion = Nothing
            }
      , args =
          [ Arg
              { argCName = "cursor"
              , argType = TInterface Name { namespace = "Gdk" , name = "Cursor" }
              , argCType = Just "GdkCursor*"
              , direction = DirectionIn
              , mayBeNull = False
              , argDoc =
                  Documentation
                    { rawDocText = Just "the `GdkCursor`" , sinceVersion = Nothing }
              , argScope = ScopeTypeInvalid
              , argClosure = -1
              , argDestroy = -1
              , argCallerAllocates = False
              , argCallbackUserData = False
              , transfer = TransferNothing
              }
          , Arg
              { argCName = "cursor_size"
              , argType = TBasicType TInt
              , argCType = Just "int"
              , direction = DirectionIn
              , mayBeNull = False
              , argDoc =
                  Documentation
                    { rawDocText =
                        Just "the nominal cursor size, in application pixels"
                    , sinceVersion = Nothing
                    }
              , argScope = ScopeTypeInvalid
              , argClosure = -1
              , argDestroy = -1
              , argCallerAllocates = False
              , argCallbackUserData = False
              , transfer = TransferNothing
              }
          , Arg
              { argCName = "scale"
              , argType = TBasicType TDouble
              , argCType = Just "double"
              , direction = DirectionIn
              , mayBeNull = False
              , argDoc =
                  Documentation
                    { rawDocText = Just "the device scale" , sinceVersion = Nothing }
              , argScope = ScopeTypeInvalid
              , argClosure = -1
              , argDestroy = -1
              , argCallerAllocates = False
              , argCallbackUserData = False
              , transfer = TransferNothing
              }
          , Arg
              { argCName = "width"
              , argType = TBasicType TInt
              , argCType = Just "int*"
              , direction = DirectionOut
              , mayBeNull = False
              , argDoc =
                  Documentation
                    { rawDocText =
                        Just
                          "return location for the actual cursor width,\n  in application pixels"
                    , sinceVersion = Nothing
                    }
              , argScope = ScopeTypeInvalid
              , argClosure = -1
              , argDestroy = -1
              , argCallerAllocates = False
              , argCallbackUserData = False
              , transfer = TransferEverything
              }
          , Arg
              { argCName = "height"
              , argType = TBasicType TInt
              , argCType = Just "int*"
              , direction = DirectionOut
              , mayBeNull = False
              , argDoc =
                  Documentation
                    { rawDocText =
                        Just
                          "return location for the actual cursor height,\n  in application pixels"
                    , sinceVersion = Nothing
                    }
              , argScope = ScopeTypeInvalid
              , argClosure = -1
              , argDestroy = -1
              , argCallerAllocates = False
              , argCallbackUserData = False
              , transfer = TransferEverything
              }
          , Arg
              { argCName = "hotspot_x"
              , argType = TBasicType TInt
              , argCType = Just "int*"
              , direction = DirectionOut
              , mayBeNull = False
              , argDoc =
                  Documentation
                    { rawDocText =
                        Just
                          "return location for the hotspot X position,\n  in application pixels"
                    , sinceVersion = Nothing
                    }
              , argScope = ScopeTypeInvalid
              , argClosure = -1
              , argDestroy = -1
              , argCallerAllocates = False
              , argCallbackUserData = False
              , transfer = TransferEverything
              }
          , Arg
              { argCName = "hotspot_y"
              , argType = TBasicType TInt
              , argCType = Just "int*"
              , direction = DirectionOut
              , mayBeNull = False
              , argDoc =
                  Documentation
                    { rawDocText =
                        Just
                          "return location for the hotspot Y position,\n  in application pixels"
                    , sinceVersion = Nothing
                    }
              , argScope = ScopeTypeInvalid
              , argClosure = -1
              , argDestroy = -1
              , argCallerAllocates = False
              , argCallbackUserData = False
              , transfer = TransferEverything
              }
          , Arg
              { argCName = "data"
              , argType = TBasicType TPtr
              , argCType = Just "gpointer"
              , direction = DirectionIn
              , mayBeNull = True
              , argDoc =
                  Documentation
                    { rawDocText = Just "User data for the callback"
                    , sinceVersion = Nothing
                    }
              , argScope = ScopeTypeInvalid
              , argClosure = -1
              , argDestroy = -1
              , argCallerAllocates = False
              , argCallbackUserData = False
              , transfer = TransferNothing
              }
          ]
      , skipReturn = False
      , callableThrows = False
      , callableDeprecated = Nothing
      , callableDocumentation =
          Documentation
            { rawDocText =
                Just
                  "The type of callback used by a dynamic `GdkCursor` to generate\na texture for the cursor image at the given @cursor_size\nand @scale.\n\nThe actual cursor size in application pixels may be different\nfrom @cursor_size x @cursor_size, and will be returned in\n@width, @height. The returned texture should have a size that\ncorresponds to the actual cursor size, in device pixels (i.e.\napplication pixels, multiplied by @scale).\n\nThis function may fail and return `NULL`, in which case\nthe fallback cursor will be used."
            , sinceVersion = Nothing
            }
      , callableResolvable = Nothing
      }
    -}
    -- | Type for the callback on the (unwrapped) C side.
    type C_CursorGetTextureCallback =
        Ptr Gdk.Cursor.Cursor ->
        Int32 ->
        CDouble ->
        Ptr Int32 ->
        Ptr Int32 ->
        Ptr Int32 ->
        Ptr Int32 ->
        Ptr () ->
        IO (Ptr Gdk.Texture.Texture)

    -- Args: [ Arg
    --           { argCName = "cursor"
    --           , argType = TInterface Name { namespace = "Gdk" , name = "Cursor" }
    --           , argCType = Just "GdkCursor*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "the `GdkCursor`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "cursor_size"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just "the nominal cursor size, in application pixels"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "scale"
    --           , argType = TBasicType TDouble
    --           , argCType = Just "double"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "the device scale" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "width"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int*"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "return location for the actual cursor width,\n  in application pixels"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferEverything
    --           }
    --       , Arg
    --           { argCName = "height"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int*"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "return location for the actual cursor height,\n  in application pixels"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferEverything
    --           }
    --       , Arg
    --           { argCName = "hotspot_x"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int*"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "return location for the hotspot X position,\n  in application pixels"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferEverything
    --           }
    --       , Arg
    --           { argCName = "hotspot_y"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int*"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "return location for the hotspot Y position,\n  in application pixels"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferEverything
    --           }
    --       , Arg
    --           { argCName = "data"
    --           , argType = TBasicType TPtr
    --           , argCType = Just "gpointer"
    --           , direction = DirectionIn
    --           , mayBeNull = True
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "User data for the callback"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TInterface Name { namespace = "Gdk" , name = "Texture" })
    -- throws : False
    -- Skip return : False

    foreign import ccall "dynamic" __dynamic_C_CursorGetTextureCallback :: FunPtr C_CursorGetTextureCallback -> C_CursorGetTextureCallback

    -- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
    dynamic_CursorGetTextureCallback ::
        (B.CallStack.HasCallStack, MonadIO m, Gdk.Cursor.IsCursor a) =>
        FunPtr C_CursorGetTextureCallback
        -> a
        -- ^ /@cursor@/: the @GdkCursor@
        -> Int32
        -- ^ /@cursorSize@/: the nominal cursor size, in application pixels
        -> Double
        -- ^ /@scale@/: the device scale
        -> Ptr ()
        -- ^ /@data@/: User data for the callback
        -> m ((Maybe Gdk.Texture.Texture, Int32, Int32, Int32, Int32))
        -- ^ __Returns:__ the cursor image, or
        --   @NULL@ if none could be produced.
    dynamic_CursorGetTextureCallback :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsCursor a) =>
    FunPtr C_CursorGetTextureCallback
    -> a
    -> Int32
    -> Double
    -> Ptr ()
    -> m (Maybe Texture, Int32, Int32, Int32, Int32)
    dynamic_CursorGetTextureCallback FunPtr C_CursorGetTextureCallback
    __funPtr a
    cursor Int32
    cursorSize Double
    scale Ptr ()
    data_ = IO (Maybe Texture, Int32, Int32, Int32, Int32)
    -> m (Maybe Texture, Int32, Int32, Int32, Int32)
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Maybe Texture, Int32, Int32, Int32, Int32)
     -> m (Maybe Texture, Int32, Int32, Int32, Int32))
    -> IO (Maybe Texture, Int32, Int32, Int32, Int32)
    -> m (Maybe Texture, Int32, Int32, Int32, Int32)
    forall a b. (a -> b) -> a -> b
    $ do
        cursor' <- a -> IO (Ptr Cursor)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    cursor
        let scale' = Double -> CDouble
    forall a b. (Real a, Fractional b) => a -> b
    realToFrac Double
    scale
        width <- allocMem :: IO (Ptr Int32)
        height <- allocMem :: IO (Ptr Int32)
        hotspotX <- allocMem :: IO (Ptr Int32)
        hotspotY <- allocMem :: IO (Ptr Int32)
        result <- (__dynamic_C_CursorGetTextureCallback __funPtr) cursor' cursorSize scale' width height hotspotX hotspotY data_
        maybeResult <- convertIfNonNull result $ \Ptr Texture
    result' -> do
            result'' <- ((ManagedPtr Texture -> Texture) -> Ptr Texture -> IO Texture
    forall a b.
    (HasCallStack, GObject a, GObject b) =>
    (ManagedPtr a -> a) -> Ptr b -> IO a
    wrapObject ManagedPtr Texture -> Texture
    Gdk.Texture.Texture) Ptr Texture
    result'
            return result''
        width' <- peek width
        height' <- peek height
        hotspotX' <- peek hotspotX
        hotspotY' <- peek hotspotY
        touchManagedPtr cursor
        freeMem width
        freeMem height
        freeMem hotspotX
        freeMem hotspotY
        return (maybeResult, width', height', hotspotX', hotspotY')

    -- | Generate a function pointer callable from C code, from a `C_CursorGetTextureCallback`.
    foreign import ccall "wrapper"
        mk_CursorGetTextureCallback :: C_CursorGetTextureCallback -> IO (FunPtr C_CursorGetTextureCallback)

    -- | The type of callback used by a dynamic @GdkCursor@ to generate
    -- a texture for the cursor image at the given /@cursorSize@/
    -- and /@scale@/.
    --
    -- The actual cursor size in application pixels may be different
    -- from /@cursorSize@/ x /@cursorSize@/, and will be returned in
    -- /@width@/, /@height@/. The returned texture should have a size that
    -- corresponds to the actual cursor size, in device pixels (i.e.
    -- application pixels, multiplied by /@scale@/).
    --
    -- This function may fail and return @NULL@, in which case
    -- the fallback cursor will be used.
    type CursorGetTextureCallback =
        Gdk.Cursor.Cursor
        -- ^ /@cursor@/: the @GdkCursor@
        -> Int32
        -- ^ /@cursorSize@/: the nominal cursor size, in application pixels
        -> Double
        -- ^ /@scale@/: the device scale
        -> Ptr ()
        -- ^ /@data@/: User data for the callback
        -> IO ((Maybe Gdk.Texture.Texture, Int32, Int32, Int32, Int32))
        -- ^ __Returns:__ the cursor image, or
        --   @NULL@ if none could be produced.

    -- | A convenience synonym for @`Nothing` :: `Maybe` `CursorGetTextureCallback`@.
    noCursorGetTextureCallback :: Maybe CursorGetTextureCallback
    noCursorGetTextureCallback :: Maybe CursorGetTextureCallback
    noCursorGetTextureCallback = Maybe CursorGetTextureCallback
    forall a. Maybe a
    Nothing

    -- | Wrap the callback into a `GClosure`.
    genClosure_CursorGetTextureCallback :: MonadIO m => CursorGetTextureCallback -> m (GClosure C_CursorGetTextureCallback)
    genClosure_CursorGetTextureCallback :: forall (m :: * -> *).
    MonadIO m =>
    CursorGetTextureCallback -> m (GClosure C_CursorGetTextureCallback)
    genClosure_CursorGetTextureCallback CursorGetTextureCallback
    cb = IO (GClosure C_CursorGetTextureCallback)
    -> m (GClosure C_CursorGetTextureCallback)
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (GClosure C_CursorGetTextureCallback)
     -> m (GClosure C_CursorGetTextureCallback))
    -> IO (GClosure C_CursorGetTextureCallback)
    -> m (GClosure C_CursorGetTextureCallback)
    forall a b. (a -> b) -> a -> b
    $ do
        let cb' :: C_CursorGetTextureCallback
    cb' = Maybe (Ptr (FunPtr C_CursorGetTextureCallback))
    -> CursorGetTextureCallback -> C_CursorGetTextureCallback
    wrap_CursorGetTextureCallback Maybe (Ptr (FunPtr C_CursorGetTextureCallback))
    forall a. Maybe a
    Nothing CursorGetTextureCallback
    cb
        C_CursorGetTextureCallback
    -> IO (FunPtr C_CursorGetTextureCallback)
    mk_CursorGetTextureCallback C_CursorGetTextureCallback
    cb' IO (FunPtr C_CursorGetTextureCallback)
    -> (FunPtr C_CursorGetTextureCallback
        -> IO (GClosure C_CursorGetTextureCallback))
    -> IO (GClosure C_CursorGetTextureCallback)
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= FunPtr C_CursorGetTextureCallback
    -> IO (GClosure C_CursorGetTextureCallback)
    forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
    B.GClosure.newGClosure

    -- | Wrap a `CursorGetTextureCallback` into a `C_CursorGetTextureCallback`.
    wrap_CursorGetTextureCallback ::
        Maybe (Ptr (FunPtr C_CursorGetTextureCallback)) ->
        CursorGetTextureCallback ->
        C_CursorGetTextureCallback
    wrap_CursorGetTextureCallback :: Maybe (Ptr (FunPtr C_CursorGetTextureCallback))
    -> CursorGetTextureCallback -> C_CursorGetTextureCallback
    wrap_CursorGetTextureCallback Maybe (Ptr (FunPtr C_CursorGetTextureCallback))
    gi'funptrptr CursorGetTextureCallback
    gi'cb Ptr Cursor
    cursor Int32
    cursorSize CDouble
    scale Ptr Int32
    width Ptr Int32
    height Ptr Int32
    hotspotX Ptr Int32
    hotspotY Ptr ()
    data_ = do
        cursor' <- ((ManagedPtr Cursor -> Cursor) -> Ptr Cursor -> IO Cursor
    forall a b.
    (HasCallStack, GObject a, GObject b) =>
    (ManagedPtr a -> a) -> Ptr b -> IO a
    newObject ManagedPtr Cursor -> Cursor
    Gdk.Cursor.Cursor) Ptr Cursor
    cursor
        let scale' = CDouble -> Double
    forall a b. (Real a, Fractional b) => a -> b
    realToFrac CDouble
    scale
        (result, outwidth, outheight, outhotspotX, outhotspotY) <- gi'cb  cursor' cursorSize scale' data_
        poke width outwidth
        poke height outheight
        poke hotspotX outhotspotX
        poke hotspotY outhotspotY
        maybeReleaseFunPtr gi'funptrptr
        maybeM FP.nullPtr result $ \Texture
    result' -> do
            result'' <- Texture -> IO (Ptr Texture)
    forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
    B.ManagedPtr.disownObject Texture
    result'
            return result''

    -- callback ContentSerializeFunc
    {- Callable
      { returnType = Nothing
      , returnMayBeNull = False
      , returnTransfer = TransferNothing
      , returnDocumentation =
          Documentation { rawDocText = Nothing , sinceVersion = Nothing }
      , args =
          [ Arg
              { argCName = "serializer"
              , argType =
                  TInterface Name { namespace = "Gdk" , name = "ContentSerializer" }
              , argCType = Just "GdkContentSerializer*"
              , direction = DirectionIn
              , mayBeNull = False
              , argDoc =
                  Documentation
                    { rawDocText = Just "a `GdkContentSerializer`"
                    , sinceVersion = Nothing
                    }
              , argScope = ScopeTypeInvalid
              , argClosure = -1
              , argDestroy = -1
              , argCallerAllocates = False
              , argCallbackUserData = False
              , transfer = TransferNothing
              }
          ]
      , skipReturn = False
      , callableThrows = False
      , callableDeprecated = Nothing
      , callableDocumentation =
          Documentation
            { rawDocText =
                Just
                  "The type of a function that can be registered with gdk_content_register_serializer().\n\nWhen the function gets called to operate on content, it can call functions on the\n@serializer object to obtain the mime type, output stream, user data, etc. for its\noperation."
            , sinceVersion = Nothing
            }
      , callableResolvable = Nothing
      }
    -}
    -- | Type for the callback on the (unwrapped) C side.
    type C_ContentSerializeFunc =
        Ptr Gdk.ContentSerializer.ContentSerializer ->
        IO ()

    -- Args: [ Arg
    --           { argCName = "serializer"
    --           , argType =
    --               TInterface Name { namespace = "Gdk" , name = "ContentSerializer" }
    --           , argCType = Just "GdkContentSerializer*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GdkContentSerializer`"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "dynamic" __dynamic_C_ContentSerializeFunc :: FunPtr C_ContentSerializeFunc -> C_ContentSerializeFunc

    -- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
    dynamic_ContentSerializeFunc ::
        (B.CallStack.HasCallStack, MonadIO m, Gdk.ContentSerializer.IsContentSerializer a) =>
        FunPtr C_ContentSerializeFunc
        -> a
        -- ^ /@serializer@/: a @GdkContentSerializer@
        -> m ()
    dynamic_ContentSerializeFunc :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsContentSerializer a) =>
    FunPtr C_ContentSerializeFunc -> a -> m ()
    dynamic_ContentSerializeFunc FunPtr C_ContentSerializeFunc
    __funPtr a
    serializer = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        serializer' <- a -> IO (Ptr ContentSerializer)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    serializer
        (__dynamic_C_ContentSerializeFunc __funPtr) serializer'
        touchManagedPtr serializer
        return ()

    -- | Generate a function pointer callable from C code, from a `C_ContentSerializeFunc`.
    foreign import ccall "wrapper"
        mk_ContentSerializeFunc :: C_ContentSerializeFunc -> IO (FunPtr C_ContentSerializeFunc)

    -- | The type of a function that can be registered with 'GI.Gdk.Functions.contentRegisterSerializer'.
    --
    -- When the function gets called to operate on content, it can call functions on the
    -- /@serializer@/ object to obtain the mime type, output stream, user data, etc. for its
    -- operation.
    type ContentSerializeFunc =
        Gdk.ContentSerializer.ContentSerializer
        -- ^ /@serializer@/: a @GdkContentSerializer@
        -> IO ()

    -- | A convenience synonym for @`Nothing` :: `Maybe` `ContentSerializeFunc`@.
    noContentSerializeFunc :: Maybe ContentSerializeFunc
    noContentSerializeFunc :: Maybe ContentSerializeFunc
    noContentSerializeFunc = Maybe ContentSerializeFunc
    forall a. Maybe a
    Nothing

    -- | Wrap the callback into a `GClosure`.
    genClosure_ContentSerializeFunc :: MonadIO m => ContentSerializeFunc -> m (GClosure C_ContentSerializeFunc)
    genClosure_ContentSerializeFunc :: forall (m :: * -> *).
    MonadIO m =>
    ContentSerializeFunc -> m (GClosure C_ContentSerializeFunc)
    genClosure_ContentSerializeFunc ContentSerializeFunc
    cb = IO (GClosure C_ContentSerializeFunc)
    -> m (GClosure C_ContentSerializeFunc)
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (GClosure C_ContentSerializeFunc)
     -> m (GClosure C_ContentSerializeFunc))
    -> IO (GClosure C_ContentSerializeFunc)
    -> m (GClosure C_ContentSerializeFunc)
    forall a b. (a -> b) -> a -> b
    $ do
        let cb' :: C_ContentSerializeFunc
    cb' = Maybe (Ptr (FunPtr C_ContentSerializeFunc))
    -> ContentSerializeFunc -> C_ContentSerializeFunc
    wrap_ContentSerializeFunc Maybe (Ptr (FunPtr C_ContentSerializeFunc))
    forall a. Maybe a
    Nothing ContentSerializeFunc
    cb
        C_ContentSerializeFunc -> IO (FunPtr C_ContentSerializeFunc)
    mk_ContentSerializeFunc C_ContentSerializeFunc
    cb' IO (FunPtr C_ContentSerializeFunc)
    -> (FunPtr C_ContentSerializeFunc
        -> IO (GClosure C_ContentSerializeFunc))
    -> IO (GClosure C_ContentSerializeFunc)
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= FunPtr C_ContentSerializeFunc
    -> IO (GClosure C_ContentSerializeFunc)
    forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
    B.GClosure.newGClosure

    -- | Wrap a `ContentSerializeFunc` into a `C_ContentSerializeFunc`.
    wrap_ContentSerializeFunc ::
        Maybe (Ptr (FunPtr C_ContentSerializeFunc)) ->
        ContentSerializeFunc ->
        C_ContentSerializeFunc
    wrap_ContentSerializeFunc :: Maybe (Ptr (FunPtr C_ContentSerializeFunc))
    -> ContentSerializeFunc -> C_ContentSerializeFunc
    wrap_ContentSerializeFunc Maybe (Ptr (FunPtr C_ContentSerializeFunc))
    gi'funptrptr ContentSerializeFunc
    gi'cb Ptr ContentSerializer
    serializer = do
        serializer' <- ((ManagedPtr ContentSerializer -> ContentSerializer)
    -> Ptr ContentSerializer -> IO ContentSerializer
    forall a b.
    (HasCallStack, GObject a, GObject b) =>
    (ManagedPtr a -> a) -> Ptr b -> IO a
    newObject ManagedPtr ContentSerializer -> ContentSerializer
    Gdk.ContentSerializer.ContentSerializer) Ptr ContentSerializer
    serializer
        gi'cb  serializer'
        maybeReleaseFunPtr gi'funptrptr

    -- callback ContentDeserializeFunc
    {- Callable
      { returnType = Nothing
      , returnMayBeNull = False
      , returnTransfer = TransferNothing
      , returnDocumentation =
          Documentation { rawDocText = Nothing , sinceVersion = Nothing }
      , args =
          [ Arg
              { argCName = "deserializer"
              , argType =
                  TInterface
                    Name { namespace = "Gdk" , name = "ContentDeserializer" }
              , argCType = Just "GdkContentDeserializer*"
              , direction = DirectionIn
              , mayBeNull = False
              , argDoc =
                  Documentation
                    { rawDocText = Just "a `GdkContentDeserializer`"
                    , sinceVersion = Nothing
                    }
              , argScope = ScopeTypeInvalid
              , argClosure = -1
              , argDestroy = -1
              , argCallerAllocates = False
              , argCallbackUserData = False
              , transfer = TransferNothing
              }
          ]
      , skipReturn = False
      , callableThrows = False
      , callableDeprecated = Nothing
      , callableDocumentation =
          Documentation
            { rawDocText =
                Just
                  "The type of a function that can be registered with gdk_content_register_deserializer().\n\nWhen the function gets called to operate on content, it can call functions on the\n@deserializer object to obtain the mime type, input stream, user data, etc. for its\noperation."
            , sinceVersion = Nothing
            }
      , callableResolvable = Nothing
      }
    -}
    -- | Type for the callback on the (unwrapped) C side.
    type C_ContentDeserializeFunc =
        Ptr Gdk.ContentDeserializer.ContentDeserializer ->
        IO ()

    -- Args: [ Arg
    --           { argCName = "deserializer"
    --           , argType =
    --               TInterface
    --                 Name { namespace = "Gdk" , name = "ContentDeserializer" }
    --           , argCType = Just "GdkContentDeserializer*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GdkContentDeserializer`"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "dynamic" __dynamic_C_ContentDeserializeFunc :: FunPtr C_ContentDeserializeFunc -> C_ContentDeserializeFunc

    -- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
    dynamic_ContentDeserializeFunc ::
        (B.CallStack.HasCallStack, MonadIO m, Gdk.ContentDeserializer.IsContentDeserializer a) =>
        FunPtr C_ContentDeserializeFunc
        -> a
        -- ^ /@deserializer@/: a @GdkContentDeserializer@
        -> m ()
    dynamic_ContentDeserializeFunc :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsContentDeserializer a) =>
    FunPtr C_ContentDeserializeFunc -> a -> m ()
    dynamic_ContentDeserializeFunc FunPtr C_ContentDeserializeFunc
    __funPtr a
    deserializer = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        deserializer' <- a -> IO (Ptr ContentDeserializer)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    deserializer
        (__dynamic_C_ContentDeserializeFunc __funPtr) deserializer'
        touchManagedPtr deserializer
        return ()

    -- | Generate a function pointer callable from C code, from a `C_ContentDeserializeFunc`.
    foreign import ccall "wrapper"
        mk_ContentDeserializeFunc :: C_ContentDeserializeFunc -> IO (FunPtr C_ContentDeserializeFunc)

    -- | The type of a function that can be registered with 'GI.Gdk.Functions.contentRegisterDeserializer'.
    --
    -- When the function gets called to operate on content, it can call functions on the
    -- /@deserializer@/ object to obtain the mime type, input stream, user data, etc. for its
    -- operation.
    type ContentDeserializeFunc =
        Gdk.ContentDeserializer.ContentDeserializer
        -- ^ /@deserializer@/: a @GdkContentDeserializer@
        -> IO ()

    -- | A convenience synonym for @`Nothing` :: `Maybe` `ContentDeserializeFunc`@.
    noContentDeserializeFunc :: Maybe ContentDeserializeFunc
    noContentDeserializeFunc :: Maybe ContentDeserializeFunc
    noContentDeserializeFunc = Maybe ContentDeserializeFunc
    forall a. Maybe a
    Nothing

    -- | Wrap the callback into a `GClosure`.
    genClosure_ContentDeserializeFunc :: MonadIO m => ContentDeserializeFunc -> m (GClosure C_ContentDeserializeFunc)
    genClosure_ContentDeserializeFunc :: forall (m :: * -> *).
    MonadIO m =>
    ContentDeserializeFunc -> m (GClosure C_ContentDeserializeFunc)
    genClosure_ContentDeserializeFunc ContentDeserializeFunc
    cb = IO (GClosure C_ContentDeserializeFunc)
    -> m (GClosure C_ContentDeserializeFunc)
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (GClosure C_ContentDeserializeFunc)
     -> m (GClosure C_ContentDeserializeFunc))
    -> IO (GClosure C_ContentDeserializeFunc)
    -> m (GClosure C_ContentDeserializeFunc)
    forall a b. (a -> b) -> a -> b
    $ do
        let cb' :: C_ContentDeserializeFunc
    cb' = Maybe (Ptr (FunPtr C_ContentDeserializeFunc))
    -> ContentDeserializeFunc -> C_ContentDeserializeFunc
    wrap_ContentDeserializeFunc Maybe (Ptr (FunPtr C_ContentDeserializeFunc))
    forall a. Maybe a
    Nothing ContentDeserializeFunc
    cb
        C_ContentDeserializeFunc -> IO (FunPtr C_ContentDeserializeFunc)
    mk_ContentDeserializeFunc C_ContentDeserializeFunc
    cb' IO (FunPtr C_ContentDeserializeFunc)
    -> (FunPtr C_ContentDeserializeFunc
        -> IO (GClosure C_ContentDeserializeFunc))
    -> IO (GClosure C_ContentDeserializeFunc)
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= FunPtr C_ContentDeserializeFunc
    -> IO (GClosure C_ContentDeserializeFunc)
    forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
    B.GClosure.newGClosure

    -- | Wrap a `ContentDeserializeFunc` into a `C_ContentDeserializeFunc`.
    wrap_ContentDeserializeFunc ::
        Maybe (Ptr (FunPtr C_ContentDeserializeFunc)) ->
        ContentDeserializeFunc ->
        C_ContentDeserializeFunc
    wrap_ContentDeserializeFunc :: Maybe (Ptr (FunPtr C_ContentDeserializeFunc))
    -> ContentDeserializeFunc -> C_ContentDeserializeFunc
    wrap_ContentDeserializeFunc Maybe (Ptr (FunPtr C_ContentDeserializeFunc))
    gi'funptrptr ContentDeserializeFunc
    gi'cb Ptr ContentDeserializer
    deserializer = do
        deserializer' <- ((ManagedPtr ContentDeserializer -> ContentDeserializer)
    -> Ptr ContentDeserializer -> IO ContentDeserializer
    forall a b.
    (HasCallStack, GObject a, GObject b) =>
    (ManagedPtr a -> a) -> Ptr b -> IO a
    newObject ManagedPtr ContentDeserializer -> ContentDeserializer
    Gdk.ContentDeserializer.ContentDeserializer) Ptr ContentDeserializer
    deserializer
        gi'cb  deserializer'
        maybeReleaseFunPtr gi'funptrptr