{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GdkX11.Objects.X11Cursor
(
X11Cursor(..) ,
IsX11Cursor ,
toX11Cursor ,
#if defined(ENABLE_OVERLOADING)
ResolveX11CursorMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
X11CursorGetXcursorMethodInfo ,
#endif
x11CursorGetXcursor ,
#if defined(ENABLE_OVERLOADING)
X11CursorGetXdisplayMethodInfo ,
#endif
x11CursorGetXdisplay ,
) 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.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.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 GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gdk.Objects.Cursor as Gdk.Cursor
import qualified GI.Xlib.Structs.Display as Xlib.Display
newtype X11Cursor = X11Cursor (SP.ManagedPtr X11Cursor)
deriving (X11Cursor -> X11Cursor -> Bool
(X11Cursor -> X11Cursor -> Bool)
-> (X11Cursor -> X11Cursor -> Bool) -> Eq X11Cursor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: X11Cursor -> X11Cursor -> Bool
$c/= :: X11Cursor -> X11Cursor -> Bool
== :: X11Cursor -> X11Cursor -> Bool
$c== :: X11Cursor -> X11Cursor -> Bool
Eq)
instance SP.ManagedPtrNewtype X11Cursor where
toManagedPtr :: X11Cursor -> ManagedPtr X11Cursor
toManagedPtr (X11Cursor ManagedPtr X11Cursor
p) = ManagedPtr X11Cursor
p
foreign import ccall "gdk_x11_cursor_get_type"
c_gdk_x11_cursor_get_type :: IO B.Types.GType
instance B.Types.TypedObject X11Cursor where
glibType :: IO GType
glibType = IO GType
c_gdk_x11_cursor_get_type
instance B.Types.GObject X11Cursor
class (SP.GObject o, O.IsDescendantOf X11Cursor o) => IsX11Cursor o
instance (SP.GObject o, O.IsDescendantOf X11Cursor o) => IsX11Cursor o
instance O.HasParentTypes X11Cursor
type instance O.ParentTypes X11Cursor = '[Gdk.Cursor.Cursor, GObject.Object.Object]
toX11Cursor :: (MIO.MonadIO m, IsX11Cursor o) => o -> m X11Cursor
toX11Cursor :: forall (m :: * -> *) o.
(MonadIO m, IsX11Cursor o) =>
o -> m X11Cursor
toX11Cursor = IO X11Cursor -> m X11Cursor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO X11Cursor -> m X11Cursor)
-> (o -> IO X11Cursor) -> o -> m X11Cursor
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr X11Cursor -> X11Cursor) -> o -> IO X11Cursor
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr X11Cursor -> X11Cursor
X11Cursor
instance B.GValue.IsGValue (Maybe X11Cursor) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gdk_x11_cursor_get_type
gvalueSet_ :: Ptr GValue -> Maybe X11Cursor -> IO ()
gvalueSet_ Ptr GValue
gv Maybe X11Cursor
P.Nothing = Ptr GValue -> Ptr X11Cursor -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr X11Cursor
forall a. Ptr a
FP.nullPtr :: FP.Ptr X11Cursor)
gvalueSet_ Ptr GValue
gv (P.Just X11Cursor
obj) = X11Cursor -> (Ptr X11Cursor -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr X11Cursor
obj (Ptr GValue -> Ptr X11Cursor -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe X11Cursor)
gvalueGet_ Ptr GValue
gv = do
Ptr X11Cursor
ptr <- Ptr GValue -> IO (Ptr X11Cursor)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr X11Cursor)
if Ptr X11Cursor
ptr Ptr X11Cursor -> Ptr X11Cursor -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr X11Cursor
forall a. Ptr a
FP.nullPtr
then X11Cursor -> Maybe X11Cursor
forall a. a -> Maybe a
P.Just (X11Cursor -> Maybe X11Cursor)
-> IO X11Cursor -> IO (Maybe X11Cursor)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr X11Cursor -> X11Cursor)
-> Ptr X11Cursor -> IO X11Cursor
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr X11Cursor -> X11Cursor
X11Cursor Ptr X11Cursor
ptr
else Maybe X11Cursor -> IO (Maybe X11Cursor)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe X11Cursor
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveX11CursorMethod (t :: Symbol) (o :: *) :: * where
ResolveX11CursorMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveX11CursorMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveX11CursorMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveX11CursorMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveX11CursorMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveX11CursorMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveX11CursorMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveX11CursorMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveX11CursorMethod "ref" o = Gdk.Cursor.CursorRefMethodInfo
ResolveX11CursorMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveX11CursorMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveX11CursorMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveX11CursorMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveX11CursorMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveX11CursorMethod "unref" o = Gdk.Cursor.CursorUnrefMethodInfo
ResolveX11CursorMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveX11CursorMethod "getCursorType" o = Gdk.Cursor.CursorGetCursorTypeMethodInfo
ResolveX11CursorMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveX11CursorMethod "getDisplay" o = Gdk.Cursor.CursorGetDisplayMethodInfo
ResolveX11CursorMethod "getImage" o = Gdk.Cursor.CursorGetImageMethodInfo
ResolveX11CursorMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveX11CursorMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveX11CursorMethod "getSurface" o = Gdk.Cursor.CursorGetSurfaceMethodInfo
ResolveX11CursorMethod "getXcursor" o = X11CursorGetXcursorMethodInfo
ResolveX11CursorMethod "getXdisplay" o = X11CursorGetXdisplayMethodInfo
ResolveX11CursorMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveX11CursorMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveX11CursorMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveX11CursorMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveX11CursorMethod t X11Cursor, O.OverloadedMethod info X11Cursor p) => OL.IsLabel t (X11Cursor -> 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 ~ ResolveX11CursorMethod t X11Cursor, O.OverloadedMethod info X11Cursor p, R.HasField t X11Cursor p) => R.HasField t X11Cursor p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveX11CursorMethod t X11Cursor, O.OverloadedMethodInfo info X11Cursor) => OL.IsLabel t (O.MethodProxy info X11Cursor) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList X11Cursor
type instance O.AttributeList X11Cursor = X11CursorAttributeList
type X11CursorAttributeList = ('[ '("cursorType", Gdk.Cursor.CursorCursorTypePropertyInfo), '("display", Gdk.Cursor.CursorDisplayPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList X11Cursor = X11CursorSignalList
type X11CursorSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gdk_x11_cursor_get_xcursor" gdk_x11_cursor_get_xcursor ::
Ptr X11Cursor ->
IO CULong
x11CursorGetXcursor ::
(B.CallStack.HasCallStack, MonadIO m, IsX11Cursor a) =>
a
-> m CULong
x11CursorGetXcursor :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsX11Cursor a) =>
a -> m CULong
x11CursorGetXcursor a
cursor = IO CULong -> m CULong
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CULong -> m CULong) -> IO CULong -> m CULong
forall a b. (a -> b) -> a -> b
$ do
Ptr X11Cursor
cursor' <- a -> IO (Ptr X11Cursor)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cursor
CULong
result <- Ptr X11Cursor -> IO CULong
gdk_x11_cursor_get_xcursor Ptr X11Cursor
cursor'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cursor
CULong -> IO CULong
forall (m :: * -> *) a. Monad m => a -> m a
return CULong
result
#if defined(ENABLE_OVERLOADING)
data X11CursorGetXcursorMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsX11Cursor a) => O.OverloadedMethod X11CursorGetXcursorMethodInfo a signature where
overloadedMethod = x11CursorGetXcursor
instance O.OverloadedMethodInfo X11CursorGetXcursorMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GdkX11.Objects.X11Cursor.x11CursorGetXcursor",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdkx11-3.0.12/docs/GI-GdkX11-Objects-X11Cursor.html#v:x11CursorGetXcursor"
})
#endif
foreign import ccall "gdk_x11_cursor_get_xdisplay" gdk_x11_cursor_get_xdisplay ::
Ptr X11Cursor ->
IO (Ptr Xlib.Display.Display)
x11CursorGetXdisplay ::
(B.CallStack.HasCallStack, MonadIO m, IsX11Cursor a) =>
a
-> m Xlib.Display.Display
x11CursorGetXdisplay :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsX11Cursor a) =>
a -> m Display
x11CursorGetXdisplay a
cursor = IO Display -> m Display
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Display -> m Display) -> IO Display -> m Display
forall a b. (a -> b) -> a -> b
$ do
Ptr X11Cursor
cursor' <- a -> IO (Ptr X11Cursor)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
cursor
Ptr Display
result <- Ptr X11Cursor -> IO (Ptr Display)
gdk_x11_cursor_get_xdisplay Ptr X11Cursor
cursor'
Text -> Ptr Display -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"x11CursorGetXdisplay" Ptr Display
result
Display
result' <- ((ManagedPtr Display -> Display) -> Ptr Display -> IO Display
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr Display -> Display
Xlib.Display.Display) Ptr Display
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cursor
Display -> IO Display
forall (m :: * -> *) a. Monad m => a -> m a
return Display
result'
#if defined(ENABLE_OVERLOADING)
data X11CursorGetXdisplayMethodInfo
instance (signature ~ (m Xlib.Display.Display), MonadIO m, IsX11Cursor a) => O.OverloadedMethod X11CursorGetXdisplayMethodInfo a signature where
overloadedMethod = x11CursorGetXdisplay
instance O.OverloadedMethodInfo X11CursorGetXdisplayMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.GdkX11.Objects.X11Cursor.x11CursorGetXdisplay",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdkx11-3.0.12/docs/GI-GdkX11-Objects-X11Cursor.html#v:x11CursorGetXdisplay"
})
#endif