{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

A 'GI.Gdk.Objects.FrameClock.FrameClock' tells the application when to update and repaint a
window. This may be synced to the vertical refresh rate of the
monitor, for example. Even when the frame clock uses a simple timer
rather than a hardware-based vertical sync, the frame clock helps
because it ensures everything paints at the same time (reducing the
total number of frames). The frame clock can also automatically
stop painting when it knows the frames will not be visible, or
scale back animation framerates.

'GI.Gdk.Objects.FrameClock.FrameClock' is designed to be compatible with an OpenGL-based
implementation or with mozRequestAnimationFrame in Firefox,
for example.

A frame clock is idle until someone requests a frame with
'GI.Gdk.Objects.FrameClock.frameClockRequestPhase'. At some later point that makes
sense for the synchronization being implemented, the clock will
process a frame and emit signals for each phase that has been
requested. (See the signals of the 'GI.Gdk.Objects.FrameClock.FrameClock' class for
documentation of the phases. 'GI.Gdk.Flags.FrameClockPhaseUpdate' and the
'GI.Gdk.Objects.FrameClock.FrameClock'::@/update/@ signal are most interesting for application
writers, and are used to update the animations, using the frame time
given by 'GI.Gdk.Objects.FrameClock.frameClockGetFrameTime'.

The frame time is reported in microseconds and generally in the same
timescale as 'GI.GLib.Functions.getMonotonicTime', however, it is not the same
as 'GI.GLib.Functions.getMonotonicTime'. The frame time does not advance during
the time a frame is being painted, and outside of a frame, an attempt
is made so that all calls to 'GI.Gdk.Objects.FrameClock.frameClockGetFrameTime' that
are called at a “similar” time get the same value. This means that
if different animations are timed by looking at the difference in
time between an initial value from 'GI.Gdk.Objects.FrameClock.frameClockGetFrameTime'
and the value inside the 'GI.Gdk.Objects.FrameClock.FrameClock'::@/update/@ signal of the clock,
they will stay exactly synchronized.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Gdk.Objects.FrameClock
    (

-- * Exported types
    FrameClock(..)                          ,
    IsFrameClock                            ,
    toFrameClock                            ,
    noFrameClock                            ,


 -- * Methods
-- ** beginUpdating #method:beginUpdating#

#if ENABLE_OVERLOADING
    FrameClockBeginUpdatingMethodInfo       ,
#endif
    frameClockBeginUpdating                 ,


-- ** endUpdating #method:endUpdating#

#if ENABLE_OVERLOADING
    FrameClockEndUpdatingMethodInfo         ,
#endif
    frameClockEndUpdating                   ,


-- ** getCurrentTimings #method:getCurrentTimings#

#if ENABLE_OVERLOADING
    FrameClockGetCurrentTimingsMethodInfo   ,
#endif
    frameClockGetCurrentTimings             ,


-- ** getFrameCounter #method:getFrameCounter#

#if ENABLE_OVERLOADING
    FrameClockGetFrameCounterMethodInfo     ,
#endif
    frameClockGetFrameCounter               ,


-- ** getFrameTime #method:getFrameTime#

#if ENABLE_OVERLOADING
    FrameClockGetFrameTimeMethodInfo        ,
#endif
    frameClockGetFrameTime                  ,


-- ** getHistoryStart #method:getHistoryStart#

#if ENABLE_OVERLOADING
    FrameClockGetHistoryStartMethodInfo     ,
#endif
    frameClockGetHistoryStart               ,


-- ** getRefreshInfo #method:getRefreshInfo#

#if ENABLE_OVERLOADING
    FrameClockGetRefreshInfoMethodInfo      ,
#endif
    frameClockGetRefreshInfo                ,


-- ** getTimings #method:getTimings#

#if ENABLE_OVERLOADING
    FrameClockGetTimingsMethodInfo          ,
#endif
    frameClockGetTimings                    ,


-- ** requestPhase #method:requestPhase#

#if ENABLE_OVERLOADING
    FrameClockRequestPhaseMethodInfo        ,
#endif
    frameClockRequestPhase                  ,




 -- * Signals
-- ** afterPaint #signal:afterPaint#

    C_FrameClockAfterPaintCallback          ,
    FrameClockAfterPaintCallback            ,
#if ENABLE_OVERLOADING
    FrameClockAfterPaintSignalInfo          ,
#endif
    afterFrameClockAfterPaint               ,
    genClosure_FrameClockAfterPaint         ,
    mk_FrameClockAfterPaintCallback         ,
    noFrameClockAfterPaintCallback          ,
    onFrameClockAfterPaint                  ,
    wrap_FrameClockAfterPaintCallback       ,


-- ** beforePaint #signal:beforePaint#

    C_FrameClockBeforePaintCallback         ,
    FrameClockBeforePaintCallback           ,
#if ENABLE_OVERLOADING
    FrameClockBeforePaintSignalInfo         ,
#endif
    afterFrameClockBeforePaint              ,
    genClosure_FrameClockBeforePaint        ,
    mk_FrameClockBeforePaintCallback        ,
    noFrameClockBeforePaintCallback         ,
    onFrameClockBeforePaint                 ,
    wrap_FrameClockBeforePaintCallback      ,


-- ** flushEvents #signal:flushEvents#

    C_FrameClockFlushEventsCallback         ,
    FrameClockFlushEventsCallback           ,
#if ENABLE_OVERLOADING
    FrameClockFlushEventsSignalInfo         ,
#endif
    afterFrameClockFlushEvents              ,
    genClosure_FrameClockFlushEvents        ,
    mk_FrameClockFlushEventsCallback        ,
    noFrameClockFlushEventsCallback         ,
    onFrameClockFlushEvents                 ,
    wrap_FrameClockFlushEventsCallback      ,


-- ** layout #signal:layout#

    C_FrameClockLayoutCallback              ,
    FrameClockLayoutCallback                ,
#if ENABLE_OVERLOADING
    FrameClockLayoutSignalInfo              ,
#endif
    afterFrameClockLayout                   ,
    genClosure_FrameClockLayout             ,
    mk_FrameClockLayoutCallback             ,
    noFrameClockLayoutCallback              ,
    onFrameClockLayout                      ,
    wrap_FrameClockLayoutCallback           ,


-- ** paint #signal:paint#

    C_FrameClockPaintCallback               ,
    FrameClockPaintCallback                 ,
#if ENABLE_OVERLOADING
    FrameClockPaintSignalInfo               ,
#endif
    afterFrameClockPaint                    ,
    genClosure_FrameClockPaint              ,
    mk_FrameClockPaintCallback              ,
    noFrameClockPaintCallback               ,
    onFrameClockPaint                       ,
    wrap_FrameClockPaintCallback            ,


-- ** resumeEvents #signal:resumeEvents#

    C_FrameClockResumeEventsCallback        ,
    FrameClockResumeEventsCallback          ,
#if ENABLE_OVERLOADING
    FrameClockResumeEventsSignalInfo        ,
#endif
    afterFrameClockResumeEvents             ,
    genClosure_FrameClockResumeEvents       ,
    mk_FrameClockResumeEventsCallback       ,
    noFrameClockResumeEventsCallback        ,
    onFrameClockResumeEvents                ,
    wrap_FrameClockResumeEventsCallback     ,


-- ** update #signal:update#

    C_FrameClockUpdateCallback              ,
    FrameClockUpdateCallback                ,
#if ENABLE_OVERLOADING
    FrameClockUpdateSignalInfo              ,
#endif
    afterFrameClockUpdate                   ,
    genClosure_FrameClockUpdate             ,
    mk_FrameClockUpdateCallback             ,
    noFrameClockUpdateCallback              ,
    onFrameClockUpdate                      ,
    wrap_FrameClockUpdateCallback           ,




    ) 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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.Text as T
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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gdk.Flags as Gdk.Flags
import {-# SOURCE #-} qualified GI.Gdk.Structs.FrameTimings as Gdk.FrameTimings

-- | Memory-managed wrapper type.
newtype FrameClock = FrameClock (ManagedPtr FrameClock)
foreign import ccall "gdk_frame_clock_get_type"
    c_gdk_frame_clock_get_type :: IO GType

instance GObject FrameClock where
    gobjectType = c_gdk_frame_clock_get_type


-- | Type class for types which can be safely cast to `FrameClock`, for instance with `toFrameClock`.
class (GObject o, O.IsDescendantOf FrameClock o) => IsFrameClock o
instance (GObject o, O.IsDescendantOf FrameClock o) => IsFrameClock o

instance O.HasParentTypes FrameClock
type instance O.ParentTypes FrameClock = '[GObject.Object.Object]

-- | Cast to `FrameClock`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toFrameClock :: (MonadIO m, IsFrameClock o) => o -> m FrameClock
toFrameClock = liftIO . unsafeCastTo FrameClock

-- | A convenience alias for `Nothing` :: `Maybe` `FrameClock`.
noFrameClock :: Maybe FrameClock
noFrameClock = Nothing

#if ENABLE_OVERLOADING
type family ResolveFrameClockMethod (t :: Symbol) (o :: *) :: * where
    ResolveFrameClockMethod "beginUpdating" o = FrameClockBeginUpdatingMethodInfo
    ResolveFrameClockMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveFrameClockMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveFrameClockMethod "endUpdating" o = FrameClockEndUpdatingMethodInfo
    ResolveFrameClockMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveFrameClockMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveFrameClockMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveFrameClockMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveFrameClockMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveFrameClockMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveFrameClockMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveFrameClockMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveFrameClockMethod "requestPhase" o = FrameClockRequestPhaseMethodInfo
    ResolveFrameClockMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveFrameClockMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveFrameClockMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveFrameClockMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveFrameClockMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveFrameClockMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveFrameClockMethod "getCurrentTimings" o = FrameClockGetCurrentTimingsMethodInfo
    ResolveFrameClockMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveFrameClockMethod "getFrameCounter" o = FrameClockGetFrameCounterMethodInfo
    ResolveFrameClockMethod "getFrameTime" o = FrameClockGetFrameTimeMethodInfo
    ResolveFrameClockMethod "getHistoryStart" o = FrameClockGetHistoryStartMethodInfo
    ResolveFrameClockMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveFrameClockMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveFrameClockMethod "getRefreshInfo" o = FrameClockGetRefreshInfoMethodInfo
    ResolveFrameClockMethod "getTimings" o = FrameClockGetTimingsMethodInfo
    ResolveFrameClockMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveFrameClockMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveFrameClockMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveFrameClockMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveFrameClockMethod t FrameClock, O.MethodInfo info FrameClock p) => OL.IsLabel t (FrameClock -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- signal FrameClock::after-paint
{- |
This signal ends processing of the frame. Applications
should generally not handle this signal.
-}
type FrameClockAfterPaintCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FrameClockAfterPaintCallback`@.
noFrameClockAfterPaintCallback :: Maybe FrameClockAfterPaintCallback
noFrameClockAfterPaintCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_FrameClockAfterPaintCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_FrameClockAfterPaint :: MonadIO m => FrameClockAfterPaintCallback -> m (GClosure C_FrameClockAfterPaintCallback)
genClosure_FrameClockAfterPaint cb = liftIO $ do
    let cb' = wrap_FrameClockAfterPaintCallback cb
    mk_FrameClockAfterPaintCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `FrameClockAfterPaintCallback` into a `C_FrameClockAfterPaintCallback`.
wrap_FrameClockAfterPaintCallback ::
    FrameClockAfterPaintCallback ->
    C_FrameClockAfterPaintCallback
wrap_FrameClockAfterPaintCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@after-paint@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' frameClock #afterPaint callback
@
-}
onFrameClockAfterPaint :: (IsFrameClock a, MonadIO m) => a -> FrameClockAfterPaintCallback -> m SignalHandlerId
onFrameClockAfterPaint obj cb = liftIO $ do
    let cb' = wrap_FrameClockAfterPaintCallback cb
    cb'' <- mk_FrameClockAfterPaintCallback cb'
    connectSignalFunPtr obj "after-paint" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@after-paint@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' frameClock #afterPaint callback
@
-}
afterFrameClockAfterPaint :: (IsFrameClock a, MonadIO m) => a -> FrameClockAfterPaintCallback -> m SignalHandlerId
afterFrameClockAfterPaint obj cb = liftIO $ do
    let cb' = wrap_FrameClockAfterPaintCallback cb
    cb'' <- mk_FrameClockAfterPaintCallback cb'
    connectSignalFunPtr obj "after-paint" cb'' SignalConnectAfter


-- signal FrameClock::before-paint
{- |
This signal begins processing of the frame. Applications
should generally not handle this signal.
-}
type FrameClockBeforePaintCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FrameClockBeforePaintCallback`@.
noFrameClockBeforePaintCallback :: Maybe FrameClockBeforePaintCallback
noFrameClockBeforePaintCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_FrameClockBeforePaintCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_FrameClockBeforePaint :: MonadIO m => FrameClockBeforePaintCallback -> m (GClosure C_FrameClockBeforePaintCallback)
genClosure_FrameClockBeforePaint cb = liftIO $ do
    let cb' = wrap_FrameClockBeforePaintCallback cb
    mk_FrameClockBeforePaintCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `FrameClockBeforePaintCallback` into a `C_FrameClockBeforePaintCallback`.
wrap_FrameClockBeforePaintCallback ::
    FrameClockBeforePaintCallback ->
    C_FrameClockBeforePaintCallback
wrap_FrameClockBeforePaintCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@before-paint@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' frameClock #beforePaint callback
@
-}
onFrameClockBeforePaint :: (IsFrameClock a, MonadIO m) => a -> FrameClockBeforePaintCallback -> m SignalHandlerId
onFrameClockBeforePaint obj cb = liftIO $ do
    let cb' = wrap_FrameClockBeforePaintCallback cb
    cb'' <- mk_FrameClockBeforePaintCallback cb'
    connectSignalFunPtr obj "before-paint" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@before-paint@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' frameClock #beforePaint callback
@
-}
afterFrameClockBeforePaint :: (IsFrameClock a, MonadIO m) => a -> FrameClockBeforePaintCallback -> m SignalHandlerId
afterFrameClockBeforePaint obj cb = liftIO $ do
    let cb' = wrap_FrameClockBeforePaintCallback cb
    cb'' <- mk_FrameClockBeforePaintCallback cb'
    connectSignalFunPtr obj "before-paint" cb'' SignalConnectAfter


-- signal FrameClock::flush-events
{- |
This signal is used to flush pending motion events that
are being batched up and compressed together. Applications
should not handle this signal.
-}
type FrameClockFlushEventsCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FrameClockFlushEventsCallback`@.
noFrameClockFlushEventsCallback :: Maybe FrameClockFlushEventsCallback
noFrameClockFlushEventsCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_FrameClockFlushEventsCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_FrameClockFlushEvents :: MonadIO m => FrameClockFlushEventsCallback -> m (GClosure C_FrameClockFlushEventsCallback)
genClosure_FrameClockFlushEvents cb = liftIO $ do
    let cb' = wrap_FrameClockFlushEventsCallback cb
    mk_FrameClockFlushEventsCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `FrameClockFlushEventsCallback` into a `C_FrameClockFlushEventsCallback`.
wrap_FrameClockFlushEventsCallback ::
    FrameClockFlushEventsCallback ->
    C_FrameClockFlushEventsCallback
wrap_FrameClockFlushEventsCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@flush-events@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' frameClock #flushEvents callback
@
-}
onFrameClockFlushEvents :: (IsFrameClock a, MonadIO m) => a -> FrameClockFlushEventsCallback -> m SignalHandlerId
onFrameClockFlushEvents obj cb = liftIO $ do
    let cb' = wrap_FrameClockFlushEventsCallback cb
    cb'' <- mk_FrameClockFlushEventsCallback cb'
    connectSignalFunPtr obj "flush-events" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@flush-events@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' frameClock #flushEvents callback
@
-}
afterFrameClockFlushEvents :: (IsFrameClock a, MonadIO m) => a -> FrameClockFlushEventsCallback -> m SignalHandlerId
afterFrameClockFlushEvents obj cb = liftIO $ do
    let cb' = wrap_FrameClockFlushEventsCallback cb
    cb'' <- mk_FrameClockFlushEventsCallback cb'
    connectSignalFunPtr obj "flush-events" cb'' SignalConnectAfter


-- signal FrameClock::layout
{- |
This signal is emitted as the second step of toolkit and
application processing of the frame. Any work to update
sizes and positions of application elements should be
performed. GTK+ normally handles this internally.
-}
type FrameClockLayoutCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FrameClockLayoutCallback`@.
noFrameClockLayoutCallback :: Maybe FrameClockLayoutCallback
noFrameClockLayoutCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_FrameClockLayoutCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_FrameClockLayout :: MonadIO m => FrameClockLayoutCallback -> m (GClosure C_FrameClockLayoutCallback)
genClosure_FrameClockLayout cb = liftIO $ do
    let cb' = wrap_FrameClockLayoutCallback cb
    mk_FrameClockLayoutCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `FrameClockLayoutCallback` into a `C_FrameClockLayoutCallback`.
wrap_FrameClockLayoutCallback ::
    FrameClockLayoutCallback ->
    C_FrameClockLayoutCallback
wrap_FrameClockLayoutCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@layout@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' frameClock #layout callback
@
-}
onFrameClockLayout :: (IsFrameClock a, MonadIO m) => a -> FrameClockLayoutCallback -> m SignalHandlerId
onFrameClockLayout obj cb = liftIO $ do
    let cb' = wrap_FrameClockLayoutCallback cb
    cb'' <- mk_FrameClockLayoutCallback cb'
    connectSignalFunPtr obj "layout" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@layout@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' frameClock #layout callback
