{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GLib.Structs.MainContext
(
MainContext(..) ,
noMainContext ,
#if defined(ENABLE_OVERLOADING)
ResolveMainContextMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
MainContextAcquireMethodInfo ,
#endif
mainContextAcquire ,
#if defined(ENABLE_OVERLOADING)
MainContextAddPollMethodInfo ,
#endif
mainContextAddPoll ,
#if defined(ENABLE_OVERLOADING)
MainContextCheckMethodInfo ,
#endif
mainContextCheck ,
mainContextDefault ,
#if defined(ENABLE_OVERLOADING)
MainContextDispatchMethodInfo ,
#endif
mainContextDispatch ,
#if defined(ENABLE_OVERLOADING)
MainContextFindSourceByFuncsUserDataMethodInfo,
#endif
mainContextFindSourceByFuncsUserData ,
#if defined(ENABLE_OVERLOADING)
MainContextFindSourceByIdMethodInfo ,
#endif
mainContextFindSourceById ,
#if defined(ENABLE_OVERLOADING)
MainContextFindSourceByUserDataMethodInfo,
#endif
mainContextFindSourceByUserData ,
mainContextGetThreadDefault ,
#if defined(ENABLE_OVERLOADING)
MainContextInvokeFullMethodInfo ,
#endif
mainContextInvokeFull ,
#if defined(ENABLE_OVERLOADING)
MainContextIsOwnerMethodInfo ,
#endif
mainContextIsOwner ,
#if defined(ENABLE_OVERLOADING)
MainContextIterationMethodInfo ,
#endif
mainContextIteration ,
mainContextNew ,
#if defined(ENABLE_OVERLOADING)
MainContextPendingMethodInfo ,
#endif
mainContextPending ,
#if defined(ENABLE_OVERLOADING)
MainContextPopThreadDefaultMethodInfo ,
#endif
mainContextPopThreadDefault ,
#if defined(ENABLE_OVERLOADING)
MainContextPrepareMethodInfo ,
#endif
mainContextPrepare ,
#if defined(ENABLE_OVERLOADING)
MainContextPushThreadDefaultMethodInfo ,
#endif
mainContextPushThreadDefault ,
#if defined(ENABLE_OVERLOADING)
MainContextQueryMethodInfo ,
#endif
mainContextQuery ,
#if defined(ENABLE_OVERLOADING)
MainContextRefMethodInfo ,
#endif
mainContextRef ,
mainContextRefThreadDefault ,
#if defined(ENABLE_OVERLOADING)
MainContextReleaseMethodInfo ,
#endif
mainContextRelease ,
#if defined(ENABLE_OVERLOADING)
MainContextRemovePollMethodInfo ,
#endif
mainContextRemovePoll ,
#if defined(ENABLE_OVERLOADING)
MainContextUnrefMethodInfo ,
#endif
mainContextUnref ,
#if defined(ENABLE_OVERLOADING)
MainContextWaitMethodInfo ,
#endif
mainContextWait ,
#if defined(ENABLE_OVERLOADING)
MainContextWakeupMethodInfo ,
#endif
mainContextWakeup ,
) 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.GI.Base.Signals as B.Signals
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.GLib.Callbacks as GLib.Callbacks
import {-# SOURCE #-} qualified GI.GLib.Structs.Cond as GLib.Cond
import {-# SOURCE #-} qualified GI.GLib.Structs.PollFD as GLib.PollFD
import {-# SOURCE #-} qualified GI.GLib.Structs.Source as GLib.Source
import {-# SOURCE #-} qualified GI.GLib.Structs.SourceFuncs as GLib.SourceFuncs
import {-# SOURCE #-} qualified GI.GLib.Unions.Mutex as GLib.Mutex
newtype MainContext = MainContext (ManagedPtr MainContext)
deriving (MainContext -> MainContext -> Bool
(MainContext -> MainContext -> Bool)
-> (MainContext -> MainContext -> Bool) -> Eq MainContext
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MainContext -> MainContext -> Bool
$c/= :: MainContext -> MainContext -> Bool
== :: MainContext -> MainContext -> Bool
$c== :: MainContext -> MainContext -> Bool
Eq)
foreign import ccall "g_main_context_get_type" c_g_main_context_get_type ::
IO GType
instance BoxedObject MainContext where
boxedType :: MainContext -> IO GType
boxedType _ = IO GType
c_g_main_context_get_type
instance B.GValue.IsGValue MainContext where
toGValue :: MainContext -> IO GValue
toGValue o :: MainContext
o = do
GType
gtype <- IO GType
c_g_main_context_get_type
MainContext -> (Ptr MainContext -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr MainContext
o (GType
-> (GValue -> Ptr MainContext -> IO ())
-> Ptr MainContext
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr MainContext -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO MainContext
fromGValue gv :: GValue
gv = do
Ptr MainContext
ptr <- GValue -> IO (Ptr MainContext)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr MainContext)
(ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr MainContext -> MainContext
MainContext Ptr MainContext
ptr
noMainContext :: Maybe MainContext
noMainContext :: Maybe MainContext
noMainContext = Maybe MainContext
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList MainContext
type instance O.AttributeList MainContext = MainContextAttributeList
type MainContextAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "g_main_context_new" g_main_context_new ::
IO (Ptr MainContext)
mainContextNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m MainContext
mainContextNew :: m MainContext
mainContextNew = IO MainContext -> m MainContext
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MainContext -> m MainContext)
-> IO MainContext -> m MainContext
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
result <- IO (Ptr MainContext)
g_main_context_new
Text -> Ptr MainContext -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "mainContextNew" Ptr MainContext
result
MainContext
result' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr MainContext -> MainContext
MainContext) Ptr MainContext
result
MainContext -> IO MainContext
forall (m :: * -> *) a. Monad m => a -> m a
return MainContext
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_main_context_acquire" g_main_context_acquire ::
Ptr MainContext ->
IO CInt
mainContextAcquire ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> m Bool
mainContextAcquire :: MainContext -> m Bool
mainContextAcquire context :: MainContext
context = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
CInt
result <- Ptr MainContext -> IO CInt
g_main_context_acquire Ptr MainContext
context'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data MainContextAcquireMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo MainContextAcquireMethodInfo MainContext signature where
overloadedMethod = mainContextAcquire
#endif
foreign import ccall "g_main_context_add_poll" g_main_context_add_poll ::
Ptr MainContext ->
Ptr GLib.PollFD.PollFD ->
Int32 ->
IO ()
mainContextAddPoll ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> GLib.PollFD.PollFD
-> Int32
-> m ()
mainContextAddPoll :: MainContext -> PollFD -> Int32 -> m ()
mainContextAddPoll context :: MainContext
context fd :: PollFD
fd priority :: Int32
priority = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr PollFD
fd' <- PollFD -> IO (Ptr PollFD)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr PollFD
fd
Ptr MainContext -> Ptr PollFD -> Int32 -> IO ()
g_main_context_add_poll Ptr MainContext
context' Ptr PollFD
fd' Int32
priority
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
PollFD -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr PollFD
fd
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MainContextAddPollMethodInfo
instance (signature ~ (GLib.PollFD.PollFD -> Int32 -> m ()), MonadIO m) => O.MethodInfo MainContextAddPollMethodInfo MainContext signature where
overloadedMethod = mainContextAddPoll
#endif
foreign import ccall "g_main_context_check" g_main_context_check ::
Ptr MainContext ->
Int32 ->
Ptr GLib.PollFD.PollFD ->
Int32 ->
IO CInt
mainContextCheck ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> Int32
-> [GLib.PollFD.PollFD]
-> m Bool
mainContextCheck :: MainContext -> Int32 -> [PollFD] -> m Bool
mainContextCheck context :: MainContext
context maxPriority :: Int32
maxPriority fds :: [PollFD]
fds = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
let nFds :: Int32
nFds = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [PollFD] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [PollFD]
fds
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
[Ptr PollFD]
fds' <- (PollFD -> IO (Ptr PollFD)) -> [PollFD] -> IO [Ptr PollFD]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM PollFD -> IO (Ptr PollFD)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [PollFD]
fds
Ptr PollFD
fds'' <- Int -> [Ptr PollFD] -> IO (Ptr PollFD)
forall a. Int -> [Ptr a] -> IO (Ptr a)
packBlockArray 8 [Ptr PollFD]
fds'
CInt
result <- Ptr MainContext -> Int32 -> Ptr PollFD -> Int32 -> IO CInt
g_main_context_check Ptr MainContext
context' Int32
maxPriority Ptr PollFD
fds'' Int32
nFds
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
(PollFD -> IO ()) -> [PollFD] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ PollFD -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [PollFD]
fds
Ptr PollFD -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr PollFD
fds''
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data MainContextCheckMethodInfo
instance (signature ~ (Int32 -> [GLib.PollFD.PollFD] -> m Bool), MonadIO m) => O.MethodInfo MainContextCheckMethodInfo MainContext signature where
overloadedMethod = mainContextCheck
#endif
foreign import ccall "g_main_context_dispatch" g_main_context_dispatch ::
Ptr MainContext ->
IO ()
mainContextDispatch ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> m ()
mainContextDispatch :: MainContext -> m ()
mainContextDispatch context :: MainContext
context = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr MainContext -> IO ()
g_main_context_dispatch Ptr MainContext
context'
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MainContextDispatchMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo MainContextDispatchMethodInfo MainContext signature where
overloadedMethod = mainContextDispatch
#endif
foreign import ccall "g_main_context_find_source_by_funcs_user_data" g_main_context_find_source_by_funcs_user_data ::
Ptr MainContext ->
Ptr GLib.SourceFuncs.SourceFuncs ->
Ptr () ->
IO (Ptr GLib.Source.Source)
mainContextFindSourceByFuncsUserData ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> GLib.SourceFuncs.SourceFuncs
-> Ptr ()
-> m GLib.Source.Source
mainContextFindSourceByFuncsUserData :: MainContext -> SourceFuncs -> Ptr () -> m Source
mainContextFindSourceByFuncsUserData context :: MainContext
context funcs :: SourceFuncs
funcs userData :: Ptr ()
userData = IO Source -> m Source
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Source -> m Source) -> IO Source -> m Source
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr SourceFuncs
funcs' <- SourceFuncs -> IO (Ptr SourceFuncs)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SourceFuncs
funcs
Ptr Source
result <- Ptr MainContext -> Ptr SourceFuncs -> Ptr () -> IO (Ptr Source)
g_main_context_find_source_by_funcs_user_data Ptr MainContext
context' Ptr SourceFuncs
funcs' Ptr ()
userData
Text -> Ptr Source -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "mainContextFindSourceByFuncsUserData" Ptr Source
result
Source
result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Source -> Source
GLib.Source.Source) Ptr Source
result
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
SourceFuncs -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SourceFuncs
funcs
Source -> IO Source
forall (m :: * -> *) a. Monad m => a -> m a
return Source
result'
#if defined(ENABLE_OVERLOADING)
data MainContextFindSourceByFuncsUserDataMethodInfo
instance (signature ~ (GLib.SourceFuncs.SourceFuncs -> Ptr () -> m GLib.Source.Source), MonadIO m) => O.MethodInfo MainContextFindSourceByFuncsUserDataMethodInfo MainContext signature where
overloadedMethod = mainContextFindSourceByFuncsUserData
#endif
foreign import ccall "g_main_context_find_source_by_id" g_main_context_find_source_by_id ::
Ptr MainContext ->
Word32 ->
IO (Ptr GLib.Source.Source)
mainContextFindSourceById ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> Word32
-> m GLib.Source.Source
mainContextFindSourceById :: MainContext -> Word32 -> m Source
mainContextFindSourceById context :: MainContext
context sourceId :: Word32
sourceId = IO Source -> m Source
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Source -> m Source) -> IO Source -> m Source
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr Source
result <- Ptr MainContext -> Word32 -> IO (Ptr Source)
g_main_context_find_source_by_id Ptr MainContext
context' Word32
sourceId
Text -> Ptr Source -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "mainContextFindSourceById" Ptr Source
result
Source
result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Source -> Source
GLib.Source.Source) Ptr Source
result
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
Source -> IO Source
forall (m :: * -> *) a. Monad m => a -> m a
return Source
result'
#if defined(ENABLE_OVERLOADING)
data MainContextFindSourceByIdMethodInfo
instance (signature ~ (Word32 -> m GLib.Source.Source), MonadIO m) => O.MethodInfo MainContextFindSourceByIdMethodInfo MainContext signature where
overloadedMethod = mainContextFindSourceById
#endif
foreign import ccall "g_main_context_find_source_by_user_data" g_main_context_find_source_by_user_data ::
Ptr MainContext ->
Ptr () ->
IO (Ptr GLib.Source.Source)
mainContextFindSourceByUserData ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> Ptr ()
-> m GLib.Source.Source
mainContextFindSourceByUserData :: MainContext -> Ptr () -> m Source
mainContextFindSourceByUserData context :: MainContext
context userData :: Ptr ()
userData = IO Source -> m Source
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Source -> m Source) -> IO Source -> m Source
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr Source
result <- Ptr MainContext -> Ptr () -> IO (Ptr Source)
g_main_context_find_source_by_user_data Ptr MainContext
context' Ptr ()
userData
Text -> Ptr Source -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "mainContextFindSourceByUserData" Ptr Source
result
Source
result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Source -> Source
GLib.Source.Source) Ptr Source
result
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
Source -> IO Source
forall (m :: * -> *) a. Monad m => a -> m a
return Source
result'
#if defined(ENABLE_OVERLOADING)
data MainContextFindSourceByUserDataMethodInfo
instance (signature ~ (Ptr () -> m GLib.Source.Source), MonadIO m) => O.MethodInfo MainContextFindSourceByUserDataMethodInfo MainContext signature where
overloadedMethod = mainContextFindSourceByUserData
#endif
foreign import ccall "g_main_context_invoke_full" g_main_context_invoke_full ::
Ptr MainContext ->
Int32 ->
FunPtr GLib.Callbacks.C_SourceFunc ->
Ptr () ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
IO ()
mainContextInvokeFull ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> Int32
-> GLib.Callbacks.SourceFunc
-> m ()
mainContextInvokeFull :: MainContext -> Int32 -> IO Bool -> m ()
mainContextInvokeFull context :: MainContext
context priority :: Int32
priority function :: IO Bool
function = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
FunPtr C_SourceFunc
function' <- C_SourceFunc -> IO (FunPtr C_SourceFunc)
GLib.Callbacks.mk_SourceFunc (Maybe (Ptr (FunPtr C_SourceFunc))
-> SourceFunc_WithClosures -> C_SourceFunc
GLib.Callbacks.wrap_SourceFunc Maybe (Ptr (FunPtr C_SourceFunc))
forall a. Maybe a
Nothing (IO Bool -> SourceFunc_WithClosures
GLib.Callbacks.drop_closures_SourceFunc IO Bool
function))
let data_ :: Ptr ()
data_ = FunPtr C_SourceFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_SourceFunc
function'
let notify :: FunPtr (Ptr a -> IO ())
notify = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
safeFreeFunPtrPtr
Ptr MainContext
-> Int32
-> FunPtr C_SourceFunc
-> Ptr ()
-> FunPtr C_DestroyNotify
-> IO ()
g_main_context_invoke_full Ptr MainContext
context' Int32
priority FunPtr C_SourceFunc
function' Ptr ()
data_ FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
notify
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MainContextInvokeFullMethodInfo
instance (signature ~ (Int32 -> GLib.Callbacks.SourceFunc -> m ()), MonadIO m) => O.MethodInfo MainContextInvokeFullMethodInfo MainContext signature where
overloadedMethod = mainContextInvokeFull
#endif
foreign import ccall "g_main_context_is_owner" g_main_context_is_owner ::
Ptr MainContext ->
IO CInt
mainContextIsOwner ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> m Bool
mainContextIsOwner :: MainContext -> m Bool
mainContextIsOwner context :: MainContext
context = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
CInt
result <- Ptr MainContext -> IO CInt
g_main_context_is_owner Ptr MainContext
context'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data MainContextIsOwnerMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo MainContextIsOwnerMethodInfo MainContext signature where
overloadedMethod = mainContextIsOwner
#endif
foreign import ccall "g_main_context_iteration" g_main_context_iteration ::
Ptr MainContext ->
CInt ->
IO CInt
mainContextIteration ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> Bool
-> m Bool
mainContextIteration :: MainContext -> Bool -> m Bool
mainContextIteration context :: MainContext
context mayBlock :: Bool
mayBlock = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
let mayBlock' :: CInt
mayBlock' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
mayBlock
CInt
result <- Ptr MainContext -> CInt -> IO CInt
g_main_context_iteration Ptr MainContext
context' CInt
mayBlock'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data MainContextIterationMethodInfo
instance (signature ~ (Bool -> m Bool), MonadIO m) => O.MethodInfo MainContextIterationMethodInfo MainContext signature where
overloadedMethod = mainContextIteration
#endif
foreign import ccall "g_main_context_pending" g_main_context_pending ::
Ptr MainContext ->
IO CInt
mainContextPending ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> m Bool
mainContextPending :: MainContext -> m Bool
mainContextPending context :: MainContext
context = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
CInt
result <- Ptr MainContext -> IO CInt
g_main_context_pending Ptr MainContext
context'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data MainContextPendingMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo MainContextPendingMethodInfo MainContext signature where
overloadedMethod = mainContextPending
#endif
foreign import ccall "g_main_context_pop_thread_default" g_main_context_pop_thread_default ::
Ptr MainContext ->
IO ()
mainContextPopThreadDefault ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> m ()
mainContextPopThreadDefault :: MainContext -> m ()
mainContextPopThreadDefault context :: MainContext
context = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr MainContext -> IO ()
g_main_context_pop_thread_default Ptr MainContext
context'
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MainContextPopThreadDefaultMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo MainContextPopThreadDefaultMethodInfo MainContext signature where
overloadedMethod = mainContextPopThreadDefault
#endif
foreign import ccall "g_main_context_prepare" g_main_context_prepare ::
Ptr MainContext ->
Int32 ->
IO CInt
mainContextPrepare ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> Int32
-> m Bool
mainContextPrepare :: MainContext -> Int32 -> m Bool
mainContextPrepare context :: MainContext
context priority :: Int32
priority = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
CInt
result <- Ptr MainContext -> Int32 -> IO CInt
g_main_context_prepare Ptr MainContext
context' Int32
priority
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data MainContextPrepareMethodInfo
instance (signature ~ (Int32 -> m Bool), MonadIO m) => O.MethodInfo MainContextPrepareMethodInfo MainContext signature where
overloadedMethod = mainContextPrepare
#endif
foreign import ccall "g_main_context_push_thread_default" g_main_context_push_thread_default ::
Ptr MainContext ->
IO ()
mainContextPushThreadDefault ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> m ()
mainContextPushThreadDefault :: MainContext -> m ()
mainContextPushThreadDefault context :: MainContext
context = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr MainContext -> IO ()
g_main_context_push_thread_default Ptr MainContext
context'
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MainContextPushThreadDefaultMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo MainContextPushThreadDefaultMethodInfo MainContext signature where
overloadedMethod = mainContextPushThreadDefault
#endif
foreign import ccall "g_main_context_query" g_main_context_query ::
Ptr MainContext ->
Int32 ->
Ptr Int32 ->
Ptr GLib.PollFD.PollFD ->
Int32 ->
IO Int32
mainContextQuery ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> Int32
-> [GLib.PollFD.PollFD]
-> m ((Int32, Int32, [GLib.PollFD.PollFD]))
mainContextQuery :: MainContext -> Int32 -> [PollFD] -> m (Int32, Int32, [PollFD])
mainContextQuery context :: MainContext
context maxPriority :: Int32
maxPriority fds :: [PollFD]
fds = IO (Int32, Int32, [PollFD]) -> m (Int32, Int32, [PollFD])
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int32, Int32, [PollFD]) -> m (Int32, Int32, [PollFD]))
-> IO (Int32, Int32, [PollFD]) -> m (Int32, Int32, [PollFD])
forall a b. (a -> b) -> a -> b
$ do
let nFds :: Int32
nFds = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [PollFD] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [PollFD]
fds
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr Int32
timeout_ <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
[Ptr PollFD]
fds' <- (PollFD -> IO (Ptr PollFD)) -> [PollFD] -> IO [Ptr PollFD]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM PollFD -> IO (Ptr PollFD)
forall a. (HasCallStack, BoxedObject a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed [PollFD]
fds
Ptr PollFD
fds'' <- Int -> [Ptr PollFD] -> IO (Ptr PollFD)
forall a. Int -> [Ptr a] -> IO (Ptr a)
packBlockArray 8 [Ptr PollFD]
fds'
Int32
result <- Ptr MainContext
-> Int32 -> Ptr Int32 -> Ptr PollFD -> Int32 -> IO Int32
g_main_context_query Ptr MainContext
context' Int32
maxPriority Ptr Int32
timeout_ Ptr PollFD
fds'' Int32
nFds
Int32
timeout_' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
timeout_
[Ptr PollFD]
fds''' <- (Int -> Int32 -> Ptr PollFD -> IO [Ptr PollFD]
forall a b.
(Integral a, BoxedObject b) =>
Int -> a -> Ptr b -> IO [Ptr b]
unpackBoxedArrayWithLength 8 Int32
nFds) Ptr PollFD
fds''
[PollFD]
fds'''' <- (Ptr PollFD -> IO PollFD) -> [Ptr PollFD] -> IO [PollFD]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr PollFD -> PollFD) -> Ptr PollFD -> IO PollFD
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr PollFD -> PollFD
GLib.PollFD.PollFD) [Ptr PollFD]
fds'''
Ptr PollFD -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr PollFD
fds''
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
(PollFD -> IO ()) -> [PollFD] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ PollFD -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [PollFD]
fds
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
timeout_
(Int32, Int32, [PollFD]) -> IO (Int32, Int32, [PollFD])
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32
result, Int32
timeout_', [PollFD]
fds'''')
#if defined(ENABLE_OVERLOADING)
data MainContextQueryMethodInfo
instance (signature ~ (Int32 -> [GLib.PollFD.PollFD] -> m ((Int32, Int32, [GLib.PollFD.PollFD]))), MonadIO m) => O.MethodInfo MainContextQueryMethodInfo MainContext signature where
overloadedMethod = mainContextQuery
#endif
foreign import ccall "g_main_context_ref" g_main_context_ref ::
Ptr MainContext ->
IO (Ptr MainContext)
mainContextRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> m MainContext
mainContextRef :: MainContext -> m MainContext
mainContextRef context :: MainContext
context = IO MainContext -> m MainContext
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MainContext -> m MainContext)
-> IO MainContext -> m MainContext
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr MainContext
result <- Ptr MainContext -> IO (Ptr MainContext)
g_main_context_ref Ptr MainContext
context'
Text -> Ptr MainContext -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "mainContextRef" Ptr MainContext
result
MainContext
result' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr MainContext -> MainContext
MainContext) Ptr MainContext
result
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
MainContext -> IO MainContext
forall (m :: * -> *) a. Monad m => a -> m a
return MainContext
result'
#if defined(ENABLE_OVERLOADING)
data MainContextRefMethodInfo
instance (signature ~ (m MainContext), MonadIO m) => O.MethodInfo MainContextRefMethodInfo MainContext signature where
overloadedMethod = mainContextRef
#endif
foreign import ccall "g_main_context_release" g_main_context_release ::
Ptr MainContext ->
IO ()
mainContextRelease ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> m ()
mainContextRelease :: MainContext -> m ()
mainContextRelease context :: MainContext
context = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr MainContext -> IO ()
g_main_context_release Ptr MainContext
context'
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MainContextReleaseMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo MainContextReleaseMethodInfo MainContext signature where
overloadedMethod = mainContextRelease
#endif
foreign import ccall "g_main_context_remove_poll" g_main_context_remove_poll ::
Ptr MainContext ->
Ptr GLib.PollFD.PollFD ->
IO ()
mainContextRemovePoll ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> GLib.PollFD.PollFD
-> m ()
mainContextRemovePoll :: MainContext -> PollFD -> m ()
mainContextRemovePoll context :: MainContext
context fd :: PollFD
fd = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr PollFD
fd' <- PollFD -> IO (Ptr PollFD)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr PollFD
fd
Ptr MainContext -> Ptr PollFD -> IO ()
g_main_context_remove_poll Ptr MainContext
context' Ptr PollFD
fd'
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
PollFD -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr PollFD
fd
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MainContextRemovePollMethodInfo
instance (signature ~ (GLib.PollFD.PollFD -> m ()), MonadIO m) => O.MethodInfo MainContextRemovePollMethodInfo MainContext signature where
overloadedMethod = mainContextRemovePoll
#endif
foreign import ccall "g_main_context_unref" g_main_context_unref ::
Ptr MainContext ->
IO ()
mainContextUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> m ()
mainContextUnref :: MainContext -> m ()
mainContextUnref context :: MainContext
context = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr MainContext -> IO ()
g_main_context_unref Ptr MainContext
context'
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MainContextUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo MainContextUnrefMethodInfo MainContext signature where
overloadedMethod = mainContextUnref
#endif
foreign import ccall "g_main_context_wait" g_main_context_wait ::
Ptr MainContext ->
Ptr GLib.Cond.Cond ->
Ptr GLib.Mutex.Mutex ->
IO CInt
{-# DEPRECATED mainContextWait ["(Since version 2.58)","Use 'GI.GLib.Structs.MainContext.mainContextIsOwner' and separate locking instead."] #-}
mainContextWait ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> GLib.Cond.Cond
-> GLib.Mutex.Mutex
-> m Bool
mainContextWait :: MainContext -> Cond -> Mutex -> m Bool
mainContextWait context :: MainContext
context cond :: Cond
cond mutex :: Mutex
mutex = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr Cond
cond' <- Cond -> IO (Ptr Cond)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Cond
cond
Ptr Mutex
mutex' <- Mutex -> IO (Ptr Mutex)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Mutex
mutex
CInt
result <- Ptr MainContext -> Ptr Cond -> Ptr Mutex -> IO CInt
g_main_context_wait Ptr MainContext
context' Ptr Cond
cond' Ptr Mutex
mutex'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
Cond -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Cond
cond
Mutex -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Mutex
mutex
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data MainContextWaitMethodInfo
instance (signature ~ (GLib.Cond.Cond -> GLib.Mutex.Mutex -> m Bool), MonadIO m) => O.MethodInfo MainContextWaitMethodInfo MainContext signature where
overloadedMethod = mainContextWait
#endif
foreign import ccall "g_main_context_wakeup" g_main_context_wakeup ::
Ptr MainContext ->
IO ()
mainContextWakeup ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> m ()
mainContextWakeup :: MainContext -> m ()
mainContextWakeup context :: MainContext
context = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
context' <- MainContext -> IO (Ptr MainContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MainContext
context
Ptr MainContext -> IO ()
g_main_context_wakeup Ptr MainContext
context'
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MainContextWakeupMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo MainContextWakeupMethodInfo MainContext signature where
overloadedMethod = mainContextWakeup
#endif
foreign import ccall "g_main_context_default" g_main_context_default ::
IO (Ptr MainContext)
mainContextDefault ::
(B.CallStack.HasCallStack, MonadIO m) =>
m MainContext
mainContextDefault :: m MainContext
mainContextDefault = IO MainContext -> m MainContext
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MainContext -> m MainContext)
-> IO MainContext -> m MainContext
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
result <- IO (Ptr MainContext)
g_main_context_default
Text -> Ptr MainContext -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "mainContextDefault" Ptr MainContext
result
MainContext
result' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr MainContext -> MainContext
MainContext) Ptr MainContext
result
MainContext -> IO MainContext
forall (m :: * -> *) a. Monad m => a -> m a
return MainContext
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_main_context_get_thread_default" g_main_context_get_thread_default ::
IO (Ptr MainContext)
mainContextGetThreadDefault ::
(B.CallStack.HasCallStack, MonadIO m) =>
m MainContext
mainContextGetThreadDefault :: m MainContext
mainContextGetThreadDefault = IO MainContext -> m MainContext
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MainContext -> m MainContext)
-> IO MainContext -> m MainContext
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
result <- IO (Ptr MainContext)
g_main_context_get_thread_default
Text -> Ptr MainContext -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "mainContextGetThreadDefault" Ptr MainContext
result
MainContext
result' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr MainContext -> MainContext
MainContext) Ptr MainContext
result
MainContext -> IO MainContext
forall (m :: * -> *) a. Monad m => a -> m a
return MainContext
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_main_context_ref_thread_default" g_main_context_ref_thread_default ::
IO (Ptr MainContext)
mainContextRefThreadDefault ::
(B.CallStack.HasCallStack, MonadIO m) =>
m MainContext
mainContextRefThreadDefault :: m MainContext
mainContextRefThreadDefault = IO MainContext -> m MainContext
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MainContext -> m MainContext)
-> IO MainContext -> m MainContext
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
result <- IO (Ptr MainContext)
g_main_context_ref_thread_default
Text -> Ptr MainContext -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "mainContextRefThreadDefault" Ptr MainContext
result
MainContext
result' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr MainContext -> MainContext
MainContext) Ptr MainContext
result
MainContext -> IO MainContext
forall (m :: * -> *) a. Monad m => a -> m a
return MainContext
result'
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveMainContextMethod (t :: Symbol) (o :: *) :: * where
ResolveMainContextMethod "acquire" o = MainContextAcquireMethodInfo
ResolveMainContextMethod "addPoll" o = MainContextAddPollMethodInfo
ResolveMainContextMethod "check" o = MainContextCheckMethodInfo
ResolveMainContextMethod "dispatch" o = MainContextDispatchMethodInfo
ResolveMainContextMethod "findSourceByFuncsUserData" o = MainContextFindSourceByFuncsUserDataMethodInfo
ResolveMainContextMethod "findSourceById" o = MainContextFindSourceByIdMethodInfo
ResolveMainContextMethod "findSourceByUserData" o = MainContextFindSourceByUserDataMethodInfo
ResolveMainContextMethod "invokeFull" o = MainContextInvokeFullMethodInfo
ResolveMainContextMethod "isOwner" o = MainContextIsOwnerMethodInfo
ResolveMainContextMethod "iteration" o = MainContextIterationMethodInfo
ResolveMainContextMethod "pending" o = MainContextPendingMethodInfo
ResolveMainContextMethod "popThreadDefault" o = MainContextPopThreadDefaultMethodInfo
ResolveMainContextMethod "prepare" o = MainContextPrepareMethodInfo
ResolveMainContextMethod "pushThreadDefault" o = MainContextPushThreadDefaultMethodInfo
ResolveMainContextMethod "query" o = MainContextQueryMethodInfo
ResolveMainContextMethod "ref" o = MainContextRefMethodInfo
ResolveMainContextMethod "release" o = MainContextReleaseMethodInfo
ResolveMainContextMethod "removePoll" o = MainContextRemovePollMethodInfo
ResolveMainContextMethod "unref" o = MainContextUnrefMethodInfo
ResolveMainContextMethod "wait" o = MainContextWaitMethodInfo
ResolveMainContextMethod "wakeup" o = MainContextWakeupMethodInfo
ResolveMainContextMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveMainContextMethod t MainContext, O.MethodInfo info MainContext p) => OL.IsLabel t (MainContext -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif