{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.GdkX11.Objects.X11Monitor
    ( 

-- * Exported types
    X11Monitor(..)                          ,
    IsX11Monitor                            ,
    toX11Monitor                            ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [isValid]("GI.Gdk.Objects.Monitor#g:method:isValid"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getConnector]("GI.Gdk.Objects.Monitor#g:method:getConnector"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getDescription]("GI.Gdk.Objects.Monitor#g:method:getDescription"), [getDisplay]("GI.Gdk.Objects.Monitor#g:method:getDisplay"), [getGeometry]("GI.Gdk.Objects.Monitor#g:method:getGeometry"), [getHeightMm]("GI.Gdk.Objects.Monitor#g:method:getHeightMm"), [getManufacturer]("GI.Gdk.Objects.Monitor#g:method:getManufacturer"), [getModel]("GI.Gdk.Objects.Monitor#g:method:getModel"), [getOutput]("GI.GdkX11.Objects.X11Monitor#g:method:getOutput"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getRefreshRate]("GI.Gdk.Objects.Monitor#g:method:getRefreshRate"), [getScale]("GI.Gdk.Objects.Monitor#g:method:getScale"), [getScaleFactor]("GI.Gdk.Objects.Monitor#g:method:getScaleFactor"), [getSubpixelLayout]("GI.Gdk.Objects.Monitor#g:method:getSubpixelLayout"), [getWidthMm]("GI.Gdk.Objects.Monitor#g:method:getWidthMm"), [getWorkarea]("GI.GdkX11.Objects.X11Monitor#g:method:getWorkarea").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveX11MonitorMethod                 ,
#endif

-- ** getOutput #method:getOutput#

#if defined(ENABLE_OVERLOADING)
    X11MonitorGetOutputMethodInfo           ,
#endif
    x11MonitorGetOutput                     ,


-- ** getWorkarea #method:getWorkarea#

#if defined(ENABLE_OVERLOADING)
    X11MonitorGetWorkareaMethodInfo         ,
#endif
    x11MonitorGetWorkarea                   ,




    ) where

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

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gdk.Objects.Monitor as Gdk.Monitor
import qualified GI.Gdk.Structs.Rectangle as Gdk.Rectangle

#else
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gdk.Objects.Monitor as Gdk.Monitor
import qualified GI.Gdk.Structs.Rectangle as Gdk.Rectangle

#endif

-- | Memory-managed wrapper type.
newtype X11Monitor = X11Monitor (SP.ManagedPtr X11Monitor)
    deriving (Eq)

instance SP.ManagedPtrNewtype X11Monitor where
    toManagedPtr (X11Monitor p) = p

foreign import ccall "gdk_x11_monitor_get_type"
    c_gdk_x11_monitor_get_type :: IO B.Types.GType

instance B.Types.TypedObject X11Monitor where
    glibType = c_gdk_x11_monitor_get_type

instance B.Types.GObject X11Monitor

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

instance O.HasParentTypes X11Monitor
type instance O.ParentTypes X11Monitor = '[Gdk.Monitor.Monitor, GObject.Object.Object]

-- | Cast to t'X11Monitor', for types for which this is known to be safe. For general casts, use 'Data.GI.Base.ManagedPtr.castTo'.
toX11Monitor :: (MIO.MonadIO m, IsX11Monitor o) => o -> m X11Monitor
toX11Monitor = MIO.liftIO . B.ManagedPtr.unsafeCastTo X11Monitor

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

#if defined(ENABLE_OVERLOADING)
type family ResolveX11MonitorMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveX11MonitorMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveX11MonitorMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveX11MonitorMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveX11MonitorMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveX11MonitorMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveX11MonitorMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveX11MonitorMethod "isValid" o = Gdk.Monitor.MonitorIsValidMethodInfo
    ResolveX11MonitorMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveX11MonitorMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveX11MonitorMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveX11MonitorMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveX11MonitorMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveX11MonitorMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveX11MonitorMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveX11MonitorMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveX11MonitorMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveX11MonitorMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveX11MonitorMethod "getConnector" o = Gdk.Monitor.MonitorGetConnectorMethodInfo
    ResolveX11MonitorMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveX11MonitorMethod "getDescription" o = Gdk.Monitor.MonitorGetDescriptionMethodInfo
    ResolveX11MonitorMethod "getDisplay" o = Gdk.Monitor.MonitorGetDisplayMethodInfo
    ResolveX11MonitorMethod "getGeometry" o = Gdk.Monitor.MonitorGetGeometryMethodInfo
    ResolveX11MonitorMethod "getHeightMm" o = Gdk.Monitor.MonitorGetHeightMmMethodInfo
    ResolveX11MonitorMethod "getManufacturer" o = Gdk.Monitor.MonitorGetManufacturerMethodInfo
    ResolveX11MonitorMethod "getModel" o = Gdk.Monitor.MonitorGetModelMethodInfo
    ResolveX11MonitorMethod "getOutput" o = X11MonitorGetOutputMethodInfo
    ResolveX11MonitorMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveX11MonitorMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveX11MonitorMethod "getRefreshRate" o = Gdk.Monitor.MonitorGetRefreshRateMethodInfo
    ResolveX11MonitorMethod "getScale" o = Gdk.Monitor.MonitorGetScaleMethodInfo
    ResolveX11MonitorMethod "getScaleFactor" o = Gdk.Monitor.MonitorGetScaleFactorMethodInfo
    ResolveX11MonitorMethod "getSubpixelLayout" o = Gdk.Monitor.MonitorGetSubpixelLayoutMethodInfo
    ResolveX11MonitorMethod "getWidthMm" o = Gdk.Monitor.MonitorGetWidthMmMethodInfo
    ResolveX11MonitorMethod "getWorkarea" o = X11MonitorGetWorkareaMethodInfo
    ResolveX11MonitorMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveX11MonitorMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveX11MonitorMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveX11MonitorMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveX11MonitorMethod t X11Monitor, O.OverloadedMethod info X11Monitor p) => OL.IsLabel t (X11Monitor -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveX11MonitorMethod t X11Monitor, O.OverloadedMethod info X11Monitor p, R.HasField t X11Monitor p) => R.HasField t X11Monitor p where
    getField = O.overloadedMethod @info