@
-}
afterFrameClockLayout :: (IsFrameClock a, MonadIO m) => a -> FrameClockLayoutCallback -> m SignalHandlerId
afterFrameClockLayout obj cb = liftIO $ do
    let cb' = wrap_FrameClockLayoutCallback cb
    cb'' <- mk_FrameClockLayoutCallback cb'
    connectSignalFunPtr obj "layout" cb'' SignalConnectAfter


-- signal FrameClock::paint
{- |
This signal is emitted as the third step of toolkit and
application processing of the frame. The frame is
repainted. GDK normally handles this internally and
produces expose events, which are turned into GTK+
@/GtkWidget::draw/@ signals.
-}
type FrameClockPaintCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FrameClockPaintCallback`@.
noFrameClockPaintCallback :: Maybe FrameClockPaintCallback
noFrameClockPaintCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_FrameClockPaintCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_FrameClockPaint :: MonadIO m => FrameClockPaintCallback -> m (GClosure C_FrameClockPaintCallback)
genClosure_FrameClockPaint cb = liftIO $ do
    let cb' = wrap_FrameClockPaintCallback cb
    mk_FrameClockPaintCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `FrameClockPaintCallback` into a `C_FrameClockPaintCallback`.
wrap_FrameClockPaintCallback ::
    FrameClockPaintCallback ->
    C_FrameClockPaintCallback
wrap_FrameClockPaintCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@paint@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' frameClock #paint callback
@
-}
onFrameClockPaint :: (IsFrameClock a, MonadIO m) => a -> FrameClockPaintCallback -> m SignalHandlerId
onFrameClockPaint obj cb = liftIO $ do
    let cb' = wrap_FrameClockPaintCallback cb
    cb'' <- mk_FrameClockPaintCallback cb'
    connectSignalFunPtr obj "paint" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@paint@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' frameClock #paint callback
@
-}
afterFrameClockPaint :: (IsFrameClock a, MonadIO m) => a -> FrameClockPaintCallback -> m SignalHandlerId
afterFrameClockPaint obj cb = liftIO $ do
    let cb' = wrap_FrameClockPaintCallback cb
    cb'' <- mk_FrameClockPaintCallback cb'
    connectSignalFunPtr obj "paint" cb'' SignalConnectAfter


-- signal FrameClock::resume-events
{- |
This signal is emitted after processing of the frame is
finished, and is handled internally by GTK+ to resume normal
event processing. Applications should not handle this signal.
-}
type FrameClockResumeEventsCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FrameClockResumeEventsCallback`@.
noFrameClockResumeEventsCallback :: Maybe FrameClockResumeEventsCallback
noFrameClockResumeEventsCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_FrameClockResumeEventsCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_FrameClockResumeEvents :: MonadIO m => FrameClockResumeEventsCallback -> m (GClosure C_FrameClockResumeEventsCallback)
genClosure_FrameClockResumeEvents cb = liftIO $ do
    let cb' = wrap_FrameClockResumeEventsCallback cb
    mk_FrameClockResumeEventsCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `FrameClockResumeEventsCallback` into a `C_FrameClockResumeEventsCallback`.
