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

The purpose of the 'GI.Gdk.Objects.DisplayManager.DisplayManager' singleton object is to offer
notification when displays appear or disappear or the default display
changes.

You can use 'GI.Gdk.Objects.DisplayManager.displayManagerGet' to obtain the 'GI.Gdk.Objects.DisplayManager.DisplayManager'
singleton, but that should be rarely necessary. Typically, initializing
GTK+ opens a display that you can work with without ever accessing the
'GI.Gdk.Objects.DisplayManager.DisplayManager'.

The GDK library can be built with support for multiple backends.
The 'GI.Gdk.Objects.DisplayManager.DisplayManager' object determines which backend is used
at runtime.

When writing backend-specific code that is supposed to work with
multiple GDK backends, you have to consider both compile time and
runtime. At compile time, use the @/GDK_WINDOWING_X11/@, @/GDK_WINDOWING_WIN32/@
macros, etc. to find out which backends are present in the GDK library
you are building your application against. At runtime, use type-check
macros like @/GDK_IS_X11_DISPLAY()/@ to find out which backend is in use:

## Backend-specific code ## {@/backend/@-specific}


=== /C code/
>
>#ifdef GDK_WINDOWING_X11
>  if (GDK_IS_X11_DISPLAY (display))
>    {
>      // make X11-specific calls here
>    }
>  else
>#endif
>#ifdef GDK_WINDOWING_QUARTZ
>  if (GDK_IS_QUARTZ_DISPLAY (display))
>    {
>      // make Quartz-specific calls here
>    }
>  else
>#endif
>  g_error ("Unsupported GDK backend");

