-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

#if !defined(__HADDOCK_VERSION__)
#define ENABLE_OVERLOADING
#endif

module GI.Vte.Functions
    ( 

 -- * Methods


-- ** eventContextGetType #method:eventContextGetType#

    eventContextGetType                     ,


-- ** getEncodingSupported #method:getEncodingSupported#

    getEncodingSupported                    ,


-- ** getEncodings #method:getEncodings#

    getEncodings                            ,


-- ** getFeatureFlags #method:getFeatureFlags#

    getFeatureFlags                         ,


-- ** getFeatures #method:getFeatures#

    getFeatures                             ,


-- ** getMajorVersion #method:getMajorVersion#

    getMajorVersion                         ,


-- ** getMicroVersion #method:getMicroVersion#

    getMicroVersion                         ,


-- ** getMinorVersion #method:getMinorVersion#

    getMinorVersion                         ,


-- ** getTermprops #method:getTermprops#

    getTermprops                            ,


-- ** getUserShell #method:getUserShell#

    getUserShell                            ,


-- ** installTermprop #method:installTermprop#

    installTermprop                         ,


-- ** installTermpropAlias #method:installTermpropAlias#

    installTermpropAlias                    ,


-- ** queryTermprop #method:queryTermprop#

    queryTermprop                           ,


-- ** queryTermpropById #method:queryTermpropById#

    queryTermpropById                       ,




    ) 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.GHashTable as B.GHT
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.Kind as DK
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 Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import {-# SOURCE #-} qualified GI.Vte.Enums as Vte.Enums
import {-# SOURCE #-} qualified GI.Vte.Flags as Vte.Flags

#else
import {-# SOURCE #-} qualified GI.Vte.Enums as Vte.Enums
import {-# SOURCE #-} qualified GI.Vte.Flags as Vte.Flags

#endif

-- function query_termprop_by_id
-- Args: [ Arg
--           { argCName = "prop"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a termprop ID" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a location to store the termprop's name"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "type"
--           , argType =
--               TInterface Name { namespace = "Vte" , name = "PropertyType" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a location to store the termprop's type as a #VtePropertyType"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "Vte" , name = "PropertyFlags" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a location to store the termprop's flags as a #VtePropertyFlags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "vte_query_termprop_by_id" vte_query_termprop_by_id :: 
    Int32 ->                                -- prop : TBasicType TInt
    Ptr CString ->                          -- name : TBasicType TUTF8
    Ptr CUInt ->                            -- type : TInterface (Name {namespace = "Vte", name = "PropertyType"})
    Ptr CUInt ->                            -- flags : TInterface (Name {namespace = "Vte", name = "PropertyFlags"})
    IO CInt

-- | Like 'GI.Vte.Functions.queryTermprop' except that it takes the termprop by ID.
-- See that function for more information.
-- 
-- For an alias termprop (see 'GI.Vte.Functions.installTermpropAlias'), /@resolvedName@/
-- will be name of the alias\' target termprop; otherwise it will be /@name@/.
-- 
-- /Since: 0.78/
queryTermpropById ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@prop@/: a termprop ID
    -> m ((Bool, T.Text, Vte.Enums.PropertyType, [Vte.Flags.PropertyFlags]))
    -- ^ __Returns:__ 'P.True' iff the termprop exists, and then /@name@/, /@type@/ and
    --   /@flags@/ will be filled in
queryTermpropById :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> m (Bool, Text, PropertyType, [PropertyFlags])
queryTermpropById Int32
prop = IO (Bool, Text, PropertyType, [PropertyFlags])
-> m (Bool, Text, PropertyType, [PropertyFlags])
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Text, PropertyType, [PropertyFlags])
 -> m (Bool, Text, PropertyType, [PropertyFlags]))
-> IO (Bool, Text, PropertyType, [PropertyFlags])
-> m (Bool, Text, PropertyType, [PropertyFlags])
forall a b. (a -> b) -> a -> b
$ do
    Ptr CString
name <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr CUInt
type_ <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
    Ptr CUInt
flags <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
    CInt
result <- Int32 -> Ptr CString -> Ptr CUInt -> Ptr CUInt -> IO CInt
vte_query_termprop_by_id Int32
prop Ptr CString
name Ptr CUInt
type_ Ptr CUInt
flags
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString
name' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
name
    Text
name'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name'
    CUInt
type_' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
type_
    let type_'' :: PropertyType
type_'' = (Int -> PropertyType
forall a. Enum a => Int -> a
toEnum (Int -> PropertyType) -> (CUInt -> Int) -> CUInt -> PropertyType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
type_'
    CUInt
flags' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
flags
    let flags'' :: [PropertyFlags]
flags'' = CUInt -> [PropertyFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
flags'
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
name
    Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
type_
    Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
flags
    (Bool, Text, PropertyType, [PropertyFlags])
-> IO (Bool, Text, PropertyType, [PropertyFlags])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Text
name'', PropertyType
type_'', [PropertyFlags]
flags'')


-- function query_termprop
-- Args: [ Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a termprop name" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "resolved_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a location to store the termprop's name"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "prop"
--           , argType = TBasicType TInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a location to store the termprop's ID"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "type"
--           , argType =
--               TInterface Name { namespace = "Vte" , name = "PropertyType" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a location to store the termprop's type as a #VtePropertyType"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "Vte" , name = "PropertyFlags" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a location to store the termprop's flags as a #VtePropertyFlags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "vte_query_termprop" vte_query_termprop :: 
    CString ->                              -- name : TBasicType TUTF8
    Ptr CString ->                          -- resolved_name : TBasicType TUTF8
    Ptr Int32 ->                            -- prop : TBasicType TInt
    Ptr CUInt ->                            -- type : TInterface (Name {namespace = "Vte", name = "PropertyType"})
    Ptr CUInt ->                            -- flags : TInterface (Name {namespace = "Vte", name = "PropertyFlags"})
    IO CInt

-- | Gets the property type of the termprop. For properties installed by
-- 'GI.Vte.Functions.installTermprop', the name starts with \"vte.ext.\".
-- 
-- For an alias termprop (see 'GI.Vte.Functions.installTermpropAlias'), /@resolvedName@/
-- will be name of the alias\' target termprop; otherwise it will be /@name@/.
-- 
-- /Since: 0.78/
queryTermprop ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@name@/: a termprop name
    -> m ((Bool, T.Text, Int32, Vte.Enums.PropertyType, [Vte.Flags.PropertyFlags]))
    -- ^ __Returns:__ 'P.True' iff the termprop exists, and then /@prop@/, /@type@/ and
    --   /@flags@/ will be filled in
queryTermprop :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m (Bool, Text, Int32, PropertyType, [PropertyFlags])
queryTermprop Text
name = IO (Bool, Text, Int32, PropertyType, [PropertyFlags])
-> m (Bool, Text, Int32, PropertyType, [PropertyFlags])
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Text, Int32, PropertyType, [PropertyFlags])
 -> m (Bool, Text, Int32, PropertyType, [PropertyFlags]))
-> IO (Bool, Text, Int32, PropertyType, [PropertyFlags])
-> m (Bool, Text, Int32, PropertyType, [PropertyFlags])
forall a b. (a -> b) -> a -> b
$ do
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr CString
resolvedName <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr Int32
prop <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    Ptr CUInt
type_ <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
    Ptr CUInt
flags <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
    CInt
result <- CString
-> Ptr CString -> Ptr Int32 -> Ptr CUInt -> Ptr CUInt -> IO CInt
vte_query_termprop CString
name' Ptr CString
resolvedName Ptr Int32
prop Ptr CUInt
type_ Ptr CUInt
flags
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString
resolvedName' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
resolvedName
    Text
resolvedName'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
resolvedName'
    Int32
prop' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
prop
    CUInt
type_' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
type_
    let type_'' :: PropertyType
type_'' = (Int -> PropertyType
forall a. Enum a => Int -> a
toEnum (Int -> PropertyType) -> (CUInt -> Int) -> CUInt -> PropertyType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
type_'
    CUInt
flags' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
flags
    let flags'' :: [PropertyFlags]
flags'' = CUInt -> [PropertyFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
flags'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
resolvedName
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
prop
    Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
type_
    Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
flags
    (Bool, Text, Int32, PropertyType, [PropertyFlags])
-> IO (Bool, Text, Int32, PropertyType, [PropertyFlags])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Text
resolvedName'', Int32
prop', PropertyType
type_'', [PropertyFlags]
flags'')


-- function install_termprop_alias
-- Args: [ Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a namespaced property name"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "target_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the target property name"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vte_install_termprop_alias" vte_install_termprop_alias :: 
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- target_name : TBasicType TUTF8
    IO Int32

-- | Installs a new terminal property /@name@/ as an alias for the terminal
-- property /@targetName@/.
-- 
-- /Since: 0.78/
installTermpropAlias ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@name@/: a namespaced property name
    -> T.Text
    -- ^ /@targetName@/: the target property name
    -> m Int32
    -- ^ __Returns:__ the ID for the termprop /@targetName@/
installTermpropAlias :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Text -> m Int32
installTermpropAlias Text
name Text
targetName = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
name' <- Text -> IO CString
textToCString Text
name
    CString
targetName' <- Text -> IO CString
textToCString Text
targetName
    Int32
result <- CString -> CString -> IO Int32
vte_install_termprop_alias CString
name' CString
targetName'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
targetName'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function install_termprop
-- Args: [ Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a namespaced property name"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "type"
--           , argType =
--               TInterface Name { namespace = "Vte" , name = "PropertyType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #VtePropertyType to use for the property"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "Vte" , name = "PropertyFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "flags from #VtePropertyFlags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vte_install_termprop" vte_install_termprop :: 
    CString ->                              -- name : TBasicType TUTF8
    CUInt ->                                -- type : TInterface (Name {namespace = "Vte", name = "PropertyType"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Vte", name = "PropertyFlags"})
    IO Int32

-- | Installs a new terminal property that can be set by the application.
-- 
-- /@name@/ must follow the rules for termprop names as laid out above; it
-- must have at least 4 components, the first two of which must be \"vte\",
-- and \"ext\". Use the 'GI.Vte.Constants.TERMPROP_NAME_PREFIX' macro which defines this
-- name prefix.
-- 
-- You should use an identifier for your terminal as the first component
-- after the prefix, as a namespace marker.
-- 
-- It is a programming error to call this function with a /@name@/ that does
-- not meet these requirements.
-- 
-- It is a programming error to call this function after any t'GI.Vte.Objects.Terminal.Terminal'
-- instances have been created.
-- 
-- It is a programming error to call this function if the named termprop
-- is already installed with a different type or flags.
-- 
-- /Since: 0.78/
installTermprop ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@name@/: a namespaced property name
    -> Vte.Enums.PropertyType
    -- ^ /@type@/: a t'GI.Vte.Enums.PropertyType' to use for the property
    -> [Vte.Flags.PropertyFlags]
    -- ^ /@flags@/: flags from t'GI.Vte.Flags.PropertyFlags'
    -> m Int32
    -- ^ __Returns:__ an ID for the termprop
installTermprop :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> PropertyType -> [PropertyFlags] -> m Int32
installTermprop Text
name PropertyType
type_ [PropertyFlags]
flags = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
name' <- Text -> IO CString
textToCString Text
name
    let type_' :: CUInt
type_' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (PropertyType -> Int) -> PropertyType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PropertyType -> Int
forall a. Enum a => a -> Int
fromEnum) PropertyType
type_
    let flags' :: CUInt
flags' = [PropertyFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [PropertyFlags]
flags
    Int32
result <- CString -> CUInt -> CUInt -> IO Int32
vte_install_termprop CString
name' CUInt
type_' CUInt
flags'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function get_user_shell
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TFileName)
-- throws : False
-- Skip return : False

foreign import ccall "vte_get_user_shell" vte_get_user_shell :: 
    IO CString

-- | Gets the user\'s shell, or 'P.Nothing'. In the latter case, the
-- system default (usually \"\/bin\/sh\") should be used.
getUserShell ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [Char]
    -- ^ __Returns:__ a newly allocated string with the
    --   user\'s shell, or 'P.Nothing'
getUserShell :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m [Char]
getUserShell  = IO [Char] -> m [Char]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Char] -> m [Char]) -> IO [Char] -> m [Char]
forall a b. (a -> b) -> a -> b
$ do
    CString
result <- IO CString
vte_get_user_shell
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"getUserShell" CString
result
    [Char]
result' <- HasCallStack => CString -> IO [Char]
CString -> IO [Char]
cstringToString CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    [Char] -> IO [Char]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Char]
result'


-- function get_termprops
-- Args: [ Arg
--           { argCName = "length"
--           , argType = TBasicType TSize
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a location to store the length of the returned array"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "length"
--              , argType = TBasicType TSize
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "a location to store the length of the returned array"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TCArray False (-1) 0 (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "vte_get_termprops" vte_get_termprops :: 
    Ptr FCT.CSize ->                        -- length : TBasicType TSize
    IO (Ptr CString)

-- | Gets the names of the installed termprops in an unspecified order.
-- 
-- /Since: 0.78/
getTermprops ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m (Maybe [T.Text])
    -- ^ __Returns:__ the names of the installed
    --   termprops, or 'P.Nothing' if there are no termprops
getTermprops :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m (Maybe [Text])
getTermprops  = IO (Maybe [Text]) -> m (Maybe [Text])
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe [Text]) -> m (Maybe [Text]))
-> IO (Maybe [Text]) -> m (Maybe [Text])
forall a b. (a -> b) -> a -> b
$ do
    Ptr CSize
length_ <- IO (Ptr CSize)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr FCT.CSize)
    Ptr CString
result <- Ptr CSize -> IO (Ptr CString)
vte_get_termprops Ptr CSize
length_
    CSize
length_' <- Ptr CSize -> IO CSize
forall a. Storable a => Ptr a -> IO a
peek Ptr CSize
length_
    Maybe [Text]
maybeResult <- Ptr CString -> (Ptr CString -> IO [Text]) -> IO (Maybe [Text])
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr CString
result ((Ptr CString -> IO [Text]) -> IO (Maybe [Text]))
-> (Ptr CString -> IO [Text]) -> IO (Maybe [Text])
forall a b. (a -> b) -> a -> b
$ \Ptr CString
result' -> do
        [Text]
result'' <- (CSize -> Ptr CString -> IO [Text]
forall a.
(HasCallStack, Integral a) =>
a -> Ptr CString -> IO [Text]
unpackUTF8CArrayWithLength CSize
length_') Ptr CString
result'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result'
        [Text] -> IO [Text]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result''
    Ptr CSize -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CSize
length_
    Maybe [Text] -> IO (Maybe [Text])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe [Text]
maybeResult


-- function get_minor_version
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "vte_get_minor_version" vte_get_minor_version :: 
    IO Word32

-- | Returns the minor version of the VTE library at runtime.
-- Contrast this with 'GI.Vte.Constants.MINOR_VERSION' which represents
-- the version of the VTE library that the code was compiled
-- with.
-- 
-- /Since: 0.40/
getMinorVersion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
    -- ^ __Returns:__ the minor version
getMinorVersion :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word32
getMinorVersion  = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Word32
result <- IO Word32
vte_get_minor_version
    Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function get_micro_version
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "vte_get_micro_version" vte_get_micro_version :: 
    IO Word32

-- | Returns the micro version of the VTE library at runtime.
-- Contrast this with 'GI.Vte.Constants.MICRO_VERSION' which represents
-- the version of the VTE library that the code was compiled
-- with.
-- 
-- /Since: 0.40/
getMicroVersion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
    -- ^ __Returns:__ the micro version
getMicroVersion :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word32
getMicroVersion  = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Word32
result <- IO Word32
vte_get_micro_version
    Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function get_major_version
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "vte_get_major_version" vte_get_major_version :: 
    IO Word32

-- | Returns the major version of the VTE library at runtime.
-- Contrast this with 'GI.Vte.Constants.MAJOR_VERSION' which represents
-- the version of the VTE library that the code was compiled
-- with.
-- 
-- /Since: 0.40/
getMajorVersion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
    -- ^ __Returns:__ the major version
getMajorVersion :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word32
getMajorVersion  = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Word32
result <- IO Word32
vte_get_major_version
    Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function get_features
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vte_get_features" vte_get_features :: 
    IO CString

-- | Gets a list of features vte was compiled with.
-- 
-- /Since: 0.40/
getFeatures ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    -- ^ __Returns:__ a string with features
getFeatures :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Text
getFeatures  = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
result <- IO CString
vte_get_features
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"getFeatures" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function get_feature_flags
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Vte" , name = "FeatureFlags" })
-- throws : False
-- Skip return : False

foreign import ccall "vte_get_feature_flags" vte_get_feature_flags :: 
    IO CInt

-- | Gets features VTE was compiled with.
-- 
-- /Since: 0.62/
getFeatureFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [Vte.Flags.FeatureFlags]
    -- ^ __Returns:__ flags from t'GI.Vte.Flags.FeatureFlags'
getFeatureFlags :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m [FeatureFlags]
getFeatureFlags  = IO [FeatureFlags] -> m [FeatureFlags]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [FeatureFlags] -> m [FeatureFlags])
-> IO [FeatureFlags] -> m [FeatureFlags]
forall a b. (a -> b) -> a -> b
$ do
    CInt
result <- IO CInt
vte_get_feature_flags
    let result' :: [FeatureFlags]
result' = CInt -> [FeatureFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CInt
result
    [FeatureFlags] -> IO [FeatureFlags]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [FeatureFlags]
result'


-- function get_encodings
-- Args: [ Arg
--           { argCName = "include_aliases"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "whether to include alias names"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "vte_get_encodings" vte_get_encodings :: 
    CInt ->                                 -- include_aliases : TBasicType TBoolean
    IO (Ptr CString)

{-# DEPRECATED getEncodings ["(Since version 0.60)"] #-}
-- | Gets the list of supported legacy encodings.
-- 
-- If ICU support is not available, this returns an empty vector.
-- Note that UTF-8 is always supported; you can select it by
-- passing 'P.Nothing' to 'GI.Vte.Objects.Terminal.terminalSetEncoding'.
-- 
-- /Since: 0.60/
getEncodings ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    -- ^ /@includeAliases@/: whether to include alias names
    -> m [T.Text]
    -- ^ __Returns:__ the list of supported encodings; free with
    --   'GI.GLib.Functions.strfreev'
getEncodings :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Bool -> m [Text]
getEncodings Bool
includeAliases = IO [Text] -> m [Text]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    let includeAliases' :: CInt
includeAliases' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.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
P.fromEnum) Bool
includeAliases
    Ptr CString
result <- CInt -> IO (Ptr CString)
vte_get_encodings CInt
includeAliases'
    Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"getEncodings" Ptr CString
result
    [Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    [Text] -> IO [Text]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'


-- function get_encoding_supported
-- Args: [ Arg
--           { argCName = "encoding"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the legacy encoding"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "vte_get_encoding_supported" vte_get_encoding_supported :: 
    CString ->                              -- encoding : TBasicType TUTF8
    IO CInt

{-# DEPRECATED getEncodingSupported ["(Since version 0.60)"] #-}
-- | Queries whether the legacy encoding /@encoding@/ is supported.
-- 
-- If ICU support is not available, this function always returns 'P.False'.
-- 
-- Note that UTF-8 is always supported; you can select it by
-- passing 'P.Nothing' to 'GI.Vte.Objects.Terminal.terminalSetEncoding'.
-- 
-- /Since: 0.60/
getEncodingSupported ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@encoding@/: the name of the legacy encoding
    -> m Bool
    -- ^ __Returns:__ 'P.True' iff the legacy encoding /@encoding@/ is supported
getEncodingSupported :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
getEncodingSupported Text
encoding = IO Bool -> m Bool
forall a. IO a -> m a
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
    CString
encoding' <- Text -> IO CString
textToCString Text
encoding
    CInt
result <- CString -> IO CInt
vte_get_encoding_supported CString
encoding'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
encoding'
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function event_context_get_type
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "vte_event_context_get_type" vte_event_context_get_type :: 
    IO CGType

-- | /No description available in the introspection data./
eventContextGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m GType
eventContextGetType :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m GType
eventContextGetType  = IO GType -> m GType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    CGType
result <- IO CGType
vte_event_context_get_type
    let result' :: GType
result' = CGType -> GType
GType CGType
result
    GType -> IO GType
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'