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

The 'GI.Wnck.Objects.Workspace.Workspace' struct contains only private fields and should not be
directly accessed.
-}

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

module GI.Wnck.Objects.Workspace
    (

-- * Exported types
    Workspace(..)                           ,
    IsWorkspace                             ,
    toWorkspace                             ,
    noWorkspace                             ,


 -- * Methods
-- ** activate #method:activate#

#if ENABLE_OVERLOADING
    WorkspaceActivateMethodInfo             ,
#endif
    workspaceActivate                       ,


-- ** changeName #method:changeName#

#if ENABLE_OVERLOADING
    WorkspaceChangeNameMethodInfo           ,
#endif
    workspaceChangeName                     ,


-- ** getHeight #method:getHeight#

#if ENABLE_OVERLOADING
    WorkspaceGetHeightMethodInfo            ,
#endif
    workspaceGetHeight                      ,


-- ** getLayoutColumn #method:getLayoutColumn#

#if ENABLE_OVERLOADING
    WorkspaceGetLayoutColumnMethodInfo      ,
#endif
    workspaceGetLayoutColumn                ,


-- ** getLayoutRow #method:getLayoutRow#

#if ENABLE_OVERLOADING
    WorkspaceGetLayoutRowMethodInfo         ,
#endif
    workspaceGetLayoutRow                   ,


-- ** getName #method:getName#

#if ENABLE_OVERLOADING
    WorkspaceGetNameMethodInfo              ,
#endif
    workspaceGetName                        ,


-- ** getNeighbor #method:getNeighbor#

#if ENABLE_OVERLOADING
    WorkspaceGetNeighborMethodInfo          ,
#endif
    workspaceGetNeighbor                    ,


-- ** getNumber #method:getNumber#

#if ENABLE_OVERLOADING
    WorkspaceGetNumberMethodInfo            ,
#endif
    workspaceGetNumber                      ,


-- ** getScreen #method:getScreen#

#if ENABLE_OVERLOADING
    WorkspaceGetScreenMethodInfo            ,
#endif
    workspaceGetScreen                      ,


-- ** getViewportX #method:getViewportX#

#if ENABLE_OVERLOADING
    WorkspaceGetViewportXMethodInfo         ,
#endif
    workspaceGetViewportX                   ,


-- ** getViewportY #method:getViewportY#

#if ENABLE_OVERLOADING
    WorkspaceGetViewportYMethodInfo         ,
#endif
    workspaceGetViewportY                   ,


-- ** getWidth #method:getWidth#

#if ENABLE_OVERLOADING
    WorkspaceGetWidthMethodInfo             ,
#endif
    workspaceGetWidth                       ,


-- ** isVirtual #method:isVirtual#

#if ENABLE_OVERLOADING
    WorkspaceIsVirtualMethodInfo            ,
#endif
    workspaceIsVirtual                      ,




 -- * Signals
-- ** nameChanged #signal:nameChanged#

    C_WorkspaceNameChangedCallback          ,
    WorkspaceNameChangedCallback            ,
#if ENABLE_OVERLOADING
    WorkspaceNameChangedSignalInfo          ,
#endif
    afterWorkspaceNameChanged               ,
    genClosure_WorkspaceNameChanged         ,
    mk_WorkspaceNameChangedCallback         ,
    noWorkspaceNameChangedCallback          ,
    onWorkspaceNameChanged                  ,
    wrap_WorkspaceNameChangedCallback       ,




    ) 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.GClosure as B.GClosure
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.GI.Base.Properties as B.Properties
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 GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Wnck.Enums as Wnck.Enums
import {-# SOURCE #-} qualified GI.Wnck.Objects.Screen as Wnck.Screen

-- | Memory-managed wrapper type.
newtype Workspace = Workspace (ManagedPtr Workspace)
foreign import ccall "wnck_workspace_get_type"
    c_wnck_workspace_get_type :: IO GType

instance GObject Workspace where
    gobjectType = c_wnck_workspace_get_type


-- | Type class for types which can be safely cast to `Workspace`, for instance with `toWorkspace`.
class (GObject o, O.IsDescendantOf Workspace o) => IsWorkspace o
instance (GObject o, O.IsDescendantOf Workspace o) => IsWorkspace o

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

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

-- | A convenience alias for `Nothing` :: `Maybe` `Workspace`.
noWorkspace :: Maybe Workspace
noWorkspace = Nothing

#if ENABLE_OVERLOADING
type family ResolveWorkspaceMethod (t :: Symbol) (o :: *) :: * where
    ResolveWorkspaceMethod "activate" o = WorkspaceActivateMethodInfo
    ResolveWorkspaceMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveWorkspaceMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveWorkspaceMethod "changeName" o = WorkspaceChangeNameMethodInfo
    ResolveWorkspaceMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveWorkspaceMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveWorkspaceMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveWorkspaceMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveWorkspaceMethod "isVirtual" o = WorkspaceIsVirtualMethodInfo
    ResolveWorkspaceMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveWorkspaceMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveWorkspaceMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveWorkspaceMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveWorkspaceMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveWorkspaceMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveWorkspaceMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveWorkspaceMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveWorkspaceMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveWorkspaceMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveWorkspaceMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveWorkspaceMethod "getHeight" o = WorkspaceGetHeightMethodInfo
    ResolveWorkspaceMethod "getLayoutColumn" o = WorkspaceGetLayoutColumnMethodInfo
    ResolveWorkspaceMethod "getLayoutRow" o = WorkspaceGetLayoutRowMethodInfo
    ResolveWorkspaceMethod "getName" o = WorkspaceGetNameMethodInfo
    ResolveWorkspaceMethod "getNeighbor" o = WorkspaceGetNeighborMethodInfo
    ResolveWorkspaceMethod "getNumber" o = WorkspaceGetNumberMethodInfo
    ResolveWorkspaceMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveWorkspaceMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveWorkspaceMethod "getScreen" o = WorkspaceGetScreenMethodInfo
    ResolveWorkspaceMethod "getViewportX" o = WorkspaceGetViewportXMethodInfo
    ResolveWorkspaceMethod "getViewportY" o = WorkspaceGetViewportYMethodInfo
    ResolveWorkspaceMethod "getWidth" o = WorkspaceGetWidthMethodInfo
    ResolveWorkspaceMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveWorkspaceMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveWorkspaceMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveWorkspaceMethod t Workspace, O.MethodInfo info Workspace p) => OL.IsLabel t (Workspace -> 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

-- signal Workspace::name-changed
{- |
Emitted when the name of /@space@/ changes.
-}
type WorkspaceNameChangedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `WorkspaceNameChangedCallback`@.
noWorkspaceNameChangedCallback :: Maybe WorkspaceNameChangedCallback
noWorkspaceNameChangedCallback = Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_WorkspaceNameChanged :: MonadIO m => WorkspaceNameChangedCallback -> m (GClosure C_WorkspaceNameChangedCallback)
genClosure_WorkspaceNameChanged cb = liftIO $ do
    let cb' = wrap_WorkspaceNameChangedCallback cb
    mk_WorkspaceNameChangedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `WorkspaceNameChangedCallback` into a `C_WorkspaceNameChangedCallback`.
wrap_WorkspaceNameChangedCallback ::
    WorkspaceNameChangedCallback ->
    C_WorkspaceNameChangedCallback
wrap_WorkspaceNameChangedCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@name-changed@” 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' workspace #nameChanged callback
@
-}
onWorkspaceNameChanged :: (IsWorkspace a, MonadIO m) => a -> WorkspaceNameChangedCallback -> m SignalHandlerId
onWorkspaceNameChanged obj cb = liftIO $ do
    let cb' = wrap_WorkspaceNameChangedCallback cb
    cb'' <- mk_WorkspaceNameChangedCallback cb'
    connectSignalFunPtr obj "name-changed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@name-changed@” 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' workspace #nameChanged callback