wrap_FrameClockResumeEventsCallback ::
    FrameClockResumeEventsCallback ->
    C_FrameClockResumeEventsCallback
wrap_FrameClockResumeEventsCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@resume-events@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' frameClock #resumeEvents callback
@
-}
onFrameClockResumeEvents :: (IsFrameClock a, MonadIO m) => a -> FrameClockResumeEventsCallback -> m SignalHandlerId
onFrameClockResumeEvents obj cb = liftIO $ do
    let cb' = wrap_FrameClockResumeEventsCallback cb
    cb'' <- mk_FrameClockResumeEventsCallback cb'
    connectSignalFunPtr obj "resume-events" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@resume-events@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' frameClock #resumeEvents callback
@
-}
afterFrameClockResumeEvents :: (IsFrameClock a, MonadIO m) => a -> FrameClockResumeEventsCallback -> m SignalHandlerId
afterFrameClockResumeEvents obj cb = liftIO $ do
    let cb' = wrap_FrameClockResumeEventsCallback cb
    cb'' <- mk_FrameClockResumeEventsCallback cb'
    connectSignalFunPtr obj "resume-events" cb'' SignalConnectAfter


-- signal FrameClock::update
{- |
This signal is emitted as the first step of toolkit and
application processing of the frame. Animations should
be updated using 'GI.Gdk.Objects.FrameClock.frameClockGetFrameTime'.
Applications can connect directly to this signal, or
use @/gtk_widget_add_tick_callback()/@ as a more convenient
interface.
-}
type FrameClockUpdateCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `FrameClockUpdateCallback`@.
noFrameClockUpdateCallback :: Maybe FrameClockUpdateCallback
noFrameClockUpdateCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_FrameClockUpdateCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `GClosure`.
genClosure_FrameClockUpdate :: MonadIO m => FrameClockUpdateCallback -> m (GClosure C_FrameClockUpdateCallback)
genClosure_FrameClockUpdate cb = liftIO $ do
    let cb' = wrap_FrameClockUpdateCallback cb
    mk_FrameClockUpdateCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `FrameClockUpdateCallback` into a `C_FrameClockUpdateCallback`.
