{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) The `GMainContext` struct is an opaque data type representing a set of sources to be handled in a main loop. -} module GI.GLib.Structs.MainContext ( -- * Exported types MainContext(..) , noMainContext , -- * Methods -- ** mainContextAcquire mainContextAcquire , -- ** mainContextAddPoll mainContextAddPoll , -- ** mainContextCheck mainContextCheck , -- ** mainContextDispatch mainContextDispatch , -- ** mainContextFindSourceByFuncsUserData mainContextFindSourceByFuncsUserData , -- ** mainContextFindSourceById mainContextFindSourceById , -- ** mainContextFindSourceByUserData mainContextFindSourceByUserData , -- ** mainContextInvokeFull mainContextInvokeFull , -- ** mainContextIsOwner mainContextIsOwner , -- ** mainContextIteration mainContextIteration , -- ** mainContextNew mainContextNew , -- ** mainContextPending mainContextPending , -- ** mainContextPopThreadDefault mainContextPopThreadDefault , -- ** mainContextPrepare mainContextPrepare , -- ** mainContextPushThreadDefault mainContextPushThreadDefault , -- ** mainContextQuery mainContextQuery , -- ** mainContextRef mainContextRef , -- ** mainContextRelease mainContextRelease , -- ** mainContextRemovePoll mainContextRemovePoll , -- ** mainContextUnref mainContextUnref , -- ** mainContextWait mainContextWait , -- ** mainContextWakeup mainContextWakeup , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.GLib.Types import GI.GLib.Callbacks newtype MainContext = MainContext (ForeignPtr MainContext) foreign import ccall "g_main_context_get_type" c_g_main_context_get_type :: IO GType instance BoxedObject MainContext where boxedType _ = c_g_main_context_get_type noMainContext :: Maybe MainContext noMainContext = Nothing -- method MainContext::new -- method type : Constructor -- Args : [] -- Lengths : [] -- hInArgs : [] -- returnType : TInterface "GLib" "MainContext" -- throws : False -- Skip return : False foreign import ccall "g_main_context_new" g_main_context_new :: IO (Ptr MainContext) mainContextNew :: (MonadIO m) => m MainContext mainContextNew = liftIO $ do result <- g_main_context_new checkUnexpectedReturnNULL "g_main_context_new" result result' <- (wrapBoxed MainContext) result return result' -- method MainContext::acquire -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_main_context_acquire" g_main_context_acquire :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" IO CInt mainContextAcquire :: (MonadIO m) => MainContext -> -- _obj m Bool mainContextAcquire _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_main_context_acquire _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method MainContext::add_poll -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd", argType = TInterface "GLib" "PollFD", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd", argType = TInterface "GLib" "PollFD", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_main_context_add_poll" g_main_context_add_poll :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" Ptr PollFD -> -- fd : TInterface "GLib" "PollFD" Int32 -> -- priority : TBasicType TInt32 IO () mainContextAddPoll :: (MonadIO m) => MainContext -> -- _obj PollFD -> -- fd Int32 -> -- priority m () mainContextAddPoll _obj fd priority = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let fd' = unsafeManagedPtrGetPtr fd g_main_context_add_poll _obj' fd' priority touchManagedPtr _obj touchManagedPtr fd return () -- method MainContext::check -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "max_priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fds", argType = TCArray False (-1) 3 (TInterface "GLib" "PollFD"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_fds", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [Arg {argName = "n_fds", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "max_priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fds", argType = TCArray False (-1) 3 (TInterface "GLib" "PollFD"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "g_main_context_check" g_main_context_check :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" Int32 -> -- max_priority : TBasicType TInt32 Ptr PollFD -> -- fds : TCArray False (-1) 3 (TInterface "GLib" "PollFD") Int32 -> -- n_fds : TBasicType TInt32 IO Int32 mainContextCheck :: (MonadIO m) => MainContext -> -- _obj Int32 -> -- max_priority [PollFD] -> -- fds m Int32 mainContextCheck _obj max_priority fds = liftIO $ do let n_fds = fromIntegral $ length fds let _obj' = unsafeManagedPtrGetPtr _obj let fds' = map unsafeManagedPtrGetPtr fds fds'' <- packBlockArray 8 fds' result <- g_main_context_check _obj' max_priority fds'' n_fds touchManagedPtr _obj mapM_ touchManagedPtr fds freeMem fds'' return result -- method MainContext::dispatch -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_main_context_dispatch" g_main_context_dispatch :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" IO () mainContextDispatch :: (MonadIO m) => MainContext -> -- _obj m () mainContextDispatch _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj g_main_context_dispatch _obj' touchManagedPtr _obj return () -- method MainContext::find_source_by_funcs_user_data -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "funcs", argType = TInterface "GLib" "SourceFuncs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "funcs", argType = TInterface "GLib" "SourceFuncs", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GLib" "Source" -- throws : False -- Skip return : False foreign import ccall "g_main_context_find_source_by_funcs_user_data" g_main_context_find_source_by_funcs_user_data :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" Ptr SourceFuncs -> -- funcs : TInterface "GLib" "SourceFuncs" Ptr () -> -- user_data : TBasicType TVoid IO (Ptr Source) mainContextFindSourceByFuncsUserData :: (MonadIO m) => MainContext -> -- _obj SourceFuncs -> -- funcs Ptr () -> -- user_data m Source mainContextFindSourceByFuncsUserData _obj funcs user_data = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let funcs' = unsafeManagedPtrGetPtr funcs result <- g_main_context_find_source_by_funcs_user_data _obj' funcs' user_data checkUnexpectedReturnNULL "g_main_context_find_source_by_funcs_user_data" result result' <- (newBoxed Source) result touchManagedPtr _obj touchManagedPtr funcs return result' -- method MainContext::find_source_by_id -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_id", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_id", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GLib" "Source" -- throws : False -- Skip return : False foreign import ccall "g_main_context_find_source_by_id" g_main_context_find_source_by_id :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" Word32 -> -- source_id : TBasicType TUInt32 IO (Ptr Source) mainContextFindSourceById :: (MonadIO m) => MainContext -> -- _obj Word32 -> -- source_id m Source mainContextFindSourceById _obj source_id = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_main_context_find_source_by_id _obj' source_id checkUnexpectedReturnNULL "g_main_context_find_source_by_id" result result' <- (newBoxed Source) result touchManagedPtr _obj return result' -- method MainContext::find_source_by_user_data -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GLib" "Source" -- throws : False -- Skip return : False foreign import ccall "g_main_context_find_source_by_user_data" g_main_context_find_source_by_user_data :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" Ptr () -> -- user_data : TBasicType TVoid IO (Ptr Source) mainContextFindSourceByUserData :: (MonadIO m) => MainContext -> -- _obj Ptr () -> -- user_data m Source mainContextFindSourceByUserData _obj user_data = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_main_context_find_source_by_user_data _obj' user_data checkUnexpectedReturnNULL "g_main_context_find_source_by_user_data" result result' <- (newBoxed Source) result touchManagedPtr _obj return result' -- method MainContext::invoke_full -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "function", argType = TInterface "GLib" "SourceFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "notify", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "function", argType = TInterface "GLib" "SourceFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_main_context_invoke_full" g_main_context_invoke_full :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" Int32 -> -- priority : TBasicType TInt32 FunPtr SourceFuncC -> -- function : TInterface "GLib" "SourceFunc" Ptr () -> -- data : TBasicType TVoid FunPtr DestroyNotifyC -> -- notify : TInterface "GLib" "DestroyNotify" IO () mainContextInvokeFull :: (MonadIO m) => MainContext -> -- _obj Int32 -> -- priority SourceFunc -> -- function m () mainContextInvokeFull _obj priority function = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj function' <- mkSourceFunc (sourceFuncWrapper Nothing function) let data_ = castFunPtrToPtr function' let notify = safeFreeFunPtrPtr g_main_context_invoke_full _obj' priority function' data_ notify touchManagedPtr _obj return () -- method MainContext::is_owner -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_main_context_is_owner" g_main_context_is_owner :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" IO CInt mainContextIsOwner :: (MonadIO m) => MainContext -> -- _obj m Bool mainContextIsOwner _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_main_context_is_owner _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method MainContext::iteration -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "may_block", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "may_block", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_main_context_iteration" g_main_context_iteration :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" CInt -> -- may_block : TBasicType TBoolean IO CInt mainContextIteration :: (MonadIO m) => MainContext -> -- _obj Bool -> -- may_block m Bool mainContextIteration _obj may_block = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let may_block' = (fromIntegral . fromEnum) may_block result <- g_main_context_iteration _obj' may_block' let result' = (/= 0) result touchManagedPtr _obj return result' -- method MainContext::pending -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_main_context_pending" g_main_context_pending :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" IO CInt mainContextPending :: (MonadIO m) => MainContext -> -- _obj m Bool mainContextPending _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_main_context_pending _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method MainContext::pop_thread_default -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_main_context_pop_thread_default" g_main_context_pop_thread_default :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" IO () mainContextPopThreadDefault :: (MonadIO m) => MainContext -> -- _obj m () mainContextPopThreadDefault _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj g_main_context_pop_thread_default _obj' touchManagedPtr _obj return () -- method MainContext::prepare -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_main_context_prepare" g_main_context_prepare :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" Int32 -> -- priority : TBasicType TInt32 IO CInt mainContextPrepare :: (MonadIO m) => MainContext -> -- _obj Int32 -> -- priority m Bool mainContextPrepare _obj priority = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_main_context_prepare _obj' priority let result' = (/= 0) result touchManagedPtr _obj return result' -- method MainContext::push_thread_default -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_main_context_push_thread_default" g_main_context_push_thread_default :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" IO () mainContextPushThreadDefault :: (MonadIO m) => MainContext -> -- _obj m () mainContextPushThreadDefault _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj g_main_context_push_thread_default _obj' touchManagedPtr _obj return () -- method MainContext::query -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "max_priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "timeout_", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "fds", argType = TCArray False (-1) 4 (TInterface "GLib" "PollFD"), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_fds", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [Arg {argName = "n_fds", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "max_priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "g_main_context_query" g_main_context_query :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" Int32 -> -- max_priority : TBasicType TInt32 Ptr Int32 -> -- timeout_ : TBasicType TInt32 Ptr (Ptr PollFD) -> -- fds : TCArray False (-1) 4 (TInterface "GLib" "PollFD") Ptr Int32 -> -- n_fds : TBasicType TInt32 IO Int32 mainContextQuery :: (MonadIO m) => MainContext -> -- _obj Int32 -> -- max_priority m (Int32,Int32,[PollFD]) mainContextQuery _obj max_priority = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj timeout_ <- allocMem :: IO (Ptr Int32) fds <- allocMem :: IO (Ptr (Ptr PollFD)) n_fds <- allocMem :: IO (Ptr Int32) result <- g_main_context_query _obj' max_priority timeout_ fds n_fds n_fds' <- peek n_fds timeout_' <- peek timeout_ fds' <- peek fds fds'' <- (unpackBoxedArrayWithLength 8 n_fds') fds' fds''' <- mapM (newBoxed PollFD) fds'' touchManagedPtr _obj freeMem timeout_ freeMem fds freeMem n_fds return (result, timeout_', fds''') -- method MainContext::ref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GLib" "MainContext" -- throws : False -- Skip return : False foreign import ccall "g_main_context_ref" g_main_context_ref :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" IO (Ptr MainContext) mainContextRef :: (MonadIO m) => MainContext -> -- _obj m MainContext mainContextRef _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- g_main_context_ref _obj' checkUnexpectedReturnNULL "g_main_context_ref" result result' <- (wrapBoxed MainContext) result touchManagedPtr _obj return result' -- method MainContext::release -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_main_context_release" g_main_context_release :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" IO () mainContextRelease :: (MonadIO m) => MainContext -> -- _obj m () mainContextRelease _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj g_main_context_release _obj' touchManagedPtr _obj return () -- method MainContext::remove_poll -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd", argType = TInterface "GLib" "PollFD", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "fd", argType = TInterface "GLib" "PollFD", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_main_context_remove_poll" g_main_context_remove_poll :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" Ptr PollFD -> -- fd : TInterface "GLib" "PollFD" IO () mainContextRemovePoll :: (MonadIO m) => MainContext -> -- _obj PollFD -> -- fd m () mainContextRemovePoll _obj fd = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let fd' = unsafeManagedPtrGetPtr fd g_main_context_remove_poll _obj' fd' touchManagedPtr _obj touchManagedPtr fd return () -- method MainContext::unref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_main_context_unref" g_main_context_unref :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" IO () mainContextUnref :: (MonadIO m) => MainContext -> -- _obj m () mainContextUnref _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj g_main_context_unref _obj' touchManagedPtr _obj return () -- method MainContext::wait -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cond", argType = TInterface "GLib" "Cond", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mutex", argType = TInterface "GLib" "Mutex", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cond", argType = TInterface "GLib" "Cond", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "mutex", argType = TInterface "GLib" "Mutex", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_main_context_wait" g_main_context_wait :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" Ptr Cond -> -- cond : TInterface "GLib" "Cond" Ptr Mutex -> -- mutex : TInterface "GLib" "Mutex" IO CInt mainContextWait :: (MonadIO m) => MainContext -> -- _obj Cond -> -- cond Mutex -> -- mutex m Bool mainContextWait _obj cond mutex = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let cond' = unsafeManagedPtrGetPtr cond let mutex' = unsafeManagedPtrGetPtr mutex result <- g_main_context_wait _obj' cond' mutex' let result' = (/= 0) result touchManagedPtr _obj touchManagedPtr cond touchManagedPtr mutex return result' -- method MainContext::wakeup -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "GLib" "MainContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_main_context_wakeup" g_main_context_wakeup :: Ptr MainContext -> -- _obj : TInterface "GLib" "MainContext" IO () mainContextWakeup :: (MonadIO m) => MainContext -> -- _obj m () mainContextWakeup _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj g_main_context_wakeup _obj' touchManagedPtr _obj return ()