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

module GI.Gdk.Functions
    ( 

 -- * Methods
-- ** addOptionEntriesLibgtkOnly
    addOptionEntriesLibgtkOnly              ,


-- ** atomIntern
    atomIntern                              ,


-- ** atomInternStaticString
    atomInternStaticString                  ,


-- ** beep
    beep                                    ,


-- ** cairoCreate
    cairoCreate                             ,


-- ** cairoDrawFromGl
    cairoDrawFromGl                         ,


-- ** cairoGetClipRectangle
    cairoGetClipRectangle                   ,


-- ** cairoRectangle
    cairoRectangle                          ,


-- ** cairoRegion
    cairoRegion                             ,


-- ** cairoRegionCreateFromSurface
    cairoRegionCreateFromSurface            ,


-- ** cairoSetSourceColor
    cairoSetSourceColor                     ,


-- ** cairoSetSourcePixbuf
    cairoSetSourcePixbuf                    ,


-- ** cairoSetSourceRgba
    cairoSetSourceRgba                      ,


-- ** cairoSetSourceWindow
    cairoSetSourceWindow                    ,


-- ** cairoSurfaceCreateFromPixbuf
    cairoSurfaceCreateFromPixbuf            ,


-- ** colorParse
    colorParse                              ,


-- ** disableMultidevice
    disableMultidevice                      ,


-- ** dragAbort
    dragAbort                               ,


-- ** dragBegin
    dragBegin                               ,


-- ** dragBeginForDevice
    dragBeginForDevice                      ,


-- ** dragDrop
    dragDrop                                ,


-- ** dragDropSucceeded
    dragDropSucceeded                       ,


-- ** dragFindWindowForScreen
    dragFindWindowForScreen                 ,


-- ** dragGetSelection
    dragGetSelection                        ,


-- ** dragMotion
    dragMotion                              ,


-- ** dragStatus
    dragStatus                              ,


-- ** dropFinish
    dropFinish                              ,


-- ** dropReply
    dropReply                               ,


-- ** errorTrapPop
    errorTrapPop                            ,


-- ** errorTrapPopIgnored
    errorTrapPopIgnored                     ,


-- ** errorTrapPush
    errorTrapPush                           ,


-- ** eventGet
    eventGet                                ,


-- ** eventHandlerSet
    eventHandlerSet                         ,


-- ** eventPeek
    eventPeek                               ,


-- ** eventRequestMotions
    eventRequestMotions                     ,


-- ** eventsGetAngle
    eventsGetAngle                          ,


-- ** eventsGetCenter
    eventsGetCenter                         ,


-- ** eventsGetDistance
    eventsGetDistance                       ,


-- ** eventsPending
    eventsPending                           ,


-- ** flush
    flush                                   ,


-- ** getDefaultRootWindow
    getDefaultRootWindow                    ,


-- ** getDisplay
    getDisplay                              ,


-- ** getDisplayArgName
    getDisplayArgName                       ,


-- ** getProgramClass
    getProgramClass                         ,


-- ** getShowEvents
    getShowEvents                           ,


-- ** glErrorQuark
    glErrorQuark                            ,


-- ** init
    init                                    ,


-- ** initCheck
    initCheck                               ,


-- ** keyboardGrab
    keyboardGrab                            ,


-- ** keyboardUngrab
    keyboardUngrab                          ,


-- ** keyvalConvertCase
    keyvalConvertCase                       ,


-- ** keyvalFromName
    keyvalFromName                          ,


-- ** keyvalIsLower
    keyvalIsLower                           ,


-- ** keyvalIsUpper
    keyvalIsUpper                           ,


-- ** keyvalName
    keyvalName                              ,


-- ** keyvalToLower
    keyvalToLower                           ,


-- ** keyvalToUnicode
    keyvalToUnicode                         ,


-- ** keyvalToUpper
    keyvalToUpper                           ,


-- ** listVisuals
    listVisuals                             ,


-- ** notifyStartupComplete
    notifyStartupComplete                   ,


-- ** notifyStartupCompleteWithId
    notifyStartupCompleteWithId             ,


-- ** offscreenWindowGetEmbedder
    offscreenWindowGetEmbedder              ,


-- ** offscreenWindowGetSurface
    offscreenWindowGetSurface               ,


-- ** offscreenWindowSetEmbedder
    offscreenWindowSetEmbedder              ,


-- ** pangoContextGet
    pangoContextGet                         ,


-- ** pangoContextGetForScreen
    pangoContextGetForScreen                ,


-- ** parseArgs
    parseArgs                               ,


-- ** pixbufGetFromSurface
    pixbufGetFromSurface                    ,


-- ** pixbufGetFromWindow
    pixbufGetFromWindow                     ,


-- ** pointerGrab
    pointerGrab                             ,


-- ** pointerIsGrabbed
    pointerIsGrabbed                        ,


-- ** pointerUngrab
    pointerUngrab                           ,


-- ** preParseLibgtkOnly
    preParseLibgtkOnly                      ,


-- ** propertyDelete
    propertyDelete                          ,


-- ** propertyGet
    propertyGet                             ,


-- ** queryDepths
    queryDepths                             ,


-- ** queryVisualTypes
    queryVisualTypes                        ,


-- ** selectionConvert
    selectionConvert                        ,


-- ** selectionOwnerGet
    selectionOwnerGet                       ,


-- ** selectionOwnerGetForDisplay
    selectionOwnerGetForDisplay             ,


-- ** selectionOwnerSet
    selectionOwnerSet                       ,


-- ** selectionOwnerSetForDisplay
    selectionOwnerSetForDisplay             ,


-- ** selectionSendNotify
    selectionSendNotify                     ,


-- ** selectionSendNotifyForDisplay
    selectionSendNotifyForDisplay           ,


-- ** setAllowedBackends
    setAllowedBackends                      ,


-- ** setDoubleClickTime
    setDoubleClickTime                      ,


-- ** setProgramClass
    setProgramClass                         ,


-- ** setShowEvents
    setShowEvents                           ,


-- ** settingGet
    settingGet                              ,


-- ** synthesizeWindowState
    synthesizeWindowState                   ,


-- ** testRenderSync
    testRenderSync                          ,


-- ** testSimulateButton
    testSimulateButton                      ,


-- ** testSimulateKey
    testSimulateKey                         ,


-- ** textPropertyToUtf8ListForDisplay
    textPropertyToUtf8ListForDisplay        ,


-- ** threadsAddIdle
    threadsAddIdle                          ,


-- ** threadsAddTimeout
    threadsAddTimeout                       ,


-- ** threadsAddTimeoutSeconds
    threadsAddTimeoutSeconds                ,


-- ** threadsEnter
    threadsEnter                            ,


-- ** threadsInit
    threadsInit                             ,


-- ** threadsLeave
    threadsLeave                            ,


-- ** unicodeToKeyval
    unicodeToKeyval                         ,


-- ** utf8ToStringTarget
    utf8ToStringTarget                      ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gdk.Types
import GI.Gdk.Callbacks
import qualified GI.GLib as GLib
import qualified GI.GdkPixbuf as GdkPixbuf
import qualified GI.Pango as Pango
import qualified GI.Cairo as Cairo

-- function gdk_utf8_to_string_target
-- Args : [Arg {argName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "gdk_utf8_to_string_target" gdk_utf8_to_string_target :: 
    CString ->                              -- str : TBasicType TUTF8
    IO CString


utf8ToStringTarget ::
    (MonadIO m) =>
    T.Text ->                               -- str
    m T.Text
utf8ToStringTarget str = liftIO $ do
    str' <- textToCString str
    result <- gdk_utf8_to_string_target str'
    checkUnexpectedReturnNULL "gdk_utf8_to_string_target" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    return result'


-- function gdk_unicode_to_keyval
-- Args : [Arg {argName = "wc", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "wc", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_unicode_to_keyval" gdk_unicode_to_keyval :: 
    Word32 ->                               -- wc : TBasicType TUInt32
    IO Word32


unicodeToKeyval ::
    (MonadIO m) =>
    Word32 ->                               -- wc
    m Word32
unicodeToKeyval wc = liftIO $ do
    result <- gdk_unicode_to_keyval wc
    return result


-- function gdk_threads_leave
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_threads_leave" gdk_threads_leave :: 
    IO ()

{-# DEPRECATED threadsLeave ["(Since version 3.6)","All GDK and GTK+ calls should be made from the main","    thread"]#-}
threadsLeave ::
    (MonadIO m) =>
    m ()
threadsLeave  = liftIO $ do
    gdk_threads_leave
    return ()


-- function gdk_threads_init
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_threads_init" gdk_threads_init :: 
    IO ()

{-# DEPRECATED threadsInit ["(Since version 3.6)","All GDK and GTK+ calls should be made from the main","    thread"]#-}
threadsInit ::
    (MonadIO m) =>
    m ()
threadsInit  = liftIO $ do
    gdk_threads_init
    return ()


-- function gdk_threads_enter
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_threads_enter" gdk_threads_enter :: 
    IO ()

{-# DEPRECATED threadsEnter ["(Since version 3.6)","All GDK and GTK+ calls should be made from the main","    thread"]#-}
threadsEnter ::
    (MonadIO m) =>
    m ()
threadsEnter  = liftIO $ do
    gdk_threads_enter
    return ()


-- function gdk_threads_add_timeout_seconds_full
-- Args : [Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "function", argType = TInterface "GLib" "SourceFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "notify", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "function", argType = TInterface "GLib" "SourceFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_threads_add_timeout_seconds_full" gdk_threads_add_timeout_seconds_full :: 
    Int32 ->                                -- priority : TBasicType TInt32
    Word32 ->                               -- interval : TBasicType TUInt32
    FunPtr GLib.SourceFuncC ->              -- function : TInterface "GLib" "SourceFunc"
    Ptr () ->                               -- data : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- notify : TInterface "GLib" "DestroyNotify"
    IO Word32


threadsAddTimeoutSeconds ::
    (MonadIO m) =>
    Int32 ->                                -- priority
    Word32 ->                               -- interval
    GLib.SourceFunc ->                      -- function
    m Word32
threadsAddTimeoutSeconds priority interval function = liftIO $ do
    function' <- GLib.mkSourceFunc (GLib.sourceFuncWrapper Nothing function)
    let data_ = castFunPtrToPtr function'
    let notify = safeFreeFunPtrPtr
    result <- gdk_threads_add_timeout_seconds_full priority interval function' data_ notify
    return result


-- function gdk_threads_add_timeout_full
-- Args : [Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "function", argType = TInterface "GLib" "SourceFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "notify", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "interval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "function", argType = TInterface "GLib" "SourceFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_threads_add_timeout_full" gdk_threads_add_timeout_full :: 
    Int32 ->                                -- priority : TBasicType TInt32
    Word32 ->                               -- interval : TBasicType TUInt32
    FunPtr GLib.SourceFuncC ->              -- function : TInterface "GLib" "SourceFunc"
    Ptr () ->                               -- data : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- notify : TInterface "GLib" "DestroyNotify"
    IO Word32


threadsAddTimeout ::
    (MonadIO m) =>
    Int32 ->                                -- priority
    Word32 ->                               -- interval
    GLib.SourceFunc ->                      -- function
    m Word32
threadsAddTimeout priority interval function = liftIO $ do
    function' <- GLib.mkSourceFunc (GLib.sourceFuncWrapper Nothing function)
    let data_ = castFunPtrToPtr function'
    let notify = safeFreeFunPtrPtr
    result <- gdk_threads_add_timeout_full priority interval function' data_ notify
    return result


-- function gdk_threads_add_idle_full
-- Args : [Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "function", argType = TInterface "GLib" "SourceFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "notify", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "priority", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "function", argType = TInterface "GLib" "SourceFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_threads_add_idle_full" gdk_threads_add_idle_full :: 
    Int32 ->                                -- priority : TBasicType TInt32
    FunPtr GLib.SourceFuncC ->              -- function : TInterface "GLib" "SourceFunc"
    Ptr () ->                               -- data : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- notify : TInterface "GLib" "DestroyNotify"
    IO Word32


threadsAddIdle ::
    (MonadIO m) =>
    Int32 ->                                -- priority
    GLib.SourceFunc ->                      -- function
    m Word32
threadsAddIdle priority function = liftIO $ do
    function' <- GLib.mkSourceFunc (GLib.sourceFuncWrapper Nothing function)
    let data_ = castFunPtrToPtr function'
    let notify = safeFreeFunPtrPtr
    result <- gdk_threads_add_idle_full priority function' data_ notify
    return result


-- function gdk_text_property_to_utf8_list_for_display
-- Args : [Arg {argName = "display", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "encoding", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "format", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TCArray False (-1) 4 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "list", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "length", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "display", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "encoding", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "format", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TCArray False (-1) 4 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_text_property_to_utf8_list_for_display" gdk_text_property_to_utf8_list_for_display :: 
    Ptr Display ->                          -- display : TInterface "Gdk" "Display"
    Ptr Atom ->                             -- encoding : TInterface "Gdk" "Atom"
    Int32 ->                                -- format : TBasicType TInt32
    Ptr Word8 ->                            -- text : TCArray False (-1) 4 (TBasicType TUInt8)
    Int32 ->                                -- length : TBasicType TInt32
    Ptr (Ptr CString) ->                    -- list : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO Int32


textPropertyToUtf8ListForDisplay ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- display
    Atom ->                                 -- encoding
    Int32 ->                                -- format
    ByteString ->                           -- text
    m (Int32,[T.Text])
textPropertyToUtf8ListForDisplay display encoding format text = liftIO $ do
    let length_ = fromIntegral $ B.length text
    let display' = unsafeManagedPtrCastPtr display
    let encoding' = unsafeManagedPtrGetPtr encoding
    text' <- packByteString text
    list <- allocMem :: IO (Ptr (Ptr CString))
    result <- gdk_text_property_to_utf8_list_for_display display' encoding' format text' length_ list
    list' <- peek list
    list'' <- unpackZeroTerminatedUTF8CArray list'
    mapZeroTerminatedCArray freeMem list'
    freeMem list'
    touchManagedPtr display
    touchManagedPtr encoding
    freeMem text'
    freeMem list
    return (result, list'')


-- function gdk_test_simulate_key
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "modifiers", argType = TInterface "Gdk" "ModifierType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key_pressrelease", argType = TInterface "Gdk" "EventType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "modifiers", argType = TInterface "Gdk" "ModifierType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "key_pressrelease", argType = TInterface "Gdk" "EventType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_test_simulate_key" gdk_test_simulate_key :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    Int32 ->                                -- x : TBasicType TInt32
    Int32 ->                                -- y : TBasicType TInt32
    Word32 ->                               -- keyval : TBasicType TUInt32
    CUInt ->                                -- modifiers : TInterface "Gdk" "ModifierType"
    CUInt ->                                -- key_pressrelease : TInterface "Gdk" "EventType"
    IO CInt


testSimulateKey ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    Int32 ->                                -- x
    Int32 ->                                -- y
    Word32 ->                               -- keyval
    [ModifierType] ->                       -- modifiers
    EventType ->                            -- key_pressrelease
    m Bool
testSimulateKey window x y keyval modifiers key_pressrelease = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    let modifiers' = gflagsToWord modifiers
    let key_pressrelease' = (fromIntegral . fromEnum) key_pressrelease
    result <- gdk_test_simulate_key window' x y keyval modifiers' key_pressrelease'
    let result' = (/= 0) result
    touchManagedPtr window
    return result'


-- function gdk_test_simulate_button
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "button", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "modifiers", argType = TInterface "Gdk" "ModifierType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "button_pressrelease", argType = TInterface "Gdk" "EventType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "button", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "modifiers", argType = TInterface "Gdk" "ModifierType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "button_pressrelease", argType = TInterface "Gdk" "EventType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_test_simulate_button" gdk_test_simulate_button :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    Int32 ->                                -- x : TBasicType TInt32
    Int32 ->                                -- y : TBasicType TInt32
    Word32 ->                               -- button : TBasicType TUInt32
    CUInt ->                                -- modifiers : TInterface "Gdk" "ModifierType"
    CUInt ->                                -- button_pressrelease : TInterface "Gdk" "EventType"
    IO CInt


testSimulateButton ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    Int32 ->                                -- x
    Int32 ->                                -- y
    Word32 ->                               -- button
    [ModifierType] ->                       -- modifiers
    EventType ->                            -- button_pressrelease
    m Bool
testSimulateButton window x y button modifiers button_pressrelease = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    let modifiers' = gflagsToWord modifiers
    let button_pressrelease' = (fromIntegral . fromEnum) button_pressrelease
    result <- gdk_test_simulate_button window' x y button modifiers' button_pressrelease'
    let result' = (/= 0) result
    touchManagedPtr window
    return result'


-- function gdk_test_render_sync
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_test_render_sync" gdk_test_render_sync :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    IO ()


testRenderSync ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    m ()
testRenderSync window = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    gdk_test_render_sync window'
    touchManagedPtr window
    return ()


-- function gdk_synthesize_window_state
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "unset_flags", argType = TInterface "Gdk" "WindowState", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "set_flags", argType = TInterface "Gdk" "WindowState", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "unset_flags", argType = TInterface "Gdk" "WindowState", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "set_flags", argType = TInterface "Gdk" "WindowState", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_synthesize_window_state" gdk_synthesize_window_state :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    CUInt ->                                -- unset_flags : TInterface "Gdk" "WindowState"
    CUInt ->                                -- set_flags : TInterface "Gdk" "WindowState"
    IO ()


synthesizeWindowState ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    [WindowState] ->                        -- unset_flags
    [WindowState] ->                        -- set_flags
    m ()
synthesizeWindowState window unset_flags set_flags_ = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    let unset_flags' = gflagsToWord unset_flags
    let set_flags_' = gflagsToWord set_flags_
    gdk_synthesize_window_state window' unset_flags' set_flags_'
    touchManagedPtr window
    return ()


-- function gdk_setting_get
-- Args : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_setting_get" gdk_setting_get :: 
    CString ->                              -- name : TBasicType TUTF8
    Ptr GValue ->                           -- value : TInterface "GObject" "Value"
    IO CInt


settingGet ::
    (MonadIO m) =>
    T.Text ->                               -- name
    GValue ->                               -- value
    m Bool
settingGet name value = liftIO $ do
    name' <- textToCString name
    let value' = unsafeManagedPtrGetPtr value
    result <- gdk_setting_get name' value'
    let result' = (/= 0) result
    touchManagedPtr value
    freeMem name'
    return result'


-- function gdk_set_show_events
-- Args : [Arg {argName = "show_events", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "show_events", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_set_show_events" gdk_set_show_events :: 
    CInt ->                                 -- show_events : TBasicType TBoolean
    IO ()


setShowEvents ::
    (MonadIO m) =>
    Bool ->                                 -- show_events
    m ()
setShowEvents show_events = liftIO $ do
    let show_events' = (fromIntegral . fromEnum) show_events
    gdk_set_show_events show_events'
    return ()


-- function gdk_set_program_class
-- Args : [Arg {argName = "program_class", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "program_class", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_set_program_class" gdk_set_program_class :: 
    CString ->                              -- program_class : TBasicType TUTF8
    IO ()


setProgramClass ::
    (MonadIO m) =>
    T.Text ->                               -- program_class
    m ()
setProgramClass program_class = liftIO $ do
    program_class' <- textToCString program_class
    gdk_set_program_class program_class'
    freeMem program_class'
    return ()


-- function gdk_set_double_click_time
-- Args : [Arg {argName = "msec", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "msec", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_set_double_click_time" gdk_set_double_click_time :: 
    Word32 ->                               -- msec : TBasicType TUInt32
    IO ()


setDoubleClickTime ::
    (MonadIO m) =>
    Word32 ->                               -- msec
    m ()
setDoubleClickTime msec = liftIO $ do
    gdk_set_double_click_time msec
    return ()


-- function gdk_set_allowed_backends
-- Args : [Arg {argName = "backends", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "backends", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_set_allowed_backends" gdk_set_allowed_backends :: 
    CString ->                              -- backends : TBasicType TUTF8
    IO ()


setAllowedBackends ::
    (MonadIO m) =>
    T.Text ->                               -- backends
    m ()
setAllowedBackends backends = liftIO $ do
    backends' <- textToCString backends
    gdk_set_allowed_backends backends'
    freeMem backends'
    return ()


-- function gdk_selection_send_notify_for_display
-- Args : [Arg {argName = "display", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "requestor", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "display", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "requestor", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_selection_send_notify_for_display" gdk_selection_send_notify_for_display :: 
    Ptr Display ->                          -- display : TInterface "Gdk" "Display"
    Ptr Window ->                           -- requestor : TInterface "Gdk" "Window"
    Ptr Atom ->                             -- selection : TInterface "Gdk" "Atom"
    Ptr Atom ->                             -- target : TInterface "Gdk" "Atom"
    Ptr Atom ->                             -- property : TInterface "Gdk" "Atom"
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()


selectionSendNotifyForDisplay ::
    (MonadIO m, DisplayK a, WindowK b) =>
    a ->                                    -- display
    b ->                                    -- requestor
    Atom ->                                 -- selection
    Atom ->                                 -- target
    Atom ->                                 -- property
    Word32 ->                               -- time_
    m ()
selectionSendNotifyForDisplay display requestor selection target property time_ = liftIO $ do
    let display' = unsafeManagedPtrCastPtr display
    let requestor' = unsafeManagedPtrCastPtr requestor
    let selection' = unsafeManagedPtrGetPtr selection
    let target' = unsafeManagedPtrGetPtr target
    let property' = unsafeManagedPtrGetPtr property
    gdk_selection_send_notify_for_display display' requestor' selection' target' property' time_
    touchManagedPtr display
    touchManagedPtr requestor
    touchManagedPtr selection
    touchManagedPtr target
    touchManagedPtr property
    return ()


-- function gdk_selection_send_notify
-- Args : [Arg {argName = "requestor", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "requestor", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_selection_send_notify" gdk_selection_send_notify :: 
    Ptr Window ->                           -- requestor : TInterface "Gdk" "Window"
    Ptr Atom ->                             -- selection : TInterface "Gdk" "Atom"
    Ptr Atom ->                             -- target : TInterface "Gdk" "Atom"
    Ptr Atom ->                             -- property : TInterface "Gdk" "Atom"
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()


selectionSendNotify ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- requestor
    Atom ->                                 -- selection
    Atom ->                                 -- target
    Atom ->                                 -- property
    Word32 ->                               -- time_
    m ()
selectionSendNotify requestor selection target property time_ = liftIO $ do
    let requestor' = unsafeManagedPtrCastPtr requestor
    let selection' = unsafeManagedPtrGetPtr selection
    let target' = unsafeManagedPtrGetPtr target
    let property' = unsafeManagedPtrGetPtr property
    gdk_selection_send_notify requestor' selection' target' property' time_
    touchManagedPtr requestor
    touchManagedPtr selection
    touchManagedPtr target
    touchManagedPtr property
    return ()


-- function gdk_selection_owner_set_for_display
-- Args : [Arg {argName = "display", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "owner", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "send_event", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "display", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "owner", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "send_event", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_selection_owner_set_for_display" gdk_selection_owner_set_for_display :: 
    Ptr Display ->                          -- display : TInterface "Gdk" "Display"
    Ptr Window ->                           -- owner : TInterface "Gdk" "Window"
    Ptr Atom ->                             -- selection : TInterface "Gdk" "Atom"
    Word32 ->                               -- time_ : TBasicType TUInt32
    CInt ->                                 -- send_event : TBasicType TBoolean
    IO CInt


selectionOwnerSetForDisplay ::
    (MonadIO m, DisplayK a, WindowK b) =>
    a ->                                    -- display
    Maybe (b) ->                            -- owner
    Atom ->                                 -- selection
    Word32 ->                               -- time_
    Bool ->                                 -- send_event
    m Bool
selectionOwnerSetForDisplay display owner selection time_ send_event = liftIO $ do
    let display' = unsafeManagedPtrCastPtr display
    maybeOwner <- case owner of
        Nothing -> return nullPtr
        Just jOwner -> do
            let jOwner' = unsafeManagedPtrCastPtr jOwner
            return jOwner'
    let selection' = unsafeManagedPtrGetPtr selection
    let send_event' = (fromIntegral . fromEnum) send_event
    result <- gdk_selection_owner_set_for_display display' maybeOwner selection' time_ send_event'
    let result' = (/= 0) result
    touchManagedPtr display
    whenJust owner touchManagedPtr
    touchManagedPtr selection
    return result'


-- function gdk_selection_owner_set
-- Args : [Arg {argName = "owner", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "send_event", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "owner", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "send_event", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_selection_owner_set" gdk_selection_owner_set :: 
    Ptr Window ->                           -- owner : TInterface "Gdk" "Window"
    Ptr Atom ->                             -- selection : TInterface "Gdk" "Atom"
    Word32 ->                               -- time_ : TBasicType TUInt32
    CInt ->                                 -- send_event : TBasicType TBoolean
    IO CInt


selectionOwnerSet ::
    (MonadIO m, WindowK a) =>
    Maybe (a) ->                            -- owner
    Atom ->                                 -- selection
    Word32 ->                               -- time_
    Bool ->                                 -- send_event
    m Bool
selectionOwnerSet owner selection time_ send_event = liftIO $ do
    maybeOwner <- case owner of
        Nothing -> return nullPtr
        Just jOwner -> do
            let jOwner' = unsafeManagedPtrCastPtr jOwner
            return jOwner'
    let selection' = unsafeManagedPtrGetPtr selection
    let send_event' = (fromIntegral . fromEnum) send_event
    result <- gdk_selection_owner_set maybeOwner selection' time_ send_event'
    let result' = (/= 0) result
    whenJust owner touchManagedPtr
    touchManagedPtr selection
    return result'


-- function gdk_selection_owner_get_for_display
-- Args : [Arg {argName = "display", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "display", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Window"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_selection_owner_get_for_display" gdk_selection_owner_get_for_display :: 
    Ptr Display ->                          -- display : TInterface "Gdk" "Display"
    Ptr Atom ->                             -- selection : TInterface "Gdk" "Atom"
    IO (Ptr Window)


selectionOwnerGetForDisplay ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- display
    Atom ->                                 -- selection
    m Window
selectionOwnerGetForDisplay display selection = liftIO $ do
    let display' = unsafeManagedPtrCastPtr display
    let selection' = unsafeManagedPtrGetPtr selection
    result <- gdk_selection_owner_get_for_display display' selection'
    checkUnexpectedReturnNULL "gdk_selection_owner_get_for_display" result
    result' <- (newObject Window) result
    touchManagedPtr display
    touchManagedPtr selection
    return result'


-- function gdk_selection_owner_get
-- Args : [Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Window"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_selection_owner_get" gdk_selection_owner_get :: 
    Ptr Atom ->                             -- selection : TInterface "Gdk" "Atom"
    IO (Ptr Window)


selectionOwnerGet ::
    (MonadIO m) =>
    Atom ->                                 -- selection
    m Window
selectionOwnerGet selection = liftIO $ do
    let selection' = unsafeManagedPtrGetPtr selection
    result <- gdk_selection_owner_get selection'
    checkUnexpectedReturnNULL "gdk_selection_owner_get" result
    result' <- (newObject Window) result
    touchManagedPtr selection
    return result'


-- function gdk_selection_convert
-- Args : [Arg {argName = "requestor", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "requestor", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_selection_convert" gdk_selection_convert :: 
    Ptr Window ->                           -- requestor : TInterface "Gdk" "Window"
    Ptr Atom ->                             -- selection : TInterface "Gdk" "Atom"
    Ptr Atom ->                             -- target : TInterface "Gdk" "Atom"
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()


selectionConvert ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- requestor
    Atom ->                                 -- selection
    Atom ->                                 -- target
    Word32 ->                               -- time_
    m ()
selectionConvert requestor selection target time_ = liftIO $ do
    let requestor' = unsafeManagedPtrCastPtr requestor
    let selection' = unsafeManagedPtrGetPtr selection
    let target' = unsafeManagedPtrGetPtr target
    gdk_selection_convert requestor' selection' target' time_
    touchManagedPtr requestor
    touchManagedPtr selection
    touchManagedPtr target
    return ()


-- function gdk_query_visual_types
-- Args : [Arg {argName = "visual_types", argType = TCArray False (-1) 1 (TInterface "Gdk" "VisualType"), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "count", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "count", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_query_visual_types" gdk_query_visual_types :: 
    Ptr (Ptr CUInt) ->                      -- visual_types : TCArray False (-1) 1 (TInterface "Gdk" "VisualType")
    Ptr Int32 ->                            -- count : TBasicType TInt32
    IO ()


queryVisualTypes ::
    (MonadIO m) =>
    m ([VisualType])
queryVisualTypes  = liftIO $ do
    visual_types <- allocMem :: IO (Ptr (Ptr CUInt))
    count <- allocMem :: IO (Ptr Int32)
    gdk_query_visual_types visual_types count
    count' <- peek count
    visual_types' <- peek visual_types
    visual_types'' <- (unpackStorableArrayWithLength count') visual_types'
    let visual_types''' = map (toEnum . fromIntegral) visual_types''
    freeMem visual_types
    freeMem count
    return visual_types'''


-- function gdk_query_depths
-- Args : [Arg {argName = "depths", argType = TCArray False (-1) 1 (TBasicType TInt32), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "count", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "count", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_query_depths" gdk_query_depths :: 
    Ptr (Ptr Int32) ->                      -- depths : TCArray False (-1) 1 (TBasicType TInt32)
    Ptr Int32 ->                            -- count : TBasicType TInt32
    IO ()


queryDepths ::
    (MonadIO m) =>
    m ([Int32])
queryDepths  = liftIO $ do
    depths <- allocMem :: IO (Ptr (Ptr Int32))
    count <- allocMem :: IO (Ptr Int32)
    gdk_query_depths depths count
    count' <- peek count
    depths' <- peek depths
    depths'' <- (unpackStorableArrayWithLength count') depths'
    freeMem depths
    freeMem count
    return depths''


-- function gdk_property_get
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pdelete", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "actual_property_type", argType = TInterface "Gdk" "Atom", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "actual_format", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "actual_length", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "data", argType = TCArray False (-1) 8 (TBasicType TUInt8), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "actual_length", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pdelete", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_property_get" gdk_property_get :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    Ptr Atom ->                             -- property : TInterface "Gdk" "Atom"
    Ptr Atom ->                             -- type : TInterface "Gdk" "Atom"
    Word64 ->                               -- offset : TBasicType TUInt64
    Word64 ->                               -- length : TBasicType TUInt64
    Int32 ->                                -- pdelete : TBasicType TInt32
    Ptr (Ptr Atom) ->                       -- actual_property_type : TInterface "Gdk" "Atom"
    Ptr Int32 ->                            -- actual_format : TBasicType TInt32
    Ptr Int32 ->                            -- actual_length : TBasicType TInt32
    Ptr (Ptr Word8) ->                      -- data : TCArray False (-1) 8 (TBasicType TUInt8)
    IO CInt


propertyGet ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    Atom ->                                 -- property
    Atom ->                                 -- type
    Word64 ->                               -- offset
    Word64 ->                               -- length
    Int32 ->                                -- pdelete
    m (Bool,Atom,Int32,ByteString)
propertyGet window property type_ offset length_ pdelete = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    let property' = unsafeManagedPtrGetPtr property
    let type_' = unsafeManagedPtrGetPtr type_
    actual_property_type <- allocMem :: IO (Ptr (Ptr Atom))
    actual_format <- allocMem :: IO (Ptr Int32)
    actual_length <- allocMem :: IO (Ptr Int32)
    data_ <- allocMem :: IO (Ptr (Ptr Word8))
    result <- gdk_property_get window' property' type_' offset length_ pdelete actual_property_type actual_format actual_length data_
    actual_length' <- peek actual_length
    let result' = (/= 0) result
    actual_property_type' <- peek actual_property_type
    -- XXX Wrapping a foreign struct/union with no known destructor, leak?
    actual_property_type'' <- (\x -> Atom <$> newForeignPtr_ x) actual_property_type'
    actual_format' <- peek actual_format
    data_' <- peek data_
    data_'' <- (unpackByteStringWithLength actual_length') data_'
    freeMem data_'
    touchManagedPtr window
    touchManagedPtr property
    touchManagedPtr type_
    freeMem actual_property_type
    freeMem actual_format
    freeMem actual_length
    freeMem data_
    return (result', actual_property_type'', actual_format', data_'')


-- function gdk_property_delete
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_property_delete" gdk_property_delete :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    Ptr Atom ->                             -- property : TInterface "Gdk" "Atom"
    IO ()


propertyDelete ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    Atom ->                                 -- property
    m ()
propertyDelete window property = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    let property' = unsafeManagedPtrGetPtr property
    gdk_property_delete window' property'
    touchManagedPtr window
    touchManagedPtr property
    return ()


-- function gdk_pre_parse_libgtk_only
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pre_parse_libgtk_only" gdk_pre_parse_libgtk_only :: 
    IO ()

{-# DEPRECATED preParseLibgtkOnly ["(Since version 3.16)","This symbol was never meant to be used outside","  of GTK+"]#-}
preParseLibgtkOnly ::
    (MonadIO m) =>
    m ()
preParseLibgtkOnly  = liftIO $ do
    gdk_pre_parse_libgtk_only
    return ()


-- function gdk_pointer_ungrab
-- Args : [Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pointer_ungrab" gdk_pointer_ungrab :: 
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()

{-# DEPRECATED pointerUngrab ["(Since version 3.0)","Use gdk_device_ungrab(), together with gdk_device_grab()","            instead."]#-}
pointerUngrab ::
    (MonadIO m) =>
    Word32 ->                               -- time_
    m ()
pointerUngrab time_ = liftIO $ do
    gdk_pointer_ungrab time_
    return ()


-- function gdk_pointer_is_grabbed
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pointer_is_grabbed" gdk_pointer_is_grabbed :: 
    IO CInt

{-# DEPRECATED pointerIsGrabbed ["(Since version 3.0)","Use gdk_display_device_is_grabbed() instead."]#-}
pointerIsGrabbed ::
    (MonadIO m) =>
    m Bool
pointerIsGrabbed  = liftIO $ do
    result <- gdk_pointer_is_grabbed
    let result' = (/= 0) result
    return result'


-- function gdk_pointer_grab
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "owner_events", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event_mask", argType = TInterface "Gdk" "EventMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "confine_to", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cursor", argType = TInterface "Gdk" "Cursor", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "owner_events", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event_mask", argType = TInterface "Gdk" "EventMask", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "confine_to", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cursor", argType = TInterface "Gdk" "Cursor", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "GrabStatus"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pointer_grab" gdk_pointer_grab :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    CInt ->                                 -- owner_events : TBasicType TBoolean
    CUInt ->                                -- event_mask : TInterface "Gdk" "EventMask"
    Ptr Window ->                           -- confine_to : TInterface "Gdk" "Window"
    Ptr Cursor ->                           -- cursor : TInterface "Gdk" "Cursor"
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO CUInt

{-# DEPRECATED pointerGrab ["(Since version 3.0)","Use gdk_device_grab() instead."]#-}
pointerGrab ::
    (MonadIO m, WindowK a, WindowK b, CursorK c) =>
    a ->                                    -- window
    Bool ->                                 -- owner_events
    [EventMask] ->                          -- event_mask
    Maybe (b) ->                            -- confine_to
    Maybe (c) ->                            -- cursor
    Word32 ->                               -- time_
    m GrabStatus
pointerGrab window owner_events event_mask confine_to cursor time_ = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    let owner_events' = (fromIntegral . fromEnum) owner_events
    let event_mask' = gflagsToWord event_mask
    maybeConfine_to <- case confine_to of
        Nothing -> return nullPtr
        Just jConfine_to -> do
            let jConfine_to' = unsafeManagedPtrCastPtr jConfine_to
            return jConfine_to'
    maybeCursor <- case cursor of
        Nothing -> return nullPtr
        Just jCursor -> do
            let jCursor' = unsafeManagedPtrCastPtr jCursor
            return jCursor'
    result <- gdk_pointer_grab window' owner_events' event_mask' maybeConfine_to maybeCursor time_
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr window
    whenJust confine_to touchManagedPtr
    whenJust cursor touchManagedPtr
    return result'


-- function gdk_pixbuf_get_from_window
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "src_x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "src_y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "src_x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "src_y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GdkPixbuf" "Pixbuf"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pixbuf_get_from_window" gdk_pixbuf_get_from_window :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    Int32 ->                                -- src_x : TBasicType TInt32
    Int32 ->                                -- src_y : TBasicType TInt32
    Int32 ->                                -- width : TBasicType TInt32
    Int32 ->                                -- height : TBasicType TInt32
    IO (Ptr GdkPixbuf.Pixbuf)


pixbufGetFromWindow ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    Int32 ->                                -- src_x
    Int32 ->                                -- src_y
    Int32 ->                                -- width
    Int32 ->                                -- height
    m GdkPixbuf.Pixbuf
pixbufGetFromWindow window src_x src_y width height = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    result <- gdk_pixbuf_get_from_window window' src_x src_y width height
    checkUnexpectedReturnNULL "gdk_pixbuf_get_from_window" result
    result' <- (wrapObject GdkPixbuf.Pixbuf) result
    touchManagedPtr window
    return result'


-- function gdk_pixbuf_get_from_surface
-- Args : [Arg {argName = "surface", argType = TInterface "cairo" "Surface", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "src_x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "src_y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "surface", argType = TInterface "cairo" "Surface", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "src_x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "src_y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GdkPixbuf" "Pixbuf"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pixbuf_get_from_surface" gdk_pixbuf_get_from_surface :: 
    Ptr Cairo.Surface ->                    -- surface : TInterface "cairo" "Surface"
    Int32 ->                                -- src_x : TBasicType TInt32
    Int32 ->                                -- src_y : TBasicType TInt32
    Int32 ->                                -- width : TBasicType TInt32
    Int32 ->                                -- height : TBasicType TInt32
    IO (Ptr GdkPixbuf.Pixbuf)


pixbufGetFromSurface ::
    (MonadIO m) =>
    Cairo.Surface ->                        -- surface
    Int32 ->                                -- src_x
    Int32 ->                                -- src_y
    Int32 ->                                -- width
    Int32 ->                                -- height
    m GdkPixbuf.Pixbuf
pixbufGetFromSurface surface src_x src_y width height = liftIO $ do
    let surface' = unsafeManagedPtrGetPtr surface
    result <- gdk_pixbuf_get_from_surface surface' src_x src_y width height
    checkUnexpectedReturnNULL "gdk_pixbuf_get_from_surface" result
    result' <- (wrapObject GdkPixbuf.Pixbuf) result
    touchManagedPtr surface
    return result'


-- function gdk_parse_args
-- Args : [Arg {argName = "argc", argType = TBasicType TInt32, direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "argv", argType = TCArray False (-1) 0 (TBasicType TUTF8), direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "argc", argType = TBasicType TInt32, direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "argv", argType = TCArray False (-1) 0 (TBasicType TUTF8), direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_parse_args" gdk_parse_args :: 
    Ptr Int32 ->                            -- argc : TBasicType TInt32
    Ptr (Ptr CString) ->                    -- argv : TCArray False (-1) 0 (TBasicType TUTF8)
    IO ()


parseArgs ::
    (MonadIO m) =>
    [T.Text] ->                             -- argv
    m ([T.Text])
parseArgs argv = liftIO $ do
    let argc = fromIntegral $ length argv
    argc' <- allocMem :: IO (Ptr Int32)
    poke argc' argc
    argv' <- packUTF8CArray argv
    argv'' <- allocMem :: IO (Ptr (Ptr CString))
    poke argv'' argv'
    gdk_parse_args argc' argv''
    argc'' <- peek argc'
    argv''' <- peek argv''
    argv'''' <- (unpackUTF8CArrayWithLength argc'') argv'''
    (mapCArrayWithLength argc'') freeMem argv'''
    freeMem argv'''
    freeMem argc'
    freeMem argv''
    return argv''''


-- function gdk_pango_context_get_for_screen
-- Args : [Arg {argName = "screen", argType = TInterface "Gdk" "Screen", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "screen", argType = TInterface "Gdk" "Screen", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "Context"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pango_context_get_for_screen" gdk_pango_context_get_for_screen :: 
    Ptr Screen ->                           -- screen : TInterface "Gdk" "Screen"
    IO (Ptr Pango.Context)


pangoContextGetForScreen ::
    (MonadIO m, ScreenK a) =>
    a ->                                    -- screen
    m Pango.Context
pangoContextGetForScreen screen = liftIO $ do
    let screen' = unsafeManagedPtrCastPtr screen
    result <- gdk_pango_context_get_for_screen screen'
    checkUnexpectedReturnNULL "gdk_pango_context_get_for_screen" result
    result' <- (wrapObject Pango.Context) result
    touchManagedPtr screen
    return result'


-- function gdk_pango_context_get
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Pango" "Context"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pango_context_get" gdk_pango_context_get :: 
    IO (Ptr Pango.Context)


pangoContextGet ::
    (MonadIO m) =>
    m Pango.Context
pangoContextGet  = liftIO $ do
    result <- gdk_pango_context_get
    checkUnexpectedReturnNULL "gdk_pango_context_get" result
    result' <- (wrapObject Pango.Context) result
    return result'


-- function gdk_offscreen_window_set_embedder
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "embedder", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "embedder", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_offscreen_window_set_embedder" gdk_offscreen_window_set_embedder :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    Ptr Window ->                           -- embedder : TInterface "Gdk" "Window"
    IO ()


offscreenWindowSetEmbedder ::
    (MonadIO m, WindowK a, WindowK b) =>
    a ->                                    -- window
    b ->                                    -- embedder
    m ()
offscreenWindowSetEmbedder window embedder = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    let embedder' = unsafeManagedPtrCastPtr embedder
    gdk_offscreen_window_set_embedder window' embedder'
    touchManagedPtr window
    touchManagedPtr embedder
    return ()


-- function gdk_offscreen_window_get_surface
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "cairo" "Surface"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_offscreen_window_get_surface" gdk_offscreen_window_get_surface :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    IO (Ptr Cairo.Surface)


offscreenWindowGetSurface ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    m Cairo.Surface
offscreenWindowGetSurface window = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    result <- gdk_offscreen_window_get_surface window'
    checkUnexpectedReturnNULL "gdk_offscreen_window_get_surface" result
    result' <- (newBoxed Cairo.Surface) result
    touchManagedPtr window
    return result'


-- function gdk_offscreen_window_get_embedder
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Window"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_offscreen_window_get_embedder" gdk_offscreen_window_get_embedder :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    IO (Ptr Window)


offscreenWindowGetEmbedder ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    m Window
offscreenWindowGetEmbedder window = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    result <- gdk_offscreen_window_get_embedder window'
    checkUnexpectedReturnNULL "gdk_offscreen_window_get_embedder" result
    result' <- (newObject Window) result
    touchManagedPtr window
    return result'


-- function gdk_notify_startup_complete_with_id
-- Args : [Arg {argName = "startup_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "startup_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_notify_startup_complete_with_id" gdk_notify_startup_complete_with_id :: 
    CString ->                              -- startup_id : TBasicType TUTF8
    IO ()


notifyStartupCompleteWithId ::
    (MonadIO m) =>
    T.Text ->                               -- startup_id
    m ()
notifyStartupCompleteWithId startup_id = liftIO $ do
    startup_id' <- textToCString startup_id
    gdk_notify_startup_complete_with_id startup_id'
    freeMem startup_id'
    return ()


-- function gdk_notify_startup_complete
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_notify_startup_complete" gdk_notify_startup_complete :: 
    IO ()


notifyStartupComplete ::
    (MonadIO m) =>
    m ()
notifyStartupComplete  = liftIO $ do
    gdk_notify_startup_complete
    return ()


-- function gdk_list_visuals
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TGList (TInterface "Gdk" "Visual")
-- throws : False
-- Skip return : False

foreign import ccall "gdk_list_visuals" gdk_list_visuals :: 
    IO (Ptr (GList (Ptr Visual)))


listVisuals ::
    (MonadIO m) =>
    m [Visual]
listVisuals  = liftIO $ do
    result <- gdk_list_visuals
    checkUnexpectedReturnNULL "gdk_list_visuals" result
    result' <- unpackGList result
    result'' <- mapM (newObject Visual) result'
    g_list_free result
    return result''


-- function gdk_keyval_to_upper
-- Args : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_keyval_to_upper" gdk_keyval_to_upper :: 
    Word32 ->                               -- keyval : TBasicType TUInt32
    IO Word32


keyvalToUpper ::
    (MonadIO m) =>
    Word32 ->                               -- keyval
    m Word32
keyvalToUpper keyval = liftIO $ do
    result <- gdk_keyval_to_upper keyval
    return result


-- function gdk_keyval_to_unicode
-- Args : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_keyval_to_unicode" gdk_keyval_to_unicode :: 
    Word32 ->                               -- keyval : TBasicType TUInt32
    IO Word32


keyvalToUnicode ::
    (MonadIO m) =>
    Word32 ->                               -- keyval
    m Word32
keyvalToUnicode keyval = liftIO $ do
    result <- gdk_keyval_to_unicode keyval
    return result


-- function gdk_keyval_to_lower
-- Args : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_keyval_to_lower" gdk_keyval_to_lower :: 
    Word32 ->                               -- keyval : TBasicType TUInt32
    IO Word32


keyvalToLower ::
    (MonadIO m) =>
    Word32 ->                               -- keyval
    m Word32
keyvalToLower keyval = liftIO $ do
    result <- gdk_keyval_to_lower keyval
    return result


-- function gdk_keyval_name
-- Args : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "gdk_keyval_name" gdk_keyval_name :: 
    Word32 ->                               -- keyval : TBasicType TUInt32
    IO CString


keyvalName ::
    (MonadIO m) =>
    Word32 ->                               -- keyval
    m T.Text
keyvalName keyval = liftIO $ do
    result <- gdk_keyval_name keyval
    checkUnexpectedReturnNULL "gdk_keyval_name" result
    result' <- cstringToText result
    return result'


-- function gdk_keyval_is_upper
-- Args : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_keyval_is_upper" gdk_keyval_is_upper :: 
    Word32 ->                               -- keyval : TBasicType TUInt32
    IO CInt


keyvalIsUpper ::
    (MonadIO m) =>
    Word32 ->                               -- keyval
    m Bool
keyvalIsUpper keyval = liftIO $ do
    result <- gdk_keyval_is_upper keyval
    let result' = (/= 0) result
    return result'


-- function gdk_keyval_is_lower
-- Args : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "keyval", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_keyval_is_lower" gdk_keyval_is_lower :: 
    Word32 ->                               -- keyval : TBasicType TUInt32
    IO CInt


keyvalIsLower ::
    (MonadIO m) =>
    Word32 ->                               -- keyval
    m Bool
keyvalIsLower keyval = liftIO $ do
    result <- gdk_keyval_is_lower keyval
    let result' = (/= 0) result
    return result'


-- function gdk_keyval_from_name
-- Args : [Arg {argName = "keyval_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "keyval_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_keyval_from_name" gdk_keyval_from_name :: 
    CString ->                              -- keyval_name : TBasicType TUTF8
    IO Word32


keyvalFromName ::
    (MonadIO m) =>
    T.Text ->                               -- keyval_name
    m Word32
keyvalFromName keyval_name = liftIO $ do
    keyval_name' <- textToCString keyval_name
    result <- gdk_keyval_from_name keyval_name'
    freeMem keyval_name'
    return result


-- function gdk_keyval_convert_case
-- Args : [Arg {argName = "symbol", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "lower", argType = TBasicType TUInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "upper", argType = TBasicType TUInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "symbol", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_keyval_convert_case" gdk_keyval_convert_case :: 
    Word32 ->                               -- symbol : TBasicType TUInt32
    Ptr Word32 ->                           -- lower : TBasicType TUInt32
    Ptr Word32 ->                           -- upper : TBasicType TUInt32
    IO ()


keyvalConvertCase ::
    (MonadIO m) =>
    Word32 ->                               -- symbol
    m (Word32,Word32)
keyvalConvertCase symbol = liftIO $ do
    lower <- allocMem :: IO (Ptr Word32)
    upper <- allocMem :: IO (Ptr Word32)
    gdk_keyval_convert_case symbol lower upper
    lower' <- peek lower
    upper' <- peek upper
    freeMem lower
    freeMem upper
    return (lower', upper')


-- function gdk_keyboard_ungrab
-- Args : [Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_keyboard_ungrab" gdk_keyboard_ungrab :: 
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()

{-# DEPRECATED keyboardUngrab ["(Since version 3.0)","Use gdk_device_ungrab(), together with gdk_device_grab()","            instead."]#-}
keyboardUngrab ::
    (MonadIO m) =>
    Word32 ->                               -- time_
    m ()
keyboardUngrab time_ = liftIO $ do
    gdk_keyboard_ungrab time_
    return ()


-- function gdk_keyboard_grab
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "owner_events", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "owner_events", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "GrabStatus"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_keyboard_grab" gdk_keyboard_grab :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    CInt ->                                 -- owner_events : TBasicType TBoolean
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO CUInt

{-# DEPRECATED keyboardGrab ["(Since version 3.0)","Use gdk_device_grab() instead."]#-}
keyboardGrab ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    Bool ->                                 -- owner_events
    Word32 ->                               -- time_
    m GrabStatus
keyboardGrab window owner_events time_ = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    let owner_events' = (fromIntegral . fromEnum) owner_events
    result <- gdk_keyboard_grab window' owner_events' time_
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr window
    return result'


-- function gdk_init_check
-- Args : [Arg {argName = "argc", argType = TBasicType TInt32, direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "argv", argType = TCArray False (-1) 0 (TBasicType TUTF8), direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "argc", argType = TBasicType TInt32, direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : [Arg {argName = "argv", argType = TCArray False (-1) 0 (TBasicType TUTF8), direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_init_check" gdk_init_check :: 
    Ptr Int32 ->                            -- argc : TBasicType TInt32
    Ptr (Ptr CString) ->                    -- argv : TCArray False (-1) 0 (TBasicType TUTF8)
    IO CInt


initCheck ::
    (MonadIO m) =>
    [T.Text] ->                             -- argv
    m (Bool,[T.Text])
initCheck argv = liftIO $ do
    let argc = fromIntegral $ length argv
    argc' <- allocMem :: IO (Ptr Int32)
    poke argc' argc
    argv' <- packUTF8CArray argv
    argv'' <- allocMem :: IO (Ptr (Ptr CString))
    poke argv'' argv'
    result <- gdk_init_check argc' argv''
    argc'' <- peek argc'
    let result' = (/= 0) result
    argv''' <- peek argv''
    argv'''' <- (unpackUTF8CArrayWithLength argc'') argv'''
    (mapCArrayWithLength argc'') freeMem argv'''
    freeMem argv'''
    freeMem argc'
    freeMem argv''
    return (result', argv'''')


-- function gdk_init
-- Args : [Arg {argName = "argc", argType = TBasicType TInt32, direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "argv", argType = TCArray False (-1) 0 (TBasicType TUTF8), direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "argc", argType = TBasicType TInt32, direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : [Arg {argName = "argv", argType = TCArray False (-1) 0 (TBasicType TUTF8), direction = DirectionInout, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_init" gdk_init :: 
    Ptr Int32 ->                            -- argc : TBasicType TInt32
    Ptr (Ptr CString) ->                    -- argv : TCArray False (-1) 0 (TBasicType TUTF8)
    IO ()


init ::
    (MonadIO m) =>
    [T.Text] ->                             -- argv
    m ([T.Text])
init argv = liftIO $ do
    let argc = fromIntegral $ length argv
    argc' <- allocMem :: IO (Ptr Int32)
    poke argc' argc
    argv' <- packUTF8CArray argv
    argv'' <- allocMem :: IO (Ptr (Ptr CString))
    poke argv'' argv'
    gdk_init argc' argv''
    argc'' <- peek argc'
    argv''' <- peek argv''
    argv'''' <- (unpackUTF8CArrayWithLength argc'') argv'''
    (mapCArrayWithLength argc'') freeMem argv'''
    freeMem argv'''
    freeMem argc'
    freeMem argv''
    return argv''''


-- function gdk_gl_error_quark
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_gl_error_quark" gdk_gl_error_quark :: 
    IO Word32


glErrorQuark ::
    (MonadIO m) =>
    m Word32
glErrorQuark  = liftIO $ do
    result <- gdk_gl_error_quark
    return result


-- function gdk_get_show_events
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_get_show_events" gdk_get_show_events :: 
    IO CInt


getShowEvents ::
    (MonadIO m) =>
    m Bool
getShowEvents  = liftIO $ do
    result <- gdk_get_show_events
    let result' = (/= 0) result
    return result'


-- function gdk_get_program_class
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "gdk_get_program_class" gdk_get_program_class :: 
    IO CString


getProgramClass ::
    (MonadIO m) =>
    m T.Text
getProgramClass  = liftIO $ do
    result <- gdk_get_program_class
    checkUnexpectedReturnNULL "gdk_get_program_class" result
    result' <- cstringToText result
    return result'


-- function gdk_get_display_arg_name
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "gdk_get_display_arg_name" gdk_get_display_arg_name :: 
    IO CString


getDisplayArgName ::
    (MonadIO m) =>
    m T.Text
getDisplayArgName  = liftIO $ do
    result <- gdk_get_display_arg_name
    checkUnexpectedReturnNULL "gdk_get_display_arg_name" result
    result' <- cstringToText result
    return result'


-- function gdk_get_display
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "gdk_get_display" gdk_get_display :: 
    IO CString

{-# DEPRECATED getDisplay ["(Since version 3.8)","Call gdk_display_get_name (gdk_display_get_default ()))","   instead."]#-}
getDisplay ::
    (MonadIO m) =>
    m T.Text
getDisplay  = liftIO $ do
    result <- gdk_get_display
    checkUnexpectedReturnNULL "gdk_get_display" result
    result' <- cstringToText result
    freeMem result
    return result'


-- function gdk_get_default_root_window
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gdk" "Window"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_get_default_root_window" gdk_get_default_root_window :: 
    IO (Ptr Window)


getDefaultRootWindow ::
    (MonadIO m) =>
    m Window
getDefaultRootWindow  = liftIO $ do
    result <- gdk_get_default_root_window
    checkUnexpectedReturnNULL "gdk_get_default_root_window" result
    result' <- (newObject Window) result
    return result'


-- function gdk_flush
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_flush" gdk_flush :: 
    IO ()


flush ::
    (MonadIO m) =>
    m ()
flush  = liftIO $ do
    gdk_flush
    return ()


-- function gdk_events_pending
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_events_pending" gdk_events_pending :: 
    IO CInt


eventsPending ::
    (MonadIO m) =>
    m Bool
eventsPending  = liftIO $ do
    result <- gdk_events_pending
    let result' = (/= 0) result
    return result'


-- function gdk_events_get_distance
-- Args : [Arg {argName = "event1", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event2", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "distance", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "event1", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event2", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_events_get_distance" gdk_events_get_distance :: 
    Ptr Event ->                            -- event1 : TInterface "Gdk" "Event"
    Ptr Event ->                            -- event2 : TInterface "Gdk" "Event"
    Ptr CDouble ->                          -- distance : TBasicType TDouble
    IO CInt


eventsGetDistance ::
    (MonadIO m) =>
    Event ->                                -- event1
    Event ->                                -- event2
    m (Bool,Double)
eventsGetDistance event1 event2 = liftIO $ do
    let event1' = unsafeManagedPtrGetPtr event1
    let event2' = unsafeManagedPtrGetPtr event2
    distance <- allocMem :: IO (Ptr CDouble)
    result <- gdk_events_get_distance event1' event2' distance
    let result' = (/= 0) result
    distance' <- peek distance
    let distance'' = realToFrac distance'
    touchManagedPtr event1
    touchManagedPtr event2
    freeMem distance
    return (result', distance'')


-- function gdk_events_get_center
-- Args : [Arg {argName = "event1", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event2", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "y", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "event1", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event2", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_events_get_center" gdk_events_get_center :: 
    Ptr Event ->                            -- event1 : TInterface "Gdk" "Event"
    Ptr Event ->                            -- event2 : TInterface "Gdk" "Event"
    Ptr CDouble ->                          -- x : TBasicType TDouble
    Ptr CDouble ->                          -- y : TBasicType TDouble
    IO CInt


eventsGetCenter ::
    (MonadIO m) =>
    Event ->                                -- event1
    Event ->                                -- event2
    m (Bool,Double,Double)
eventsGetCenter event1 event2 = liftIO $ do
    let event1' = unsafeManagedPtrGetPtr event1
    let event2' = unsafeManagedPtrGetPtr event2
    x <- allocMem :: IO (Ptr CDouble)
    y <- allocMem :: IO (Ptr CDouble)
    result <- gdk_events_get_center event1' event2' x y
    let result' = (/= 0) result
    x' <- peek x
    let x'' = realToFrac x'
    y' <- peek y
    let y'' = realToFrac y'
    touchManagedPtr event1
    touchManagedPtr event2
    freeMem x
    freeMem y
    return (result', x'', y'')


-- function gdk_events_get_angle
-- Args : [Arg {argName = "event1", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event2", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "angle", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "event1", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event2", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_events_get_angle" gdk_events_get_angle :: 
    Ptr Event ->                            -- event1 : TInterface "Gdk" "Event"
    Ptr Event ->                            -- event2 : TInterface "Gdk" "Event"
    Ptr CDouble ->                          -- angle : TBasicType TDouble
    IO CInt


eventsGetAngle ::
    (MonadIO m) =>
    Event ->                                -- event1
    Event ->                                -- event2
    m (Bool,Double)
eventsGetAngle event1 event2 = liftIO $ do
    let event1' = unsafeManagedPtrGetPtr event1
    let event2' = unsafeManagedPtrGetPtr event2
    angle <- allocMem :: IO (Ptr CDouble)
    result <- gdk_events_get_angle event1' event2' angle
    let result' = (/= 0) result
    angle' <- peek angle
    let angle'' = realToFrac angle'
    touchManagedPtr event1
    touchManagedPtr event2
    freeMem angle
    return (result', angle'')


-- function gdk_event_request_motions
-- Args : [Arg {argName = "event", argType = TInterface "Gdk" "EventMotion", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "event", argType = TInterface "Gdk" "EventMotion", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_event_request_motions" gdk_event_request_motions :: 
    Ptr EventMotion ->                      -- event : TInterface "Gdk" "EventMotion"
    IO ()


eventRequestMotions ::
    (MonadIO m) =>
    EventMotion ->                          -- event
    m ()
eventRequestMotions event = liftIO $ do
    let event' = unsafeManagedPtrGetPtr event
    gdk_event_request_motions event'
    touchManagedPtr event
    return ()


-- function gdk_event_peek
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gdk" "Event"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_event_peek" gdk_event_peek :: 
    IO (Ptr Event)


eventPeek ::
    (MonadIO m) =>
    m Event
eventPeek  = liftIO $ do
    result <- gdk_event_peek
    checkUnexpectedReturnNULL "gdk_event_peek" result
    result' <- (wrapBoxed Event) result
    return result'


-- function gdk_event_handler_set
-- Args : [Arg {argName = "func", argType = TInterface "Gdk" "EventFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 1, argDestroy = 2, transfer = TransferNothing},Arg {argName = "data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "notify", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "func", argType = TInterface "Gdk" "EventFunc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeNotified, argClosure = 1, argDestroy = 2, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_event_handler_set" gdk_event_handler_set :: 
    FunPtr EventFuncC ->                    -- func : TInterface "Gdk" "EventFunc"
    Ptr () ->                               -- data : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- notify : TInterface "GLib" "DestroyNotify"
    IO ()


eventHandlerSet ::
    (MonadIO m) =>
    EventFunc ->                            -- func
    m ()
eventHandlerSet func = liftIO $ do
    func' <- mkEventFunc (eventFuncWrapper Nothing func)
    let data_ = castFunPtrToPtr func'
    let notify = safeFreeFunPtrPtr
    gdk_event_handler_set func' data_ notify
    return ()


-- function gdk_event_get
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gdk" "Event"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_event_get" gdk_event_get :: 
    IO (Ptr Event)


eventGet ::
    (MonadIO m) =>
    m Event
eventGet  = liftIO $ do
    result <- gdk_event_get
    checkUnexpectedReturnNULL "gdk_event_get" result
    result' <- (wrapBoxed Event) result
    return result'


-- function gdk_error_trap_push
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_error_trap_push" gdk_error_trap_push :: 
    IO ()


errorTrapPush ::
    (MonadIO m) =>
    m ()
errorTrapPush  = liftIO $ do
    gdk_error_trap_push
    return ()


-- function gdk_error_trap_pop_ignored
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_error_trap_pop_ignored" gdk_error_trap_pop_ignored :: 
    IO ()


errorTrapPopIgnored ::
    (MonadIO m) =>
    m ()
errorTrapPopIgnored  = liftIO $ do
    gdk_error_trap_pop_ignored
    return ()


-- function gdk_error_trap_pop
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_error_trap_pop" gdk_error_trap_pop :: 
    IO Int32


errorTrapPop ::
    (MonadIO m) =>
    m Int32
errorTrapPop  = liftIO $ do
    result <- gdk_error_trap_pop
    return result


-- function gdk_drop_reply
-- Args : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "accepted", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "accepted", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_drop_reply" gdk_drop_reply :: 
    Ptr DragContext ->                      -- context : TInterface "Gdk" "DragContext"
    CInt ->                                 -- accepted : TBasicType TBoolean
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()


dropReply ::
    (MonadIO m, DragContextK a) =>
    a ->                                    -- context
    Bool ->                                 -- accepted
    Word32 ->                               -- time_
    m ()
dropReply context accepted time_ = liftIO $ do
    let context' = unsafeManagedPtrCastPtr context
    let accepted' = (fromIntegral . fromEnum) accepted
    gdk_drop_reply context' accepted' time_
    touchManagedPtr context
    return ()


-- function gdk_drop_finish
-- Args : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "success", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "success", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_drop_finish" gdk_drop_finish :: 
    Ptr DragContext ->                      -- context : TInterface "Gdk" "DragContext"
    CInt ->                                 -- success : TBasicType TBoolean
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()


dropFinish ::
    (MonadIO m, DragContextK a) =>
    a ->                                    -- context
    Bool ->                                 -- success
    Word32 ->                               -- time_
    m ()
dropFinish context success time_ = liftIO $ do
    let context' = unsafeManagedPtrCastPtr context
    let success' = (fromIntegral . fromEnum) success
    gdk_drop_finish context' success' time_
    touchManagedPtr context
    return ()


-- function gdk_drag_status
-- Args : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action", argType = TInterface "Gdk" "DragAction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action", argType = TInterface "Gdk" "DragAction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_drag_status" gdk_drag_status :: 
    Ptr DragContext ->                      -- context : TInterface "Gdk" "DragContext"
    CUInt ->                                -- action : TInterface "Gdk" "DragAction"
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()


dragStatus ::
    (MonadIO m, DragContextK a) =>
    a ->                                    -- context
    [DragAction] ->                         -- action
    Word32 ->                               -- time_
    m ()
dragStatus context action time_ = liftIO $ do
    let context' = unsafeManagedPtrCastPtr context
    let action' = gflagsToWord action
    gdk_drag_status context' action' time_
    touchManagedPtr context
    return ()


-- function gdk_drag_motion
-- Args : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "dest_window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "protocol", argType = TInterface "Gdk" "DragProtocol", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x_root", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y_root", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "suggested_action", argType = TInterface "Gdk" "DragAction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "possible_actions", argType = TInterface "Gdk" "DragAction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "dest_window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "protocol", argType = TInterface "Gdk" "DragProtocol", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x_root", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y_root", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "suggested_action", argType = TInterface "Gdk" "DragAction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "possible_actions", argType = TInterface "Gdk" "DragAction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_drag_motion" gdk_drag_motion :: 
    Ptr DragContext ->                      -- context : TInterface "Gdk" "DragContext"
    Ptr Window ->                           -- dest_window : TInterface "Gdk" "Window"
    CUInt ->                                -- protocol : TInterface "Gdk" "DragProtocol"
    Int32 ->                                -- x_root : TBasicType TInt32
    Int32 ->                                -- y_root : TBasicType TInt32
    CUInt ->                                -- suggested_action : TInterface "Gdk" "DragAction"
    CUInt ->                                -- possible_actions : TInterface "Gdk" "DragAction"
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO CInt


dragMotion ::
    (MonadIO m, DragContextK a, WindowK b) =>
    a ->                                    -- context
    b ->                                    -- dest_window
    DragProtocol ->                         -- protocol
    Int32 ->                                -- x_root
    Int32 ->                                -- y_root
    [DragAction] ->                         -- suggested_action
    [DragAction] ->                         -- possible_actions
    Word32 ->                               -- time_
    m Bool
dragMotion context dest_window protocol x_root y_root suggested_action possible_actions time_ = liftIO $ do
    let context' = unsafeManagedPtrCastPtr context
    let dest_window' = unsafeManagedPtrCastPtr dest_window
    let protocol' = (fromIntegral . fromEnum) protocol
    let suggested_action' = gflagsToWord suggested_action
    let possible_actions' = gflagsToWord possible_actions
    result <- gdk_drag_motion context' dest_window' protocol' x_root y_root suggested_action' possible_actions' time_
    let result' = (/= 0) result
    touchManagedPtr context
    touchManagedPtr dest_window
    return result'


-- function gdk_drag_get_selection
-- Args : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Atom"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_drag_get_selection" gdk_drag_get_selection :: 
    Ptr DragContext ->                      -- context : TInterface "Gdk" "DragContext"
    IO (Ptr Atom)


dragGetSelection ::
    (MonadIO m, DragContextK a) =>
    a ->                                    -- context
    m Atom
dragGetSelection context = liftIO $ do
    let context' = unsafeManagedPtrCastPtr context
    result <- gdk_drag_get_selection context'
    checkUnexpectedReturnNULL "gdk_drag_get_selection" result
    -- XXX Wrapping a foreign struct/union with no known destructor, leak?
    result' <- (\x -> Atom <$> newForeignPtr_ x) result
    touchManagedPtr context
    return result'


-- function gdk_drag_find_window_for_screen
-- Args : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "drag_window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "screen", argType = TInterface "Gdk" "Screen", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x_root", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y_root", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "dest_window", argType = TInterface "Gdk" "Window", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "protocol", argType = TInterface "Gdk" "DragProtocol", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "drag_window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "screen", argType = TInterface "Gdk" "Screen", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x_root", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y_root", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_drag_find_window_for_screen" gdk_drag_find_window_for_screen :: 
    Ptr DragContext ->                      -- context : TInterface "Gdk" "DragContext"
    Ptr Window ->                           -- drag_window : TInterface "Gdk" "Window"
    Ptr Screen ->                           -- screen : TInterface "Gdk" "Screen"
    Int32 ->                                -- x_root : TBasicType TInt32
    Int32 ->                                -- y_root : TBasicType TInt32
    Ptr (Ptr Window) ->                     -- dest_window : TInterface "Gdk" "Window"
    Ptr CUInt ->                            -- protocol : TInterface "Gdk" "DragProtocol"
    IO ()


dragFindWindowForScreen ::
    (MonadIO m, DragContextK a, WindowK b, ScreenK c) =>
    a ->                                    -- context
    b ->                                    -- drag_window
    c ->                                    -- screen
    Int32 ->                                -- x_root
    Int32 ->                                -- y_root
    m (Window,DragProtocol)
dragFindWindowForScreen context drag_window screen x_root y_root = liftIO $ do
    let context' = unsafeManagedPtrCastPtr context
    let drag_window' = unsafeManagedPtrCastPtr drag_window
    let screen' = unsafeManagedPtrCastPtr screen
    dest_window <- allocMem :: IO (Ptr (Ptr Window))
    protocol <- allocMem :: IO (Ptr CUInt)
    gdk_drag_find_window_for_screen context' drag_window' screen' x_root y_root dest_window protocol
    dest_window' <- peek dest_window
    dest_window'' <- (wrapObject Window) dest_window'
    protocol' <- peek protocol
    let protocol'' = (toEnum . fromIntegral) protocol'
    touchManagedPtr context
    touchManagedPtr drag_window
    touchManagedPtr screen
    freeMem dest_window
    freeMem protocol
    return (dest_window'', protocol'')


-- function gdk_drag_drop_succeeded
-- Args : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_drag_drop_succeeded" gdk_drag_drop_succeeded :: 
    Ptr DragContext ->                      -- context : TInterface "Gdk" "DragContext"
    IO CInt


dragDropSucceeded ::
    (MonadIO m, DragContextK a) =>
    a ->                                    -- context
    m Bool
dragDropSucceeded context = liftIO $ do
    let context' = unsafeManagedPtrCastPtr context
    result <- gdk_drag_drop_succeeded context'
    let result' = (/= 0) result
    touchManagedPtr context
    return result'


-- function gdk_drag_drop
-- Args : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_drag_drop" gdk_drag_drop :: 
    Ptr DragContext ->                      -- context : TInterface "Gdk" "DragContext"
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()


dragDrop ::
    (MonadIO m, DragContextK a) =>
    a ->                                    -- context
    Word32 ->                               -- time_
    m ()
dragDrop context time_ = liftIO $ do
    let context' = unsafeManagedPtrCastPtr context
    gdk_drag_drop context' time_
    touchManagedPtr context
    return ()


-- function gdk_drag_begin_for_device
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "device", argType = TInterface "Gdk" "Device", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "targets", argType = TGList (TInterface "Gdk" "Atom"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "device", argType = TInterface "Gdk" "Device", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "targets", argType = TGList (TInterface "Gdk" "Atom"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "DragContext"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_drag_begin_for_device" gdk_drag_begin_for_device :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    Ptr Device ->                           -- device : TInterface "Gdk" "Device"
    Ptr (GList (Ptr Atom)) ->               -- targets : TGList (TInterface "Gdk" "Atom")
    IO (Ptr DragContext)


dragBeginForDevice ::
    (MonadIO m, WindowK a, DeviceK b) =>
    a ->                                    -- window
    b ->                                    -- device
    [Atom] ->                               -- targets
    m DragContext
dragBeginForDevice window device targets = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    let device' = unsafeManagedPtrCastPtr device
    let targets' = map unsafeManagedPtrGetPtr targets
    targets'' <- packGList targets'
    result <- gdk_drag_begin_for_device window' device' targets''
    checkUnexpectedReturnNULL "gdk_drag_begin_for_device" result
    result' <- (wrapObject DragContext) result
    touchManagedPtr window
    touchManagedPtr device
    mapM_ touchManagedPtr targets
    g_list_free targets''
    return result'


-- function gdk_drag_begin
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "targets", argType = TGList (TInterface "Gdk" "Atom"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "targets", argType = TGList (TInterface "Gdk" "Atom"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "DragContext"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_drag_begin" gdk_drag_begin :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    Ptr (GList (Ptr Atom)) ->               -- targets : TGList (TInterface "Gdk" "Atom")
    IO (Ptr DragContext)


dragBegin ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    [Atom] ->                               -- targets
    m DragContext
dragBegin window targets = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    let targets' = map unsafeManagedPtrGetPtr targets
    targets'' <- packGList targets'
    result <- gdk_drag_begin window' targets''
    checkUnexpectedReturnNULL "gdk_drag_begin" result
    result' <- (wrapObject DragContext) result
    touchManagedPtr window
    mapM_ touchManagedPtr targets
    g_list_free targets''
    return result'


-- function gdk_drag_abort
-- Args : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "context", argType = TInterface "Gdk" "DragContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time_", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_drag_abort" gdk_drag_abort :: 
    Ptr DragContext ->                      -- context : TInterface "Gdk" "DragContext"
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()


dragAbort ::
    (MonadIO m, DragContextK a) =>
    a ->                                    -- context
    Word32 ->                               -- time_
    m ()
dragAbort context time_ = liftIO $ do
    let context' = unsafeManagedPtrCastPtr context
    gdk_drag_abort context' time_
    touchManagedPtr context
    return ()


-- function gdk_disable_multidevice
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_disable_multidevice" gdk_disable_multidevice :: 
    IO ()


disableMultidevice ::
    (MonadIO m) =>
    m ()
disableMultidevice  = liftIO $ do
    gdk_disable_multidevice
    return ()


-- function gdk_color_parse
-- Args : [Arg {argName = "spec", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "color", argType = TInterface "Gdk" "Color", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "spec", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_color_parse" gdk_color_parse :: 
    CString ->                              -- spec : TBasicType TUTF8
    Ptr Color ->                            -- color : TInterface "Gdk" "Color"
    IO CInt

{-# DEPRECATED colorParse ["(Since version 3.14)","Use #GdkRGBA"]#-}
colorParse ::
    (MonadIO m) =>
    T.Text ->                               -- spec
    m (Bool,Color)
colorParse spec = liftIO $ do
    spec' <- textToCString spec
    color <- callocBoxedBytes 12 :: IO (Ptr Color)
    result <- gdk_color_parse spec' color
    let result' = (/= 0) result
    color' <- (wrapBoxed Color) color
    freeMem spec'
    return (result', color')


-- function gdk_cairo_surface_create_from_pixbuf
-- Args : [Arg {argName = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "scale", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "for_window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "scale", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "for_window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "cairo" "Surface"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_cairo_surface_create_from_pixbuf" gdk_cairo_surface_create_from_pixbuf :: 
    Ptr GdkPixbuf.Pixbuf ->                 -- pixbuf : TInterface "GdkPixbuf" "Pixbuf"
    Int32 ->                                -- scale : TBasicType TInt32
    Ptr Window ->                           -- for_window : TInterface "Gdk" "Window"
    IO (Ptr Cairo.Surface)


cairoSurfaceCreateFromPixbuf ::
    (MonadIO m, GdkPixbuf.PixbufK a, WindowK b) =>
    a ->                                    -- pixbuf
    Int32 ->                                -- scale
    Maybe (b) ->                            -- for_window
    m Cairo.Surface
cairoSurfaceCreateFromPixbuf pixbuf scale for_window = liftIO $ do
    let pixbuf' = unsafeManagedPtrCastPtr pixbuf
    maybeFor_window <- case for_window of
        Nothing -> return nullPtr
        Just jFor_window -> do
            let jFor_window' = unsafeManagedPtrCastPtr jFor_window
            return jFor_window'
    result <- gdk_cairo_surface_create_from_pixbuf pixbuf' scale maybeFor_window
    checkUnexpectedReturnNULL "gdk_cairo_surface_create_from_pixbuf" result
    result' <- (wrapBoxed Cairo.Surface) result
    touchManagedPtr pixbuf
    whenJust for_window touchManagedPtr
    return result'


-- function gdk_cairo_set_source_window
-- Args : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_cairo_set_source_window" gdk_cairo_set_source_window :: 
    Ptr Cairo.Context ->                    -- cr : TInterface "cairo" "Context"
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    CDouble ->                              -- x : TBasicType TDouble
    CDouble ->                              -- y : TBasicType TDouble
    IO ()


cairoSetSourceWindow ::
    (MonadIO m, WindowK a) =>
    Cairo.Context ->                        -- cr
    a ->                                    -- window
    Double ->                               -- x
    Double ->                               -- y
    m ()
cairoSetSourceWindow cr window x y = liftIO $ do
    let cr' = unsafeManagedPtrGetPtr cr
    let window' = unsafeManagedPtrCastPtr window
    let x' = realToFrac x
    let y' = realToFrac y
    gdk_cairo_set_source_window cr' window' x' y'
    touchManagedPtr cr
    touchManagedPtr window
    return ()


-- function gdk_cairo_set_source_rgba
-- Args : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rgba", argType = TInterface "Gdk" "RGBA", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rgba", argType = TInterface "Gdk" "RGBA", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_cairo_set_source_rgba" gdk_cairo_set_source_rgba :: 
    Ptr Cairo.Context ->                    -- cr : TInterface "cairo" "Context"
    Ptr RGBA ->                             -- rgba : TInterface "Gdk" "RGBA"
    IO ()


cairoSetSourceRgba ::
    (MonadIO m) =>
    Cairo.Context ->                        -- cr
    RGBA ->                                 -- rgba
    m ()
cairoSetSourceRgba cr rgba = liftIO $ do
    let cr' = unsafeManagedPtrGetPtr cr
    let rgba' = unsafeManagedPtrGetPtr rgba
    gdk_cairo_set_source_rgba cr' rgba'
    touchManagedPtr cr
    touchManagedPtr rgba
    return ()


-- function gdk_cairo_set_source_pixbuf
-- Args : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pixbuf_x", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pixbuf_y", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pixbuf_x", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pixbuf_y", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_cairo_set_source_pixbuf" gdk_cairo_set_source_pixbuf :: 
    Ptr Cairo.Context ->                    -- cr : TInterface "cairo" "Context"
    Ptr GdkPixbuf.Pixbuf ->                 -- pixbuf : TInterface "GdkPixbuf" "Pixbuf"
    CDouble ->                              -- pixbuf_x : TBasicType TDouble
    CDouble ->                              -- pixbuf_y : TBasicType TDouble
    IO ()


cairoSetSourcePixbuf ::
    (MonadIO m, GdkPixbuf.PixbufK a) =>
    Cairo.Context ->                        -- cr
    a ->                                    -- pixbuf
    Double ->                               -- pixbuf_x
    Double ->                               -- pixbuf_y
    m ()
cairoSetSourcePixbuf cr pixbuf pixbuf_x pixbuf_y = liftIO $ do
    let cr' = unsafeManagedPtrGetPtr cr
    let pixbuf' = unsafeManagedPtrCastPtr pixbuf
    let pixbuf_x' = realToFrac pixbuf_x
    let pixbuf_y' = realToFrac pixbuf_y
    gdk_cairo_set_source_pixbuf cr' pixbuf' pixbuf_x' pixbuf_y'
    touchManagedPtr cr
    touchManagedPtr pixbuf
    return ()


-- function gdk_cairo_set_source_color
-- Args : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "color", argType = TInterface "Gdk" "Color", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "color", argType = TInterface "Gdk" "Color", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_cairo_set_source_color" gdk_cairo_set_source_color :: 
    Ptr Cairo.Context ->                    -- cr : TInterface "cairo" "Context"
    Ptr Color ->                            -- color : TInterface "Gdk" "Color"
    IO ()

{-# DEPRECATED cairoSetSourceColor ["(Since version 3.4)","Use gdk_cairo_set_source_rgba() instead"]#-}
cairoSetSourceColor ::
    (MonadIO m) =>
    Cairo.Context ->                        -- cr
    Color ->                                -- color
    m ()
cairoSetSourceColor cr color = liftIO $ do
    let cr' = unsafeManagedPtrGetPtr cr
    let color' = unsafeManagedPtrGetPtr color
    gdk_cairo_set_source_color cr' color'
    touchManagedPtr cr
    touchManagedPtr color
    return ()


-- function gdk_cairo_region_create_from_surface
-- Args : [Arg {argName = "surface", argType = TInterface "cairo" "Surface", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "surface", argType = TInterface "cairo" "Surface", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "cairo" "Region"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_cairo_region_create_from_surface" gdk_cairo_region_create_from_surface :: 
    Ptr Cairo.Surface ->                    -- surface : TInterface "cairo" "Surface"
    IO (Ptr Cairo.Region)


cairoRegionCreateFromSurface ::
    (MonadIO m) =>
    Cairo.Surface ->                        -- surface
    m Cairo.Region
cairoRegionCreateFromSurface surface = liftIO $ do
    let surface' = unsafeManagedPtrGetPtr surface
    result <- gdk_cairo_region_create_from_surface surface'
    checkUnexpectedReturnNULL "gdk_cairo_region_create_from_surface" result
    result' <- (wrapBoxed Cairo.Region) result
    touchManagedPtr surface
    return result'


-- function gdk_cairo_region
-- Args : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "region", argType = TInterface "cairo" "Region", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "region", argType = TInterface "cairo" "Region", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_cairo_region" gdk_cairo_region :: 
    Ptr Cairo.Context ->                    -- cr : TInterface "cairo" "Context"
    Ptr Cairo.Region ->                     -- region : TInterface "cairo" "Region"
    IO ()


cairoRegion ::
    (MonadIO m) =>
    Cairo.Context ->                        -- cr
    Cairo.Region ->                         -- region
    m ()
cairoRegion cr region = liftIO $ do
    let cr' = unsafeManagedPtrGetPtr cr
    let region' = unsafeManagedPtrGetPtr region
    gdk_cairo_region cr' region'
    touchManagedPtr cr
    touchManagedPtr region
    return ()


-- function gdk_cairo_rectangle
-- Args : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rectangle", argType = TInterface "Gdk" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rectangle", argType = TInterface "Gdk" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_cairo_rectangle" gdk_cairo_rectangle :: 
    Ptr Cairo.Context ->                    -- cr : TInterface "cairo" "Context"
    Ptr Rectangle ->                        -- rectangle : TInterface "Gdk" "Rectangle"
    IO ()


cairoRectangle ::
    (MonadIO m) =>
    Cairo.Context ->                        -- cr
    Rectangle ->                            -- rectangle
    m ()
cairoRectangle cr rectangle = liftIO $ do
    let cr' = unsafeManagedPtrGetPtr cr
    let rectangle' = unsafeManagedPtrGetPtr rectangle
    gdk_cairo_rectangle cr' rectangle'
    touchManagedPtr cr
    touchManagedPtr rectangle
    return ()


-- function gdk_cairo_get_clip_rectangle
-- Args : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Gdk" "Rectangle", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_cairo_get_clip_rectangle" gdk_cairo_get_clip_rectangle :: 
    Ptr Cairo.Context ->                    -- cr : TInterface "cairo" "Context"
    Ptr Rectangle ->                        -- rect : TInterface "Gdk" "Rectangle"
    IO CInt


cairoGetClipRectangle ::
    (MonadIO m) =>
    Cairo.Context ->                        -- cr
    m (Bool,Rectangle)
cairoGetClipRectangle cr = liftIO $ do
    let cr' = unsafeManagedPtrGetPtr cr
    rect <- callocBoxedBytes 16 :: IO (Ptr Rectangle)
    result <- gdk_cairo_get_clip_rectangle cr' rect
    let result' = (/= 0) result
    rect' <- (wrapBoxed Rectangle) rect
    touchManagedPtr cr
    return (result', rect')


-- function gdk_cairo_draw_from_gl
-- Args : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_type", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "buffer_scale", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source_type", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "buffer_scale", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_cairo_draw_from_gl" gdk_cairo_draw_from_gl :: 
    Ptr Cairo.Context ->                    -- cr : TInterface "cairo" "Context"
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    Int32 ->                                -- source : TBasicType TInt32
    Int32 ->                                -- source_type : TBasicType TInt32
    Int32 ->                                -- buffer_scale : TBasicType TInt32
    Int32 ->                                -- x : TBasicType TInt32
    Int32 ->                                -- y : TBasicType TInt32
    Int32 ->                                -- width : TBasicType TInt32
    Int32 ->                                -- height : TBasicType TInt32
    IO ()


cairoDrawFromGl ::
    (MonadIO m, WindowK a) =>
    Cairo.Context ->                        -- cr
    a ->                                    -- window
    Int32 ->                                -- source
    Int32 ->                                -- source_type
    Int32 ->                                -- buffer_scale
    Int32 ->                                -- x
    Int32 ->                                -- y
    Int32 ->                                -- width
    Int32 ->                                -- height
    m ()
cairoDrawFromGl cr window source source_type buffer_scale x y width height = liftIO $ do
    let cr' = unsafeManagedPtrGetPtr cr
    let window' = unsafeManagedPtrCastPtr window
    gdk_cairo_draw_from_gl cr' window' source source_type buffer_scale x y width height
    touchManagedPtr cr
    touchManagedPtr window
    return ()


-- function gdk_cairo_create
-- Args : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "cairo" "Context"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_cairo_create" gdk_cairo_create :: 
    Ptr Window ->                           -- window : TInterface "Gdk" "Window"
    IO (Ptr Cairo.Context)


cairoCreate ::
    (MonadIO m, WindowK a) =>
    a ->                                    -- window
    m Cairo.Context
cairoCreate window = liftIO $ do
    let window' = unsafeManagedPtrCastPtr window
    result <- gdk_cairo_create window'
    checkUnexpectedReturnNULL "gdk_cairo_create" result
    result' <- (wrapBoxed Cairo.Context) result
    touchManagedPtr window
    return result'


-- function gdk_beep
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_beep" gdk_beep :: 
    IO ()


beep ::
    (MonadIO m) =>
    m ()
beep  = liftIO $ do
    gdk_beep
    return ()


-- function gdk_atom_intern_static_string
-- Args : [Arg {argName = "atom_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "atom_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Atom"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_atom_intern_static_string" gdk_atom_intern_static_string :: 
    CString ->                              -- atom_name : TBasicType TUTF8
    IO (Ptr Atom)


atomInternStaticString ::
    (MonadIO m) =>
    T.Text ->                               -- atom_name
    m Atom
atomInternStaticString atom_name = liftIO $ do
    atom_name' <- textToCString atom_name
    result <- gdk_atom_intern_static_string atom_name'
    checkUnexpectedReturnNULL "gdk_atom_intern_static_string" result
    -- XXX Wrapping a foreign struct/union with no known destructor, leak?
    result' <- (\x -> Atom <$> newForeignPtr_ x) result
    freeMem atom_name'
    return result'


-- function gdk_atom_intern
-- Args : [Arg {argName = "atom_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "only_if_exists", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "atom_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "only_if_exists", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Atom"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_atom_intern" gdk_atom_intern :: 
    CString ->                              -- atom_name : TBasicType TUTF8
    CInt ->                                 -- only_if_exists : TBasicType TBoolean
    IO (Ptr Atom)


atomIntern ::
    (MonadIO m) =>
    T.Text ->                               -- atom_name
    Bool ->                                 -- only_if_exists
    m Atom
atomIntern atom_name only_if_exists = liftIO $ do
    atom_name' <- textToCString atom_name
    let only_if_exists' = (fromIntegral . fromEnum) only_if_exists
    result <- gdk_atom_intern atom_name' only_if_exists'
    checkUnexpectedReturnNULL "gdk_atom_intern" result
    -- XXX Wrapping a foreign struct/union with no known destructor, leak?
    result' <- (\x -> Atom <$> newForeignPtr_ x) result
    freeMem atom_name'
    return result'


-- function gdk_add_option_entries_libgtk_only
-- Args : [Arg {argName = "group", argType = TInterface "GLib" "OptionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "group", argType = TInterface "GLib" "OptionGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_add_option_entries_libgtk_only" gdk_add_option_entries_libgtk_only :: 
    Ptr GLib.OptionGroup ->                 -- group : TInterface "GLib" "OptionGroup"
    IO ()

{-# DEPRECATED addOptionEntriesLibgtkOnly ["(Since version 3.16)","This symbol was never meant to be used outside","  of GTK+"]#-}
addOptionEntriesLibgtkOnly ::
    (MonadIO m) =>
    GLib.OptionGroup ->                     -- group
    m ()
addOptionEntriesLibgtkOnly group = liftIO $ do
    let group' = unsafeManagedPtrGetPtr group
    gdk_add_option_entries_libgtk_only group'
    touchManagedPtr group
    return ()