#endif

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

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList X11Monitor
type instance O.AttributeList X11Monitor = X11MonitorAttributeList
type X11MonitorAttributeList = ('[ '("connector", Gdk.Monitor.MonitorConnectorPropertyInfo), '("description", Gdk.Monitor.MonitorDescriptionPropertyInfo), '("display", Gdk.Monitor.MonitorDisplayPropertyInfo), '("geometry", Gdk.Monitor.MonitorGeometryPropertyInfo), '("heightMm", Gdk.Monitor.MonitorHeightMmPropertyInfo), '("manufacturer", Gdk.Monitor.MonitorManufacturerPropertyInfo), '("model", Gdk.Monitor.MonitorModelPropertyInfo), '("refreshRate", Gdk.Monitor.MonitorRefreshRatePropertyInfo), '("scale", Gdk.Monitor.MonitorScalePropertyInfo), '("scaleFactor", Gdk.Monitor.MonitorScaleFactorPropertyInfo), '("subpixelLayout", Gdk.Monitor.MonitorSubpixelLayoutPropertyInfo), '("valid", Gdk.Monitor.MonitorValidPropertyInfo), '("widthMm", Gdk.Monitor.MonitorWidthMmPropertyInfo)] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList X11Monitor = X11MonitorSignalList
type X11MonitorSignalList = ('[ '("invalidate", Gdk.Monitor.MonitorInvalidateSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method X11Monitor::get_output
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "monitor"
--           , argType =
--               TInterface Name { namespace = "GdkX11" , name = "X11Monitor" }
--           , argCType = Just "GdkMonitor*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkMonitor`" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TULong)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_x11_monitor_get_output" gdk_x11_monitor_get_output :: 
    Ptr X11Monitor ->                       -- monitor : TInterface (Name {namespace = "GdkX11", name = "X11Monitor"})
    IO FCT.CULong

{-# DEPRECATED x11MonitorGetOutput ["(Since version 4.18)"] #-}
-- | Returns the XID of the Output corresponding to /@monitor@/.
x11MonitorGetOutput ::
    (B.CallStack.HasCallStack, MonadIO m, IsX11Monitor a) =>
    a
    -- ^ /@monitor@/: a @GdkMonitor@
    -> m FCT.CULong
    -- ^ __Returns:__ the XID of /@monitor@/
x11MonitorGetOutput monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    result <- gdk_x11_monitor_get_output monitor'
    touchManagedPtr monitor
    return result

#if defined(ENABLE_OVERLOADING)
data X11MonitorGetOutputMethodInfo
instance (signature ~ (m FCT.CULong), MonadIO m, IsX11Monitor a) => O.OverloadedMethod X11MonitorGetOutputMethodInfo a signature where
    overloadedMethod = x11MonitorGetOutput

instance O.OverloadedMethodInfo X11MonitorGetOutputMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GdkX11.Objects.X11Monitor.x11MonitorGetOutput",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdkx11-4.0.8/docs/GI-GdkX11-Objects-X11Monitor.html#v:x11MonitorGetOutput"
        })