-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Gdk.Objects.DisplayManager
    (

-- * Exported types
    DisplayManager(..)                      ,
    IsDisplayManager                        ,
    toDisplayManager                        ,
    noDisplayManager                        ,


 -- * Methods
-- ** get #method:get#

    displayManagerGet                       ,


-- ** getDefaultDisplay #method:getDefaultDisplay#

#if ENABLE_OVERLOADING
    DisplayManagerGetDefaultDisplayMethodInfo,
#endif
    displayManagerGetDefaultDisplay         ,


-- ** listDisplays #method:listDisplays#

#if ENABLE_OVERLOADING
    DisplayManagerListDisplaysMethodInfo    ,
#endif
    displayManagerListDisplays              ,


-- ** openDisplay #method:openDisplay#

#if ENABLE_OVERLOADING
    DisplayManagerOpenDisplayMethodInfo     ,
#endif
    displayManagerOpenDisplay               ,


-- ** setDefaultDisplay #method:setDefaultDisplay#

#if ENABLE_OVERLOADING
    DisplayManagerSetDefaultDisplayMethodInfo,
#endif
    displayManagerSetDefaultDisplay         ,




 -- * Properties
-- ** defaultDisplay #attr:defaultDisplay#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DisplayManagerDefaultDisplayPropertyInfo,
#endif
    constructDisplayManagerDefaultDisplay   ,
#if ENABLE_OVERLOADING
    displayManagerDefaultDisplay            ,
#endif
    getDisplayManagerDefaultDisplay         ,
    setDisplayManagerDefaultDisplay         ,




 -- * Signals
-- ** displayOpened #signal:displayOpened#

    C_DisplayManagerDisplayOpenedCallback   ,
    DisplayManagerDisplayOpenedCallback     ,
#if ENABLE_OVERLOADING
    DisplayManagerDisplayOpenedSignalInfo   ,
#endif
    afterDisplayManagerDisplayOpened        ,
    genClosure_DisplayManagerDisplayOpened  ,
    mk_DisplayManagerDisplayOpenedCallback  ,
    noDisplayManagerDisplayOpenedCallback   ,
    onDisplayManagerDisplayOpened           ,
    wrap_DisplayManagerDisplayOpenedCallback,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gdk.Objects.Display as Gdk.Display

-- | Memory-managed wrapper type.
newtype DisplayManager = DisplayManager (ManagedPtr DisplayManager)
foreign import ccall "gdk_display_manager_get_type"
    c_gdk_display_manager_get_type :: IO GType

instance GObject DisplayManager where
    gobjectType _ = c_gdk_display_manager_get_type


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

-- | Cast to `DisplayManager`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDisplayManager :: (MonadIO m, IsDisplayManager o) => o -> m DisplayManager
toDisplayManager = liftIO . unsafeCastTo DisplayManager

-- | A convenience alias for `Nothing` :: `Maybe` `DisplayManager`.
noDisplayManager :: Maybe DisplayManager
noDisplayManager = Nothing

#if ENABLE_OVERLOADING
type family ResolveDisplayManagerMethod (t :: Symbol) (o :: *) :: * where
    ResolveDisplayManagerMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDisplayManagerMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDisplayManagerMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDisplayManagerMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDisplayManagerMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveDisplayManagerMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDisplayManagerMethod "listDisplays" o = DisplayManagerListDisplaysMethodInfo
    ResolveDisplayManagerMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDisplayManagerMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDisplayManagerMethod "openDisplay" o = DisplayManagerOpenDisplayMethodInfo
    ResolveDisplayManagerMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDisplayManagerMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDisplayManagerMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDisplayManagerMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDisplayManagerMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDisplayManagerMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDisplayManagerMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDisplayManagerMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDisplayManagerMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDisplayManagerMethod "getDefaultDisplay" o = DisplayManagerGetDefaultDisplayMethodInfo
    ResolveDisplayManagerMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDisplayManagerMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDisplayManagerMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDisplayManagerMethod "setDefaultDisplay" o = DisplayManagerSetDefaultDisplayMethodInfo
    ResolveDisplayManagerMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDisplayManagerMethod l o = O.MethodResolutionFailed l o

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

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

#endif

-- signal DisplayManager::display-opened
{- |
The ::display-opened signal is emitted when a display is opened.

/Since: 2.2/
-}
type DisplayManagerDisplayOpenedCallback =
    Gdk.Display.Display
    {- ^ /@display@/: the opened display -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DisplayManagerDisplayOpenedCallback`@.
noDisplayManagerDisplayOpenedCallback :: Maybe DisplayManagerDisplayOpenedCallback
noDisplayManagerDisplayOpenedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_DisplayManagerDisplayOpenedCallback =
    Ptr () ->                               -- object
    Ptr Gdk.Display.Display ->
    Ptr () ->                               -- user_data
    IO ()

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

-- | Wrap the callback into a `Closure`.
genClosure_DisplayManagerDisplayOpened :: DisplayManagerDisplayOpenedCallback -> IO Closure
genClosure_DisplayManagerDisplayOpened cb = do
    let cb' = wrap_DisplayManagerDisplayOpenedCallback cb
    mk_DisplayManagerDisplayOpenedCallback cb' >>= newCClosure


-- | Wrap a `DisplayManagerDisplayOpenedCallback` into a `C_DisplayManagerDisplayOpenedCallback`.
wrap_DisplayManagerDisplayOpenedCallback ::
    DisplayManagerDisplayOpenedCallback ->
    C_DisplayManagerDisplayOpenedCallback
wrap_DisplayManagerDisplayOpenedCallback _cb _ display _ = do
    display' <- (newObject Gdk.Display.Display) display
    _cb  display'


{- |
Connect a signal handler for the “@display-opened@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' displayManager #displayOpened callback
@
-}
onDisplayManagerDisplayOpened :: (IsDisplayManager a, MonadIO m) => a -> DisplayManagerDisplayOpenedCallback -> m SignalHandlerId
onDisplayManagerDisplayOpened obj cb = liftIO $ do
    let cb' = wrap_DisplayManagerDisplayOpenedCallback cb
    cb'' <- mk_DisplayManagerDisplayOpenedCallback cb'
    connectSignalFunPtr obj "display-opened" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@display-opened@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' displayManager #displayOpened callback
@
-}
afterDisplayManagerDisplayOpened :: (IsDisplayManager a, MonadIO m) => a -> DisplayManagerDisplayOpenedCallback -> m SignalHandlerId
afterDisplayManagerDisplayOpened obj cb = liftIO $ do
    let cb' = wrap_DisplayManagerDisplayOpenedCallback cb
    cb'' <- mk_DisplayManagerDisplayOpenedCallback cb'
    connectSignalFunPtr obj "display-opened" cb'' SignalConnectAfter


-- VVV Prop "default-display"
   -- Type: TInterface (Name {namespace = "Gdk", name = "Display"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just True,Just False)

{- |
Get the value of the “@default-display@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' displayManager #defaultDisplay
@
-}
getDisplayManagerDefaultDisplay :: (MonadIO m, IsDisplayManager o) => o -> m (Maybe Gdk.Display.Display)
getDisplayManagerDefaultDisplay obj = liftIO $ getObjectPropertyObject obj "default-display" Gdk.Display.Display

{- |
Set the value of the “@default-display@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' displayManager [ #defaultDisplay 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDisplayManagerDefaultDisplay :: (MonadIO m, IsDisplayManager o, Gdk.Display.IsDisplay a) => o -> a -> m ()
setDisplayManagerDefaultDisplay obj val = liftIO $ setObjectPropertyObject obj "default-display" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@default-display@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDisplayManagerDefaultDisplay :: (IsDisplayManager o, Gdk.Display.IsDisplay a) => a -> IO (GValueConstruct o)
constructDisplayManagerDefaultDisplay val = constructObjectPropertyObject "default-display" (Just val)

#if ENABLE_OVERLOADING
data DisplayManagerDefaultDisplayPropertyInfo
instance AttrInfo DisplayManagerDefaultDisplayPropertyInfo where
    type AttrAllowedOps DisplayManagerDefaultDisplayPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DisplayManagerDefaultDisplayPropertyInfo = Gdk.Display.IsDisplay
    type AttrBaseTypeConstraint DisplayManagerDefaultDisplayPropertyInfo = IsDisplayManager
    type AttrGetType DisplayManagerDefaultDisplayPropertyInfo = (Maybe Gdk.Display.Display)
    type AttrLabel DisplayManagerDefaultDisplayPropertyInfo = "default-display"
    type AttrOrigin DisplayManagerDefaultDisplayPropertyInfo = DisplayManager
    attrGet _ = getDisplayManagerDefaultDisplay
    attrSet _ = setDisplayManagerDefaultDisplay
    attrConstruct _ = constructDisplayManagerDefaultDisplay
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList DisplayManager
type instance O.AttributeList DisplayManager = DisplayManagerAttributeList
type DisplayManagerAttributeList = ('[ '("defaultDisplay", DisplayManagerDefaultDisplayPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
displayManagerDefaultDisplay :: AttrLabelProxy "defaultDisplay"
displayManagerDefaultDisplay = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
data DisplayManagerDisplayOpenedSignalInfo
instance SignalInfo DisplayManagerDisplayOpenedSignalInfo where
    type HaskellCallbackType DisplayManagerDisplayOpenedSignalInfo = DisplayManagerDisplayOpenedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_DisplayManagerDisplayOpenedCallback cb
        cb'' <- mk_DisplayManagerDisplayOpenedCallback cb'
        connectSignalFunPtr obj "display-opened" cb'' connectMode

type instance O.SignalList DisplayManager = DisplayManagerSignalList
type DisplayManagerSignalList = ('[ '("displayOpened", DisplayManagerDisplayOpenedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method DisplayManager::get_default_display
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gdk", name = "DisplayManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDisplayManager", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gdk", name = "Display"}))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_manager_get_default_display" gdk_display_manager_get_default_display ::
    Ptr DisplayManager ->                   -- manager : TInterface (Name {namespace = "Gdk", name = "DisplayManager"})
    IO (Ptr Gdk.Display.Display)

{- |
Gets the default 'GI.Gdk.Objects.Display.Display'.

/Since: 2.2/
-}
displayManagerGetDefaultDisplay ::
    (B.CallStack.HasCallStack, MonadIO m, IsDisplayManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gdk.Objects.DisplayManager.DisplayManager' -}
    -> m (Maybe Gdk.Display.Display)
    {- ^ __Returns:__ a 'GI.Gdk.Objects.Display.Display', or 'Nothing' if
    there is no default display. -}
displayManagerGetDefaultDisplay manager = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    result <- gdk_display_manager_get_default_display manager'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Gdk.Display.Display) result'
        return result''
    touchManagedPtr manager
    return maybeResult

#if ENABLE_OVERLOADING
data DisplayManagerGetDefaultDisplayMethodInfo
instance (signature ~ (m (Maybe Gdk.Display.Display)), MonadIO m, IsDisplayManager a) => O.MethodInfo DisplayManagerGetDefaultDisplayMethodInfo a signature where
    overloadedMethod _ = displayManagerGetDefaultDisplay

#endif

-- method DisplayManager::list_displays
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gdk", name = "DisplayManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDisplayManager", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGSList (TInterface (Name {namespace = "Gdk", name = "Display"})))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_manager_list_displays" gdk_display_manager_list_displays ::
    Ptr DisplayManager ->                   -- manager : TInterface (Name {namespace = "Gdk", name = "DisplayManager"})
    IO (Ptr (GSList (Ptr Gdk.Display.Display)))

{- |
List all currently open displays.

/Since: 2.2/
-}
displayManagerListDisplays ::
    (B.CallStack.HasCallStack, MonadIO m, IsDisplayManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gdk.Objects.DisplayManager.DisplayManager' -}
    -> m [Gdk.Display.Display]
    {- ^ __Returns:__ a newly
    allocated 'GI.GLib.Structs.SList.SList' of 'GI.Gdk.Objects.Display.Display' objects. Free with @/g_slist_free()/@
    when you are done with it. -}
displayManagerListDisplays manager = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    result <- gdk_display_manager_list_displays manager'
    result' <- unpackGSList result
    result'' <- mapM (newObject Gdk.Display.Display) result'
    g_slist_free result
    touchManagedPtr manager
    return result''

#if ENABLE_OVERLOADING
data DisplayManagerListDisplaysMethodInfo
instance (signature ~ (m [Gdk.Display.Display]), MonadIO m, IsDisplayManager a) => O.MethodInfo DisplayManagerListDisplaysMethodInfo a signature where
    overloadedMethod _ = displayManagerListDisplays

#endif

-- method DisplayManager::open_display
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gdk", name = "DisplayManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDisplayManager", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the display to open", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gdk", name = "Display"}))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_manager_open_display" gdk_display_manager_open_display ::
    Ptr DisplayManager ->                   -- manager : TInterface (Name {namespace = "Gdk", name = "DisplayManager"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr Gdk.Display.Display)

{- |
Opens a display.

/Since: 3.0/
-}
displayManagerOpenDisplay ::
    (B.CallStack.HasCallStack, MonadIO m, IsDisplayManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gdk.Objects.DisplayManager.DisplayManager' -}
    -> T.Text
    {- ^ /@name@/: the name of the display to open -}
    -> m (Maybe Gdk.Display.Display)
    {- ^ __Returns:__ a 'GI.Gdk.Objects.Display.Display', or 'Nothing' if the
    display could not be opened -}
displayManagerOpenDisplay manager name = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    name' <- textToCString name
    result <- gdk_display_manager_open_display manager' name'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Gdk.Display.Display) result'
        return result''
    touchManagedPtr manager
    freeMem name'
    return maybeResult

#if ENABLE_OVERLOADING
data DisplayManagerOpenDisplayMethodInfo
instance (signature ~ (T.Text -> m (Maybe Gdk.Display.Display)), MonadIO m, IsDisplayManager a) => O.MethodInfo DisplayManagerOpenDisplayMethodInfo a signature where
    overloadedMethod _ = displayManagerOpenDisplay

#endif

-- method DisplayManager::set_default_display
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gdk", name = "DisplayManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDisplayManager", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "display", argType = TInterface (Name {namespace = "Gdk", name = "Display"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDisplay", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_manager_set_default_display" gdk_display_manager_set_default_display ::
    Ptr DisplayManager ->                   -- manager : TInterface (Name {namespace = "Gdk", name = "DisplayManager"})
    Ptr Gdk.Display.Display ->              -- display : TInterface (Name {namespace = "Gdk", name = "Display"})
    IO ()

{- |
Sets /@display@/ as the default display.

/Since: 2.2/
-}
displayManagerSetDefaultDisplay ::
    (B.CallStack.HasCallStack, MonadIO m, IsDisplayManager a, Gdk.Display.IsDisplay b) =>
    a
    {- ^ /@manager@/: a 'GI.Gdk.Objects.DisplayManager.DisplayManager' -}
    -> b
    {- ^ /@display@/: a 'GI.Gdk.Objects.Display.Display' -}
    -> m ()
displayManagerSetDefaultDisplay manager display = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    display' <- unsafeManagedPtrCastPtr display
    gdk_display_manager_set_default_display manager' display'
    touchManagedPtr manager
    touchManagedPtr display
    return ()

#if ENABLE_OVERLOADING
data DisplayManagerSetDefaultDisplayMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDisplayManager a, Gdk.Display.IsDisplay b) => O.MethodInfo DisplayManagerSetDefaultDisplayMethodInfo a signature where
    overloadedMethod _ = displayManagerSetDefaultDisplay

#endif

-- method DisplayManager::get
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gdk", name = "DisplayManager"}))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_display_manager_get" gdk_display_manager_get ::
    IO (Ptr DisplayManager)

{- |
Gets the singleton 'GI.Gdk.Objects.DisplayManager.DisplayManager' object.

When called for the first time, this function consults the
@GDK_BACKEND@ environment variable to find out which
of the supported GDK backends to use (in case GDK has been compiled
with multiple backends). Applications can use 'GI.Gdk.Functions.setAllowedBackends'
to limit what backends can be used.

/Since: 2.2/
-}
displayManagerGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m DisplayManager
    {- ^ __Returns:__ The global 'GI.Gdk.Objects.DisplayManager.DisplayManager' singleton;
    'GI.Gdk.Functions.parseArgs', 'GI.Gdk.Functions.init', or 'GI.Gdk.Functions.initCheck' must have
    been called first. -}
displayManagerGet  = liftIO $ do
    result <- gdk_display_manager_get
    checkUnexpectedReturnNULL "displayManagerGet" result
    result' <- (newObject DisplayManager) result
    return result'

#if ENABLE_OVERLOADING
#endif