wrap_FrameClockUpdateCallback ::
    FrameClockUpdateCallback ->
    C_FrameClockUpdateCallback
wrap_FrameClockUpdateCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@update@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' frameClock #update callback
@
-}
onFrameClockUpdate :: (IsFrameClock a, MonadIO m) => a -> FrameClockUpdateCallback -> m SignalHandlerId
onFrameClockUpdate obj cb = liftIO $ do
    let cb' = wrap_FrameClockUpdateCallback cb
    cb'' <- mk_FrameClockUpdateCallback cb'
    connectSignalFunPtr obj "update" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@update@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' frameClock #update callback
@
-}
afterFrameClockUpdate :: (IsFrameClock a, MonadIO m) => a -> FrameClockUpdateCallback -> m SignalHandlerId
afterFrameClockUpdate obj cb = liftIO $ do
    let cb' = wrap_FrameClockUpdateCallback cb
    cb'' <- mk_FrameClockUpdateCallback cb'
    connectSignalFunPtr obj "update" cb'' SignalConnectAfter


#if ENABLE_OVERLOADING
instance O.HasAttributeList FrameClock
type instance O.AttributeList FrameClock = FrameClockAttributeList
type FrameClockAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
data FrameClockAfterPaintSignalInfo
instance SignalInfo FrameClockAfterPaintSignalInfo where
    type HaskellCallbackType FrameClockAfterPaintSignalInfo = FrameClockAfterPaintCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_FrameClockAfterPaintCallback cb
        cb'' <- mk_FrameClockAfterPaintCallback cb'
        connectSignalFunPtr obj "after-paint" cb'' connectMode

