    {-# LANGUAGE ImplicitParams, RankNTypes, TypeApplications #-}

    -- | Copyright  : Will Thompson and Iñaki García Etxebarria
    -- License    : LGPL-2.1
    -- Maintainer : Iñaki García Etxebarria
    --
    -- The interface for GTK input methods.
    --
    -- @GtkIMContext@ is used by GTK text input widgets like @GtkText@
    -- to map from key events to Unicode character strings.
    --
    -- An input method may consume multiple key events in sequence before finally
    -- outputting the composed result. This is called *preediting*, and an input
    -- method may provide feedback about this process by displaying the intermediate
    -- composition states as preedit text. To do so, the @GtkIMContext@ will emit
    -- [IMContext::preeditStart]("GI.Gtk.Objects.IMContext#g:signal:preeditStart"), [IMContext::preeditChanged]("GI.Gtk.Objects.IMContext#g:signal:preeditChanged")
    -- and [IMContext::preeditEnd]("GI.Gtk.Objects.IMContext#g:signal:preeditEnd") signals.
    --
    -- For instance, the built-in GTK input method t'GI.Gtk.Objects.IMContextSimple.IMContextSimple'
    -- implements the input of arbitrary Unicode code points by holding down the
    -- \<kbd>Control\<\/kbd> and \<kbd>Shift\<\/kbd> keys and then typing \<kbd>u\<\/kbd>
    -- followed by the hexadecimal digits of the code point. When releasing the
    -- \<kbd>Control\<\/kbd> and \<kbd>Shift\<\/kbd> keys, preediting ends and the
    -- character is inserted as text. For example,
    --
    --     Ctrl+Shift+u 2 0 A C
    --
    -- results in the € sign.
    --
    -- Additional input methods can be made available for use by GTK widgets as
    -- loadable modules. An input method module is a small shared library which
    -- provides a @GIOExtension@ for the extension point named \"gtk-im-module\".
    --
    -- To connect a widget to the users preferred input method, you should use
    -- t'GI.Gtk.Objects.IMMulticontext.IMMulticontext'.

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

    module GI.Gtk.Objects.IMContext
        (

    -- * Exported types
        IMContext(..)                           ,
        IsIMContext                             ,
        toIMContext                             ,

     -- * Methods
    -- |
    --
    --  === __Click to display all available methods, including inherited ones__
    -- ==== Methods
    -- [activateOsk]("GI.Gtk.Objects.IMContext#g:method:activateOsk"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [deleteSurrounding]("GI.Gtk.Objects.IMContext#g:method:deleteSurrounding"), [filterKey]("GI.Gtk.Objects.IMContext#g:method:filterKey"), [filterKeypress]("GI.Gtk.Objects.IMContext#g:method:filterKeypress"), [focusIn]("GI.Gtk.Objects.IMContext#g:method:focusIn"), [focusOut]("GI.Gtk.Objects.IMContext#g:method:focusOut"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [reset]("GI.Gtk.Objects.IMContext#g:method:reset"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
    --
    -- ==== Getters
    -- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getPreeditString]("GI.Gtk.Objects.IMContext#g:method:getPreeditString"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getSurrounding]("GI.Gtk.Objects.IMContext#g:method:getSurrounding"), [getSurroundingWithSelection]("GI.Gtk.Objects.IMContext#g:method:getSurroundingWithSelection").
    --
    -- ==== Setters
    -- [setClientWidget]("GI.Gtk.Objects.IMContext#g:method:setClientWidget"), [setCursorLocation]("GI.Gtk.Objects.IMContext#g:method:setCursorLocation"), [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setSurrounding]("GI.Gtk.Objects.IMContext#g:method:setSurrounding"), [setSurroundingWithSelection]("GI.Gtk.Objects.IMContext#g:method:setSurroundingWithSelection"), [setUsePreedit]("GI.Gtk.Objects.IMContext#g:method:setUsePreedit").

    #if defined(ENABLE_OVERLOADING)
        ResolveIMContextMethod                  ,
    #endif

    -- ** activateOsk #method:activateOsk#

    #if defined(ENABLE_OVERLOADING)
        IMContextActivateOskMethodInfo          ,
    #endif
        iMContextActivateOsk                    ,

    -- ** deleteSurrounding #method:deleteSurrounding#

    #if defined(ENABLE_OVERLOADING)
        IMContextDeleteSurroundingMethodInfo    ,
    #endif
        iMContextDeleteSurrounding              ,

    -- ** filterKey #method:filterKey#

    #if defined(ENABLE_OVERLOADING)
        IMContextFilterKeyMethodInfo            ,
    #endif
        iMContextFilterKey                      ,

    -- ** filterKeypress #method:filterKeypress#

    #if defined(ENABLE_OVERLOADING)
        IMContextFilterKeypressMethodInfo       ,
    #endif
        iMContextFilterKeypress                 ,

    -- ** focusIn #method:focusIn#

    #if defined(ENABLE_OVERLOADING)
        IMContextFocusInMethodInfo              ,
    #endif
        iMContextFocusIn                        ,

    -- ** focusOut #method:focusOut#

    #if defined(ENABLE_OVERLOADING)
        IMContextFocusOutMethodInfo             ,
    #endif
        iMContextFocusOut                       ,

    -- ** getPreeditString #method:getPreeditString#

    #if defined(ENABLE_OVERLOADING)
        IMContextGetPreeditStringMethodInfo     ,
    #endif
        iMContextGetPreeditString               ,

    -- ** getSurrounding #method:getSurrounding#

    #if defined(ENABLE_OVERLOADING)
        IMContextGetSurroundingMethodInfo       ,
    #endif
        iMContextGetSurrounding                 ,

    -- ** getSurroundingWithSelection #method:getSurroundingWithSelection#

    #if defined(ENABLE_OVERLOADING)
        IMContextGetSurroundingWithSelectionMethodInfo,
    #endif
        iMContextGetSurroundingWithSelection    ,

    -- ** reset #method:reset#

    #if defined(ENABLE_OVERLOADING)
        IMContextResetMethodInfo                ,
    #endif
        iMContextReset                          ,

    -- ** setClientWidget #method:setClientWidget#

    #if defined(ENABLE_OVERLOADING)
        IMContextSetClientWidgetMethodInfo      ,
    #endif
        iMContextSetClientWidget                ,

    -- ** setCursorLocation #method:setCursorLocation#

    #if defined(ENABLE_OVERLOADING)
        IMContextSetCursorLocationMethodInfo    ,
    #endif
        iMContextSetCursorLocation              ,

    -- ** setSurrounding #method:setSurrounding#

    #if defined(ENABLE_OVERLOADING)
        IMContextSetSurroundingMethodInfo       ,
    #endif
        iMContextSetSurrounding                 ,

    -- ** setSurroundingWithSelection #method:setSurroundingWithSelection#

    #if defined(ENABLE_OVERLOADING)
        IMContextSetSurroundingWithSelectionMethodInfo,
    #endif
        iMContextSetSurroundingWithSelection    ,

    -- ** setUsePreedit #method:setUsePreedit#

    #if defined(ENABLE_OVERLOADING)
        IMContextSetUsePreeditMethodInfo        ,
    #endif
        iMContextSetUsePreedit                  ,

     -- * Properties

    -- ** inputHints #attr:inputHints#
    -- | Additional hints that allow input methods to fine-tune
    -- their behaviour.

    #if defined(ENABLE_OVERLOADING)
        IMContextInputHintsPropertyInfo         ,
    #endif
        constructIMContextInputHints            ,
        getIMContextInputHints                  ,
    #if defined(ENABLE_OVERLOADING)
        iMContextInputHints                     ,
    #endif
        setIMContextInputHints                  ,

    -- ** inputPurpose #attr:inputPurpose#
    -- | The purpose of the text field that the \`GtkIMContext is connected to.
    --
    -- This property can be used by on-screen keyboards and other input
    -- methods to adjust their behaviour.

    #if defined(ENABLE_OVERLOADING)
        IMContextInputPurposePropertyInfo       ,
    #endif
        constructIMContextInputPurpose          ,
        getIMContextInputPurpose                ,
    #if defined(ENABLE_OVERLOADING)
        iMContextInputPurpose                   ,
    #endif
        setIMContextInputPurpose                ,

     -- * Signals

    -- ** commit #signal:commit#

        IMContextCommitCallback                 ,
    #if defined(ENABLE_OVERLOADING)
        IMContextCommitSignalInfo               ,
    #endif
        afterIMContextCommit                    ,
        onIMContextCommit                       ,

    -- ** deleteSurrounding #signal:deleteSurrounding#

        IMContextDeleteSurroundingCallback      ,
    #if defined(ENABLE_OVERLOADING)
        IMContextDeleteSurroundingSignalInfo    ,
    #endif
        afterIMContextDeleteSurrounding         ,
        onIMContextDeleteSurrounding            ,

    -- ** invalidComposition #signal:invalidComposition#

        IMContextInvalidCompositionCallback     ,
    #if defined(ENABLE_OVERLOADING)
        IMContextInvalidCompositionSignalInfo   ,
    #endif
        afterIMContextInvalidComposition        ,
        onIMContextInvalidComposition           ,

    -- ** preeditChanged #signal:preeditChanged#

        IMContextPreeditChangedCallback         ,
    #if defined(ENABLE_OVERLOADING)
        IMContextPreeditChangedSignalInfo       ,
    #endif
        afterIMContextPreeditChanged            ,
        onIMContextPreeditChanged               ,

    -- ** preeditEnd #signal:preeditEnd#

        IMContextPreeditEndCallback             ,
    #if defined(ENABLE_OVERLOADING)
        IMContextPreeditEndSignalInfo           ,
    #endif
        afterIMContextPreeditEnd                ,
        onIMContextPreeditEnd                   ,

    -- ** preeditStart #signal:preeditStart#

        IMContextPreeditStartCallback           ,
    #if defined(ENABLE_OVERLOADING)
        IMContextPreeditStartSignalInfo         ,
    #endif
        afterIMContextPreeditStart              ,
        onIMContextPreeditStart                 ,

    -- ** retrieveSurrounding #signal:retrieveSurrounding#

        IMContextRetrieveSurroundingCallback    ,
    #if defined(ENABLE_OVERLOADING)
        IMContextRetrieveSurroundingSignalInfo  ,
    #endif
        afterIMContextRetrieveSurrounding       ,
        onIMContextRetrieveSurrounding          ,

        ) 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 qualified GI.Cairo.Structs.Context as Cairo.Context
    import qualified GI.Cairo.Structs.FontOptions as Cairo.FontOptions
    import qualified GI.GLib.Callbacks as GLib.Callbacks
    import qualified GI.GLib.Structs.Bytes as GLib.Bytes
    import qualified GI.GObject.Objects.Object as GObject.Object
    import qualified GI.Gdk.Flags as Gdk.Flags
    import qualified GI.Gdk.Interfaces.Paintable as Gdk.Paintable
    import qualified GI.Gdk.Objects.Clipboard as Gdk.Clipboard
    import qualified GI.Gdk.Objects.Cursor as Gdk.Cursor
    import qualified GI.Gdk.Objects.Device as Gdk.Device
    import qualified GI.Gdk.Objects.Display as Gdk.Display
    import qualified GI.Gdk.Objects.Event as Gdk.Event
    import qualified GI.Gdk.Objects.FrameClock as Gdk.FrameClock
    import qualified GI.Gdk.Objects.Snapshot as Gdk.Snapshot
    import qualified GI.Gdk.Objects.Surface as Gdk.Surface
    import qualified GI.Gdk.Objects.Texture as Gdk.Texture
    import qualified GI.Gdk.Structs.RGBA as Gdk.RGBA
    import qualified GI.Gdk.Structs.Rectangle as Gdk.Rectangle
    import qualified GI.Gio.Interfaces.ActionGroup as Gio.ActionGroup
    import qualified GI.Gio.Interfaces.Icon as Gio.Icon
    import qualified GI.Gio.Interfaces.ListModel as Gio.ListModel
    import qualified GI.Graphene.Structs.Matrix as Graphene.Matrix
    import qualified GI.Graphene.Structs.Point as Graphene.Point
    import qualified GI.Graphene.Structs.Point3D as Graphene.Point3D
    import qualified GI.Graphene.Structs.Rect as Graphene.Rect
    import qualified GI.Graphene.Structs.Size as Graphene.Size
    import qualified GI.Graphene.Structs.Vec3 as Graphene.Vec3
    import qualified GI.Graphene.Structs.Vec4 as Graphene.Vec4
    import qualified GI.Gsk.Enums as Gsk.Enums
    import qualified GI.Gsk.Flags as Gsk.Flags
    import qualified GI.Gsk.Objects.GLShader as Gsk.GLShader
    import qualified GI.Gsk.Objects.RenderNode as Gsk.RenderNode
    import qualified GI.Gsk.Objects.Renderer as Gsk.Renderer
    import qualified GI.Gsk.Structs.ColorStop as Gsk.ColorStop
    import qualified GI.Gsk.Structs.ComponentTransfer as Gsk.ComponentTransfer
    import qualified GI.Gsk.Structs.Path as Gsk.Path
    import qualified GI.Gsk.Structs.RoundedRect as Gsk.RoundedRect
    import qualified GI.Gsk.Structs.Shadow as Gsk.Shadow
    import qualified GI.Gsk.Structs.Stroke as Gsk.Stroke
    import qualified GI.Gsk.Structs.Transform as Gsk.Transform
    import qualified GI.Gtk.Callbacks as Gtk.Callbacks
    import {-# SOURCE #-} qualified GI.Gtk.Enums as Gtk.Enums
    import {-# SOURCE #-} qualified GI.Gtk.Flags as Gtk.Flags
    import {-# SOURCE #-} qualified GI.Gtk.Interfaces.Accessible as Gtk.Accessible
    import {-# SOURCE #-} qualified GI.Gtk.Interfaces.Buildable as Gtk.Buildable
    import {-# SOURCE #-} qualified GI.Gtk.Interfaces.ConstraintTarget as Gtk.ConstraintTarget
    import {-# SOURCE #-} qualified GI.Gtk.Interfaces.Native as Gtk.Native
    import {-# SOURCE #-} qualified GI.Gtk.Interfaces.Root as Gtk.Root
    import {-# SOURCE #-} qualified GI.Gtk.Interfaces.StyleProvider as Gtk.StyleProvider
    import {-# SOURCE #-} qualified GI.Gtk.Objects.ATContext as Gtk.ATContext
    import {-# SOURCE #-} qualified GI.Gtk.Objects.EventController as Gtk.EventController
    import {-# SOURCE #-} qualified GI.Gtk.Objects.LayoutChild as Gtk.LayoutChild
    import {-# SOURCE #-} qualified GI.Gtk.Objects.LayoutManager as Gtk.LayoutManager
    import {-# SOURCE #-} qualified GI.Gtk.Objects.Settings as Gtk.Settings
    import {-# SOURCE #-} qualified GI.Gtk.Objects.Snapshot as Gtk.Snapshot
    import {-# SOURCE #-} qualified GI.Gtk.Objects.StyleContext as Gtk.StyleContext
    import {-# SOURCE #-} qualified GI.Gtk.Objects.Tooltip as Gtk.Tooltip
    import {-# SOURCE #-} qualified GI.Gtk.Objects.Widget as Gtk.Widget
    import {-# SOURCE #-} qualified GI.Gtk.Structs.Border as Gtk.Border
    import {-# SOURCE #-} qualified GI.Gtk.Structs.Requisition as Gtk.Requisition
    import qualified GI.Pango.Enums as Pango.Enums
    import qualified GI.Pango.Objects.Context as Pango.Context
    import qualified GI.Pango.Objects.FontMap as Pango.FontMap
    import qualified GI.Pango.Objects.Layout as Pango.Layout
    import qualified GI.Pango.Structs.AttrList as Pango.AttrList

    #else
    import qualified GI.GObject.Objects.Object as GObject.Object
    import qualified GI.Gdk.Flags as Gdk.Flags
    import qualified GI.Gdk.Objects.Device as Gdk.Device
    import qualified GI.Gdk.Objects.Event as Gdk.Event
    import qualified GI.Gdk.Objects.Surface as Gdk.Surface
    import qualified GI.Gdk.Structs.Rectangle as Gdk.Rectangle
    import {-# SOURCE #-} qualified GI.Gtk.Enums as Gtk.Enums
    import {-# SOURCE #-} qualified GI.Gtk.Flags as Gtk.Flags
    import {-# SOURCE #-} qualified GI.Gtk.Objects.Widget as Gtk.Widget
    import qualified GI.Pango.Structs.AttrList as Pango.AttrList

    #endif

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

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

    foreign import ccall "gtk_im_context_get_type"
        c_gtk_im_context_get_type :: IO B.Types.GType

    instance B.Types.TypedObject IMContext where
        glibType :: IO GType
    glibType = IO GType
    c_gtk_im_context_get_type

    instance B.Types.GObject IMContext

    -- | Type class for types which can be safely cast to t'IMContext', for instance with `toIMContext`.
    class (SP.GObject o, O.IsDescendantOf IMContext o) => IsIMContext o
    instance (SP.GObject o, O.IsDescendantOf IMContext o) => IsIMContext o

    instance O.HasParentTypes IMContext
    type instance O.ParentTypes IMContext = '[GObject.Object.Object]

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

    -- | Convert t'IMContext' to and from t'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
    instance B.GValue.IsGValue (Maybe IMContext) where
        gvalueGType_ :: IO GType
    gvalueGType_ = IO GType
    c_gtk_im_context_get_type
        gvalueSet_ :: Ptr GValue -> Maybe IMContext -> IO ()
    gvalueSet_ Ptr GValue
    gv Maybe IMContext
    P.Nothing = Ptr GValue -> Ptr IMContext -> IO ()
    forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
    B.GValue.set_object Ptr GValue
    gv (Ptr IMContext
    forall a. Ptr a
    FP.nullPtr :: FP.Ptr IMContext)
        gvalueSet_ Ptr GValue
    gv (P.Just IMContext
    obj) = IMContext -> (Ptr IMContext -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    B.ManagedPtr.withManagedPtr IMContext
    obj (Ptr GValue -> Ptr IMContext -> IO ()
    forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
    B.GValue.set_object Ptr GValue
    gv)
        gvalueGet_ :: Ptr GValue -> IO (Maybe IMContext)
    gvalueGet_ Ptr GValue
    gv = do
            ptr <- Ptr GValue -> IO (Ptr IMContext)
    forall a. GObject a => Ptr GValue -> IO (Ptr a)
    B.GValue.get_object Ptr GValue
    gv :: IO (FP.Ptr IMContext)
            if ptr /= FP.nullPtr
            then P.Just <$> B.ManagedPtr.newObject IMContext ptr
            else return P.Nothing

    #if defined(ENABLE_OVERLOADING)
    type family ResolveIMContextMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
        ResolveIMContextMethod "activateOsk" o = IMContextActivateOskMethodInfo
        ResolveIMContextMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
        ResolveIMContextMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
        ResolveIMContextMethod "deleteSurrounding" o = IMContextDeleteSurroundingMethodInfo
        ResolveIMContextMethod "filterKey" o = IMContextFilterKeyMethodInfo
        ResolveIMContextMethod "filterKeypress" o = IMContextFilterKeypressMethodInfo
        ResolveIMContextMethod "focusIn" o = IMContextFocusInMethodInfo
        ResolveIMContextMethod "focusOut" o = IMContextFocusOutMethodInfo
        ResolveIMContextMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
        ResolveIMContextMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
        ResolveIMContextMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
        ResolveIMContextMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
        ResolveIMContextMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
        ResolveIMContextMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
        ResolveIMContextMethod "ref" o = GObject.Object.ObjectRefMethodInfo
        ResolveIMContextMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
        ResolveIMContextMethod "reset" o = IMContextResetMethodInfo
        ResolveIMContextMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
        ResolveIMContextMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
        ResolveIMContextMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
        ResolveIMContextMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
        ResolveIMContextMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
        ResolveIMContextMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
        ResolveIMContextMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
        ResolveIMContextMethod "getPreeditString" o = IMContextGetPreeditStringMethodInfo
        ResolveIMContextMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
        ResolveIMContextMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
        ResolveIMContextMethod "getSurrounding" o = IMContextGetSurroundingMethodInfo
        ResolveIMContextMethod "getSurroundingWithSelection" o = IMContextGetSurroundingWithSelectionMethodInfo
        ResolveIMContextMethod "setClientWidget" o = IMContextSetClientWidgetMethodInfo
        ResolveIMContextMethod "setCursorLocation" o = IMContextSetCursorLocationMethodInfo
        ResolveIMContextMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
        ResolveIMContextMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
        ResolveIMContextMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
        ResolveIMContextMethod "setSurrounding" o = IMContextSetSurroundingMethodInfo
        ResolveIMContextMethod "setSurroundingWithSelection" o = IMContextSetSurroundingWithSelectionMethodInfo
        ResolveIMContextMethod "setUsePreedit" o = IMContextSetUsePreeditMethodInfo
        ResolveIMContextMethod l o = O.MethodResolutionFailed l o

    instance (info ~ ResolveIMContextMethod t IMContext, O.OverloadedMethod info IMContext p) => OL.IsLabel t (IMContext -> 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 ~ ResolveIMContextMethod t IMContext, O.OverloadedMethod info IMContext p, R.HasField t IMContext p) => R.HasField t IMContext p where
        getField = O.overloadedMethod @info

    #endif

    instance (info ~ ResolveIMContextMethod t IMContext, O.OverloadedMethodInfo info IMContext) => OL.IsLabel t (O.MethodProxy info IMContext) where
    #if MIN_VERSION_base(4,10,0)
        fromLabel = O.MethodProxy
    #else
        fromLabel _ = O.MethodProxy
    #endif

    #endif

    -- signal IMContext::commit
    -- | The [commit](#g:signal:commit) signal is emitted when a complete input sequence
    -- has been entered by the user.
    --
    -- If the commit comes after a preediting sequence, the
    -- [commit](#g:signal:commit) signal is emitted after [preeditEnd](#g:signal:preeditEnd).
    --
    -- This can be a single character immediately after a key press or
    -- the final result of preediting.
    type IMContextCommitCallback =
        T.Text
        -- ^ /@str@/: the completed character(s) entered by the user
        -> IO ()

    type C_IMContextCommitCallback =
        Ptr IMContext ->                        -- object
        CString ->
        Ptr () ->                               -- user_data
        IO ()

    -- | Generate a function pointer callable from C code, from a `C_IMContextCommitCallback`.
    foreign import ccall "wrapper"
        mk_IMContextCommitCallback :: C_IMContextCommitCallback -> IO (FunPtr C_IMContextCommitCallback)

    wrap_IMContextCommitCallback ::
        GObject a => (a -> IMContextCommitCallback) ->
        C_IMContextCommitCallback
    wrap_IMContextCommitCallback :: forall a.
    GObject a =>
    (a -> IMContextCommitCallback) -> C_IMContextCommitCallback
    wrap_IMContextCommitCallback a -> IMContextCommitCallback
    gi'cb Ptr IMContext
    gi'selfPtr CString
    str Ptr ()
    _ = do
        str' <- HasCallStack => CString -> IO Text
    CString -> IO Text
    cstringToText CString
    str
        B.ManagedPtr.withNewObject gi'selfPtr $ \IMContext
    gi'self -> a -> IMContextCommitCallback
    gi'cb (IMContext -> a
    forall a b. Coercible a b => a -> b
    Coerce.coerce IMContext
    gi'self)  Text
    str'

    -- | Connect a signal handler for the [commit](#signal:commit) signal, to be run before the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.on' iMContext #commit callback
    -- @
    --
    --
    onIMContextCommit :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextCommitCallback) -> m SignalHandlerId
    onIMContextCommit :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a -> ((?self::a) => IMContextCommitCallback) -> m SignalHandlerId
    onIMContextCommit a
    obj (?self::a) => IMContextCommitCallback
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IMContextCommitCallback
    wrapped a
    self = let ?self = a
    ?self::a
    self in (?self::a) => IMContextCommitCallback
    IMContextCommitCallback
    cb
        let wrapped' :: C_IMContextCommitCallback
    wrapped' = (a -> IMContextCommitCallback) -> C_IMContextCommitCallback
    forall a.
    GObject a =>
    (a -> IMContextCommitCallback) -> C_IMContextCommitCallback
    wrap_IMContextCommitCallback a -> IMContextCommitCallback
    wrapped
        wrapped'' <- C_IMContextCommitCallback -> IO (FunPtr C_IMContextCommitCallback)
    mk_IMContextCommitCallback C_IMContextCommitCallback
    wrapped'
        connectSignalFunPtr obj "commit" wrapped'' SignalConnectBefore Nothing

    -- | Connect a signal handler for the [commit](#signal:commit) signal, to be run after the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.after' iMContext #commit callback
    -- @
    --
    --
    --
    -- By default the object invoking the signal is not passed to the callback.
    -- If you need to access it, you can use the implit @?self@ parameter.
    -- Note that this requires activating the @ImplicitParams@ GHC extension.
    --
    afterIMContextCommit :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextCommitCallback) -> m SignalHandlerId
    afterIMContextCommit :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a -> ((?self::a) => IMContextCommitCallback) -> m SignalHandlerId
    afterIMContextCommit a
    obj (?self::a) => IMContextCommitCallback
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IMContextCommitCallback
    wrapped a
    self = let ?self = a
    ?self::a
    self in (?self::a) => IMContextCommitCallback
    IMContextCommitCallback
    cb
        let wrapped' :: C_IMContextCommitCallback
    wrapped' = (a -> IMContextCommitCallback) -> C_IMContextCommitCallback
    forall a.
    GObject a =>
    (a -> IMContextCommitCallback) -> C_IMContextCommitCallback
    wrap_IMContextCommitCallback a -> IMContextCommitCallback
    wrapped
        wrapped'' <- C_IMContextCommitCallback -> IO (FunPtr C_IMContextCommitCallback)
    mk_IMContextCommitCallback C_IMContextCommitCallback
    wrapped'
        connectSignalFunPtr obj "commit" wrapped'' SignalConnectAfter Nothing

    #if defined(ENABLE_OVERLOADING)
    data IMContextCommitSignalInfo
    instance SignalInfo IMContextCommitSignalInfo where
        type HaskellCallbackType IMContextCommitSignalInfo = IMContextCommitCallback
        connectSignal obj cb connectMode detail = do
            let cb' = wrap_IMContextCommitCallback cb
            cb'' <- mk_IMContextCommitCallback cb'
            connectSignalFunPtr obj "commit" cb'' connectMode detail
        dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext::commit"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#g:signal:commit"})

    #endif

    -- signal IMContext::delete-surrounding
    -- | The [deleteSurrounding](#g:signal:deleteSurrounding) signal is emitted when the input method
    -- needs to delete all or part of the context surrounding the cursor.
    type IMContextDeleteSurroundingCallback =
        Int32
        -- ^ /@offset@/: the character offset from the cursor position of the text
        --   to be deleted. A negative value indicates a position before
        --   the cursor.
        -> Int32
        -- ^ /@nChars@/: the number of characters to be deleted
        -> IO Bool
        -- ^ __Returns:__ 'P.True' if the signal was handled.

    type C_IMContextDeleteSurroundingCallback =
        Ptr IMContext ->                        -- object
        Int32 ->
        Int32 ->
        Ptr () ->                               -- user_data
        IO CInt

    -- | Generate a function pointer callable from C code, from a `C_IMContextDeleteSurroundingCallback`.
    foreign import ccall "wrapper"
        mk_IMContextDeleteSurroundingCallback :: C_IMContextDeleteSurroundingCallback -> IO (FunPtr C_IMContextDeleteSurroundingCallback)

    wrap_IMContextDeleteSurroundingCallback ::
        GObject a => (a -> IMContextDeleteSurroundingCallback) ->
        C_IMContextDeleteSurroundingCallback
    wrap_IMContextDeleteSurroundingCallback :: forall a.
    GObject a =>
    (a -> IMContextDeleteSurroundingCallback)
    -> C_IMContextDeleteSurroundingCallback
    wrap_IMContextDeleteSurroundingCallback a -> IMContextDeleteSurroundingCallback
    gi'cb Ptr IMContext
    gi'selfPtr Int32
    offset Int32
    nChars Ptr ()
    _ = do
        result <- Ptr IMContext -> (IMContext -> IO Bool) -> IO Bool
    forall o b.
    (HasCallStack, GObject o) =>
    Ptr o -> (o -> IO b) -> IO b
    B.ManagedPtr.withNewObject Ptr IMContext
    gi'selfPtr ((IMContext -> IO Bool) -> IO Bool)
    -> (IMContext -> IO Bool) -> IO Bool
    forall a b. (a -> b) -> a -> b
    $ \IMContext
    gi'self -> a -> IMContextDeleteSurroundingCallback
    gi'cb (IMContext -> a
    forall a b. Coercible a b => a -> b
    Coerce.coerce IMContext
    gi'self)  Int32
    offset Int32
    nChars
        let result' = (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
    result
        return result'

    -- | Connect a signal handler for the [deleteSurrounding](#signal:deleteSurrounding) signal, to be run before the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.on' iMContext #deleteSurrounding callback
    -- @
    --
    --
    onIMContextDeleteSurrounding :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextDeleteSurroundingCallback) -> m SignalHandlerId
    onIMContextDeleteSurrounding :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a
    -> ((?self::a) => IMContextDeleteSurroundingCallback)
    -> m SignalHandlerId
    onIMContextDeleteSurrounding a
    obj (?self::a) => IMContextDeleteSurroundingCallback
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IMContextDeleteSurroundingCallback
    wrapped a
    self = let ?self = a
    ?self::a
    self in (?self::a) => IMContextDeleteSurroundingCallback
    IMContextDeleteSurroundingCallback
    cb
        let wrapped' :: C_IMContextDeleteSurroundingCallback
    wrapped' = (a -> IMContextDeleteSurroundingCallback)
    -> C_IMContextDeleteSurroundingCallback
    forall a.
    GObject a =>
    (a -> IMContextDeleteSurroundingCallback)
    -> C_IMContextDeleteSurroundingCallback
    wrap_IMContextDeleteSurroundingCallback a -> IMContextDeleteSurroundingCallback
    wrapped
        wrapped'' <- C_IMContextDeleteSurroundingCallback
    -> IO (FunPtr C_IMContextDeleteSurroundingCallback)
    mk_IMContextDeleteSurroundingCallback C_IMContextDeleteSurroundingCallback
    wrapped'
        connectSignalFunPtr obj "delete-surrounding" wrapped'' SignalConnectBefore Nothing

    -- | Connect a signal handler for the [deleteSurrounding](#signal:deleteSurrounding) signal, to be run after the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.after' iMContext #deleteSurrounding callback
    -- @
    --
    --
    --
    -- By default the object invoking the signal is not passed to the callback.
    -- If you need to access it, you can use the implit @?self@ parameter.
    -- Note that this requires activating the @ImplicitParams@ GHC extension.
    --
    afterIMContextDeleteSurrounding :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextDeleteSurroundingCallback) -> m SignalHandlerId
    afterIMContextDeleteSurrounding :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a
    -> ((?self::a) => IMContextDeleteSurroundingCallback)
    -> m SignalHandlerId
    afterIMContextDeleteSurrounding a
    obj (?self::a) => IMContextDeleteSurroundingCallback
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IMContextDeleteSurroundingCallback
    wrapped a
    self = let ?self = a
    ?self::a
    self in (?self::a) => IMContextDeleteSurroundingCallback
    IMContextDeleteSurroundingCallback
    cb
        let wrapped' :: C_IMContextDeleteSurroundingCallback
    wrapped' = (a -> IMContextDeleteSurroundingCallback)
    -> C_IMContextDeleteSurroundingCallback
    forall a.
    GObject a =>
    (a -> IMContextDeleteSurroundingCallback)
    -> C_IMContextDeleteSurroundingCallback
    wrap_IMContextDeleteSurroundingCallback a -> IMContextDeleteSurroundingCallback
    wrapped
        wrapped'' <- C_IMContextDeleteSurroundingCallback
    -> IO (FunPtr C_IMContextDeleteSurroundingCallback)
    mk_IMContextDeleteSurroundingCallback C_IMContextDeleteSurroundingCallback
    wrapped'
        connectSignalFunPtr obj "delete-surrounding" wrapped'' SignalConnectAfter Nothing

    #if defined(ENABLE_OVERLOADING)
    data IMContextDeleteSurroundingSignalInfo
    instance SignalInfo IMContextDeleteSurroundingSignalInfo where
        type HaskellCallbackType IMContextDeleteSurroundingSignalInfo = IMContextDeleteSurroundingCallback
        connectSignal obj cb connectMode detail = do
            let cb' = wrap_IMContextDeleteSurroundingCallback cb
            cb'' <- mk_IMContextDeleteSurroundingCallback cb'
            connectSignalFunPtr obj "delete-surrounding" cb'' connectMode detail
        dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext::delete-surrounding"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#g:signal:deleteSurrounding"})

    #endif

    -- signal IMContext::invalid-composition
    -- | Emitted when the filtered keys do not compose to a single valid character.
    --
    -- /Since: 4.22/
    type IMContextInvalidCompositionCallback =
        T.Text
        -- ^ /@str@/: the completed character(s) entered by the user
        -> IO Bool
        -- ^ __Returns:__ true if the IM context avoid beeping on invalid composition

    type C_IMContextInvalidCompositionCallback =
        Ptr IMContext ->                        -- object
        CString ->
        Ptr () ->                               -- user_data
        IO CInt

    -- | Generate a function pointer callable from C code, from a `C_IMContextInvalidCompositionCallback`.
    foreign import ccall "wrapper"
        mk_IMContextInvalidCompositionCallback :: C_IMContextInvalidCompositionCallback -> IO (FunPtr C_IMContextInvalidCompositionCallback)

    wrap_IMContextInvalidCompositionCallback ::
        GObject a => (a -> IMContextInvalidCompositionCallback) ->
        C_IMContextInvalidCompositionCallback
    wrap_IMContextInvalidCompositionCallback :: forall a.
    GObject a =>
    (a -> IMContextInvalidCompositionCallback)
    -> C_IMContextInvalidCompositionCallback
    wrap_IMContextInvalidCompositionCallback a -> IMContextInvalidCompositionCallback
    gi'cb Ptr IMContext
    gi'selfPtr CString
    str Ptr ()
    _ = do
        str' <- HasCallStack => CString -> IO Text
    CString -> IO Text
    cstringToText CString
    str
        result <- B.ManagedPtr.withNewObject gi'selfPtr $ \IMContext
    gi'self -> a -> IMContextInvalidCompositionCallback
    gi'cb (IMContext -> a
    forall a b. Coercible a b => a -> b
    Coerce.coerce IMContext
    gi'self)  Text
    str'
        let result' = (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
    result
        return result'

    -- | Connect a signal handler for the [invalidComposition](#signal:invalidComposition) signal, to be run before the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.on' iMContext #invalidComposition callback
    -- @
    --
    --
    onIMContextInvalidComposition :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextInvalidCompositionCallback) -> m SignalHandlerId
    onIMContextInvalidComposition :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a
    -> ((?self::a) => IMContextInvalidCompositionCallback)
    -> m SignalHandlerId
    onIMContextInvalidComposition a
    obj (?self::a) => IMContextInvalidCompositionCallback
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IMContextInvalidCompositionCallback
    wrapped a
    self = let ?self = a
    ?self::a
    self in (?self::a) => IMContextInvalidCompositionCallback
    IMContextInvalidCompositionCallback
    cb
        let wrapped' :: C_IMContextInvalidCompositionCallback
    wrapped' = (a -> IMContextInvalidCompositionCallback)
    -> C_IMContextInvalidCompositionCallback
    forall a.
    GObject a =>
    (a -> IMContextInvalidCompositionCallback)
    -> C_IMContextInvalidCompositionCallback
    wrap_IMContextInvalidCompositionCallback a -> IMContextInvalidCompositionCallback
    wrapped
        wrapped'' <- C_IMContextInvalidCompositionCallback
    -> IO (FunPtr C_IMContextInvalidCompositionCallback)
    mk_IMContextInvalidCompositionCallback C_IMContextInvalidCompositionCallback
    wrapped'
        connectSignalFunPtr obj "invalid-composition" wrapped'' SignalConnectBefore Nothing

    -- | Connect a signal handler for the [invalidComposition](#signal:invalidComposition) signal, to be run after the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.after' iMContext #invalidComposition callback
    -- @
    --
    --
    --
    -- By default the object invoking the signal is not passed to the callback.
    -- If you need to access it, you can use the implit @?self@ parameter.
    -- Note that this requires activating the @ImplicitParams@ GHC extension.
    --
    afterIMContextInvalidComposition :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextInvalidCompositionCallback) -> m SignalHandlerId
    afterIMContextInvalidComposition :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a
    -> ((?self::a) => IMContextInvalidCompositionCallback)
    -> m SignalHandlerId
    afterIMContextInvalidComposition a
    obj (?self::a) => IMContextInvalidCompositionCallback
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IMContextInvalidCompositionCallback
    wrapped a
    self = let ?self = a
    ?self::a
    self in (?self::a) => IMContextInvalidCompositionCallback
    IMContextInvalidCompositionCallback
    cb
        let wrapped' :: C_IMContextInvalidCompositionCallback
    wrapped' = (a -> IMContextInvalidCompositionCallback)
    -> C_IMContextInvalidCompositionCallback
    forall a.
    GObject a =>
    (a -> IMContextInvalidCompositionCallback)
    -> C_IMContextInvalidCompositionCallback
    wrap_IMContextInvalidCompositionCallback a -> IMContextInvalidCompositionCallback
    wrapped
        wrapped'' <- C_IMContextInvalidCompositionCallback
    -> IO (FunPtr C_IMContextInvalidCompositionCallback)
    mk_IMContextInvalidCompositionCallback C_IMContextInvalidCompositionCallback
    wrapped'
        connectSignalFunPtr obj "invalid-composition" wrapped'' SignalConnectAfter Nothing

    #if defined(ENABLE_OVERLOADING)
    data IMContextInvalidCompositionSignalInfo
    instance SignalInfo IMContextInvalidCompositionSignalInfo where
        type HaskellCallbackType IMContextInvalidCompositionSignalInfo = IMContextInvalidCompositionCallback
        connectSignal obj cb connectMode detail = do
            let cb' = wrap_IMContextInvalidCompositionCallback cb
            cb'' <- mk_IMContextInvalidCompositionCallback cb'
            connectSignalFunPtr obj "invalid-composition" cb'' connectMode detail
        dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext::invalid-composition"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#g:signal:invalidComposition"})

    #endif

    -- signal IMContext::preedit-changed
    -- | The [preeditChanged](#g:signal:preeditChanged) signal is emitted whenever the preedit sequence
    -- currently being entered has changed.
    --
    -- It is also emitted at the end of a preedit sequence, in which case
    -- 'GI.Gtk.Objects.IMContext.iMContextGetPreeditString' returns the empty string.
    type IMContextPreeditChangedCallback =
        IO ()

    type C_IMContextPreeditChangedCallback =
        Ptr IMContext ->                        -- object
        Ptr () ->                               -- user_data
        IO ()

    -- | Generate a function pointer callable from C code, from a `C_IMContextPreeditChangedCallback`.
    foreign import ccall "wrapper"
        mk_IMContextPreeditChangedCallback :: C_IMContextPreeditChangedCallback -> IO (FunPtr C_IMContextPreeditChangedCallback)

    wrap_IMContextPreeditChangedCallback ::
        GObject a => (a -> IMContextPreeditChangedCallback) ->
        C_IMContextPreeditChangedCallback
    wrap_IMContextPreeditChangedCallback :: forall a.
    GObject a =>
    (a -> IO ()) -> C_IMContextPreeditChangedCallback
    wrap_IMContextPreeditChangedCallback a -> IO ()
    gi'cb Ptr IMContext
    gi'selfPtr Ptr ()
    _ = do
        Ptr IMContext -> (IMContext -> IO ()) -> IO ()
    forall o b.
    (HasCallStack, GObject o) =>
    Ptr o -> (o -> IO b) -> IO b
    B.ManagedPtr.withNewObject Ptr IMContext
    gi'selfPtr ((IMContext -> IO ()) -> IO ()) -> (IMContext -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \IMContext
    gi'self -> a -> IO ()
    gi'cb (IMContext -> a
    forall a b. Coercible a b => a -> b
    Coerce.coerce IMContext
    gi'self)

    -- | Connect a signal handler for the [preeditChanged](#signal:preeditChanged) signal, to be run before the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.on' iMContext #preeditChanged callback
    -- @
    --
    --
    onIMContextPreeditChanged :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextPreeditChangedCallback) -> m SignalHandlerId
    onIMContextPreeditChanged :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a -> ((?self::a) => IO ()) -> m SignalHandlerId
    onIMContextPreeditChanged a
    obj (?self::a) => IO ()
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IO ()
    wrapped a
    self = let ?self = a
    ?self::a
    self in IO ()
    (?self::a) => IO ()
    cb
        let wrapped' :: C_IMContextPreeditChangedCallback
    wrapped' = (a -> IO ()) -> C_IMContextPreeditChangedCallback
    forall a.
    GObject a =>
    (a -> IO ()) -> C_IMContextPreeditChangedCallback
    wrap_IMContextPreeditChangedCallback a -> IO ()
    wrapped
        wrapped'' <- C_IMContextPreeditChangedCallback
    -> IO (FunPtr C_IMContextPreeditChangedCallback)
    mk_IMContextPreeditChangedCallback C_IMContextPreeditChangedCallback
    wrapped'
        connectSignalFunPtr obj "preedit-changed" wrapped'' SignalConnectBefore Nothing

    -- | Connect a signal handler for the [preeditChanged](#signal:preeditChanged) signal, to be run after the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.after' iMContext #preeditChanged callback
    -- @
    --
    --
    --
    -- By default the object invoking the signal is not passed to the callback.
    -- If you need to access it, you can use the implit @?self@ parameter.
    -- Note that this requires activating the @ImplicitParams@ GHC extension.
    --
    afterIMContextPreeditChanged :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextPreeditChangedCallback) -> m SignalHandlerId
    afterIMContextPreeditChanged :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a -> ((?self::a) => IO ()) -> m SignalHandlerId
    afterIMContextPreeditChanged a
    obj (?self::a) => IO ()
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IO ()
    wrapped a
    self = let ?self = a
    ?self::a
    self in IO ()
    (?self::a) => IO ()
    cb
        let wrapped' :: C_IMContextPreeditChangedCallback
    wrapped' = (a -> IO ()) -> C_IMContextPreeditChangedCallback
    forall a.
    GObject a =>
    (a -> IO ()) -> C_IMContextPreeditChangedCallback
    wrap_IMContextPreeditChangedCallback a -> IO ()
    wrapped
        wrapped'' <- C_IMContextPreeditChangedCallback
    -> IO (FunPtr C_IMContextPreeditChangedCallback)
    mk_IMContextPreeditChangedCallback C_IMContextPreeditChangedCallback
    wrapped'
        connectSignalFunPtr obj "preedit-changed" wrapped'' SignalConnectAfter Nothing

    #if defined(ENABLE_OVERLOADING)
    data IMContextPreeditChangedSignalInfo
    instance SignalInfo IMContextPreeditChangedSignalInfo where
        type HaskellCallbackType IMContextPreeditChangedSignalInfo = IMContextPreeditChangedCallback
        connectSignal obj cb connectMode detail = do
            let cb' = wrap_IMContextPreeditChangedCallback cb
            cb'' <- mk_IMContextPreeditChangedCallback cb'
            connectSignalFunPtr obj "preedit-changed" cb'' connectMode detail
        dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext::preedit-changed"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#g:signal:preeditChanged"})

    #endif

    -- signal IMContext::preedit-end
    -- | The [preeditEnd](#g:signal:preeditEnd) signal is emitted when a preediting sequence
    -- has been completed or canceled.
    type IMContextPreeditEndCallback =
        IO ()

    type C_IMContextPreeditEndCallback =
        Ptr IMContext ->                        -- object
        Ptr () ->                               -- user_data
        IO ()

    -- | Generate a function pointer callable from C code, from a `C_IMContextPreeditEndCallback`.
    foreign import ccall "wrapper"
        mk_IMContextPreeditEndCallback :: C_IMContextPreeditEndCallback -> IO (FunPtr C_IMContextPreeditEndCallback)

    wrap_IMContextPreeditEndCallback ::
        GObject a => (a -> IMContextPreeditEndCallback) ->
        C_IMContextPreeditEndCallback
    wrap_IMContextPreeditEndCallback :: forall a.
    GObject a =>
    (a -> IO ()) -> C_IMContextPreeditChangedCallback
    wrap_IMContextPreeditEndCallback a -> IO ()
    gi'cb Ptr IMContext
    gi'selfPtr Ptr ()
    _ = do
        Ptr IMContext -> (IMContext -> IO ()) -> IO ()
    forall o b.
    (HasCallStack, GObject o) =>
    Ptr o -> (o -> IO b) -> IO b
    B.ManagedPtr.withNewObject Ptr IMContext
    gi'selfPtr ((IMContext -> IO ()) -> IO ()) -> (IMContext -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \IMContext
    gi'self -> a -> IO ()
    gi'cb (IMContext -> a
    forall a b. Coercible a b => a -> b
    Coerce.coerce IMContext
    gi'self)

    -- | Connect a signal handler for the [preeditEnd](#signal:preeditEnd) signal, to be run before the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.on' iMContext #preeditEnd callback
    -- @
    --
    --
    onIMContextPreeditEnd :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextPreeditEndCallback) -> m SignalHandlerId
    onIMContextPreeditEnd :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a -> ((?self::a) => IO ()) -> m SignalHandlerId
    onIMContextPreeditEnd a
    obj (?self::a) => IO ()
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IO ()
    wrapped a
    self = let ?self = a
    ?self::a
    self in IO ()
    (?self::a) => IO ()
    cb
        let wrapped' :: C_IMContextPreeditChangedCallback
    wrapped' = (a -> IO ()) -> C_IMContextPreeditChangedCallback
    forall a.
    GObject a =>
    (a -> IO ()) -> C_IMContextPreeditChangedCallback
    wrap_IMContextPreeditEndCallback a -> IO ()
    wrapped
        wrapped'' <- C_IMContextPreeditChangedCallback
    -> IO (FunPtr C_IMContextPreeditChangedCallback)
    mk_IMContextPreeditEndCallback C_IMContextPreeditChangedCallback
    wrapped'
        connectSignalFunPtr obj "preedit-end" wrapped'' SignalConnectBefore Nothing

    -- | Connect a signal handler for the [preeditEnd](#signal:preeditEnd) signal, to be run after the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.after' iMContext #preeditEnd callback
    -- @
    --
    --
    --
    -- By default the object invoking the signal is not passed to the callback.
    -- If you need to access it, you can use the implit @?self@ parameter.
    -- Note that this requires activating the @ImplicitParams@ GHC extension.
    --
    afterIMContextPreeditEnd :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextPreeditEndCallback) -> m SignalHandlerId
    afterIMContextPreeditEnd :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a -> ((?self::a) => IO ()) -> m SignalHandlerId
    afterIMContextPreeditEnd a
    obj (?self::a) => IO ()
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IO ()
    wrapped a
    self = let ?self = a
    ?self::a
    self in IO ()
    (?self::a) => IO ()
    cb
        let wrapped' :: C_IMContextPreeditChangedCallback
    wrapped' = (a -> IO ()) -> C_IMContextPreeditChangedCallback
    forall a.
    GObject a =>
    (a -> IO ()) -> C_IMContextPreeditChangedCallback
    wrap_IMContextPreeditEndCallback a -> IO ()
    wrapped
        wrapped'' <- C_IMContextPreeditChangedCallback
    -> IO (FunPtr C_IMContextPreeditChangedCallback)
    mk_IMContextPreeditEndCallback C_IMContextPreeditChangedCallback
    wrapped'
        connectSignalFunPtr obj "preedit-end" wrapped'' SignalConnectAfter Nothing

    #if defined(ENABLE_OVERLOADING)
    data IMContextPreeditEndSignalInfo
    instance SignalInfo IMContextPreeditEndSignalInfo where
        type HaskellCallbackType IMContextPreeditEndSignalInfo = IMContextPreeditEndCallback
        connectSignal obj cb connectMode detail = do
            let cb' = wrap_IMContextPreeditEndCallback cb
            cb'' <- mk_IMContextPreeditEndCallback cb'
            connectSignalFunPtr obj "preedit-end" cb'' connectMode detail
        dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext::preedit-end"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#g:signal:preeditEnd"})

    #endif

    -- signal IMContext::preedit-start
    -- | The [preeditStart](#g:signal:preeditStart) signal is emitted when a new preediting sequence
    -- starts.
    type IMContextPreeditStartCallback =
        IO ()

    type C_IMContextPreeditStartCallback =
        Ptr IMContext ->                        -- object
        Ptr () ->                               -- user_data
        IO ()

    -- | Generate a function pointer callable from C code, from a `C_IMContextPreeditStartCallback`.
    foreign import ccall "wrapper"
        mk_IMContextPreeditStartCallback :: C_IMContextPreeditStartCallback -> IO (FunPtr C_IMContextPreeditStartCallback)

    wrap_IMContextPreeditStartCallback ::
        GObject a => (a -> IMContextPreeditStartCallback) ->
        C_IMContextPreeditStartCallback
    wrap_IMContextPreeditStartCallback :: forall a.
    GObject a =>
    (a -> IO ()) -> C_IMContextPreeditChangedCallback
    wrap_IMContextPreeditStartCallback a -> IO ()
    gi'cb Ptr IMContext
    gi'selfPtr Ptr ()
    _ = do
        Ptr IMContext -> (IMContext -> IO ()) -> IO ()
    forall o b.
    (HasCallStack, GObject o) =>
    Ptr o -> (o -> IO b) -> IO b
    B.ManagedPtr.withNewObject Ptr IMContext
    gi'selfPtr ((IMContext -> IO ()) -> IO ()) -> (IMContext -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \IMContext
    gi'self -> a -> IO ()
    gi'cb (IMContext -> a
    forall a b. Coercible a b => a -> b
    Coerce.coerce IMContext
    gi'self)

    -- | Connect a signal handler for the [preeditStart](#signal:preeditStart) signal, to be run before the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.on' iMContext #preeditStart callback
    -- @
    --
    --
    onIMContextPreeditStart :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextPreeditStartCallback) -> m SignalHandlerId
    onIMContextPreeditStart :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a -> ((?self::a) => IO ()) -> m SignalHandlerId
    onIMContextPreeditStart a
    obj (?self::a) => IO ()
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IO ()
    wrapped a
    self = let ?self = a
    ?self::a
    self in IO ()
    (?self::a) => IO ()
    cb
        let wrapped' :: C_IMContextPreeditChangedCallback
    wrapped' = (a -> IO ()) -> C_IMContextPreeditChangedCallback
    forall a.
    GObject a =>
    (a -> IO ()) -> C_IMContextPreeditChangedCallback
    wrap_IMContextPreeditStartCallback a -> IO ()
    wrapped
        wrapped'' <- C_IMContextPreeditChangedCallback
    -> IO (FunPtr C_IMContextPreeditChangedCallback)
    mk_IMContextPreeditStartCallback C_IMContextPreeditChangedCallback
    wrapped'
        connectSignalFunPtr obj "preedit-start" wrapped'' SignalConnectBefore Nothing

    -- | Connect a signal handler for the [preeditStart](#signal:preeditStart) signal, to be run after the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.after' iMContext #preeditStart callback
    -- @
    --
    --
    --
    -- By default the object invoking the signal is not passed to the callback.
    -- If you need to access it, you can use the implit @?self@ parameter.
    -- Note that this requires activating the @ImplicitParams@ GHC extension.
    --
    afterIMContextPreeditStart :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextPreeditStartCallback) -> m SignalHandlerId
    afterIMContextPreeditStart :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a -> ((?self::a) => IO ()) -> m SignalHandlerId
    afterIMContextPreeditStart a
    obj (?self::a) => IO ()
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IO ()
    wrapped a
    self = let ?self = a
    ?self::a
    self in IO ()
    (?self::a) => IO ()
    cb
        let wrapped' :: C_IMContextPreeditChangedCallback
    wrapped' = (a -> IO ()) -> C_IMContextPreeditChangedCallback
    forall a.
    GObject a =>
    (a -> IO ()) -> C_IMContextPreeditChangedCallback
    wrap_IMContextPreeditStartCallback a -> IO ()
    wrapped
        wrapped'' <- C_IMContextPreeditChangedCallback
    -> IO (FunPtr C_IMContextPreeditChangedCallback)
    mk_IMContextPreeditStartCallback C_IMContextPreeditChangedCallback
    wrapped'
        connectSignalFunPtr obj "preedit-start" wrapped'' SignalConnectAfter Nothing

    #if defined(ENABLE_OVERLOADING)
    data IMContextPreeditStartSignalInfo
    instance SignalInfo IMContextPreeditStartSignalInfo where
        type HaskellCallbackType IMContextPreeditStartSignalInfo = IMContextPreeditStartCallback
        connectSignal obj cb connectMode detail = do
            let cb' = wrap_IMContextPreeditStartCallback cb
            cb'' <- mk_IMContextPreeditStartCallback cb'
            connectSignalFunPtr obj "preedit-start" cb'' connectMode detail
        dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext::preedit-start"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#g:signal:preeditStart"})

    #endif

    -- signal IMContext::retrieve-surrounding
    -- | The [retrieveSurrounding](#g:signal:retrieveSurrounding) signal is emitted when the input method
    -- requires the context surrounding the cursor.
    --
    -- The callback should set the input method surrounding context by
    -- calling the 'GI.Gtk.Objects.IMContext.iMContextSetSurrounding' method.
    type IMContextRetrieveSurroundingCallback =
        IO Bool
        -- ^ __Returns:__ 'P.True' if the signal was handled.

    type C_IMContextRetrieveSurroundingCallback =
        Ptr IMContext ->                        -- object
        Ptr () ->                               -- user_data
        IO CInt

    -- | Generate a function pointer callable from C code, from a `C_IMContextRetrieveSurroundingCallback`.
    foreign import ccall "wrapper"
        mk_IMContextRetrieveSurroundingCallback :: C_IMContextRetrieveSurroundingCallback -> IO (FunPtr C_IMContextRetrieveSurroundingCallback)

    wrap_IMContextRetrieveSurroundingCallback ::
        GObject a => (a -> IMContextRetrieveSurroundingCallback) ->
        C_IMContextRetrieveSurroundingCallback
    wrap_IMContextRetrieveSurroundingCallback :: forall a.
    GObject a =>
    (a -> IO Bool) -> C_IMContextRetrieveSurroundingCallback
    wrap_IMContextRetrieveSurroundingCallback a -> IO Bool
    gi'cb Ptr IMContext
    gi'selfPtr Ptr ()
    _ = do
        result <- Ptr IMContext -> (IMContext -> IO Bool) -> IO Bool
    forall o b.
    (HasCallStack, GObject o) =>
    Ptr o -> (o -> IO b) -> IO b
    B.ManagedPtr.withNewObject Ptr IMContext
    gi'selfPtr ((IMContext -> IO Bool) -> IO Bool)
    -> (IMContext -> IO Bool) -> IO Bool
    forall a b. (a -> b) -> a -> b
    $ \IMContext
    gi'self -> a -> IO Bool
    gi'cb (IMContext -> a
    forall a b. Coercible a b => a -> b
    Coerce.coerce IMContext
    gi'self)
        let result' = (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
    result
        return result'

    -- | Connect a signal handler for the [retrieveSurrounding](#signal:retrieveSurrounding) signal, to be run before the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.on' iMContext #retrieveSurrounding callback
    -- @
    --
    --
    onIMContextRetrieveSurrounding :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextRetrieveSurroundingCallback) -> m SignalHandlerId
    onIMContextRetrieveSurrounding :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a -> ((?self::a) => IO Bool) -> m SignalHandlerId
    onIMContextRetrieveSurrounding a
    obj (?self::a) => IO Bool
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IO Bool
    wrapped a
    self = let ?self = a
    ?self::a
    self in IO Bool
    (?self::a) => IO Bool
    cb
        let wrapped' :: C_IMContextRetrieveSurroundingCallback
    wrapped' = (a -> IO Bool) -> C_IMContextRetrieveSurroundingCallback
    forall a.
    GObject a =>
    (a -> IO Bool) -> C_IMContextRetrieveSurroundingCallback
    wrap_IMContextRetrieveSurroundingCallback a -> IO Bool
    wrapped
        wrapped'' <- C_IMContextRetrieveSurroundingCallback
    -> IO (FunPtr C_IMContextRetrieveSurroundingCallback)
    mk_IMContextRetrieveSurroundingCallback C_IMContextRetrieveSurroundingCallback
    wrapped'
        connectSignalFunPtr obj "retrieve-surrounding" wrapped'' SignalConnectBefore Nothing

    -- | Connect a signal handler for the [retrieveSurrounding](#signal:retrieveSurrounding) signal, to be run after the default handler.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Signals.after' iMContext #retrieveSurrounding callback
    -- @
    --
    --
    --
    -- By default the object invoking the signal is not passed to the callback.
    -- If you need to access it, you can use the implit @?self@ parameter.
    -- Note that this requires activating the @ImplicitParams@ GHC extension.
    --
    afterIMContextRetrieveSurrounding :: (IsIMContext a, MonadIO m) => a -> ((?self :: a) => IMContextRetrieveSurroundingCallback) -> m SignalHandlerId
    afterIMContextRetrieveSurrounding :: forall a (m :: * -> *).
    (IsIMContext a, MonadIO m) =>
    a -> ((?self::a) => IO Bool) -> m SignalHandlerId
    afterIMContextRetrieveSurrounding a
    obj (?self::a) => IO Bool
    cb = IO SignalHandlerId -> m SignalHandlerId
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SignalHandlerId -> m SignalHandlerId)
    -> IO SignalHandlerId -> m SignalHandlerId
    forall a b. (a -> b) -> a -> b
    $ do
        let wrapped :: a -> IO Bool
    wrapped a
    self = let ?self = a
    ?self::a
    self in IO Bool
    (?self::a) => IO Bool
    cb
        let wrapped' :: C_IMContextRetrieveSurroundingCallback
    wrapped' = (a -> IO Bool) -> C_IMContextRetrieveSurroundingCallback
    forall a.
    GObject a =>
    (a -> IO Bool) -> C_IMContextRetrieveSurroundingCallback
    wrap_IMContextRetrieveSurroundingCallback a -> IO Bool
    wrapped
        wrapped'' <- C_IMContextRetrieveSurroundingCallback
    -> IO (FunPtr C_IMContextRetrieveSurroundingCallback)
    mk_IMContextRetrieveSurroundingCallback C_IMContextRetrieveSurroundingCallback
    wrapped'
        connectSignalFunPtr obj "retrieve-surrounding" wrapped'' SignalConnectAfter Nothing

    #if defined(ENABLE_OVERLOADING)
    data IMContextRetrieveSurroundingSignalInfo
    instance SignalInfo IMContextRetrieveSurroundingSignalInfo where
        type HaskellCallbackType IMContextRetrieveSurroundingSignalInfo = IMContextRetrieveSurroundingCallback
        connectSignal obj cb connectMode detail = do
            let cb' = wrap_IMContextRetrieveSurroundingCallback cb
            cb'' <- mk_IMContextRetrieveSurroundingCallback cb'
            connectSignalFunPtr obj "retrieve-surrounding" cb'' connectMode detail
        dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext::retrieve-surrounding"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#g:signal:retrieveSurrounding"})

    #endif

    -- VVV Prop "input-hints"
       -- Type: TInterface (Name {namespace = "Gtk", name = "InputHints"})
       -- Flags: [PropertyReadable,PropertyWritable]
       -- Nullable: (Nothing,Nothing)

    -- | Get the value of the “@input-hints@” property.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' iMContext #inputHints
    -- @
    getIMContextInputHints :: (MonadIO m, IsIMContext o) => o -> m [Gtk.Flags.InputHints]
    getIMContextInputHints :: forall (m :: * -> *) o.
    (MonadIO m, IsIMContext o) =>
    o -> m [InputHints]
    getIMContextInputHints o
    obj = IO [InputHints] -> m [InputHints]
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    MIO.liftIO (IO [InputHints] -> m [InputHints])
    -> IO [InputHints] -> m [InputHints]
    forall a b. (a -> b) -> a -> b
    $ o -> String -> IO [InputHints]
    forall a b.
    (GObject a, IsGFlag b, BoxedFlags b) =>
    a -> String -> IO [b]
    B.Properties.getObjectPropertyFlags o
    obj String
    "input-hints"

    -- | Set the value of the “@input-hints@” property.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.set' iMContext [ #inputHints 'Data.GI.Base.Attributes.:=' value ]
    -- @
    setIMContextInputHints :: (MonadIO m, IsIMContext o) => o -> [Gtk.Flags.InputHints] -> m ()
    setIMContextInputHints :: forall (m :: * -> *) o.
    (MonadIO m, IsIMContext o) =>
    o -> [InputHints] -> m ()
    setIMContextInputHints o
    obj [InputHints]
    val = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    MIO.liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        o -> String -> [InputHints] -> IO ()
    forall a b.
    (IsGFlag b, BoxedFlags b, GObject a) =>
    a -> String -> [b] -> IO ()
    B.Properties.setObjectPropertyFlags o
    obj String
    "input-hints" [InputHints]
    val

    -- | Construct a t'GValueConstruct' with valid value for the “@input-hints@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
    constructIMContextInputHints :: (IsIMContext o, MIO.MonadIO m) => [Gtk.Flags.InputHints] -> m (GValueConstruct o)
    constructIMContextInputHints :: forall o (m :: * -> *).
    (IsIMContext o, MonadIO m) =>
    [InputHints] -> m (GValueConstruct o)
    constructIMContextInputHints [InputHints]
    val = IO (GValueConstruct o) -> m (GValueConstruct o)
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
    -> IO (GValueConstruct o) -> m (GValueConstruct o)
    forall a b. (a -> b) -> a -> b
    $ do
        IO (GValueConstruct o) -> IO (GValueConstruct o)
    forall a. IO a -> IO a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
    -> IO (GValueConstruct o) -> IO (GValueConstruct o)
    forall a b. (a -> b) -> a -> b
    $ String -> [InputHints] -> IO (GValueConstruct o)
    forall a o.
    (IsGFlag a, BoxedFlags a) =>
    String -> [a] -> IO (GValueConstruct o)
    B.Properties.constructObjectPropertyFlags String
    "input-hints" [InputHints]
    val

    #if defined(ENABLE_OVERLOADING)
    data IMContextInputHintsPropertyInfo
    instance AttrInfo IMContextInputHintsPropertyInfo where
        type AttrAllowedOps IMContextInputHintsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrPut]
        type AttrBaseTypeConstraint IMContextInputHintsPropertyInfo = IsIMContext
        type AttrSetTypeConstraint IMContextInputHintsPropertyInfo = (~) [Gtk.Flags.InputHints]
        type AttrTransferTypeConstraint IMContextInputHintsPropertyInfo = (~) [Gtk.Flags.InputHints]
        type AttrTransferType IMContextInputHintsPropertyInfo = [Gtk.Flags.InputHints]
        type AttrGetType IMContextInputHintsPropertyInfo = [Gtk.Flags.InputHints]
        type AttrLabel IMContextInputHintsPropertyInfo = "input-hints"
        type AttrOrigin IMContextInputHintsPropertyInfo = IMContext
        attrGet = getIMContextInputHints
        attrSet = setIMContextInputHints
        attrPut = setIMContextInputHints
        attrTransfer _ v = do
            return v
        attrConstruct = constructIMContextInputHints
        attrClear = undefined
        dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.inputHints"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#g:attr:inputHints"
            })
    #endif

    -- VVV Prop "input-purpose"
       -- Type: TInterface (Name {namespace = "Gtk", name = "InputPurpose"})
       -- Flags: [PropertyReadable,PropertyWritable]
       -- Nullable: (Nothing,Nothing)

    -- | Get the value of the “@input-purpose@” property.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' iMContext #inputPurpose
    -- @
    getIMContextInputPurpose :: (MonadIO m, IsIMContext o) => o -> m Gtk.Enums.InputPurpose
    getIMContextInputPurpose :: forall (m :: * -> *) o.
    (MonadIO m, IsIMContext o) =>
    o -> m InputPurpose
    getIMContextInputPurpose o
    obj = IO InputPurpose -> m InputPurpose
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    MIO.liftIO (IO InputPurpose -> m InputPurpose)
    -> IO InputPurpose -> m InputPurpose
    forall a b. (a -> b) -> a -> b
    $ o -> String -> IO InputPurpose
    forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
    B.Properties.getObjectPropertyEnum o
    obj String
    "input-purpose"

    -- | Set the value of the “@input-purpose@” property.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.set' iMContext [ #inputPurpose 'Data.GI.Base.Attributes.:=' value ]
    -- @
    setIMContextInputPurpose :: (MonadIO m, IsIMContext o) => o -> Gtk.Enums.InputPurpose -> m ()
    setIMContextInputPurpose :: forall (m :: * -> *) o.
    (MonadIO m, IsIMContext o) =>
    o -> InputPurpose -> m ()
    setIMContextInputPurpose o
    obj InputPurpose
    val = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    MIO.liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        o -> String -> InputPurpose -> IO ()
    forall a b.
    (GObject a, Enum b, BoxedEnum b) =>
    a -> String -> b -> IO ()
    B.Properties.setObjectPropertyEnum o
    obj String
    "input-purpose" InputPurpose
    val

    -- | Construct a t'GValueConstruct' with valid value for the “@input-purpose@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
    constructIMContextInputPurpose :: (IsIMContext o, MIO.MonadIO m) => Gtk.Enums.InputPurpose -> m (GValueConstruct o)
    constructIMContextInputPurpose :: forall o (m :: * -> *).
    (IsIMContext o, MonadIO m) =>
    InputPurpose -> m (GValueConstruct o)
    constructIMContextInputPurpose InputPurpose
    val = IO (GValueConstruct o) -> m (GValueConstruct o)
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
    -> IO (GValueConstruct o) -> m (GValueConstruct o)
    forall a b. (a -> b) -> a -> b
    $ do
        IO (GValueConstruct o) -> IO (GValueConstruct o)
    forall a. IO a -> IO a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
    -> IO (GValueConstruct o) -> IO (GValueConstruct o)
    forall a b. (a -> b) -> a -> b
    $ String -> InputPurpose -> IO (GValueConstruct o)
    forall a o.
    (Enum a, BoxedEnum a) =>
    String -> a -> IO (GValueConstruct o)
    B.Properties.constructObjectPropertyEnum String
    "input-purpose" InputPurpose
    val

    #if defined(ENABLE_OVERLOADING)
    data IMContextInputPurposePropertyInfo
    instance AttrInfo IMContextInputPurposePropertyInfo where
        type AttrAllowedOps IMContextInputPurposePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrPut]
        type AttrBaseTypeConstraint IMContextInputPurposePropertyInfo = IsIMContext
        type AttrSetTypeConstraint IMContextInputPurposePropertyInfo = (~) Gtk.Enums.InputPurpose
        type AttrTransferTypeConstraint IMContextInputPurposePropertyInfo = (~) Gtk.Enums.InputPurpose
        type AttrTransferType IMContextInputPurposePropertyInfo = Gtk.Enums.InputPurpose
        type AttrGetType IMContextInputPurposePropertyInfo = Gtk.Enums.InputPurpose
        type AttrLabel IMContextInputPurposePropertyInfo = "input-purpose"
        type AttrOrigin IMContextInputPurposePropertyInfo = IMContext
        attrGet = getIMContextInputPurpose
        attrSet = setIMContextInputPurpose
        attrPut = setIMContextInputPurpose
        attrTransfer _ v = do
            return v
        attrConstruct = constructIMContextInputPurpose
        attrClear = undefined
        dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.inputPurpose"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#g:attr:inputPurpose"
            })
    #endif

    #if defined(ENABLE_OVERLOADING)
    instance O.HasAttributeList IMContext
    type instance O.AttributeList IMContext = IMContextAttributeList
    type IMContextAttributeList = ('[ '("inputHints", IMContextInputHintsPropertyInfo), '("inputPurpose", IMContextInputPurposePropertyInfo)] :: [(Symbol, DK.Type)])
    #endif

    #if defined(ENABLE_OVERLOADING)
    iMContextInputHints :: AttrLabelProxy "inputHints"
    iMContextInputHints = AttrLabelProxy

    iMContextInputPurpose :: AttrLabelProxy "inputPurpose"
    iMContextInputPurpose = AttrLabelProxy

    #endif

    #if defined(ENABLE_OVERLOADING)
    type instance O.SignalList IMContext = IMContextSignalList
    type IMContextSignalList = ('[ '("commit", IMContextCommitSignalInfo), '("deleteSurrounding", IMContextDeleteSurroundingSignalInfo), '("invalidComposition", IMContextInvalidCompositionSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("preeditChanged", IMContextPreeditChangedSignalInfo), '("preeditEnd", IMContextPreeditEndSignalInfo), '("preeditStart", IMContextPreeditStartSignalInfo), '("retrieveSurrounding", IMContextRetrieveSurroundingSignalInfo)] :: [(Symbol, DK.Type)])

    #endif

    -- method IMContext::activate_osk
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "event"
    --           , argType = TInterface Name { namespace = "Gdk" , name = "Event" }
    --           , argCType = Just "GdkEvent*"
    --           , direction = DirectionIn
    --           , mayBeNull = True
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a [class@Gdk.Event]"
    --                 , 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 "gtk_im_context_activate_osk" gtk_im_context_activate_osk ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        Ptr Gdk.Event.Event ->                  -- event : TInterface (Name {namespace = "Gdk", name = "Event"})
        IO CInt

    -- | Requests the platform to show an on-screen keyboard for user input.
    --
    -- This method will return 'P.True' if this request was actually performed
    -- to the platform, other environmental factors may result in an on-screen
    -- keyboard effectively not showing up.
    --
    -- /Since: 4.14/
    iMContextActivateOsk ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a, Gdk.Event.IsEvent b) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> Maybe (b)
        -- ^ /@event@/: a t'GI.Gdk.Objects.Event.Event'
        -> m Bool
        -- ^ __Returns:__ 'P.True' if an on-screen keyboard could be requested to the platform.
    iMContextActivateOsk :: forall (m :: * -> *) a b.
    (HasCallStack, MonadIO m, IsIMContext a, IsEvent b) =>
    a -> Maybe b -> m Bool
    iMContextActivateOsk a
    context Maybe b
    event = 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
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        maybeEvent <- case event of
            Maybe b
    Nothing -> Ptr Event -> IO (Ptr Event)
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return Ptr Event
    forall a. Ptr a
    FP.nullPtr
            Just b
    jEvent -> do
                jEvent' <- b -> IO (Ptr Event)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr b
    jEvent
                return jEvent'
        result <- gtk_im_context_activate_osk context' maybeEvent
        let result' = (CInt -> CInt -> Bool
    forall a. Eq a => a -> a -> Bool
    /= CInt
    0) CInt
    result
        touchManagedPtr context
        whenJust event touchManagedPtr
        return result'

    #if defined(ENABLE_OVERLOADING)
    data IMContextActivateOskMethodInfo
    instance (signature ~ (Maybe (b) -> m Bool), MonadIO m, IsIMContext a, Gdk.Event.IsEvent b) => O.OverloadedMethod IMContextActivateOskMethodInfo a signature where
        overloadedMethod = iMContextActivateOsk

    instance O.OverloadedMethodInfo IMContextActivateOskMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextActivateOsk",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextActivateOsk"
            })

    #endif

    -- method IMContext::delete_surrounding
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "offset"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "offset from cursor position in chars;\n   a negative value means start before the cursor."
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "n_chars"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "number of characters to delete."
    --                 , 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 "gtk_im_context_delete_surrounding" gtk_im_context_delete_surrounding ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        Int32 ->                                -- offset : TBasicType TInt
        Int32 ->                                -- n_chars : TBasicType TInt
        IO CInt

    -- | Asks the widget that the input context is attached to delete
    -- characters around the cursor position by emitting the
    -- @::delete_surrounding@ signal.
    --
    -- Note that /@offset@/ and /@nChars@/ are in characters not in bytes
    -- which differs from the usage other places in @GtkIMContext@.
    --
    -- In order to use this function, you should first call
    -- 'GI.Gtk.Objects.IMContext.iMContextGetSurrounding' to get the current context,
    -- and call this function immediately afterwards to make sure that you
    -- know what you are deleting. You should also account for the fact
    -- that even if the signal was handled, the input context might not
    -- have deleted all the characters that were requested to be deleted.
    --
    -- This function is used by an input method that wants to make
    -- substitutions in the existing text in response to new input.
    -- It is not useful for applications.
    iMContextDeleteSurrounding ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> Int32
        -- ^ /@offset@/: offset from cursor position in chars;
        --    a negative value means start before the cursor.
        -> Int32
        -- ^ /@nChars@/: number of characters to delete.
        -> m Bool
        -- ^ __Returns:__ 'P.True' if the signal was handled.
    iMContextDeleteSurrounding :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsIMContext a) =>
    a -> Int32 -> Int32 -> m Bool
    iMContextDeleteSurrounding a
    context Int32
    offset Int32
    nChars = 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
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        result <- gtk_im_context_delete_surrounding context' offset nChars
        let result' = (CInt -> CInt -> Bool
    forall a. Eq a => a -> a -> Bool
    /= CInt
    0) CInt
    result
        touchManagedPtr context
        return result'

    #if defined(ENABLE_OVERLOADING)
    data IMContextDeleteSurroundingMethodInfo
    instance (signature ~ (Int32 -> Int32 -> m Bool), MonadIO m, IsIMContext a) => O.OverloadedMethod IMContextDeleteSurroundingMethodInfo a signature where
        overloadedMethod = iMContextDeleteSurrounding

    instance O.OverloadedMethodInfo IMContextDeleteSurroundingMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextDeleteSurrounding",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextDeleteSurrounding"
            })

    #endif

    -- method IMContext::filter_key
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "press"
    --           , argType = TBasicType TBoolean
    --           , argCType = Just "gboolean"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just "whether to forward a key press or release event"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "surface"
    --           , argType =
    --               TInterface Name { namespace = "Gdk" , name = "Surface" }
    --           , argCType = Just "GdkSurface*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "the surface the event is for"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "device"
    --           , argType = TInterface Name { namespace = "Gdk" , name = "Device" }
    --           , argCType = Just "GdkDevice*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "the device that the event is for"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "time"
    --           , argType = TBasicType TUInt32
    --           , argCType = Just "guint32"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "the timestamp for the event"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "keycode"
    --           , argType = TBasicType TUInt
    --           , argCType = Just "guint"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "the keycode for the event"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "state"
    --           , argType =
    --               TInterface Name { namespace = "Gdk" , name = "ModifierType" }
    --           , argCType = Just "GdkModifierType"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "modifier state for the event"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "group"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "the active keyboard group for the event"
    --                 , 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 "gtk_im_context_filter_key" gtk_im_context_filter_key ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        CInt ->                                 -- press : TBasicType TBoolean
        Ptr Gdk.Surface.Surface ->              -- surface : TInterface (Name {namespace = "Gdk", name = "Surface"})
        Ptr Gdk.Device.Device ->                -- device : TInterface (Name {namespace = "Gdk", name = "Device"})
        Word32 ->                               -- time : TBasicType TUInt32
        Word32 ->                               -- keycode : TBasicType TUInt
        CUInt ->                                -- state : TInterface (Name {namespace = "Gdk", name = "ModifierType"})
        Int32 ->                                -- group : TBasicType TInt
        IO CInt

    -- | Allow an input method to forward key press and release events
    -- to another input method without necessarily having a @GdkEvent@
    -- available.
    iMContextFilterKey ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a, Gdk.Surface.IsSurface b, Gdk.Device.IsDevice c) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> Bool
        -- ^ /@press@/: whether to forward a key press or release event
        -> b
        -- ^ /@surface@/: the surface the event is for
        -> c
        -- ^ /@device@/: the device that the event is for
        -> Word32
        -- ^ /@time@/: the timestamp for the event
        -> Word32
        -- ^ /@keycode@/: the keycode for the event
        -> [Gdk.Flags.ModifierType]
        -- ^ /@state@/: modifier state for the event
        -> Int32
        -- ^ /@group@/: the active keyboard group for the event
        -> m Bool
        -- ^ __Returns:__ 'P.True' if the input method handled the key event.
    iMContextFilterKey :: forall (m :: * -> *) a b c.
    (HasCallStack, MonadIO m, IsIMContext a, IsSurface b,
     IsDevice c) =>
    a
    -> Bool
    -> b
    -> c
    -> Word32
    -> Word32
    -> [ModifierType]
    -> Int32
    -> m Bool
    iMContextFilterKey a
    context Bool
    press b
    surface c
    device Word32
    time Word32
    keycode [ModifierType]
    state Int32
    group = 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
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        let press' = (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
    press
        surface' <- unsafeManagedPtrCastPtr surface
        device' <- unsafeManagedPtrCastPtr device
        let state' = [ModifierType] -> CUInt
    forall b a. (Num b, IsGFlag a) => [a] -> b
    gflagsToWord [ModifierType]
    state
        result <- gtk_im_context_filter_key context' press' surface' device' time keycode state' group
        let result' = (CInt -> CInt -> Bool
    forall a. Eq a => a -> a -> Bool
    /= CInt
    0) CInt
    result
        touchManagedPtr context
        touchManagedPtr surface
        touchManagedPtr device
        return result'

    #if defined(ENABLE_OVERLOADING)
    data IMContextFilterKeyMethodInfo
    instance (signature ~ (Bool -> b -> c -> Word32 -> Word32 -> [Gdk.Flags.ModifierType] -> Int32 -> m Bool), MonadIO m, IsIMContext a, Gdk.Surface.IsSurface b, Gdk.Device.IsDevice c) => O.OverloadedMethod IMContextFilterKeyMethodInfo a signature where
        overloadedMethod = iMContextFilterKey

    instance O.OverloadedMethodInfo IMContextFilterKeyMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextFilterKey",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextFilterKey"
            })

    #endif

    -- method IMContext::filter_keypress
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "event"
    --           , argType = TInterface Name { namespace = "Gdk" , name = "Event" }
    --           , argCType = Just "GdkEvent*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "the key event" , 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 "gtk_im_context_filter_keypress" gtk_im_context_filter_keypress ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        Ptr Gdk.Event.Event ->                  -- event : TInterface (Name {namespace = "Gdk", name = "Event"})
        IO CInt

    -- | Allow an input method to internally handle key press and release
    -- events.
    --
    -- If this function returns 'P.True', then no further processing
    -- should be done for this key event.
    iMContextFilterKeypress ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a, Gdk.Event.IsEvent b) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> b
        -- ^ /@event@/: the key event
        -> m Bool
        -- ^ __Returns:__ 'P.True' if the input method handled the key event.
    iMContextFilterKeypress :: forall (m :: * -> *) a b.
    (HasCallStack, MonadIO m, IsIMContext a, IsEvent b) =>
    a -> b -> m Bool
    iMContextFilterKeypress a
    context b
    event = 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
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        event' <- unsafeManagedPtrCastPtr event
        result <- gtk_im_context_filter_keypress context' event'
        let result' = (CInt -> CInt -> Bool
    forall a. Eq a => a -> a -> Bool
    /= CInt
    0) CInt
    result
        touchManagedPtr context
        touchManagedPtr event
        return result'

    #if defined(ENABLE_OVERLOADING)
    data IMContextFilterKeypressMethodInfo
    instance (signature ~ (b -> m Bool), MonadIO m, IsIMContext a, Gdk.Event.IsEvent b) => O.OverloadedMethod IMContextFilterKeypressMethodInfo a signature where
        overloadedMethod = iMContextFilterKeypress

    instance O.OverloadedMethodInfo IMContextFilterKeypressMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextFilterKeypress",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextFilterKeypress"
            })

    #endif

    -- method IMContext::focus_in
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "gtk_im_context_focus_in" gtk_im_context_focus_in ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        IO ()

    -- | Notify the input method that the widget to which this
    -- input context corresponds has gained focus.
    --
    -- The input method may, for example, change the displayed
    -- feedback to reflect this change.
    iMContextFocusIn ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> m ()
    iMContextFocusIn :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsIMContext a) =>
    a -> m ()
    iMContextFocusIn a
    context = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        gtk_im_context_focus_in context'
        touchManagedPtr context
        return ()

    #if defined(ENABLE_OVERLOADING)
    data IMContextFocusInMethodInfo
    instance (signature ~ (m ()), MonadIO m, IsIMContext a) => O.OverloadedMethod IMContextFocusInMethodInfo a signature where
        overloadedMethod = iMContextFocusIn

    instance O.OverloadedMethodInfo IMContextFocusInMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextFocusIn",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextFocusIn"
            })

    #endif

    -- method IMContext::focus_out
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "gtk_im_context_focus_out" gtk_im_context_focus_out ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        IO ()

    -- | Notify the input method that the widget to which this
    -- input context corresponds has lost focus.
    --
    -- The input method may, for example, change the displayed
    -- feedback or reset the contexts state to reflect this change.
    iMContextFocusOut ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> m ()
    iMContextFocusOut :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsIMContext a) =>
    a -> m ()
    iMContextFocusOut a
    context = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        gtk_im_context_focus_out context'
        touchManagedPtr context
        return ()

    #if defined(ENABLE_OVERLOADING)
    data IMContextFocusOutMethodInfo
    instance (signature ~ (m ()), MonadIO m, IsIMContext a) => O.OverloadedMethod IMContextFocusOutMethodInfo a signature where
        overloadedMethod = iMContextFocusOut

    instance O.OverloadedMethodInfo IMContextFocusOutMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextFocusOut",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextFocusOut"
            })

    #endif

    -- method IMContext::get_preedit_string
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "str"
    --           , argType = TBasicType TUTF8
    --           , argCType = Just "char**"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "location to store the retrieved\n  string. The string retrieved must be freed with g_free()."
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferEverything
    --           }
    --       , Arg
    --           { argCName = "attrs"
    --           , argType =
    --               TInterface Name { namespace = "Pango" , name = "AttrList" }
    --           , argCType = Just "PangoAttrList**"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "location to store the retrieved\n  attribute list. When you are done with this list, you\n  must unreference it with [method@Pango.AttrList.unref]."
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferEverything
    --           }
    --       , Arg
    --           { argCName = "cursor_pos"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int*"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "location to store position of cursor\n  (in characters) within the preedit string."
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferEverything
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "gtk_im_context_get_preedit_string" gtk_im_context_get_preedit_string ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        Ptr CString ->                          -- str : TBasicType TUTF8
        Ptr (Ptr Pango.AttrList.AttrList) ->    -- attrs : TInterface (Name {namespace = "Pango", name = "AttrList"})
        Ptr Int32 ->                            -- cursor_pos : TBasicType TInt
        IO ()

    -- | Retrieve the current preedit string for the input context,
    -- and a list of attributes to apply to the string.
    --
    -- This string should be displayed inserted at the insertion point.
    iMContextGetPreeditString ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> m ((T.Text, Pango.AttrList.AttrList, Int32))
    iMContextGetPreeditString :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsIMContext a) =>
    a -> m (Text, AttrList, Int32)
    iMContextGetPreeditString a
    context = IO (Text, AttrList, Int32) -> m (Text, AttrList, Int32)
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Text, AttrList, Int32) -> m (Text, AttrList, Int32))
    -> IO (Text, AttrList, Int32) -> m (Text, AttrList, Int32)
    forall a b. (a -> b) -> a -> b
    $ do
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        str <- callocMem :: IO (Ptr CString)
        attrs <- callocMem :: IO (Ptr (Ptr Pango.AttrList.AttrList))
        cursorPos <- allocMem :: IO (Ptr Int32)
        gtk_im_context_get_preedit_string context' str attrs cursorPos
        str' <- peek str
        str'' <- cstringToText str'
        freeMem str'
        attrs' <- peek attrs
        attrs'' <- (wrapBoxed Pango.AttrList.AttrList) attrs'
        cursorPos' <- peek cursorPos
        touchManagedPtr context
        freeMem str
        freeMem attrs
        freeMem cursorPos
        return (str'', attrs'', cursorPos')

    #if defined(ENABLE_OVERLOADING)
    data IMContextGetPreeditStringMethodInfo
    instance (signature ~ (m ((T.Text, Pango.AttrList.AttrList, Int32))), MonadIO m, IsIMContext a) => O.OverloadedMethod IMContextGetPreeditStringMethodInfo a signature where
        overloadedMethod = iMContextGetPreeditString

    instance O.OverloadedMethodInfo IMContextGetPreeditStringMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextGetPreeditString",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextGetPreeditString"
            })

    #endif

    -- method IMContext::get_surrounding
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "text"
    --           , argType = TBasicType TUTF8
    --           , argCType = Just "char**"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "location to store a UTF-8 encoded\n  string of text holding context around the insertion point.\n  If the function returns %TRUE, then you must free the result\n  stored in this location with g_free()."
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferEverything
    --           }
    --       , Arg
    --           { argCName = "cursor_index"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int*"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "location to store byte index of the insertion\n  cursor within @text."
    --                 , 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 "gtk_im_context_get_surrounding" gtk_im_context_get_surrounding ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        Ptr CString ->                          -- text : TBasicType TUTF8
        Ptr Int32 ->                            -- cursor_index : TBasicType TInt
        IO CInt

    {-# DEPRECATED iMContextGetSurrounding ["(Since version 4.2)","Use 'GI.Gtk.Objects.IMContext.iMContextGetSurroundingWithSelection' instead."] #-}
    -- | Retrieves context around the insertion point.
    --
    -- Input methods typically want context in order to constrain input text
    -- based on existing text; this is important for languages such as Thai
    -- where only some sequences of characters are allowed.
    --
    -- This function is implemented by emitting the
    -- [IMContext::retrieveSurrounding]("GI.Gtk.Objects.IMContext#g:signal:retrieveSurrounding") signal on the input method;
    -- in response to this signal, a widget should provide as much context as
    -- is available, up to an entire paragraph, by calling
    -- 'GI.Gtk.Objects.IMContext.iMContextSetSurrounding'.
    --
    -- Note that there is no obligation for a widget to respond to the
    -- @::retrieve-surrounding@ signal, so input methods must be prepared to
    -- function without context.
    iMContextGetSurrounding ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> m ((Bool, T.Text, Int32))
        -- ^ __Returns:__ @TRUE@ if surrounding text was provided; in this case
        --    you must free the result stored in @text@.
    iMContextGetSurrounding :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsIMContext a) =>
    a -> m (Bool, Text, Int32)
    iMContextGetSurrounding a
    context = IO (Bool, Text, Int32) -> m (Bool, Text, Int32)
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Bool, Text, Int32) -> m (Bool, Text, Int32))
    -> IO (Bool, Text, Int32) -> m (Bool, Text, Int32)
    forall a b. (a -> b) -> a -> b
    $ do
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        text <- callocMem :: IO (Ptr CString)
        cursorIndex <- allocMem :: IO (Ptr Int32)
        result <- gtk_im_context_get_surrounding context' text cursorIndex
        let result' = (CInt -> CInt -> Bool
    forall a. Eq a => a -> a -> Bool
    /= CInt
    0) CInt
    result
        text' <- peek text
        text'' <- cstringToText text'
        freeMem text'
        cursorIndex' <- peek cursorIndex
        touchManagedPtr context
        freeMem text
        freeMem cursorIndex
        return (result', text'', cursorIndex')

    #if defined(ENABLE_OVERLOADING)
    data IMContextGetSurroundingMethodInfo
    instance (signature ~ (m ((Bool, T.Text, Int32))), MonadIO m, IsIMContext a) => O.OverloadedMethod IMContextGetSurroundingMethodInfo a signature where
        overloadedMethod = iMContextGetSurrounding

    instance O.OverloadedMethodInfo IMContextGetSurroundingMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextGetSurrounding",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextGetSurrounding"
            })

    #endif

    -- method IMContext::get_surrounding_with_selection
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "text"
    --           , argType = TBasicType TUTF8
    --           , argCType = Just "char**"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "location to store a UTF-8 encoded\n  string of text holding context around the insertion point.\n  If the function returns %TRUE, then you must free the result\n  stored in this location with g_free()."
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferEverything
    --           }
    --       , Arg
    --           { argCName = "cursor_index"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int*"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "location to store byte index of the insertion\n  cursor within @text."
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferEverything
    --           }
    --       , Arg
    --           { argCName = "anchor_index"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int*"
    --           , direction = DirectionOut
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "location to store byte index of the selection\n  bound within @text"
    --                 , 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 "gtk_im_context_get_surrounding_with_selection" gtk_im_context_get_surrounding_with_selection ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        Ptr CString ->                          -- text : TBasicType TUTF8
        Ptr Int32 ->                            -- cursor_index : TBasicType TInt
        Ptr Int32 ->                            -- anchor_index : TBasicType TInt
        IO CInt

    -- | Retrieves context around the insertion point.
    --
    -- Input methods typically want context in order to constrain input
    -- text based on existing text; this is important for languages such
    -- as Thai where only some sequences of characters are allowed.
    --
    -- This function is implemented by emitting the
    -- [IMContext::retrieveSurrounding]("GI.Gtk.Objects.IMContext#g:signal:retrieveSurrounding") signal on the input method;
    -- in response to this signal, a widget should provide as much context as
    -- is available, up to an entire paragraph, by calling
    -- 'GI.Gtk.Objects.IMContext.iMContextSetSurroundingWithSelection'.
    --
    -- Note that there is no obligation for a widget to respond to the
    -- @::retrieve-surrounding@ signal, so input methods must be prepared to
    -- function without context.
    --
    -- /Since: 4.2/
    iMContextGetSurroundingWithSelection ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> m ((Bool, T.Text, Int32, Int32))
        -- ^ __Returns:__ @TRUE@ if surrounding text was provided; in this case
        --   you must free the result stored in @text@.
    iMContextGetSurroundingWithSelection :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsIMContext a) =>
    a -> m (Bool, Text, Int32, Int32)
    iMContextGetSurroundingWithSelection a
    context = IO (Bool, Text, Int32, Int32) -> m (Bool, Text, Int32, Int32)
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Bool, Text, Int32, Int32) -> m (Bool, Text, Int32, Int32))
    -> IO (Bool, Text, Int32, Int32) -> m (Bool, Text, Int32, Int32)
    forall a b. (a -> b) -> a -> b
    $ do
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        text <- callocMem :: IO (Ptr CString)
        cursorIndex <- allocMem :: IO (Ptr Int32)
        anchorIndex <- allocMem :: IO (Ptr Int32)
        result <- gtk_im_context_get_surrounding_with_selection context' text cursorIndex anchorIndex
        let result' = (CInt -> CInt -> Bool
    forall a. Eq a => a -> a -> Bool
    /= CInt
    0) CInt
    result
        text' <- peek text
        text'' <- cstringToText text'
        freeMem text'
        cursorIndex' <- peek cursorIndex
        anchorIndex' <- peek anchorIndex
        touchManagedPtr context
        freeMem text
        freeMem cursorIndex
        freeMem anchorIndex
        return (result', text'', cursorIndex', anchorIndex')

    #if defined(ENABLE_OVERLOADING)
    data IMContextGetSurroundingWithSelectionMethodInfo
    instance (signature ~ (m ((Bool, T.Text, Int32, Int32))), MonadIO m, IsIMContext a) => O.OverloadedMethod IMContextGetSurroundingWithSelectionMethodInfo a signature where
        overloadedMethod = iMContextGetSurroundingWithSelection

    instance O.OverloadedMethodInfo IMContextGetSurroundingWithSelectionMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextGetSurroundingWithSelection",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextGetSurroundingWithSelection"
            })

    #endif

    -- method IMContext::reset
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "gtk_im_context_reset" gtk_im_context_reset ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        IO ()

    -- | Notify the input method that a change such as a change in cursor
    -- position has been made.
    --
    -- This will typically cause the input method to clear the preedit state.
    iMContextReset ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> m ()
    iMContextReset :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsIMContext a) =>
    a -> m ()
    iMContextReset a
    context = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        gtk_im_context_reset context'
        touchManagedPtr context
        return ()

    #if defined(ENABLE_OVERLOADING)
    data IMContextResetMethodInfo
    instance (signature ~ (m ()), MonadIO m, IsIMContext a) => O.OverloadedMethod IMContextResetMethodInfo a signature where
        overloadedMethod = iMContextReset

    instance O.OverloadedMethodInfo IMContextResetMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextReset",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextReset"
            })

    #endif

    -- method IMContext::set_client_widget
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "widget"
    --           , argType = TInterface Name { namespace = "Gtk" , name = "Widget" }
    --           , argCType = Just "GtkWidget*"
    --           , direction = DirectionIn
    --           , mayBeNull = True
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "the client widget. This may be %NULL to indicate\n  that the previous client widget no longer exists."
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "gtk_im_context_set_client_widget" gtk_im_context_set_client_widget ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        Ptr Gtk.Widget.Widget ->                -- widget : TInterface (Name {namespace = "Gtk", name = "Widget"})
        IO ()

    -- | Set the client widget for the input context.
    --
    -- This is the @GtkWidget@ holding the input focus. This widget is
    -- used in order to correctly position status windows, and may
    -- also be used for purposes internal to the input method.
    iMContextSetClientWidget ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a, Gtk.Widget.IsWidget b) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> Maybe (b)
        -- ^ /@widget@/: the client widget. This may be 'P.Nothing' to indicate
        --   that the previous client widget no longer exists.
        -> m ()
    iMContextSetClientWidget :: forall (m :: * -> *) a b.
    (HasCallStack, MonadIO m, IsIMContext a, IsWidget b) =>
    a -> Maybe b -> m ()
    iMContextSetClientWidget a
    context Maybe b
    widget = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        maybeWidget <- case widget of
            Maybe b
    Nothing -> Ptr Widget -> IO (Ptr Widget)
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return Ptr Widget
    forall a. Ptr a
    FP.nullPtr
            Just b
    jWidget -> do
                jWidget' <- b -> IO (Ptr Widget)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr b
    jWidget
                return jWidget'
        gtk_im_context_set_client_widget context' maybeWidget
        touchManagedPtr context
        whenJust widget touchManagedPtr
        return ()

    #if defined(ENABLE_OVERLOADING)
    data IMContextSetClientWidgetMethodInfo
    instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsIMContext a, Gtk.Widget.IsWidget b) => O.OverloadedMethod IMContextSetClientWidgetMethodInfo a signature where
        overloadedMethod = iMContextSetClientWidget

    instance O.OverloadedMethodInfo IMContextSetClientWidgetMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextSetClientWidget",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextSetClientWidget"
            })

    #endif

    -- method IMContext::set_cursor_location
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "area"
    --           , argType =
    --               TInterface Name { namespace = "Gdk" , name = "Rectangle" }
    --           , argCType = Just "const GdkRectangle*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "new location" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "gtk_im_context_set_cursor_location" gtk_im_context_set_cursor_location ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        Ptr Gdk.Rectangle.Rectangle ->          -- area : TInterface (Name {namespace = "Gdk", name = "Rectangle"})
        IO ()

    -- | Notify the input method that a change in cursor
    -- position has been made.
    --
    -- The location is relative to the client widget.
    iMContextSetCursorLocation ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> Gdk.Rectangle.Rectangle
        -- ^ /@area@/: new location
        -> m ()
    iMContextSetCursorLocation :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsIMContext a) =>
    a -> Rectangle -> m ()
    iMContextSetCursorLocation a
    context Rectangle
    area = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        area' <- unsafeManagedPtrGetPtr area
        gtk_im_context_set_cursor_location context' area'
        touchManagedPtr context
        touchManagedPtr area
        return ()

    #if defined(ENABLE_OVERLOADING)
    data IMContextSetCursorLocationMethodInfo
    instance (signature ~ (Gdk.Rectangle.Rectangle -> m ()), MonadIO m, IsIMContext a) => O.OverloadedMethod IMContextSetCursorLocationMethodInfo a signature where
        overloadedMethod = iMContextSetCursorLocation

    instance O.OverloadedMethodInfo IMContextSetCursorLocationMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextSetCursorLocation",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextSetCursorLocation"
            })

    #endif

    -- method IMContext::set_surrounding
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "text"
    --           , argType = TBasicType TUTF8
    --           , argCType = Just "const char*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "text surrounding the insertion point, as UTF-8.\n  the preedit string should not be included within @text"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "len"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just "the length of @text, or -1 if @text is nul-terminated"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "cursor_index"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just "the byte index of the insertion cursor within @text."
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "gtk_im_context_set_surrounding" gtk_im_context_set_surrounding ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        CString ->                              -- text : TBasicType TUTF8
        Int32 ->                                -- len : TBasicType TInt
        Int32 ->                                -- cursor_index : TBasicType TInt
        IO ()

    {-# DEPRECATED iMContextSetSurrounding ["(Since version 4.2)","Use 'GI.Gtk.Objects.IMContext.iMContextSetSurroundingWithSelection' instead"] #-}
    -- | Sets surrounding context around the insertion point and preedit
    -- string.
    --
    -- This function is expected to be called in response to the
    -- [IMContext::retrieveSurrounding]("GI.Gtk.Objects.IMContext#g:signal:retrieveSurrounding") signal, and will
    -- likely have no effect if called at other times.
    iMContextSetSurrounding ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> T.Text
        -- ^ /@text@/: text surrounding the insertion point, as UTF-8.
        --   the preedit string should not be included within /@text@/
        -> Int32
        -- ^ /@len@/: the length of /@text@/, or -1 if /@text@/ is nul-terminated
        -> Int32
        -- ^ /@cursorIndex@/: the byte index of the insertion cursor within /@text@/.
        -> m ()
    iMContextSetSurrounding :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsIMContext a) =>
    a -> Text -> Int32 -> Int32 -> m ()
    iMContextSetSurrounding a
    context Text
    text Int32
    len Int32
    cursorIndex = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        text' <- textToCString text
        gtk_im_context_set_surrounding context' text' len cursorIndex
        touchManagedPtr context
        freeMem text'
        return ()

    #if defined(ENABLE_OVERLOADING)
    data IMContextSetSurroundingMethodInfo
    instance (signature ~ (T.Text -> Int32 -> Int32 -> m ()), MonadIO m, IsIMContext a) => O.OverloadedMethod IMContextSetSurroundingMethodInfo a signature where
        overloadedMethod = iMContextSetSurrounding

    instance O.OverloadedMethodInfo IMContextSetSurroundingMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextSetSurrounding",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextSetSurrounding"
            })

    #endif

    -- method IMContext::set_surrounding_with_selection
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "text"
    --           , argType = TBasicType TUTF8
    --           , argCType = Just "const char*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just
    --                       "text surrounding the insertion point, as UTF-8.\n  the preedit string should not be included within @text"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "len"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just "the length of @text, or -1 if @text is nul-terminated"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "cursor_index"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just "the byte index of the insertion cursor within @text"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "anchor_index"
    --           , argType = TBasicType TInt
    --           , argCType = Just "int"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just "the byte index of the selection bound within @text"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "gtk_im_context_set_surrounding_with_selection" gtk_im_context_set_surrounding_with_selection ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        CString ->                              -- text : TBasicType TUTF8
        Int32 ->                                -- len : TBasicType TInt
        Int32 ->                                -- cursor_index : TBasicType TInt
        Int32 ->                                -- anchor_index : TBasicType TInt
        IO ()

    -- | Sets surrounding context around the insertion point and preedit
    -- string. This function is expected to be called in response to the
    -- [signal/@gtk@/.IMContext[retrieve_surrounding](#g:signal:retrieve_surrounding)] signal, and will likely
    -- have no effect if called at other times.
    --
    -- /Since: 4.2/
    iMContextSetSurroundingWithSelection ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> T.Text
        -- ^ /@text@/: text surrounding the insertion point, as UTF-8.
        --   the preedit string should not be included within /@text@/
        -> Int32
        -- ^ /@len@/: the length of /@text@/, or -1 if /@text@/ is nul-terminated
        -> Int32
        -- ^ /@cursorIndex@/: the byte index of the insertion cursor within /@text@/
        -> Int32
        -- ^ /@anchorIndex@/: the byte index of the selection bound within /@text@/
        -> m ()
    iMContextSetSurroundingWithSelection :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsIMContext a) =>
    a -> Text -> Int32 -> Int32 -> Int32 -> m ()
    iMContextSetSurroundingWithSelection a
    context Text
    text Int32
    len Int32
    cursorIndex Int32
    anchorIndex = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        text' <- textToCString text
        gtk_im_context_set_surrounding_with_selection context' text' len cursorIndex anchorIndex
        touchManagedPtr context
        freeMem text'
        return ()

    #if defined(ENABLE_OVERLOADING)
    data IMContextSetSurroundingWithSelectionMethodInfo
    instance (signature ~ (T.Text -> Int32 -> Int32 -> Int32 -> m ()), MonadIO m, IsIMContext a) => O.OverloadedMethod IMContextSetSurroundingWithSelectionMethodInfo a signature where
        overloadedMethod = iMContextSetSurroundingWithSelection

    instance O.OverloadedMethodInfo IMContextSetSurroundingWithSelectionMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextSetSurroundingWithSelection",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextSetSurroundingWithSelection"
            })

    #endif

    -- method IMContext::set_use_preedit
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "context"
    --           , argType =
    --               TInterface Name { namespace = "Gtk" , name = "IMContext" }
    --           , argCType = Just "GtkIMContext*"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a `GtkIMContext`" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "use_preedit"
    --           , argType = TBasicType TBoolean
    --           , argCType = Just "gboolean"
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just "whether the IM context should use the preedit string."
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "gtk_im_context_set_use_preedit" gtk_im_context_set_use_preedit ::
        Ptr IMContext ->                        -- context : TInterface (Name {namespace = "Gtk", name = "IMContext"})
        CInt ->                                 -- use_preedit : TBasicType TBoolean
        IO ()

    -- | Sets whether the IM context should use the preedit string
    -- to display feedback.
    --
    -- If /@usePreedit@/ is 'P.False' (default is 'P.True'), then the IM context
    -- may use some other method to display feedback, such as displaying
    -- it in a child of the root window.
    iMContextSetUsePreedit ::
        (B.CallStack.HasCallStack, MonadIO m, IsIMContext a) =>
        a
        -- ^ /@context@/: a @GtkIMContext@
        -> Bool
        -- ^ /@usePreedit@/: whether the IM context should use the preedit string.
        -> m ()
    iMContextSetUsePreedit :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsIMContext a) =>
    a -> Bool -> m ()
    iMContextSetUsePreedit a
    context Bool
    usePreedit = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        context' <- a -> IO (Ptr IMContext)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    context
        let usePreedit' = (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
    usePreedit
        gtk_im_context_set_use_preedit context' usePreedit'
        touchManagedPtr context
        return ()

    #if defined(ENABLE_OVERLOADING)
    data IMContextSetUsePreeditMethodInfo
    instance (signature ~ (Bool -> m ()), MonadIO m, IsIMContext a) => O.OverloadedMethod IMContextSetUsePreeditMethodInfo a signature where
        overloadedMethod = iMContextSetUsePreedit

    instance O.OverloadedMethodInfo IMContextSetUsePreeditMethodInfo a where
        overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gtk.Objects.IMContext.iMContextSetUsePreedit",
            O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-IMContext.html#v:iMContextSetUsePreedit"
            })

    #endif