{- | 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.Structs.FrameTimings.FrameTimings' object holds timing information for a single frame of the application’s displays. To retrieve 'GI.Gdk.Structs.FrameTimings.FrameTimings' objects, use 'GI.Gdk.Objects.FrameClock.frameClockGetTimings' or 'GI.Gdk.Objects.FrameClock.frameClockGetCurrentTimings'. The information in 'GI.Gdk.Structs.FrameTimings.FrameTimings' is useful for precise synchronization of video with the event or audio streams, and for measuring quality metrics for the application’s display, such as latency and jitter. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Gdk.Structs.FrameTimings ( -- * Exported types FrameTimings(..) , noFrameTimings , -- * Methods -- ** getComplete #method:getComplete# #if ENABLE_OVERLOADING FrameTimingsGetCompleteMethodInfo , #endif frameTimingsGetComplete , -- ** getFrameCounter #method:getFrameCounter# #if ENABLE_OVERLOADING FrameTimingsGetFrameCounterMethodInfo , #endif frameTimingsGetFrameCounter , -- ** getFrameTime #method:getFrameTime# #if ENABLE_OVERLOADING FrameTimingsGetFrameTimeMethodInfo , #endif frameTimingsGetFrameTime , -- ** getPredictedPresentationTime #method:getPredictedPresentationTime# #if ENABLE_OVERLOADING FrameTimingsGetPredictedPresentationTimeMethodInfo, #endif frameTimingsGetPredictedPresentationTime, -- ** getPresentationTime #method:getPresentationTime# #if ENABLE_OVERLOADING FrameTimingsGetPresentationTimeMethodInfo, #endif frameTimingsGetPresentationTime , -- ** getRefreshInterval #method:getRefreshInterval# #if ENABLE_OVERLOADING FrameTimingsGetRefreshIntervalMethodInfo, #endif frameTimingsGetRefreshInterval , -- ** ref #method:ref# #if ENABLE_OVERLOADING FrameTimingsRefMethodInfo , #endif frameTimingsRef , -- ** unref #method:unref# #if ENABLE_OVERLOADING FrameTimingsUnrefMethodInfo , #endif frameTimingsUnref , ) 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 -- | Memory-managed wrapper type. newtype FrameTimings = FrameTimings (ManagedPtr FrameTimings) foreign import ccall "gdk_frame_timings_get_type" c_gdk_frame_timings_get_type :: IO GType instance BoxedObject FrameTimings where boxedType _ = c_gdk_frame_timings_get_type -- | A convenience alias for `Nothing` :: `Maybe` `FrameTimings`. noFrameTimings :: Maybe FrameTimings noFrameTimings = Nothing #if ENABLE_OVERLOADING instance O.HasAttributeList FrameTimings type instance O.AttributeList FrameTimings = FrameTimingsAttributeList type FrameTimingsAttributeList = ('[ ] :: [(Symbol, *)]) #endif -- method FrameTimings::get_complete -- method type : OrdinaryMethod -- Args : [Arg {argCName = "timings", argType = TInterface (Name {namespace = "Gdk", name = "FrameTimings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameTimings", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gdk_frame_timings_get_complete" gdk_frame_timings_get_complete :: Ptr FrameTimings -> -- timings : TInterface (Name {namespace = "Gdk", name = "FrameTimings"}) IO CInt {- | The timing information in a 'GI.Gdk.Structs.FrameTimings.FrameTimings' is filled in incrementally as the frame as drawn and passed off to the window system for processing and display to the user. The accessor functions for 'GI.Gdk.Structs.FrameTimings.FrameTimings' can return 0 to indicate an unavailable value for two reasons: either because the information is not yet available, or because it isn\'t available at all. Once 'GI.Gdk.Structs.FrameTimings.frameTimingsGetComplete' returns 'True' for a frame, you can be certain that no further values will become available and be stored in the 'GI.Gdk.Structs.FrameTimings.FrameTimings'. /Since: 3.8/ -} frameTimingsGetComplete :: (B.CallStack.HasCallStack, MonadIO m) => FrameTimings {- ^ /@timings@/: a 'GI.Gdk.Structs.FrameTimings.FrameTimings' -} -> m Bool {- ^ __Returns:__ 'True' if all information that will be available for the frame has been filled in. -} frameTimingsGetComplete timings = liftIO $ do timings' <- unsafeManagedPtrGetPtr timings result <- gdk_frame_timings_get_complete timings' let result' = (/= 0) result touchManagedPtr timings return result' #if ENABLE_OVERLOADING data FrameTimingsGetCompleteMethodInfo instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo FrameTimingsGetCompleteMethodInfo FrameTimings signature where overloadedMethod _ = frameTimingsGetComplete #endif -- method FrameTimings::get_frame_counter -- method type : OrdinaryMethod -- Args : [Arg {argCName = "timings", argType = TInterface (Name {namespace = "Gdk", name = "FrameTimings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameTimings", 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_timings_get_frame_counter" gdk_frame_timings_get_frame_counter :: Ptr FrameTimings -> -- timings : TInterface (Name {namespace = "Gdk", name = "FrameTimings"}) IO Int64 {- | Gets the frame counter value of the 'GI.Gdk.Objects.FrameClock.FrameClock' when this this frame was drawn. /Since: 3.8/ -} frameTimingsGetFrameCounter :: (B.CallStack.HasCallStack, MonadIO m) => FrameTimings {- ^ /@timings@/: a 'GI.Gdk.Structs.FrameTimings.FrameTimings' -} -> m Int64 {- ^ __Returns:__ the frame counter value for this frame -} frameTimingsGetFrameCounter timings = liftIO $ do timings' <- unsafeManagedPtrGetPtr timings result <- gdk_frame_timings_get_frame_counter timings' touchManagedPtr timings return result #if ENABLE_OVERLOADING data FrameTimingsGetFrameCounterMethodInfo instance (signature ~ (m Int64), MonadIO m) => O.MethodInfo FrameTimingsGetFrameCounterMethodInfo FrameTimings signature where overloadedMethod _ = frameTimingsGetFrameCounter #endif -- method FrameTimings::get_frame_time -- method type : OrdinaryMethod -- Args : [Arg {argCName = "timings", argType = TInterface (Name {namespace = "Gdk", name = "FrameTimings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GdkFrameTimings", 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_timings_get_frame_time" gdk_frame_timings_get_frame_time :: Ptr FrameTimings -> -- timings : TInterface (Name {namespace = "Gdk", name = "FrameTimings"}) IO Int64 {- | Returns the frame time for the frame. This is the time value that is typically used to time animations for the frame. See 'GI.Gdk.Objects.FrameClock.frameClockGetFrameTime'. -} frameTimingsGetFrameTime :: (B.CallStack.HasCallStack, MonadIO m) => FrameTimings {- ^ /@timings@/: A 'GI.Gdk.Structs.FrameTimings.FrameTimings' -} -> m Int64 {- ^ __Returns:__ the frame time for the frame, in the timescale of 'GI.GLib.Functions.getMonotonicTime' -} frameTimingsGetFrameTime timings = liftIO $ do timings' <- unsafeManagedPtrGetPtr timings result <- gdk_frame_timings_get_frame_time timings' touchManagedPtr timings return result #if ENABLE_OVERLOADING data FrameTimingsGetFrameTimeMethodInfo instance (signature ~ (m Int64), MonadIO m) => O.MethodInfo FrameTimingsGetFrameTimeMethodInfo FrameTimings signature where overloadedMethod _ = frameTimingsGetFrameTime #endif -- method FrameTimings::get_predicted_presentation_time -- method type : OrdinaryMethod -- Args : [Arg {argCName = "timings", argType = TInterface (Name {namespace = "Gdk", name = "FrameTimings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameTimings", 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_timings_get_predicted_presentation_time" gdk_frame_timings_get_predicted_presentation_time :: Ptr FrameTimings -> -- timings : TInterface (Name {namespace = "Gdk", name = "FrameTimings"}) IO Int64 {- | Gets the predicted time at which this frame will be displayed. Although no predicted time may be available, if one is available, it will be available while the frame is being generated, in contrast to 'GI.Gdk.Structs.FrameTimings.frameTimingsGetPresentationTime', which is only available after the frame has been presented. In general, if you are simply animating, you should use 'GI.Gdk.Objects.FrameClock.frameClockGetFrameTime' rather than this function, but this function is useful for applications that want exact control over latency. For example, a movie player may want this information for Audio\/Video synchronization. /Since: 3.8/ -} frameTimingsGetPredictedPresentationTime :: (B.CallStack.HasCallStack, MonadIO m) => FrameTimings {- ^ /@timings@/: a 'GI.Gdk.Structs.FrameTimings.FrameTimings' -} -> m Int64 {- ^ __Returns:__ The predicted time at which the frame will be presented, in the timescale of 'GI.GLib.Functions.getMonotonicTime', or 0 if no predicted presentation time is available. -} frameTimingsGetPredictedPresentationTime timings = liftIO $ do timings' <- unsafeManagedPtrGetPtr timings result <- gdk_frame_timings_get_predicted_presentation_time timings' touchManagedPtr timings return result #if ENABLE_OVERLOADING data FrameTimingsGetPredictedPresentationTimeMethodInfo instance (signature ~ (m Int64), MonadIO m) => O.MethodInfo FrameTimingsGetPredictedPresentationTimeMethodInfo FrameTimings signature where overloadedMethod _ = frameTimingsGetPredictedPresentationTime #endif -- method FrameTimings::get_presentation_time -- method type : OrdinaryMethod -- Args : [Arg {argCName = "timings", argType = TInterface (Name {namespace = "Gdk", name = "FrameTimings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameTimings", 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_timings_get_presentation_time" gdk_frame_timings_get_presentation_time :: Ptr FrameTimings -> -- timings : TInterface (Name {namespace = "Gdk", name = "FrameTimings"}) IO Int64 {- | Reurns the presentation time. This is the time at which the frame became visible to the user. /Since: 3.8/ -} frameTimingsGetPresentationTime :: (B.CallStack.HasCallStack, MonadIO m) => FrameTimings {- ^ /@timings@/: a 'GI.Gdk.Structs.FrameTimings.FrameTimings' -} -> m Int64 {- ^ __Returns:__ the time the frame was displayed to the user, in the timescale of 'GI.GLib.Functions.getMonotonicTime', or 0 if no presentation time is available. See 'GI.Gdk.Structs.FrameTimings.frameTimingsGetComplete' -} frameTimingsGetPresentationTime timings = liftIO $ do timings' <- unsafeManagedPtrGetPtr timings result <- gdk_frame_timings_get_presentation_time timings' touchManagedPtr timings return result #if ENABLE_OVERLOADING data FrameTimingsGetPresentationTimeMethodInfo instance (signature ~ (m Int64), MonadIO m) => O.MethodInfo FrameTimingsGetPresentationTimeMethodInfo FrameTimings signature where overloadedMethod _ = frameTimingsGetPresentationTime #endif -- method FrameTimings::get_refresh_interval -- method type : OrdinaryMethod -- Args : [Arg {argCName = "timings", argType = TInterface (Name {namespace = "Gdk", name = "FrameTimings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameTimings", 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_timings_get_refresh_interval" gdk_frame_timings_get_refresh_interval :: Ptr FrameTimings -> -- timings : TInterface (Name {namespace = "Gdk", name = "FrameTimings"}) IO Int64 {- | Gets the natural interval between presentation times for the display that this frame was displayed on. Frame presentation usually happens during the “vertical blanking interval”. /Since: 3.8/ -} frameTimingsGetRefreshInterval :: (B.CallStack.HasCallStack, MonadIO m) => FrameTimings {- ^ /@timings@/: a 'GI.Gdk.Structs.FrameTimings.FrameTimings' -} -> m Int64 {- ^ __Returns:__ the refresh interval of the display, in microseconds, or 0 if the refresh interval is not available. See 'GI.Gdk.Structs.FrameTimings.frameTimingsGetComplete'. -} frameTimingsGetRefreshInterval timings = liftIO $ do timings' <- unsafeManagedPtrGetPtr timings result <- gdk_frame_timings_get_refresh_interval timings' touchManagedPtr timings return result #if ENABLE_OVERLOADING data FrameTimingsGetRefreshIntervalMethodInfo instance (signature ~ (m Int64), MonadIO m) => O.MethodInfo FrameTimingsGetRefreshIntervalMethodInfo FrameTimings signature where overloadedMethod _ = frameTimingsGetRefreshInterval #endif -- method FrameTimings::ref -- method type : OrdinaryMethod -- Args : [Arg {argCName = "timings", argType = TInterface (Name {namespace = "Gdk", name = "FrameTimings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameTimings", 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_timings_ref" gdk_frame_timings_ref :: Ptr FrameTimings -> -- timings : TInterface (Name {namespace = "Gdk", name = "FrameTimings"}) IO (Ptr FrameTimings) {- | Increases the reference count of /@timings@/. /Since: 3.8/ -} frameTimingsRef :: (B.CallStack.HasCallStack, MonadIO m) => FrameTimings {- ^ /@timings@/: a 'GI.Gdk.Structs.FrameTimings.FrameTimings' -} -> m FrameTimings {- ^ __Returns:__ /@timings@/ -} frameTimingsRef timings = liftIO $ do timings' <- unsafeManagedPtrGetPtr timings result <- gdk_frame_timings_ref timings' checkUnexpectedReturnNULL "frameTimingsRef" result result' <- (wrapBoxed FrameTimings) result touchManagedPtr timings return result' #if ENABLE_OVERLOADING data FrameTimingsRefMethodInfo instance (signature ~ (m FrameTimings), MonadIO m) => O.MethodInfo FrameTimingsRefMethodInfo FrameTimings signature where overloadedMethod _ = frameTimingsRef #endif -- method FrameTimings::unref -- method type : OrdinaryMethod -- Args : [Arg {argCName = "timings", argType = TInterface (Name {namespace = "Gdk", name = "FrameTimings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkFrameTimings", 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_timings_unref" gdk_frame_timings_unref :: Ptr FrameTimings -> -- timings : TInterface (Name {namespace = "Gdk", name = "FrameTimings"}) IO () {- | Decreases the reference count of /@timings@/. If /@timings@/ is no longer referenced, it will be freed. /Since: 3.8/ -} frameTimingsUnref :: (B.CallStack.HasCallStack, MonadIO m) => FrameTimings {- ^ /@timings@/: a 'GI.Gdk.Structs.FrameTimings.FrameTimings' -} -> m () frameTimingsUnref timings = liftIO $ do timings' <- unsafeManagedPtrGetPtr timings gdk_frame_timings_unref timings' touchManagedPtr timings return () #if ENABLE_OVERLOADING data FrameTimingsUnrefMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo FrameTimingsUnrefMethodInfo FrameTimings signature where overloadedMethod _ = frameTimingsUnref #endif #if ENABLE_OVERLOADING type family ResolveFrameTimingsMethod (t :: Symbol) (o :: *) :: * where ResolveFrameTimingsMethod "ref" o = FrameTimingsRefMethodInfo ResolveFrameTimingsMethod "unref" o = FrameTimingsUnrefMethodInfo ResolveFrameTimingsMethod "getComplete" o = FrameTimingsGetCompleteMethodInfo ResolveFrameTimingsMethod "getFrameCounter" o = FrameTimingsGetFrameCounterMethodInfo ResolveFrameTimingsMethod "getFrameTime" o = FrameTimingsGetFrameTimeMethodInfo ResolveFrameTimingsMethod "getPredictedPresentationTime" o = FrameTimingsGetPredictedPresentationTimeMethodInfo ResolveFrameTimingsMethod "getPresentationTime" o = FrameTimingsGetPresentationTimeMethodInfo ResolveFrameTimingsMethod "getRefreshInterval" o = FrameTimingsGetRefreshIntervalMethodInfo ResolveFrameTimingsMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveFrameTimingsMethod t FrameTimings, O.MethodInfo info FrameTimings p) => OL.IsLabel t (FrameTimings -> 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