data FrameClockBeforePaintSignalInfo
instance SignalInfo FrameClockBeforePaintSignalInfo where
    type HaskellCallbackType FrameClockBeforePaintSignalInfo = FrameClockBeforePaintCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_FrameClockBeforePaintCallback cb
        cb'' <- mk_FrameClockBeforePaintCallback cb'
        connectSignalFunPtr obj "before-paint" cb'' connectMode

data FrameClockFlushEventsSignalInfo
instance SignalInfo FrameClockFlushEventsSignalInfo where
    type HaskellCallbackType FrameClockFlushEventsSignalInfo = FrameClockFlushEventsCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_FrameClockFlushEventsCallback cb
        cb'' <- mk_FrameClockFlushEventsCallback cb'
        connectSignalFunPtr obj "flush-events" cb'' connectMode

data FrameClockLayoutSignalInfo
instance SignalInfo FrameClockLayoutSignalInfo where
    type HaskellCallbackType FrameClockLayoutSignalInfo = FrameClockLayoutCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_FrameClockLayoutCallback cb
        cb'' <- mk_FrameClockLayoutCallback cb'
        connectSignalFunPtr obj "layout" cb'' connectMode

data FrameClockPaintSignalInfo
instance SignalInfo FrameClockPaintSignalInfo where
    type HaskellCallbackType FrameClockPaintSignalInfo = FrameClockPaintCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_FrameClockPaintCallback cb
        cb'' <- mk_FrameClockPaintCallback cb'
        connectSignalFunPtr obj "paint" cb'' connectMode

data FrameClockResumeEventsSignalInfo
instance SignalInfo FrameClockResumeEventsSignalInfo where
    type HaskellCallbackType FrameClockResumeEventsSignalInfo = FrameClockResumeEventsCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_FrameClockResumeEventsCallback cb
        cb'' <- mk_FrameClockResumeEventsCallback cb'
        connectSignalFunPtr obj "resume-events" cb'' connectMode

data FrameClockUpdateSignalInfo
instance SignalInfo FrameClockUpdateSignalInfo where
    type HaskellCallbackType FrameClockUpdateSignalInfo = FrameClockUpdateCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_FrameClockUpdateCallback cb
        cb'' <- mk_FrameClockUpdateCallback cb'
        connectSignalFunPtr obj "update" cb'' connectMode