@
-}
afterWorkspaceNameChanged :: (IsWorkspace a, MonadIO m) => a -> WorkspaceNameChangedCallback -> m SignalHandlerId
afterWorkspaceNameChanged obj cb = liftIO $ do
    let cb' = wrap_WorkspaceNameChangedCallback cb
    cb'' <- mk_WorkspaceNameChangedCallback cb'
    connectSignalFunPtr obj "name-changed" cb'' SignalConnectAfter


#if ENABLE_OVERLOADING
instance O.HasAttributeList Workspace
type instance O.AttributeList Workspace = WorkspaceAttributeList
type WorkspaceAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
data WorkspaceNameChangedSignalInfo
instance SignalInfo WorkspaceNameChangedSignalInfo where
    type HaskellCallbackType WorkspaceNameChangedSignalInfo = WorkspaceNameChangedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_WorkspaceNameChangedCallback cb
        cb'' <- mk_WorkspaceNameChangedCallback cb'
        connectSignalFunPtr obj "name-changed" cb'' connectMode

type instance O.SignalList Workspace = WorkspaceSignalList
type WorkspaceSignalList = ('[ '("nameChanged", WorkspaceNameChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Workspace::activate
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the X server timestamp of the user interaction event that caused\nthis call to occur.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_activate" wnck_workspace_activate ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    Word32 ->                               -- timestamp : TBasicType TUInt32
    IO ()

{- |
Asks the window manager to make /@space@/ the active workspace. The window
manager may decide to refuse the request (to not steal the focus if there is
a more recent user activity, for example).

This function existed before 2.10, but the /@timestamp@/ argument was missing
in earlier versions.

/Since: 2.10/
-}
workspaceActivate ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> Word32
    {- ^ /@timestamp@/: the X server timestamp of the user interaction event that caused
this call to occur. -}
    -> m ()
workspaceActivate space timestamp = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    wnck_workspace_activate space' timestamp
    touchManagedPtr space
    return ()

#if ENABLE_OVERLOADING
data WorkspaceActivateMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceActivateMethodInfo a signature where
    overloadedMethod _ = workspaceActivate

#endif

-- method Workspace::change_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", 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 "new name for @space.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_change_name" wnck_workspace_change_name ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    CString ->                              -- name : TBasicType TUTF8
    IO ()

{- |
Changes the name of /@space@/.

/Since: 2.2/
-}
workspaceChangeName ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> T.Text
    {- ^ /@name@/: new name for /@space@/. -}
    -> m ()
workspaceChangeName space name = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    name' <- textToCString name
    wnck_workspace_change_name space' name'
    touchManagedPtr space
    freeMem name'
    return ()

#if ENABLE_OVERLOADING
data WorkspaceChangeNameMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceChangeNameMethodInfo a signature where
    overloadedMethod _ = workspaceChangeName

#endif

-- method Workspace::get_height
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_get_height" wnck_workspace_get_height ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    IO Int32

{- |
Gets the height of /@space@/.

/Since: 2.4/
-}
workspaceGetHeight ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> m Int32
    {- ^ __Returns:__ the height of /@space@/. -}
workspaceGetHeight space = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    result <- wnck_workspace_get_height space'
    touchManagedPtr space
    return result

#if ENABLE_OVERLOADING
data WorkspaceGetHeightMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceGetHeightMethodInfo a signature where
    overloadedMethod _ = workspaceGetHeight

#endif

-- method Workspace::get_layout_column
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_get_layout_column" wnck_workspace_get_layout_column ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    IO Int32

{- |
Gets the column of /@space@/ in the 'GI.Wnck.Objects.Workspace.Workspace' layout. The first column
has an index of 0 and is always the left column, regardless of the starting
corner set for the layout and regardless of the default direction of the
environment (i.e., in both Left-To-Right and Right-To-Left environments).

/Since: 2.20/
-}
workspaceGetLayoutColumn ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> m Int32
    {- ^ __Returns:__ the column of /@space@/ in the 'GI.Wnck.Objects.Workspace.Workspace' layout, or -1 on
errors. -}
workspaceGetLayoutColumn space = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    result <- wnck_workspace_get_layout_column space'
    touchManagedPtr space
    return result

#if ENABLE_OVERLOADING
data WorkspaceGetLayoutColumnMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceGetLayoutColumnMethodInfo a signature where
    overloadedMethod _ = workspaceGetLayoutColumn

#endif

-- method Workspace::get_layout_row
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_get_layout_row" wnck_workspace_get_layout_row ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    IO Int32

{- |
Gets the row of /@space@/ in the 'GI.Wnck.Objects.Workspace.Workspace' layout. The first row has an
index of 0 and is always the top row, regardless of the starting corner set
for the layout.

/Since: 2.20/
-}
workspaceGetLayoutRow ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> m Int32
    {- ^ __Returns:__ the row of /@space@/ in the 'GI.Wnck.Objects.Workspace.Workspace' layout, or -1 on
errors. -}
workspaceGetLayoutRow space = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    result <- wnck_workspace_get_layout_row space'
    touchManagedPtr space
    return result

#if ENABLE_OVERLOADING
data WorkspaceGetLayoutRowMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceGetLayoutRowMethodInfo a signature where
    overloadedMethod _ = workspaceGetLayoutRow

#endif

-- method Workspace::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_get_name" wnck_workspace_get_name ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    IO CString

{- |
Gets the human-readable name that should be used to refer to /@space@/. If
the user has not set a special name, a fallback like \"Workspace 3\" will be
used.
-}
workspaceGetName ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> m T.Text
    {- ^ __Returns:__ the name of /@space@/. -}
workspaceGetName space = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    result <- wnck_workspace_get_name space'
    checkUnexpectedReturnNULL "workspaceGetName" result
    result' <- cstringToText result
    touchManagedPtr space
    return result'

#if ENABLE_OVERLOADING
data WorkspaceGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceGetNameMethodInfo a signature where
    overloadedMethod _ = workspaceGetName

#endif

-- method Workspace::get_neighbor
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "direction", argType = TInterface (Name {namespace = "Wnck", name = "MotionDirection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "direction in which to search the neighbor.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Wnck", name = "Workspace"}))
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_get_neighbor" wnck_workspace_get_neighbor ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    CInt ->                                 -- direction : TInterface (Name {namespace = "Wnck", name = "MotionDirection"})
    IO (Ptr Workspace)

{- |
Gets the neighbor 'GI.Wnck.Objects.Workspace.Workspace' of /@space@/ in the /@direction@/ direction.

/Since: 2.20/
-}
workspaceGetNeighbor ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> Wnck.Enums.MotionDirection
    {- ^ /@direction@/: direction in which to search the neighbor. -}
    -> m Workspace
    {- ^ __Returns:__ the neighbor 'GI.Wnck.Objects.Workspace.Workspace' of /@space@/ in the
/@direction@/ direction, or 'Nothing' if no such neighbor 'GI.Wnck.Objects.Workspace.Workspace' exists.
The returned 'GI.Wnck.Objects.Workspace.Workspace' is owned by libwnck and must not be referenced
or unreferenced. -}
workspaceGetNeighbor space direction = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    let direction' = (fromIntegral . fromEnum) direction
    result <- wnck_workspace_get_neighbor space' direction'
    checkUnexpectedReturnNULL "workspaceGetNeighbor" result
    result' <- (newObject Workspace) result
    touchManagedPtr space
    return result'

#if ENABLE_OVERLOADING
data WorkspaceGetNeighborMethodInfo
instance (signature ~ (Wnck.Enums.MotionDirection -> m Workspace), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceGetNeighborMethodInfo a signature where
    overloadedMethod _ = workspaceGetNeighbor

#endif

-- method Workspace::get_number
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_get_number" wnck_workspace_get_number ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    IO Int32

{- |
Gets the index of /@space@/ on the 'GI.Wnck.Objects.Screen.Screen' to which it belongs. The
first workspace has an index of 0.
-}
workspaceGetNumber ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> m Int32
    {- ^ __Returns:__ the index of /@space@/ on its 'GI.Wnck.Objects.Screen.Screen', or -1 on errors. -}
workspaceGetNumber space = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    result <- wnck_workspace_get_number space'
    touchManagedPtr space
    return result

#if ENABLE_OVERLOADING
data WorkspaceGetNumberMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceGetNumberMethodInfo a signature where
    overloadedMethod _ = workspaceGetNumber

#endif

-- method Workspace::get_screen
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Wnck", name = "Screen"}))
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_get_screen" wnck_workspace_get_screen ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    IO (Ptr Wnck.Screen.Screen)

{- |
Gets the 'GI.Wnck.Objects.Screen.Screen' /@space@/ is on.
-}
workspaceGetScreen ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> m Wnck.Screen.Screen
    {- ^ __Returns:__ the 'GI.Wnck.Objects.Screen.Screen' /@space@/ is on. The returned
'GI.Wnck.Objects.Screen.Screen' is owned by libwnck and must not be referenced or unreferenced. -}
workspaceGetScreen space = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    result <- wnck_workspace_get_screen space'
    checkUnexpectedReturnNULL "workspaceGetScreen" result
    result' <- (newObject Wnck.Screen.Screen) result
    touchManagedPtr space
    return result'

#if ENABLE_OVERLOADING
data WorkspaceGetScreenMethodInfo
instance (signature ~ (m Wnck.Screen.Screen), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceGetScreenMethodInfo a signature where
    overloadedMethod _ = workspaceGetScreen

#endif

-- method Workspace::get_viewport_x
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_get_viewport_x" wnck_workspace_get_viewport_x ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    IO Int32

{- |
Gets the X coordinate of the viewport in /@space@/.

/Since: 2.4/
-}
workspaceGetViewportX ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> m Int32
    {- ^ __Returns:__ the X coordinate of the viewport in /@space@/, or 0 if /@space@/ does not
contain a viewport. -}
workspaceGetViewportX space = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    result <- wnck_workspace_get_viewport_x space'
    touchManagedPtr space
    return result

#if ENABLE_OVERLOADING
data WorkspaceGetViewportXMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceGetViewportXMethodInfo a signature where
    overloadedMethod _ = workspaceGetViewportX

#endif

-- method Workspace::get_viewport_y
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_get_viewport_y" wnck_workspace_get_viewport_y ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    IO Int32

{- |
Gets the Y coordinate of the viewport in /@space@/.

/Since: 2.4/
-}
workspaceGetViewportY ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> m Int32
    {- ^ __Returns:__ the Y coordinate of the viewport in /@space@/, or 0 if /@space@/ does not
contain a viewport. -}
workspaceGetViewportY space = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    result <- wnck_workspace_get_viewport_y space'
    touchManagedPtr space
    return result

#if ENABLE_OVERLOADING
data WorkspaceGetViewportYMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceGetViewportYMethodInfo a signature where
    overloadedMethod _ = workspaceGetViewportY

#endif

-- method Workspace::get_width
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_get_width" wnck_workspace_get_width ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    IO Int32

{- |
Gets the width of /@space@/.

/Since: 2.4/
-}
workspaceGetWidth ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> m Int32
    {- ^ __Returns:__ the width of /@space@/. -}
workspaceGetWidth space = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    result <- wnck_workspace_get_width space'
    touchManagedPtr space
    return result

#if ENABLE_OVERLOADING
data WorkspaceGetWidthMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceGetWidthMethodInfo a signature where
    overloadedMethod _ = workspaceGetWidth

#endif

-- method Workspace::is_virtual
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "space", argType = TInterface (Name {namespace = "Wnck", name = "Workspace"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WnckWorkspace.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "wnck_workspace_is_virtual" wnck_workspace_is_virtual ::
    Ptr Workspace ->                        -- space : TInterface (Name {namespace = "Wnck", name = "Workspace"})
    IO CInt

{- |
Gets whether /@space@/ contains a viewport.

/Since: 2.4/
-}
workspaceIsVirtual ::
    (B.CallStack.HasCallStack, MonadIO m, IsWorkspace a) =>
    a
    {- ^ /@space@/: a 'GI.Wnck.Objects.Workspace.Workspace'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@space@/ contains a viewport, 'False' otherwise. -}
workspaceIsVirtual space = liftIO $ do
    space' <- unsafeManagedPtrCastPtr space
    result <- wnck_workspace_is_virtual space'
    let result' = (/= 0) result
    touchManagedPtr space
    return result'

#if ENABLE_OVERLOADING
data WorkspaceIsVirtualMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsWorkspace a) => O.MethodInfo WorkspaceIsVirtualMethodInfo a signature where
    overloadedMethod _ = workspaceIsVirtual

#endif