{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GLib.Structs.MainContext
(
MainContext(..) ,
#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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified 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 (SP.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)
instance SP.ManagedPtrNewtype MainContext where
toManagedPtr :: MainContext -> ManagedPtr MainContext
toManagedPtr (MainContext ManagedPtr MainContext
p) = ManagedPtr MainContext
p
foreign import ccall "g_main_context_get_type" c_g_main_context_get_type ::
IO GType
type instance O.ParentTypes MainContext = '[]
instance O.HasParentTypes MainContext
instance B.Types.TypedObject MainContext where
glibType :: IO GType
glibType = IO GType
c_g_main_context_get_type
instance B.Types.GBoxed MainContext
instance B.GValue.IsGValue (Maybe MainContext) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_main_context_get_type
gvalueSet_ :: Ptr GValue -> Maybe MainContext -> IO ()
gvalueSet_ Ptr GValue
gv Maybe MainContext
P.Nothing = Ptr GValue -> Ptr MainContext -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr MainContext
forall a. Ptr a
FP.nullPtr :: FP.Ptr MainContext)
gvalueSet_ Ptr GValue
gv (P.Just MainContext
obj) = MainContext -> (Ptr MainContext -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr MainContext
obj (Ptr GValue -> Ptr MainContext -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe MainContext)
gvalueGet_ Ptr GValue
gv = do
Ptr MainContext
ptr <- Ptr GValue -> IO (Ptr MainContext)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr MainContext)
if Ptr MainContext
ptr Ptr MainContext -> Ptr MainContext -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr MainContext
forall a. Ptr a
FP.nullPtr
then MainContext -> Maybe MainContext
forall a. a -> Maybe a
P.Just (MainContext -> Maybe MainContext)
-> IO MainContext -> IO (Maybe MainContext)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr MainContext -> MainContext
MainContext Ptr MainContext
ptr
else Maybe MainContext -> IO (Maybe MainContext)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe MainContext
forall a. Maybe a
P.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => 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 Text
"mainContextNew" Ptr MainContext
result
MainContext
result' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, GBoxed 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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> m Bool
mainContextAcquire 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
/= CInt
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.OverloadedMethod MainContextAcquireMethodInfo MainContext signature where
overloadedMethod = mainContextAcquire
instance O.OverloadedMethodInfo MainContextAcquireMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextAcquire",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> PollFD -> Int32 -> m ()
mainContextAddPoll MainContext
context PollFD
fd 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.OverloadedMethod MainContextAddPollMethodInfo MainContext signature where
overloadedMethod = mainContextAddPoll
instance O.OverloadedMethodInfo MainContextAddPollMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextAddPoll",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> Int32 -> [PollFD] -> m Bool
mainContextCheck MainContext
context Int32
maxPriority [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
P.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 Int
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
/= CInt
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.OverloadedMethod MainContextCheckMethodInfo MainContext signature where
overloadedMethod = mainContextCheck
instance O.OverloadedMethodInfo MainContextCheckMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextCheck",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> m ()
mainContextDispatch 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.OverloadedMethod MainContextDispatchMethodInfo MainContext signature where
overloadedMethod = mainContextDispatch
instance O.OverloadedMethodInfo MainContextDispatchMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextDispatch",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> SourceFuncs -> Ptr () -> m Source
mainContextFindSourceByFuncsUserData MainContext
context SourceFuncs
funcs 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 Text
"mainContextFindSourceByFuncsUserData" Ptr Source
result
Source
result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod MainContextFindSourceByFuncsUserDataMethodInfo MainContext signature where
overloadedMethod = mainContextFindSourceByFuncsUserData
instance O.OverloadedMethodInfo MainContextFindSourceByFuncsUserDataMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextFindSourceByFuncsUserData",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> Word32 -> m Source
mainContextFindSourceById MainContext
context 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 Text
"mainContextFindSourceById" Ptr Source
result
Source
result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod MainContextFindSourceByIdMethodInfo MainContext signature where
overloadedMethod = mainContextFindSourceById
instance O.OverloadedMethodInfo MainContextFindSourceByIdMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextFindSourceById",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> Ptr () -> m Source
mainContextFindSourceByUserData MainContext
context 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 Text
"mainContextFindSourceByUserData" Ptr Source
result
Source
result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod MainContextFindSourceByUserDataMethodInfo MainContext signature where
overloadedMethod = mainContextFindSourceByUserData
instance O.OverloadedMethodInfo MainContextFindSourceByUserDataMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextFindSourceByUserData",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> Int32 -> IO Bool -> m ()
mainContextInvokeFull MainContext
context Int32
priority 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 ())
SP.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.OverloadedMethod MainContextInvokeFullMethodInfo MainContext signature where
overloadedMethod = mainContextInvokeFull
instance O.OverloadedMethodInfo MainContextInvokeFullMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextInvokeFull",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> m Bool
mainContextIsOwner 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
/= CInt
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.OverloadedMethod MainContextIsOwnerMethodInfo MainContext signature where
overloadedMethod = mainContextIsOwner
instance O.OverloadedMethodInfo MainContextIsOwnerMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextIsOwner",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> Bool -> m Bool
mainContextIteration MainContext
context 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
/= CInt
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.OverloadedMethod MainContextIterationMethodInfo MainContext signature where
overloadedMethod = mainContextIteration
instance O.OverloadedMethodInfo MainContextIterationMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextIteration",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> m Bool
mainContextPending 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
/= CInt
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.OverloadedMethod MainContextPendingMethodInfo MainContext signature where
overloadedMethod = mainContextPending
instance O.OverloadedMethodInfo MainContextPendingMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextPending",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> m ()
mainContextPopThreadDefault 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.OverloadedMethod MainContextPopThreadDefaultMethodInfo MainContext signature where
overloadedMethod = mainContextPopThreadDefault
instance O.OverloadedMethodInfo MainContextPopThreadDefaultMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextPopThreadDefault",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v:mainContextPopThreadDefault"
})
#endif
foreign import ccall "g_main_context_prepare" g_main_context_prepare ::
Ptr MainContext ->
Ptr Int32 ->
IO CInt
mainContextPrepare ::
(B.CallStack.HasCallStack, MonadIO m) =>
MainContext
-> m ((Bool, Int32))
mainContextPrepare :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> m (Bool, Int32)
mainContextPrepare MainContext
context = IO (Bool, Int32) -> m (Bool, Int32)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Int32) -> m (Bool, Int32))
-> IO (Bool, Int32) -> m (Bool, Int32)
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 Int32
priority <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
CInt
result <- Ptr MainContext -> Ptr Int32 -> IO CInt
g_main_context_prepare Ptr MainContext
context' Ptr Int32
priority
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
Int32
priority' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
priority
MainContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MainContext
context
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
priority
(Bool, Int32) -> IO (Bool, Int32)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Int32
priority')
#if defined(ENABLE_OVERLOADING)
data MainContextPrepareMethodInfo
instance (signature ~ (m ((Bool, Int32))), MonadIO m) => O.OverloadedMethod MainContextPrepareMethodInfo MainContext signature where
overloadedMethod = mainContextPrepare
instance O.OverloadedMethodInfo MainContextPrepareMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextPrepare",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> m ()
mainContextPushThreadDefault 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.OverloadedMethod MainContextPushThreadDefaultMethodInfo MainContext signature where
overloadedMethod = mainContextPushThreadDefault
instance O.OverloadedMethodInfo MainContextPushThreadDefaultMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextPushThreadDefault",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> Int32 -> [PollFD] -> m (Int32, Int32, [PollFD])
mainContextQuery MainContext
context Int32
maxPriority [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
P.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, GBoxed 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 Int
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, GBoxed b) =>
Int -> a -> Ptr b -> IO [Ptr b]
unpackBoxedArrayWithLength Int
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, GBoxed 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.OverloadedMethod MainContextQueryMethodInfo MainContext signature where
overloadedMethod = mainContextQuery
instance O.OverloadedMethodInfo MainContextQueryMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextQuery",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> m MainContext
mainContextRef 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 Text
"mainContextRef" Ptr MainContext
result
MainContext
result' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod MainContextRefMethodInfo MainContext signature where
overloadedMethod = mainContextRef
instance O.OverloadedMethodInfo MainContextRefMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextRef",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> m ()
mainContextRelease 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.OverloadedMethod MainContextReleaseMethodInfo MainContext signature where
overloadedMethod = mainContextRelease
instance O.OverloadedMethodInfo MainContextReleaseMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextRelease",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> PollFD -> m ()
mainContextRemovePoll MainContext
context 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.OverloadedMethod MainContextRemovePollMethodInfo MainContext signature where
overloadedMethod = mainContextRemovePoll
instance O.OverloadedMethodInfo MainContextRemovePollMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextRemovePoll",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> m ()
mainContextUnref 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.OverloadedMethod MainContextUnrefMethodInfo MainContext signature where
overloadedMethod = mainContextUnref
instance O.OverloadedMethodInfo MainContextUnrefMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextUnref",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> Cond -> Mutex -> m Bool
mainContextWait MainContext
context Cond
cond 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
/= CInt
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.OverloadedMethod MainContextWaitMethodInfo MainContext signature where
overloadedMethod = mainContextWait
instance O.OverloadedMethodInfo MainContextWaitMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextWait",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
MainContext -> m ()
mainContextWakeup 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.OverloadedMethod MainContextWakeupMethodInfo MainContext signature where
overloadedMethod = mainContextWakeup
instance O.OverloadedMethodInfo MainContextWakeupMethodInfo MainContext where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GLib.Structs.MainContext.mainContextWakeup",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.26/docs/GI-GLib-Structs-MainContext.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => 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 Text
"mainContextDefault" Ptr MainContext
result
MainContext
result' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, GBoxed 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 (Maybe MainContext)
mainContextGetThreadDefault :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
m (Maybe MainContext)
mainContextGetThreadDefault = IO (Maybe MainContext) -> m (Maybe MainContext)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe MainContext) -> m (Maybe MainContext))
-> IO (Maybe MainContext) -> m (Maybe MainContext)
forall a b. (a -> b) -> a -> b
$ do
Ptr MainContext
result <- IO (Ptr MainContext)
g_main_context_get_thread_default
Maybe MainContext
maybeResult <- Ptr MainContext
-> (Ptr MainContext -> IO MainContext) -> IO (Maybe MainContext)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr MainContext
result ((Ptr MainContext -> IO MainContext) -> IO (Maybe MainContext))
-> (Ptr MainContext -> IO MainContext) -> IO (Maybe MainContext)
forall a b. (a -> b) -> a -> b
$ \Ptr MainContext
result' -> do
MainContext
result'' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, GBoxed 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''
Maybe MainContext -> IO (Maybe MainContext)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe MainContext
maybeResult
#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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => 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 Text
"mainContextRefThreadDefault" Ptr MainContext
result
MainContext
result' <- ((ManagedPtr MainContext -> MainContext)
-> Ptr MainContext -> IO MainContext
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod 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
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveMainContextMethod t MainContext, O.OverloadedMethod info MainContext p, R.HasField t MainContext p) => R.HasField t MainContext p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveMainContextMethod t MainContext, O.OverloadedMethodInfo info MainContext) => OL.IsLabel t (O.MethodProxy info MainContext) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif