    {-# LANGUAGE TypeApplications #-}

    -- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
    -- License    : LGPL-2.1
    -- Maintainer : Iñaki García Etxebarria
    --
    -- /No description available in the introspection data./

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

    module GI.GdkX11.Objects.X11Keymap
        (

    -- * Exported types
        X11Keymap(..)                           ,
        IsX11Keymap                             ,
        toX11Keymap                             ,

     -- * Methods
    -- ** Overloaded methods #method:Overloaded methods#

    #if defined(ENABLE_OVERLOADING)
        ResolveX11KeymapMethod                  ,
    #endif

    -- ** getGroupForState #method:getGroupForState#

    #if defined(ENABLE_OVERLOADING)
        X11KeymapGetGroupForStateMethodInfo     ,
    #endif
        x11KeymapGetGroupForState               ,

    -- ** keyIsModifier #method:keyIsModifier#

    #if defined(ENABLE_OVERLOADING)
        X11KeymapKeyIsModifierMethodInfo        ,
    #endif
        x11KeymapKeyIsModifier                  ,

        ) 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.Text as T
    import qualified Data.ByteString.Char8 as B
    import qualified Data.Map as Map
    import qualified Foreign.Ptr as FP
    import qualified GHC.OverloadedLabels as OL

    import qualified GI.GObject.Objects.Object as GObject.Object
    import qualified GI.Gdk.Objects.Keymap as Gdk.Keymap

    -- | Memory-managed wrapper type.
    newtype X11Keymap = X11Keymap (SP.ManagedPtr X11Keymap)
        deriving (X11Keymap -> X11Keymap -> Bool
    (X11Keymap -> X11Keymap -> Bool)
    -> (X11Keymap -> X11Keymap -> Bool) -> Eq X11Keymap
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: X11Keymap -> X11Keymap -> Bool
    $c/= :: X11Keymap -> X11Keymap -> Bool
    == :: X11Keymap -> X11Keymap -> Bool
    $c== :: X11Keymap -> X11Keymap -> Bool
    Eq)

    instance SP.ManagedPtrNewtype X11Keymap where
        toManagedPtr :: X11Keymap -> ManagedPtr X11Keymap
    toManagedPtr (X11Keymap p :: ManagedPtr X11Keymap
    p) = ManagedPtr X11Keymap
    p

    foreign import ccall "gdk_x11_keymap_get_type"
        c_gdk_x11_keymap_get_type :: IO B.Types.GType

    instance B.Types.TypedObject X11Keymap where
        glibType :: IO GType
    glibType = IO GType
    c_gdk_x11_keymap_get_type

    instance B.Types.GObject X11Keymap

    -- | Convert 'X11Keymap' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
    instance B.GValue.IsGValue X11Keymap where
        toGValue :: X11Keymap -> IO GValue
    toGValue o :: X11Keymap
    o = do
            GType
    gtype <- IO GType
    c_gdk_x11_keymap_get_type
            X11Keymap -> (Ptr X11Keymap -> IO GValue) -> IO GValue
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    B.ManagedPtr.withManagedPtr X11Keymap
    o (GType
    -> (GValue -> Ptr X11Keymap -> IO ()) -> Ptr X11Keymap -> IO GValue
    forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
    B.GValue.buildGValue GType
    gtype GValue -> Ptr X11Keymap -> IO ()
    forall a. GObject a => GValue -> Ptr a -> IO ()
    B.GValue.set_object)

        fromGValue :: GValue -> IO X11Keymap
    fromGValue gv :: GValue
    gv = do
            Ptr X11Keymap
    ptr <- GValue -> IO (Ptr X11Keymap)
    forall b. GObject b => GValue -> IO (Ptr b)
    B.GValue.get_object GValue
    gv :: IO (Ptr X11Keymap)
            (ManagedPtr X11Keymap -> X11Keymap)
    -> Ptr X11Keymap -> IO X11Keymap
    forall a b.
    (HasCallStack, GObject a, GObject b) =>
    (ManagedPtr a -> a) -> Ptr b -> IO a
    B.ManagedPtr.newObject ManagedPtr X11Keymap -> X11Keymap
    X11Keymap Ptr X11Keymap
    ptr

    -- | Type class for types which can be safely cast to `X11Keymap`, for instance with `toX11Keymap`.
    class (SP.GObject o, O.IsDescendantOf X11Keymap o) => IsX11Keymap o
    instance (SP.GObject o, O.IsDescendantOf X11Keymap o) => IsX11Keymap o

    instance O.HasParentTypes X11Keymap
    type instance O.ParentTypes X11Keymap = '[Gdk.Keymap.Keymap, GObject.Object.Object]

    -- | Cast to `X11Keymap`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
    toX11Keymap :: (MonadIO m, IsX11Keymap o) => o -> m X11Keymap
    toX11Keymap :: o -> m X11Keymap
    toX11Keymap = IO X11Keymap -> m X11Keymap
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO X11Keymap -> m X11Keymap)
    -> (o -> IO X11Keymap) -> o -> m X11Keymap
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (ManagedPtr X11Keymap -> X11Keymap) -> o -> IO X11Keymap
    forall o o'.
    (HasCallStack, ManagedPtrNewtype o, TypedObject o,
     ManagedPtrNewtype o', TypedObject o') =>
    (ManagedPtr o' -> o') -> o -> IO o'
    unsafeCastTo ManagedPtr X11Keymap -> X11Keymap
    X11Keymap

    #if defined(ENABLE_OVERLOADING)
    type family ResolveX11KeymapMethod (t :: Symbol) (o :: *) :: * where
        ResolveX11KeymapMethod "addVirtualModifiers" o = Gdk.Keymap.KeymapAddVirtualModifiersMethodInfo
        ResolveX11KeymapMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
        ResolveX11KeymapMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
        ResolveX11KeymapMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
        ResolveX11KeymapMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
        ResolveX11KeymapMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
        ResolveX11KeymapMethod "haveBidiLayouts" o = Gdk.Keymap.KeymapHaveBidiLayoutsMethodInfo
        ResolveX11KeymapMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
        ResolveX11KeymapMethod "keyIsModifier" o = X11KeymapKeyIsModifierMethodInfo
        ResolveX11KeymapMethod "lookupKey" o = Gdk.Keymap.KeymapLookupKeyMethodInfo
        ResolveX11KeymapMethod "mapVirtualModifiers" o = Gdk.Keymap.KeymapMapVirtualModifiersMethodInfo
        ResolveX11KeymapMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
        ResolveX11KeymapMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
        ResolveX11KeymapMethod "ref" o = GObject.Object.ObjectRefMethodInfo
        ResolveX11KeymapMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
        ResolveX11KeymapMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
        ResolveX11KeymapMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
        ResolveX11KeymapMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
        ResolveX11KeymapMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
        ResolveX11KeymapMethod "translateKeyboardState" o = Gdk.Keymap.KeymapTranslateKeyboardStateMethodInfo
        ResolveX11KeymapMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
        ResolveX11KeymapMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
        ResolveX11KeymapMethod "getCapsLockState" o = Gdk.Keymap.KeymapGetCapsLockStateMethodInfo
        ResolveX11KeymapMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
        ResolveX11KeymapMethod "getDirection" o = Gdk.Keymap.KeymapGetDirectionMethodInfo
        ResolveX11KeymapMethod "getEntriesForKeycode" o = Gdk.Keymap.KeymapGetEntriesForKeycodeMethodInfo
        ResolveX11KeymapMethod "getEntriesForKeyval" o = Gdk.Keymap.KeymapGetEntriesForKeyvalMethodInfo
        ResolveX11KeymapMethod "getGroupForState" o = X11KeymapGetGroupForStateMethodInfo
        ResolveX11KeymapMethod "getModifierMask" o = Gdk.Keymap.KeymapGetModifierMaskMethodInfo
        ResolveX11KeymapMethod "getModifierState" o = Gdk.Keymap.KeymapGetModifierStateMethodInfo
        ResolveX11KeymapMethod "getNumLockState" o = Gdk.Keymap.KeymapGetNumLockStateMethodInfo
        ResolveX11KeymapMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
        ResolveX11KeymapMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
        ResolveX11KeymapMethod "getScrollLockState" o = Gdk.Keymap.KeymapGetScrollLockStateMethodInfo
        ResolveX11KeymapMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
        ResolveX11KeymapMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
        ResolveX11KeymapMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
        ResolveX11KeymapMethod l o = O.MethodResolutionFailed l o

    instance (info ~ ResolveX11KeymapMethod t X11Keymap, O.MethodInfo info X11Keymap p) => OL.IsLabel t (X11Keymap -> p) where
    #if MIN_VERSION_base(4,10,0)
        fromLabel = O.overloadedMethod @info
    #else
        fromLabel _ = O.overloadedMethod @info
    #endif

    #endif

    #if defined(ENABLE_OVERLOADING)
    instance O.HasAttributeList X11Keymap
    type instance O.AttributeList X11Keymap = X11KeymapAttributeList
    type X11KeymapAttributeList = ('[ ] :: [(Symbol, *)])
    #endif

    #if defined(ENABLE_OVERLOADING)
    #endif

    #if defined(ENABLE_OVERLOADING)
    type instance O.SignalList X11Keymap = X11KeymapSignalList
    type X11KeymapSignalList = ('[ '("directionChanged", Gdk.Keymap.KeymapDirectionChangedSignalInfo), '("keysChanged", Gdk.Keymap.KeymapKeysChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("stateChanged", Gdk.Keymap.KeymapStateChangedSignalInfo)] :: [(Symbol, *)])

    #endif

    -- method X11Keymap::get_group_for_state
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "keymap"
    --           , argType =
    --               TInterface Name { namespace = "GdkX11" , name = "X11Keymap" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GdkX11Keymap" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "state"
    --           , argType = TBasicType TUInt
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "raw state returned from X"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TBasicType TInt)
    -- throws : False
    -- Skip return : False

    foreign import ccall "gdk_x11_keymap_get_group_for_state" gdk_x11_keymap_get_group_for_state ::
        Ptr X11Keymap ->                        -- keymap : TInterface (Name {namespace = "GdkX11", name = "X11Keymap"})
        Word32 ->                               -- state : TBasicType TUInt
        IO Int32

    -- | Extracts the group from the state field sent in an X Key event.
    -- This is only needed for code processing raw X events, since t'GI.Gdk.Structs.EventKey.EventKey'
    -- directly includes an is_modifier field.
    --
    -- /Since: 3.6/
    x11KeymapGetGroupForState ::
        (B.CallStack.HasCallStack, MonadIO m, IsX11Keymap a) =>
        a
        -- ^ /@keymap@/: a t'GI.GdkX11.Objects.X11Keymap.X11Keymap'
        -> Word32
        -- ^ /@state@/: raw state returned from X
        -> m Int32
        -- ^ __Returns:__ the index of the active keyboard group for the event
    x11KeymapGetGroupForState :: a -> Word32 -> m Int32
    x11KeymapGetGroupForState keymap :: a
    keymap state :: Word32
    state = IO Int32 -> m Int32
    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
        Ptr X11Keymap
    keymap' <- a -> IO (Ptr X11Keymap)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    keymap
        Int32
    result <- Ptr X11Keymap -> Word32 -> IO Int32
    gdk_x11_keymap_get_group_for_state Ptr X11Keymap
    keymap' Word32
    state
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    keymap
        Int32 -> IO Int32
    forall (m :: * -> *) a. Monad m => a -> m a
    return Int32
    result

    #if defined(ENABLE_OVERLOADING)
    data X11KeymapGetGroupForStateMethodInfo
    instance (signature ~ (Word32 -> m Int32), MonadIO m, IsX11Keymap a) => O.MethodInfo X11KeymapGetGroupForStateMethodInfo a signature where
        overloadedMethod = x11KeymapGetGroupForState

    #endif

    -- method X11Keymap::key_is_modifier
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "keymap"
    --           , argType =
    --               TInterface Name { namespace = "GdkX11" , name = "X11Keymap" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GdkX11Keymap" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "keycode"
    --           , argType = TBasicType TUInt
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "the hardware keycode from a key event"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TBasicType TBoolean)
    -- throws : False
    -- Skip return : False

    foreign import ccall "gdk_x11_keymap_key_is_modifier" gdk_x11_keymap_key_is_modifier ::
        Ptr X11Keymap ->                        -- keymap : TInterface (Name {namespace = "GdkX11", name = "X11Keymap"})
        Word32 ->                               -- keycode : TBasicType TUInt
        IO CInt

    -- | Determines whether a particular key code represents a key that
    -- is a modifier. That is, it’s a key that normally just affects
    -- the keyboard state and the behavior of other keys rather than
    -- producing a direct effect itself. This is only needed for code
    -- processing raw X events, since t'GI.Gdk.Structs.EventKey.EventKey' directly includes
    -- an is_modifier field.
    --
    -- /Since: 3.6/
    x11KeymapKeyIsModifier ::
        (B.CallStack.HasCallStack, MonadIO m, IsX11Keymap a) =>
        a
        -- ^ /@keymap@/: a t'GI.GdkX11.Objects.X11Keymap.X11Keymap'
        -> Word32
        -- ^ /@keycode@/: the hardware keycode from a key event
        -> m Bool
        -- ^ __Returns:__ 'P.True' if the hardware keycode is a modifier key
    x11KeymapKeyIsModifier :: a -> Word32 -> m Bool
    x11KeymapKeyIsModifier keymap :: a
    keymap keycode :: Word32
    keycode = 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 X11Keymap
    keymap' <- a -> IO (Ptr X11Keymap)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    keymap
        CInt
    result <- Ptr X11Keymap -> Word32 -> IO CInt
    gdk_x11_keymap_key_is_modifier Ptr X11Keymap
    keymap' Word32
    keycode
        let result' :: Bool
    result' = (CInt -> CInt -> Bool
    forall a. Eq a => a -> a -> Bool
    /= 0) CInt
    result
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    keymap
        Bool -> IO Bool
    forall (m :: * -> *) a. Monad m => a -> m a
    return Bool
    result'

    #if defined(ENABLE_OVERLOADING)
    data X11KeymapKeyIsModifierMethodInfo
    instance (signature ~ (Word32 -> m Bool), MonadIO m, IsX11Keymap a) => O.MethodInfo X11KeymapKeyIsModifierMethodInfo a signature where
        overloadedMethod = x11KeymapKeyIsModifier

    #endif