#endif

-- method X11Monitor::get_workarea
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "monitor"
--           , argType =
--               TInterface Name { namespace = "GdkX11" , name = "X11Monitor" }
--           , argCType = Just "GdkMonitor*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a `GdkMonitor`" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "workarea"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "Rectangle" }
--           , argCType = Just "GdkRectangle*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a `GdkRectangle` to be filled with the monitor workarea"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_x11_monitor_get_workarea" gdk_x11_monitor_get_workarea :: 
    Ptr X11Monitor ->                       -- monitor : TInterface (Name {namespace = "GdkX11", name = "X11Monitor"})
    Ptr Gdk.Rectangle.Rectangle ->          -- workarea : TInterface (Name {namespace = "Gdk", name = "Rectangle"})
    IO ()

{-# DEPRECATED x11MonitorGetWorkarea ["(Since version 4.18)"] #-}
-- | Retrieves the size and position of the “work area” on a monitor
-- within the display coordinate space.
-- 
-- The returned geometry is in ”application pixels”, not in ”device pixels”
-- (see 'GI.Gdk.Objects.Monitor.monitorGetScaleFactor').
x11MonitorGetWorkarea ::
    (B.CallStack.HasCallStack, MonadIO m, IsX11Monitor a) =>
    a
    -- ^ /@monitor@/: a @GdkMonitor@
    -> m (Gdk.Rectangle.Rectangle)
x11MonitorGetWorkarea monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    workarea <- SP.callocBoxedBytes 16 :: IO (Ptr Gdk.Rectangle.Rectangle)
    gdk_x11_monitor_get_workarea monitor' workarea
    workarea' <- (wrapBoxed Gdk.Rectangle.Rectangle) workarea
    touchManagedPtr monitor
    return workarea'

#if defined(ENABLE_OVERLOADING)
data X11MonitorGetWorkareaMethodInfo
instance (signature ~ (m (Gdk.Rectangle.Rectangle)), MonadIO m, IsX11Monitor a) => O.OverloadedMethod X11MonitorGetWorkareaMethodInfo a signature where
    overloadedMethod = x11MonitorGetWorkarea

instance O.OverloadedMethodInfo X11MonitorGetWorkareaMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GdkX11.Objects.X11Monitor.x11MonitorGetWorkarea",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdkx11-4.0.8/docs/GI-GdkX11-Objects-X11Monitor.html#v:x11MonitorGetWorkarea"
        })


#endif