type instance O.SignalList FrameClock = FrameClockSignalList
type FrameClockSignalList = ('[ '("afterPaint", FrameClockAfterPaintSignalInfo), '("beforePaint", FrameClockBeforePaintSignalInfo), '("flushEvents", FrameClockFlushEventsSignalInfo), '("layout", FrameClockLayoutSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("paint", FrameClockPaintSignalInfo), '("resumeEvents", FrameClockResumeEventsSignalInfo), '("update", FrameClockUpdateSignalInfo)] :: [(Symbol, *)])

#endif

-- method FrameClock::begin_updating
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame_clock", argType = TInterface (Name {namespace = "Gdk", name = "FrameClock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_frame_clock_begin_updating" gdk_frame_clock_begin_updating ::
    Ptr FrameClock ->                       -- frame_clock : TInterface (Name {namespace = "Gdk", name = "FrameClock"})
    IO ()

{- |
Starts updates for an animation. Until a matching call to
'GI.Gdk.Objects.FrameClock.frameClockEndUpdating' is made, the frame clock will continually
request a new frame with the 'GI.Gdk.Flags.FrameClockPhaseUpdate' phase.
This function may be called multiple times and frames will be
requested until 'GI.Gdk.Objects.FrameClock.frameClockEndUpdating' is called the same
number of times.

/Since: 3.8/
-}
frameClockBeginUpdating ::
    (B.CallStack.HasCallStack, MonadIO m, IsFrameClock a) =>
    a
    {- ^ /@frameClock@/: a 'GI.Gdk.Objects.FrameClock.FrameClock' -}
    -> m ()
frameClockBeginUpdating frameClock = liftIO $ do
    frameClock' <- unsafeManagedPtrCastPtr frameClock
    gdk_frame_clock_begin_updating frameClock'
    touchManagedPtr frameClock
    return ()

#if ENABLE_OVERLOADING
data FrameClockBeginUpdatingMethodInfo
instance (signature ~ (m ()), MonadIO m, IsFrameClock a) => O.MethodInfo FrameClockBeginUpdatingMethodInfo a signature where
    overloadedMethod _ = frameClockBeginUpdating

#endif

-- method FrameClock::end_updating
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame_clock", argType = TInterface (Name {namespace = "Gdk", name = "FrameClock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_frame_clock_end_updating" gdk_frame_clock_end_updating ::
    Ptr FrameClock ->                       -- frame_clock : TInterface (Name {namespace = "Gdk", name = "FrameClock"})
    IO ()

{- |
Stops updates for an animation. See the documentation for
'GI.Gdk.Objects.FrameClock.frameClockBeginUpdating'.

/Since: 3.8/
-}
frameClockEndUpdating ::
    (B.CallStack.HasCallStack, MonadIO m, IsFrameClock a) =>
    a
    {- ^ /@frameClock@/: a 'GI.Gdk.Objects.FrameClock.FrameClock' -}
    -> m ()
frameClockEndUpdating frameClock = liftIO $ do
    frameClock' <- unsafeManagedPtrCastPtr frameClock
    gdk_frame_clock_end_updating frameClock'
    touchManagedPtr frameClock
    return ()

#if ENABLE_OVERLOADING
data FrameClockEndUpdatingMethodInfo
instance (signature ~ (m ()), MonadIO m, IsFrameClock a) => O.MethodInfo FrameClockEndUpdatingMethodInfo a signature where
    overloadedMethod _ = frameClockEndUpdating

#endif

-- method FrameClock::get_current_timings
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame_clock", argType = TInterface (Name {namespace = "Gdk", name = "FrameClock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gdk", name = "FrameTimings"}))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_frame_clock_get_current_timings" gdk_frame_clock_get_current_timings ::
    Ptr FrameClock ->                       -- frame_clock : TInterface (Name {namespace = "Gdk", name = "FrameClock"})
    IO (Ptr Gdk.FrameTimings.FrameTimings)

{- |
Gets the frame timings for the current frame.

/Since: 3.8/
-}
frameClockGetCurrentTimings ::
    (B.CallStack.HasCallStack, MonadIO m, IsFrameClock a) =>
    a
    {- ^ /@frameClock@/: a 'GI.Gdk.Objects.FrameClock.FrameClock' -}
    -> m (Maybe Gdk.FrameTimings.FrameTimings)
    {- ^ __Returns:__ the 'GI.Gdk.Structs.FrameTimings.FrameTimings' for the
 frame currently being processed, or even no frame is being
 processed, for the previous frame. Before any frames have been
 processed, returns 'Nothing'. -}
frameClockGetCurrentTimings frameClock = liftIO $ do
    frameClock' <- unsafeManagedPtrCastPtr frameClock
    result <- gdk_frame_clock_get_current_timings frameClock'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Gdk.FrameTimings.FrameTimings) result'
        return result''
    touchManagedPtr frameClock
    return maybeResult

#if ENABLE_OVERLOADING
data FrameClockGetCurrentTimingsMethodInfo
instance (signature ~ (m (Maybe Gdk.FrameTimings.FrameTimings)), MonadIO m, IsFrameClock a) => O.MethodInfo FrameClockGetCurrentTimingsMethodInfo a signature where
    overloadedMethod _ = frameClockGetCurrentTimings

#endif

-- method FrameClock::get_frame_counter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame_clock", argType = TInterface (Name {namespace = "Gdk", name = "FrameClock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_frame_clock_get_frame_counter" gdk_frame_clock_get_frame_counter ::
    Ptr FrameClock ->                       -- frame_clock : TInterface (Name {namespace = "Gdk", name = "FrameClock"})
    IO Int64

{- |
A 'GI.Gdk.Objects.FrameClock.FrameClock' maintains a 64-bit counter that increments for
each frame drawn.

/Since: 3.8/
-}
frameClockGetFrameCounter ::
    (B.CallStack.HasCallStack, MonadIO m, IsFrameClock a) =>
    a
    {- ^ /@frameClock@/: a 'GI.Gdk.Objects.FrameClock.FrameClock' -}
    -> m Int64
    {- ^ __Returns:__ inside frame processing, the value of the frame counter
 for the current frame. Outside of frame processing, the frame
  counter for the last frame. -}
frameClockGetFrameCounter frameClock = liftIO $ do
    frameClock' <- unsafeManagedPtrCastPtr frameClock
    result <- gdk_frame_clock_get_frame_counter frameClock'
    touchManagedPtr frameClock
    return result

#if ENABLE_OVERLOADING
data FrameClockGetFrameCounterMethodInfo
instance (signature ~ (m Int64), MonadIO m, IsFrameClock a) => O.MethodInfo FrameClockGetFrameCounterMethodInfo a signature where
    overloadedMethod _ = frameClockGetFrameCounter

#endif

-- method FrameClock::get_frame_time
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame_clock", argType = TInterface (Name {namespace = "Gdk", name = "FrameClock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_frame_clock_get_frame_time" gdk_frame_clock_get_frame_time ::
    Ptr FrameClock ->                       -- frame_clock : TInterface (Name {namespace = "Gdk", name = "FrameClock"})
    IO Int64

{- |
Gets the time that should currently be used for animations.  Inside
the processing of a frame, it’s the time used to compute the
animation position of everything in a frame. Outside of a frame, it\'s
the time of the conceptual “previous frame,” which may be either
the actual previous frame time, or if that’s too old, an updated
time.

/Since: 3.8/
-}
frameClockGetFrameTime ::
    (B.CallStack.HasCallStack, MonadIO m, IsFrameClock a) =>
    a
    {- ^ /@frameClock@/: a 'GI.Gdk.Objects.FrameClock.FrameClock' -}
    -> m Int64
    {- ^ __Returns:__ a timestamp in microseconds, in the timescale of
 of 'GI.GLib.Functions.getMonotonicTime'. -}
frameClockGetFrameTime frameClock = liftIO $ do
    frameClock' <- unsafeManagedPtrCastPtr frameClock
    result <- gdk_frame_clock_get_frame_time frameClock'
    touchManagedPtr frameClock
    return result

#if ENABLE_OVERLOADING
data FrameClockGetFrameTimeMethodInfo
instance (signature ~ (m Int64), MonadIO m, IsFrameClock a) => O.MethodInfo FrameClockGetFrameTimeMethodInfo a signature where
    overloadedMethod _ = frameClockGetFrameTime

#endif

-- method FrameClock::get_history_start
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame_clock", argType = TInterface (Name {namespace = "Gdk", name = "FrameClock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_frame_clock_get_history_start" gdk_frame_clock_get_history_start ::
    Ptr FrameClock ->                       -- frame_clock : TInterface (Name {namespace = "Gdk", name = "FrameClock"})
    IO Int64

{- |
'GI.Gdk.Objects.FrameClock.FrameClock' internally keeps a history of 'GI.Gdk.Structs.FrameTimings.FrameTimings'
objects for recent frames that can be retrieved with
'GI.Gdk.Objects.FrameClock.frameClockGetTimings'. The set of stored frames
is the set from the counter values given by
'GI.Gdk.Objects.FrameClock.frameClockGetHistoryStart' and
'GI.Gdk.Objects.FrameClock.frameClockGetFrameCounter', inclusive.

/Since: 3.8/
-}
frameClockGetHistoryStart ::
    (B.CallStack.HasCallStack, MonadIO m, IsFrameClock a) =>
    a
    {- ^ /@frameClock@/: a 'GI.Gdk.Objects.FrameClock.FrameClock' -}
    -> m Int64
    {- ^ __Returns:__ the frame counter value for the oldest frame
 that is available in the internal frame history of the
 'GI.Gdk.Objects.FrameClock.FrameClock'. -}
frameClockGetHistoryStart frameClock = liftIO $ do
    frameClock' <- unsafeManagedPtrCastPtr frameClock
    result <- gdk_frame_clock_get_history_start frameClock'
    touchManagedPtr frameClock
    return result

#if ENABLE_OVERLOADING
data FrameClockGetHistoryStartMethodInfo
instance (signature ~ (m Int64), MonadIO m, IsFrameClock a) => O.MethodInfo FrameClockGetHistoryStartMethodInfo a signature where
    overloadedMethod _ = frameClockGetHistoryStart

#endif

-- method FrameClock::get_refresh_info
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame_clock", argType = TInterface (Name {namespace = "Gdk", name = "FrameClock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "base_time", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "base time for determining a presentaton time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "refresh_interval_return", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location to store the\ndetermined refresh interval, or %NULL. A default refresh interval of\n1/60th of a second will be stored if no history is present.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "presentation_time_return", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location to store the next\n candidate presentation time after the given base time.\n 0 will be will be stored if no history is present.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_frame_clock_get_refresh_info" gdk_frame_clock_get_refresh_info ::
    Ptr FrameClock ->                       -- frame_clock : TInterface (Name {namespace = "Gdk", name = "FrameClock"})
    Int64 ->                                -- base_time : TBasicType TInt64
    Ptr Int64 ->                            -- refresh_interval_return : TBasicType TInt64
    Ptr Int64 ->                            -- presentation_time_return : TBasicType TInt64
    IO ()

{- |
Using the frame history stored in the frame clock, finds the last
known presentation time and refresh interval, and assuming that
presentation times are separated by the refresh interval,
predicts a presentation time that is a multiple of the refresh
interval after the last presentation time, and later than /@baseTime@/.

/Since: 3.8/
-}
frameClockGetRefreshInfo ::
    (B.CallStack.HasCallStack, MonadIO m, IsFrameClock a) =>
    a
    {- ^ /@frameClock@/: a 'GI.Gdk.Objects.FrameClock.FrameClock' -}
    -> Int64
    {- ^ /@baseTime@/: base time for determining a presentaton time -}
    -> m ((Int64, Int64))
frameClockGetRefreshInfo frameClock baseTime = liftIO $ do
    frameClock' <- unsafeManagedPtrCastPtr frameClock
    refreshIntervalReturn <- allocMem :: IO (Ptr Int64)
    presentationTimeReturn <- allocMem :: IO (Ptr Int64)
    gdk_frame_clock_get_refresh_info frameClock' baseTime refreshIntervalReturn presentationTimeReturn
    refreshIntervalReturn' <- peek refreshIntervalReturn
    presentationTimeReturn' <- peek presentationTimeReturn
    touchManagedPtr frameClock
    freeMem refreshIntervalReturn
    freeMem presentationTimeReturn
    return (refreshIntervalReturn', presentationTimeReturn')

#if ENABLE_OVERLOADING
data FrameClockGetRefreshInfoMethodInfo
instance (signature ~ (Int64 -> m ((Int64, Int64))), MonadIO m, IsFrameClock a) => O.MethodInfo FrameClockGetRefreshInfoMethodInfo a signature where
    overloadedMethod _ = frameClockGetRefreshInfo

#endif

-- method FrameClock::get_timings
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame_clock", argType = TInterface (Name {namespace = "Gdk", name = "FrameClock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "frame_counter", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the frame counter value identifying the frame to\n be received.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gdk", name = "FrameTimings"}))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_frame_clock_get_timings" gdk_frame_clock_get_timings ::
    Ptr FrameClock ->                       -- frame_clock : TInterface (Name {namespace = "Gdk", name = "FrameClock"})
    Int64 ->                                -- frame_counter : TBasicType TInt64
    IO (Ptr Gdk.FrameTimings.FrameTimings)

{- |
Retrieves a 'GI.Gdk.Structs.FrameTimings.FrameTimings' object holding timing information
for the current frame or a recent frame. The 'GI.Gdk.Structs.FrameTimings.FrameTimings'
object may not yet be complete: see 'GI.Gdk.Structs.FrameTimings.frameTimingsGetComplete'.

/Since: 3.8/
-}
frameClockGetTimings ::
    (B.CallStack.HasCallStack, MonadIO m, IsFrameClock a) =>
    a
    {- ^ /@frameClock@/: a 'GI.Gdk.Objects.FrameClock.FrameClock' -}
    -> Int64
    {- ^ /@frameCounter@/: the frame counter value identifying the frame to
 be received. -}
    -> m (Maybe Gdk.FrameTimings.FrameTimings)
    {- ^ __Returns:__ the 'GI.Gdk.Structs.FrameTimings.FrameTimings' object for
 the specified frame, or 'Nothing' if it is not available. See
 'GI.Gdk.Objects.FrameClock.frameClockGetHistoryStart'. -}
frameClockGetTimings frameClock frameCounter = liftIO $ do
    frameClock' <- unsafeManagedPtrCastPtr frameClock
    result <- gdk_frame_clock_get_timings frameClock' frameCounter
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Gdk.FrameTimings.FrameTimings) result'
        return result''
    touchManagedPtr frameClock
    return maybeResult

