{- |
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.Objects.Display
    ( 

-- * Exported types
    Display(..)                             ,
    DisplayK                                ,
    toDisplay                               ,
    noDisplay                               ,


 -- * Methods
-- ** displayBeep
    displayBeep                             ,


-- ** displayClose
    displayClose                            ,


-- ** displayDeviceIsGrabbed
    displayDeviceIsGrabbed                  ,


-- ** displayFlush
    displayFlush                            ,


-- ** displayGetAppLaunchContext
    displayGetAppLaunchContext              ,


-- ** displayGetDefault
    displayGetDefault                       ,


-- ** displayGetDefaultCursorSize
    displayGetDefaultCursorSize             ,


-- ** displayGetDefaultGroup
    displayGetDefaultGroup                  ,


-- ** displayGetDefaultScreen
    displayGetDefaultScreen                 ,


-- ** displayGetDeviceManager
    displayGetDeviceManager                 ,


-- ** displayGetEvent
    displayGetEvent                         ,


-- ** displayGetMaximalCursorSize
    displayGetMaximalCursorSize             ,


-- ** displayGetNScreens
    displayGetNScreens                      ,


-- ** displayGetName
    displayGetName                          ,


-- ** displayGetPointer
    displayGetPointer                       ,


-- ** displayGetScreen
    displayGetScreen                        ,


-- ** displayGetWindowAtPointer
    displayGetWindowAtPointer               ,


-- ** displayHasPending
    displayHasPending                       ,


-- ** displayIsClosed
    displayIsClosed                         ,


-- ** displayKeyboardUngrab
    displayKeyboardUngrab                   ,


-- ** displayListDevices
    displayListDevices                      ,


-- ** displayNotifyStartupComplete
    displayNotifyStartupComplete            ,


-- ** displayOpen
    displayOpen                             ,


-- ** displayOpenDefaultLibgtkOnly
    displayOpenDefaultLibgtkOnly            ,


-- ** displayPeekEvent
    displayPeekEvent                        ,


-- ** displayPointerIsGrabbed
    displayPointerIsGrabbed                 ,


-- ** displayPointerUngrab
    displayPointerUngrab                    ,


-- ** displayPutEvent
    displayPutEvent                         ,


-- ** displayRequestSelectionNotification
    displayRequestSelectionNotification     ,


-- ** displaySetDoubleClickDistance
    displaySetDoubleClickDistance           ,


-- ** displaySetDoubleClickTime
    displaySetDoubleClickTime               ,


-- ** displayStoreClipboard
    displayStoreClipboard                   ,


-- ** displaySupportsClipboardPersistence
    displaySupportsClipboardPersistence     ,


-- ** displaySupportsComposite
    displaySupportsComposite                ,


-- ** displaySupportsCursorAlpha
    displaySupportsCursorAlpha              ,


-- ** displaySupportsCursorColor
    displaySupportsCursorColor              ,


-- ** displaySupportsInputShapes
    displaySupportsInputShapes              ,


-- ** displaySupportsSelectionNotification
    displaySupportsSelectionNotification    ,


-- ** displaySupportsShapes
    displaySupportsShapes                   ,


-- ** displaySync
    displaySync                             ,


-- ** displayWarpPointer
    displayWarpPointer                      ,




 -- * Signals
-- ** Closed
    DisplayClosedCallback                   ,
    DisplayClosedCallbackC                  ,
    DisplayClosedSignalInfo                 ,
    afterDisplayClosed                      ,
    displayClosedCallbackWrapper            ,
    displayClosedClosure                    ,
    mkDisplayClosedCallback                 ,
    noDisplayClosedCallback                 ,
    onDisplayClosed                         ,


-- ** Opened
    DisplayOpenedCallback                   ,
    DisplayOpenedCallbackC                  ,
    DisplayOpenedSignalInfo                 ,
    afterDisplayOpened                      ,
    displayOpenedCallbackWrapper            ,
    displayOpenedClosure                    ,
    mkDisplayOpenedCallback                 ,
    noDisplayOpenedCallback                 ,
    onDisplayOpened                         ,




    ) 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.GObject as GObject

newtype Display = Display (ForeignPtr Display)
foreign import ccall "gdk_display_get_type"
    c_gdk_display_get_type :: IO GType

type instance ParentTypes Display = DisplayParentTypes
type DisplayParentTypes = '[GObject.Object]

instance GObject Display where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gdk_display_get_type
    

class GObject o => DisplayK o
instance (GObject o, IsDescendantOf Display o) => DisplayK o

toDisplay :: DisplayK o => o -> IO Display
toDisplay = unsafeCastTo Display

noDisplay :: Maybe Display
noDisplay = Nothing

-- signal Display::closed
type DisplayClosedCallback =
    Bool ->
    IO ()

noDisplayClosedCallback :: Maybe DisplayClosedCallback
noDisplayClosedCallback = Nothing

type DisplayClosedCallbackC =
    Ptr () ->                               -- object
    CInt ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkDisplayClosedCallback :: DisplayClosedCallbackC -> IO (FunPtr DisplayClosedCallbackC)

displayClosedClosure :: DisplayClosedCallback -> IO Closure
displayClosedClosure cb = newCClosure =<< mkDisplayClosedCallback wrapped
    where wrapped = displayClosedCallbackWrapper cb

displayClosedCallbackWrapper ::
    DisplayClosedCallback ->
    Ptr () ->
    CInt ->
    Ptr () ->
    IO ()
displayClosedCallbackWrapper _cb _ is_error _ = do
    let is_error' = (/= 0) is_error
    _cb  is_error'

onDisplayClosed :: (GObject a, MonadIO m) => a -> DisplayClosedCallback -> m SignalHandlerId
onDisplayClosed obj cb = liftIO $ connectDisplayClosed obj cb SignalConnectBefore
afterDisplayClosed :: (GObject a, MonadIO m) => a -> DisplayClosedCallback -> m SignalHandlerId
afterDisplayClosed obj cb = connectDisplayClosed obj cb SignalConnectAfter

connectDisplayClosed :: (GObject a, MonadIO m) =>
                        a -> DisplayClosedCallback -> SignalConnectMode -> m SignalHandlerId
connectDisplayClosed obj cb after = liftIO $ do
    cb' <- mkDisplayClosedCallback (displayClosedCallbackWrapper cb)
    connectSignalFunPtr obj "closed" cb' after

-- signal Display::opened
type DisplayOpenedCallback =
    IO ()

noDisplayOpenedCallback :: Maybe DisplayOpenedCallback
noDisplayOpenedCallback = Nothing

type DisplayOpenedCallbackC =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkDisplayOpenedCallback :: DisplayOpenedCallbackC -> IO (FunPtr DisplayOpenedCallbackC)

displayOpenedClosure :: DisplayOpenedCallback -> IO Closure
displayOpenedClosure cb = newCClosure =<< mkDisplayOpenedCallback wrapped
    where wrapped = displayOpenedCallbackWrapper cb

displayOpenedCallbackWrapper ::
    DisplayOpenedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
displayOpenedCallbackWrapper _cb _ _ = do
    _cb 

onDisplayOpened :: (GObject a, MonadIO m) => a -> DisplayOpenedCallback -> m SignalHandlerId
onDisplayOpened obj cb = liftIO $ connectDisplayOpened obj cb SignalConnectBefore
afterDisplayOpened :: (GObject a, MonadIO m) => a -> DisplayOpenedCallback -> m SignalHandlerId
afterDisplayOpened obj cb = connectDisplayOpened obj cb SignalConnectAfter

connectDisplayOpened :: (GObject a, MonadIO m) =>
                        a -> DisplayOpenedCallback -> SignalConnectMode -> m SignalHandlerId
connectDisplayOpened obj cb after = liftIO $ do
    cb' <- mkDisplayOpenedCallback (displayOpenedCallbackWrapper cb)
    connectSignalFunPtr obj "opened" cb' after

type instance AttributeList Display = DisplayAttributeList
type DisplayAttributeList = ('[ ] :: [(Symbol, *)])

data DisplayClosedSignalInfo
instance SignalInfo DisplayClosedSignalInfo where
    type HaskellCallbackType DisplayClosedSignalInfo = DisplayClosedCallback
    connectSignal _ = connectDisplayClosed

data DisplayOpenedSignalInfo
instance SignalInfo DisplayOpenedSignalInfo where
    type HaskellCallbackType DisplayOpenedSignalInfo = DisplayOpenedCallback
    connectSignal _ = connectDisplayOpened

type instance SignalList Display = DisplaySignalList
type DisplaySignalList = ('[ '("closed", DisplayClosedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("opened", DisplayOpenedSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Display::beep
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_beep" gdk_display_beep :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO ()


displayBeep ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m ()
displayBeep _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gdk_display_beep _obj'
    touchManagedPtr _obj
    return ()

-- method Display::close
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_close" gdk_display_close :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO ()


displayClose ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m ()
displayClose _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gdk_display_close _obj'
    touchManagedPtr _obj
    return ()

-- method Display::device_is_grabbed
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", 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}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", 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}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_device_is_grabbed" gdk_display_device_is_grabbed :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Ptr Device ->                           -- device : TInterface "Gdk" "Device"
    IO CInt


displayDeviceIsGrabbed ::
    (MonadIO m, DisplayK a, DeviceK b) =>
    a ->                                    -- _obj
    b ->                                    -- device
    m Bool
displayDeviceIsGrabbed _obj device = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let device' = unsafeManagedPtrCastPtr device
    result <- gdk_display_device_is_grabbed _obj' device'
    let result' = (/= 0) result
    touchManagedPtr _obj
    touchManagedPtr device
    return result'

-- method Display::flush
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_flush" gdk_display_flush :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO ()


displayFlush ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m ()
displayFlush _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gdk_display_flush _obj'
    touchManagedPtr _obj
    return ()

-- method Display::get_app_launch_context
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "AppLaunchContext"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_get_app_launch_context" gdk_display_get_app_launch_context :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO (Ptr AppLaunchContext)


displayGetAppLaunchContext ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m AppLaunchContext
displayGetAppLaunchContext _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_get_app_launch_context _obj'
    checkUnexpectedReturnNULL "gdk_display_get_app_launch_context" result
    result' <- (wrapObject AppLaunchContext) result
    touchManagedPtr _obj
    return result'

-- method Display::get_default_cursor_size
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_get_default_cursor_size" gdk_display_get_default_cursor_size :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO Word32


displayGetDefaultCursorSize ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Word32
displayGetDefaultCursorSize _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_get_default_cursor_size _obj'
    touchManagedPtr _obj
    return result

-- method Display::get_default_group
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", 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_display_get_default_group" gdk_display_get_default_group :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO (Ptr Window)


displayGetDefaultGroup ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Window
displayGetDefaultGroup _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_get_default_group _obj'
    checkUnexpectedReturnNULL "gdk_display_get_default_group" result
    result' <- (newObject Window) result
    touchManagedPtr _obj
    return result'

-- method Display::get_default_screen
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Screen"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_get_default_screen" gdk_display_get_default_screen :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO (Ptr Screen)


displayGetDefaultScreen ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Screen
displayGetDefaultScreen _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_get_default_screen _obj'
    checkUnexpectedReturnNULL "gdk_display_get_default_screen" result
    result' <- (newObject Screen) result
    touchManagedPtr _obj
    return result'

-- method Display::get_device_manager
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "DeviceManager"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_get_device_manager" gdk_display_get_device_manager :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO (Ptr DeviceManager)


displayGetDeviceManager ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m DeviceManager
displayGetDeviceManager _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_get_device_manager _obj'
    checkUnexpectedReturnNULL "gdk_display_get_device_manager" result
    result' <- (newObject DeviceManager) result
    touchManagedPtr _obj
    return result'

-- method Display::get_event
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Event"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_get_event" gdk_display_get_event :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO (Ptr Event)


displayGetEvent ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Event
displayGetEvent _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_get_event _obj'
    checkUnexpectedReturnNULL "gdk_display_get_event" result
    result' <- (wrapBoxed Event) result
    touchManagedPtr _obj
    return result'

-- method Display::get_maximal_cursor_size
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TUInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "height", argType = TBasicType TUInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_get_maximal_cursor_size" gdk_display_get_maximal_cursor_size :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Ptr Word32 ->                           -- width : TBasicType TUInt32
    Ptr Word32 ->                           -- height : TBasicType TUInt32
    IO ()


displayGetMaximalCursorSize ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m (Word32,Word32)
displayGetMaximalCursorSize _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    width <- allocMem :: IO (Ptr Word32)
    height <- allocMem :: IO (Ptr Word32)
    gdk_display_get_maximal_cursor_size _obj' width height
    width' <- peek width
    height' <- peek height
    touchManagedPtr _obj
    freeMem width
    freeMem height
    return (width', height')

-- method Display::get_n_screens
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_get_n_screens" gdk_display_get_n_screens :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO Int32

{-# DEPRECATED displayGetNScreens ["(Since version 3.10)","The number of screens is always 1."]#-}
displayGetNScreens ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Int32
displayGetNScreens _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_get_n_screens _obj'
    touchManagedPtr _obj
    return result

-- method Display::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_get_name" gdk_display_get_name :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO CString


displayGetName ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m T.Text
displayGetName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_get_name _obj'
    checkUnexpectedReturnNULL "gdk_display_get_name" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method Display::get_pointer
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "screen", argType = TInterface "Gdk" "Screen", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "y", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "mask", argType = TInterface "Gdk" "ModifierType", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_get_pointer" gdk_display_get_pointer :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Ptr (Ptr Screen) ->                     -- screen : TInterface "Gdk" "Screen"
    Ptr Int32 ->                            -- x : TBasicType TInt32
    Ptr Int32 ->                            -- y : TBasicType TInt32
    Ptr CUInt ->                            -- mask : TInterface "Gdk" "ModifierType"
    IO ()

{-# DEPRECATED displayGetPointer ["(Since version 3.0)","Use gdk_device_get_position() instead."]#-}
displayGetPointer ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m (Screen,Int32,Int32,[ModifierType])
displayGetPointer _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    screen <- allocMem :: IO (Ptr (Ptr Screen))
    x <- allocMem :: IO (Ptr Int32)
    y <- allocMem :: IO (Ptr Int32)
    mask <- allocMem :: IO (Ptr CUInt)
    gdk_display_get_pointer _obj' screen x y mask
    screen' <- peek screen
    screen'' <- (newObject Screen) screen'
    x' <- peek x
    y' <- peek y
    mask' <- peek mask
    let mask'' = wordToGFlags mask'
    touchManagedPtr _obj
    freeMem screen
    freeMem x
    freeMem y
    freeMem mask
    return (screen'', x', y', mask'')

-- method Display::get_screen
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "screen_num", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "screen_num", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Screen"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_get_screen" gdk_display_get_screen :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Int32 ->                                -- screen_num : TBasicType TInt32
    IO (Ptr Screen)


displayGetScreen ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- screen_num
    m Screen
displayGetScreen _obj screen_num = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_get_screen _obj' screen_num
    checkUnexpectedReturnNULL "gdk_display_get_screen" result
    result' <- (newObject Screen) result
    touchManagedPtr _obj
    return result'

-- method Display::get_window_at_pointer
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "win_x", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "win_y", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", 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_display_get_window_at_pointer" gdk_display_get_window_at_pointer :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Ptr Int32 ->                            -- win_x : TBasicType TInt32
    Ptr Int32 ->                            -- win_y : TBasicType TInt32
    IO (Ptr Window)

{-# DEPRECATED displayGetWindowAtPointer ["(Since version 3.0)","Use gdk_device_get_window_at_position() instead."]#-}
displayGetWindowAtPointer ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m (Window,Int32,Int32)
displayGetWindowAtPointer _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    win_x <- allocMem :: IO (Ptr Int32)
    win_y <- allocMem :: IO (Ptr Int32)
    result <- gdk_display_get_window_at_pointer _obj' win_x win_y
    checkUnexpectedReturnNULL "gdk_display_get_window_at_pointer" result
    result' <- (newObject Window) result
    win_x' <- peek win_x
    win_y' <- peek win_y
    touchManagedPtr _obj
    freeMem win_x
    freeMem win_y
    return (result', win_x', win_y')

-- method Display::has_pending
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_has_pending" gdk_display_has_pending :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO CInt


displayHasPending ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Bool
displayHasPending _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_has_pending _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Display::is_closed
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_is_closed" gdk_display_is_closed :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO CInt


displayIsClosed ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Bool
displayIsClosed _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_is_closed _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Display::keyboard_ungrab
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", 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 = "_obj", argType = TInterface "Gdk" "Display", 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_display_keyboard_ungrab" gdk_display_keyboard_ungrab :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()

{-# DEPRECATED displayKeyboardUngrab ["(Since version 3.0)","Use gdk_device_ungrab(), together with gdk_device_grab()","            instead."]#-}
displayKeyboardUngrab ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- time_
    m ()
displayKeyboardUngrab _obj time_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gdk_display_keyboard_ungrab _obj' time_
    touchManagedPtr _obj
    return ()

-- method Display::list_devices
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Gdk" "Device")
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_list_devices" gdk_display_list_devices :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO (Ptr (GList (Ptr Device)))

{-# DEPRECATED displayListDevices ["(Since version 3.0)","Use gdk_device_manager_list_devices() instead."]#-}
displayListDevices ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m [Device]
displayListDevices _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_list_devices _obj'
    checkUnexpectedReturnNULL "gdk_display_list_devices" result
    result' <- unpackGList result
    result'' <- mapM (newObject Device) result'
    touchManagedPtr _obj
    return result''

-- method Display::notify_startup_complete
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "startup_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},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_display_notify_startup_complete" gdk_display_notify_startup_complete :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    CString ->                              -- startup_id : TBasicType TUTF8
    IO ()


displayNotifyStartupComplete ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- startup_id
    m ()
displayNotifyStartupComplete _obj startup_id = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    startup_id' <- textToCString startup_id
    gdk_display_notify_startup_complete _obj' startup_id'
    touchManagedPtr _obj
    freeMem startup_id'
    return ()

-- method Display::peek_event
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Event"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_peek_event" gdk_display_peek_event :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO (Ptr Event)


displayPeekEvent ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Event
displayPeekEvent _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_peek_event _obj'
    checkUnexpectedReturnNULL "gdk_display_peek_event" result
    result' <- (wrapBoxed Event) result
    touchManagedPtr _obj
    return result'

-- method Display::pointer_is_grabbed
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_pointer_is_grabbed" gdk_display_pointer_is_grabbed :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO CInt

{-# DEPRECATED displayPointerIsGrabbed ["(Since version 3.0)","Use gdk_display_device_is_grabbed() instead."]#-}
displayPointerIsGrabbed ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Bool
displayPointerIsGrabbed _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_pointer_is_grabbed _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Display::pointer_ungrab
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", 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 = "_obj", argType = TInterface "Gdk" "Display", 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_display_pointer_ungrab" gdk_display_pointer_ungrab :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Word32 ->                               -- time_ : TBasicType TUInt32
    IO ()

{-# DEPRECATED displayPointerUngrab ["(Since version 3.0)","Use gdk_device_ungrab(), together with gdk_device_grab()","            instead."]#-}
displayPointerUngrab ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- time_
    m ()
displayPointerUngrab _obj time_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gdk_display_pointer_ungrab _obj' time_
    touchManagedPtr _obj
    return ()

-- method Display::put_event
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_put_event" gdk_display_put_event :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Ptr Event ->                            -- event : TInterface "Gdk" "Event"
    IO ()


displayPutEvent ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    Event ->                                -- event
    m ()
displayPutEvent _obj event = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let event' = unsafeManagedPtrGetPtr event
    gdk_display_put_event _obj' event'
    touchManagedPtr _obj
    touchManagedPtr event
    return ()

-- method Display::request_selection_notification
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", 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 = "_obj", 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 : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_request_selection_notification" gdk_display_request_selection_notification :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Ptr Atom ->                             -- selection : TInterface "Gdk" "Atom"
    IO CInt


displayRequestSelectionNotification ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    Atom ->                                 -- selection
    m Bool
displayRequestSelectionNotification _obj selection = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let selection' = unsafeManagedPtrGetPtr selection
    result <- gdk_display_request_selection_notification _obj' selection'
    let result' = (/= 0) result
    touchManagedPtr _obj
    touchManagedPtr selection
    return result'

-- method Display::set_double_click_distance
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "distance", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "distance", 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_display_set_double_click_distance" gdk_display_set_double_click_distance :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Word32 ->                               -- distance : TBasicType TUInt32
    IO ()


displaySetDoubleClickDistance ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- distance
    m ()
displaySetDoubleClickDistance _obj distance = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gdk_display_set_double_click_distance _obj' distance
    touchManagedPtr _obj
    return ()

-- method Display::set_double_click_time
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "msec", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},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_display_set_double_click_time" gdk_display_set_double_click_time :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Word32 ->                               -- msec : TBasicType TUInt32
    IO ()


displaySetDoubleClickTime ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- msec
    m ()
displaySetDoubleClickTime _obj msec = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gdk_display_set_double_click_time _obj' msec
    touchManagedPtr _obj
    return ()

-- method Display::store_clipboard
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "clipboard_window", argType = TInterface "Gdk" "Window", 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 = "targets", argType = TCArray False (-1) 4 (TInterface "Gdk" "Atom"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_targets", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "n_targets", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "clipboard_window", argType = TInterface "Gdk" "Window", 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 = "targets", argType = TCArray False (-1) 4 (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_display_store_clipboard" gdk_display_store_clipboard :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Ptr Window ->                           -- clipboard_window : TInterface "Gdk" "Window"
    Word32 ->                               -- time_ : TBasicType TUInt32
    Ptr (Ptr Atom) ->                       -- targets : TCArray False (-1) 4 (TInterface "Gdk" "Atom")
    Int32 ->                                -- n_targets : TBasicType TInt32
    IO ()


displayStoreClipboard ::
    (MonadIO m, DisplayK a, WindowK b) =>
    a ->                                    -- _obj
    b ->                                    -- clipboard_window
    Word32 ->                               -- time_
    [Atom] ->                               -- targets
    m ()
displayStoreClipboard _obj clipboard_window time_ targets = liftIO $ do
    let n_targets = fromIntegral $ length targets
    let _obj' = unsafeManagedPtrCastPtr _obj
    let clipboard_window' = unsafeManagedPtrCastPtr clipboard_window
    let targets' = map unsafeManagedPtrGetPtr targets
    targets'' <- packPtrArray targets'
    gdk_display_store_clipboard _obj' clipboard_window' time_ targets'' n_targets
    touchManagedPtr _obj
    touchManagedPtr clipboard_window
    mapM_ touchManagedPtr targets
    freeMem targets''
    return ()

-- method Display::supports_clipboard_persistence
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_supports_clipboard_persistence" gdk_display_supports_clipboard_persistence :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO CInt


displaySupportsClipboardPersistence ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Bool
displaySupportsClipboardPersistence _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_supports_clipboard_persistence _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Display::supports_composite
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_supports_composite" gdk_display_supports_composite :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO CInt

{-# DEPRECATED displaySupportsComposite ["(Since version 3.16)","Compositing is an outdated technology that","  only ever worked on X11."]#-}
displaySupportsComposite ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Bool
displaySupportsComposite _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_supports_composite _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Display::supports_cursor_alpha
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_supports_cursor_alpha" gdk_display_supports_cursor_alpha :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO CInt


displaySupportsCursorAlpha ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Bool
displaySupportsCursorAlpha _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_supports_cursor_alpha _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Display::supports_cursor_color
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_supports_cursor_color" gdk_display_supports_cursor_color :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO CInt


displaySupportsCursorColor ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Bool
displaySupportsCursorColor _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_supports_cursor_color _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Display::supports_input_shapes
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_supports_input_shapes" gdk_display_supports_input_shapes :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO CInt


displaySupportsInputShapes ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Bool
displaySupportsInputShapes _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_supports_input_shapes _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Display::supports_selection_notification
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_supports_selection_notification" gdk_display_supports_selection_notification :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO CInt


displaySupportsSelectionNotification ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Bool
displaySupportsSelectionNotification _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_supports_selection_notification _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Display::supports_shapes
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_supports_shapes" gdk_display_supports_shapes :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO CInt


displaySupportsShapes ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m Bool
displaySupportsShapes _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_display_supports_shapes _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Display::sync
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_sync" gdk_display_sync :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    IO ()


displaySync ::
    (MonadIO m, DisplayK a) =>
    a ->                                    -- _obj
    m ()
displaySync _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gdk_display_sync _obj'
    touchManagedPtr _obj
    return ()

-- method Display::warp_pointer
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", 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", 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}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "Display", 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", 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}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_warp_pointer" gdk_display_warp_pointer :: 
    Ptr Display ->                          -- _obj : TInterface "Gdk" "Display"
    Ptr Screen ->                           -- screen : TInterface "Gdk" "Screen"
    Int32 ->                                -- x : TBasicType TInt32
    Int32 ->                                -- y : TBasicType TInt32
    IO ()

{-# DEPRECATED displayWarpPointer ["(Since version 3.0)","Use gdk_device_warp() instead."]#-}
displayWarpPointer ::
    (MonadIO m, DisplayK a, ScreenK b) =>
    a ->                                    -- _obj
    b ->                                    -- screen
    Int32 ->                                -- x
    Int32 ->                                -- y
    m ()
displayWarpPointer _obj screen x y = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let screen' = unsafeManagedPtrCastPtr screen
    gdk_display_warp_pointer _obj' screen' x y
    touchManagedPtr _obj
    touchManagedPtr screen
    return ()

-- method Display::get_default
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gdk" "Display"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_get_default" gdk_display_get_default :: 
    IO (Ptr Display)


displayGetDefault ::
    (MonadIO m) =>
    m Display
displayGetDefault  = liftIO $ do
    result <- gdk_display_get_default
    checkUnexpectedReturnNULL "gdk_display_get_default" result
    result' <- (newObject Display) result
    return result'

-- method Display::open
-- method type : MemberFunction
-- Args : [Arg {argName = "display_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "display_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Display"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_open" gdk_display_open :: 
    CString ->                              -- display_name : TBasicType TUTF8
    IO (Ptr Display)


displayOpen ::
    (MonadIO m) =>
    T.Text ->                               -- display_name
    m Display
displayOpen display_name = liftIO $ do
    display_name' <- textToCString display_name
    result <- gdk_display_open display_name'
    checkUnexpectedReturnNULL "gdk_display_open" result
    result' <- (newObject Display) result
    freeMem display_name'
    return result'

-- method Display::open_default_libgtk_only
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gdk" "Display"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_open_default_libgtk_only" gdk_display_open_default_libgtk_only :: 
    IO (Ptr Display)

{-# DEPRECATED displayOpenDefaultLibgtkOnly ["(Since version 3.16)","This symbol was never meant to be used outside","  of GTK+"]#-}
displayOpenDefaultLibgtkOnly ::
    (MonadIO m) =>
    m Display
displayOpenDefaultLibgtkOnly  = liftIO $ do
    result <- gdk_display_open_default_libgtk_only
    checkUnexpectedReturnNULL "gdk_display_open_default_libgtk_only" result
    result' <- (newObject Display) result
    return result'