    {- |
    Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
    License    : LGPL-2.1
    Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

    /No description available in the introspection data./
    -}

    #define ENABLE_OVERLOADING \
           (!defined(__HADDOCK_VERSION__))

    module GI.GdkX11.Objects.X11Keymap
        (

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

     -- * Methods
    -- ** getGroupForState #method:getGroupForState#

    #if ENABLE_OVERLOADING
        X11KeymapGetGroupForStateMethodInfo     ,
    #endif
        x11KeymapGetGroupForState               ,

    -- ** keyIsModifier #method:keyIsModifier#

    #if 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.ManagedPtr as B.ManagedPtr
    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.Text as T
    import qualified Data.ByteString.Char8 as B
    import qualified Data.Map as Map
    import qualified Foreign.Ptr as FP

    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 (ManagedPtr X11Keymap)
    foreign import ccall "gdk_x11_keymap_get_type"
        c_gdk_x11_keymap_get_type :: IO GType

    instance GObject X11Keymap where
        gobjectType _ = c_gdk_x11_keymap_get_type

    -- | Type class for types which can be safely cast to `X11Keymap`, for instance with `toX11Keymap`.
    class GObject o => IsX11Keymap o
    #if MIN_VERSION_base(4,9,0)
    instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError X11Keymap a) =>
        IsX11Keymap a
    #endif
    instance IsX11Keymap X11Keymap
    instance Gdk.Keymap.IsKeymap X11Keymap
    instance GObject.Object.IsObject X11Keymap

    -- | 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 = liftIO . unsafeCastTo X11Keymap

    -- | A convenience alias for `Nothing` :: `Maybe` `X11Keymap`.
    noX11Keymap :: Maybe X11Keymap
    noX11Keymap = Nothing

    #if 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 "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
        ResolveX11KeymapMethod l o = O.MethodResolutionFailed l o

    instance (info ~ ResolveX11KeymapMethod t X11Keymap, O.MethodInfo info X11Keymap p) => O.IsLabelProxy t (X11Keymap -> p) where
        fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

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

    #endif

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

    #if ENABLE_OVERLOADING
    #endif

    #if 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 '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 '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 keymap state = liftIO $ do
        keymap' <- unsafeManagedPtrCastPtr keymap
        result <- gdk_x11_keymap_get_group_for_state keymap' state
        touchManagedPtr keymap
        return result

    #if 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 '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 'GI.GdkX11.Objects.X11Keymap.X11Keymap' -}
        -> Word32
        {- ^ /@keycode@/: the hardware keycode from a key event -}
        -> m Bool
        {- ^ __Returns:__ 'True' if the hardware keycode is a modifier key -}
    x11KeymapKeyIsModifier keymap keycode = liftIO $ do
        keymap' <- unsafeManagedPtrCastPtr keymap
        result <- gdk_x11_keymap_key_is_modifier keymap' keycode
        let result' = (/= 0) result
        touchManagedPtr keymap
        return result'

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

    #endif