#if ENABLE_OVERLOADING
data FrameClockGetTimingsMethodInfo
instance (signature ~ (Int64 -> m (Maybe Gdk.FrameTimings.FrameTimings)), MonadIO m, IsFrameClock a) => O.MethodInfo FrameClockGetTimingsMethodInfo a signature where
    overloadedMethod _ = frameClockGetTimings

#endif

-- method FrameClock::request_phase
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "frame_clock", argType = TInterface (Name {namespace = "Gdk", name = "FrameClock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "phase", argType = TInterface (Name {namespace = "Gdk", name = "FrameClockPhase"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the phase that is requested", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_frame_clock_request_phase" gdk_frame_clock_request_phase ::
    Ptr FrameClock ->                       -- frame_clock : TInterface (Name {namespace = "Gdk", name = "FrameClock"})
    CUInt ->                                -- phase : TInterface (Name {namespace = "Gdk", name = "FrameClockPhase"})
    IO ()

{- |
Asks the frame clock to run a particular phase. The signal
corresponding the requested phase will be emitted the next
time the frame clock processes. Multiple calls to
'GI.Gdk.Objects.FrameClock.frameClockRequestPhase' will be combined together
and only one frame processed. If you are displaying animated
content and want to continually request the
'GI.Gdk.Flags.FrameClockPhaseUpdate' phase for a period of time,
you should use 'GI.Gdk.Objects.FrameClock.frameClockBeginUpdating' instead, since
this allows GTK+ to adjust system parameters to get maximally
smooth animations.

/Since: 3.8/
-}
frameClockRequestPhase ::
    (B.CallStack.HasCallStack, MonadIO m, IsFrameClock a) =>
    a
    {- ^ /@frameClock@/: a 'GI.Gdk.Objects.FrameClock.FrameClock' -}
    -> [Gdk.Flags.FrameClockPhase]
    {- ^ /@phase@/: the phase that is requested -}
    -> m ()
frameClockRequestPhase frameClock phase = liftIO $ do
    frameClock' <- unsafeManagedPtrCastPtr frameClock
    let phase' = gflagsToWord phase
    gdk_frame_clock_request_phase frameClock' phase'
    touchManagedPtr frameClock
    return ()

#if ENABLE_OVERLOADING
data FrameClockRequestPhaseMethodInfo
instance (signature ~ ([Gdk.Flags.FrameClockPhase] -> m ()), MonadIO m, IsFrameClock a) => O.MethodInfo FrameClockRequestPhaseMethodInfo a signature where
    overloadedMethod _ = frameClockRequestPhase

#endif