#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.GdkX11.Functions
(
x11DeviceGetId ,
x11DeviceManagerLookup ,
x11FreeCompoundText ,
x11FreeTextList ,
x11GetServerTime ,
x11GetXatomByNameForDisplay ,
x11GetXatomNameForDisplay ,
x11LookupXdisplay ,
x11SetSmClientId ,
) 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.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 {-# SOURCE #-} qualified GI.GdkX11.Objects.X11DeviceManagerXI2 as GdkX11.X11DeviceManagerXI2
import {-# SOURCE #-} qualified GI.GdkX11.Objects.X11DeviceXI2 as GdkX11.X11DeviceXI2
import {-# SOURCE #-} qualified GI.GdkX11.Objects.X11Display as GdkX11.X11Display
import {-# SOURCE #-} qualified GI.GdkX11.Objects.X11Surface as GdkX11.X11Surface
import qualified GI.Xlib.Structs.Display as Xlib.Display
foreign import ccall "gdk_x11_set_sm_client_id" gdk_x11_set_sm_client_id ::
CString ->
IO ()
x11SetSmClientId ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe (T.Text)
-> m ()
x11SetSmClientId :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe Text -> m ()
x11SetSmClientId Maybe Text
smClientId = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr CChar
maybeSmClientId <- case Maybe Text
smClientId of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jSmClientId -> do
Ptr CChar
jSmClientId' <- Text -> IO (Ptr CChar)
textToCString Text
jSmClientId
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jSmClientId'
Ptr CChar -> IO ()
gdk_x11_set_sm_client_id Ptr CChar
maybeSmClientId
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeSmClientId
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "gdk_x11_lookup_xdisplay" gdk_x11_lookup_xdisplay ::
Ptr Xlib.Display.Display ->
IO (Ptr GdkX11.X11Display.X11Display)
x11LookupXdisplay ::
(B.CallStack.HasCallStack, MonadIO m) =>
Xlib.Display.Display
-> m GdkX11.X11Display.X11Display
x11LookupXdisplay :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Display -> m X11Display
x11LookupXdisplay Display
xdisplay = IO X11Display -> m X11Display
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO X11Display -> m X11Display) -> IO X11Display -> m X11Display
forall a b. (a -> b) -> a -> b
$ do
Ptr Display
xdisplay' <- Display -> IO (Ptr Display)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Display
xdisplay
Ptr X11Display
result <- Ptr Display -> IO (Ptr X11Display)
gdk_x11_lookup_xdisplay Ptr Display
xdisplay'
Text -> Ptr X11Display -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"x11LookupXdisplay" Ptr X11Display
result
X11Display
result' <- ((ManagedPtr X11Display -> X11Display)
-> Ptr X11Display -> IO X11Display
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr X11Display -> X11Display
GdkX11.X11Display.X11Display) Ptr X11Display
result
Display -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Display
xdisplay
X11Display -> IO X11Display
forall (m :: * -> *) a. Monad m => a -> m a
return X11Display
result'
foreign import ccall "gdk_x11_get_xatom_name_for_display" gdk_x11_get_xatom_name_for_display ::
Ptr GdkX11.X11Display.X11Display ->
CULong ->
IO CString
x11GetXatomNameForDisplay ::
(B.CallStack.HasCallStack, MonadIO m, GdkX11.X11Display.IsX11Display a) =>
a
-> CULong
-> m T.Text
x11GetXatomNameForDisplay :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsX11Display a) =>
a -> CULong -> m Text
x11GetXatomNameForDisplay a
display CULong
xatom = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr X11Display
display' <- a -> IO (Ptr X11Display)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
display
Ptr CChar
result <- Ptr X11Display -> CULong -> IO (Ptr CChar)
gdk_x11_get_xatom_name_for_display Ptr X11Display
display' CULong
xatom
Text -> Ptr CChar -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"x11GetXatomNameForDisplay" Ptr CChar
result
Text
result' <- HasCallStack => Ptr CChar -> IO Text
Ptr CChar -> IO Text
cstringToText Ptr CChar
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
display
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
foreign import ccall "gdk_x11_get_xatom_by_name_for_display" gdk_x11_get_xatom_by_name_for_display ::
Ptr GdkX11.X11Display.X11Display ->
CString ->
IO CULong
x11GetXatomByNameForDisplay ::
(B.CallStack.HasCallStack, MonadIO m, GdkX11.X11Display.IsX11Display a) =>
a
-> T.Text
-> m CULong
x11GetXatomByNameForDisplay :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsX11Display a) =>
a -> Text -> m CULong
x11GetXatomByNameForDisplay a
display Text
atomName = 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 X11Display
display' <- a -> IO (Ptr X11Display)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
display
Ptr CChar
atomName' <- Text -> IO (Ptr CChar)
textToCString Text
atomName
CULong
result <- Ptr X11Display -> Ptr CChar -> IO CULong
gdk_x11_get_xatom_by_name_for_display Ptr X11Display
display' Ptr CChar
atomName'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
display
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
atomName'
CULong -> IO CULong
forall (m :: * -> *) a. Monad m => a -> m a
return CULong
result
foreign import ccall "gdk_x11_get_server_time" gdk_x11_get_server_time ::
Ptr GdkX11.X11Surface.X11Surface ->
IO Word32
x11GetServerTime ::
(B.CallStack.HasCallStack, MonadIO m, GdkX11.X11Surface.IsX11Surface a) =>
a
-> m Word32
x11GetServerTime :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsX11Surface a) =>
a -> m Word32
x11GetServerTime a
surface = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr X11Surface
surface' <- a -> IO (Ptr X11Surface)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
surface
Word32
result <- Ptr X11Surface -> IO Word32
gdk_x11_get_server_time Ptr X11Surface
surface'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
surface
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
foreign import ccall "gdk_x11_free_text_list" gdk_x11_free_text_list ::
CString ->
IO ()
x11FreeTextList ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m ()
x11FreeTextList :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
x11FreeTextList Text
list = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr CChar
list' <- Text -> IO (Ptr CChar)
textToCString Text
list
Ptr CChar -> IO ()
gdk_x11_free_text_list Ptr CChar
list'
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
list'
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "gdk_x11_free_compound_text" gdk_x11_free_compound_text ::
Word8 ->
IO ()
x11FreeCompoundText ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word8
-> m ()
x11FreeCompoundText :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word8 -> m ()
x11FreeCompoundText Word8
ctext = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Word8 -> IO ()
gdk_x11_free_compound_text Word8
ctext
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "gdk_x11_device_manager_lookup" gdk_x11_device_manager_lookup ::
Ptr GdkX11.X11DeviceManagerXI2.X11DeviceManagerXI2 ->
Int32 ->
IO (Ptr GdkX11.X11DeviceXI2.X11DeviceXI2)
x11DeviceManagerLookup ::
(B.CallStack.HasCallStack, MonadIO m, GdkX11.X11DeviceManagerXI2.IsX11DeviceManagerXI2 a) =>
a
-> Int32
-> m (Maybe GdkX11.X11DeviceXI2.X11DeviceXI2)
x11DeviceManagerLookup :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsX11DeviceManagerXI2 a) =>
a -> Int32 -> m (Maybe X11DeviceXI2)
x11DeviceManagerLookup a
deviceManager Int32
deviceId = IO (Maybe X11DeviceXI2) -> m (Maybe X11DeviceXI2)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe X11DeviceXI2) -> m (Maybe X11DeviceXI2))
-> IO (Maybe X11DeviceXI2) -> m (Maybe X11DeviceXI2)
forall a b. (a -> b) -> a -> b
$ do
Ptr X11DeviceManagerXI2
deviceManager' <- a -> IO (Ptr X11DeviceManagerXI2)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
deviceManager
Ptr X11DeviceXI2
result <- Ptr X11DeviceManagerXI2 -> Int32 -> IO (Ptr X11DeviceXI2)
gdk_x11_device_manager_lookup Ptr X11DeviceManagerXI2
deviceManager' Int32
deviceId
Maybe X11DeviceXI2
maybeResult <- Ptr X11DeviceXI2
-> (Ptr X11DeviceXI2 -> IO X11DeviceXI2) -> IO (Maybe X11DeviceXI2)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr X11DeviceXI2
result ((Ptr X11DeviceXI2 -> IO X11DeviceXI2) -> IO (Maybe X11DeviceXI2))
-> (Ptr X11DeviceXI2 -> IO X11DeviceXI2) -> IO (Maybe X11DeviceXI2)
forall a b. (a -> b) -> a -> b
$ \Ptr X11DeviceXI2
result' -> do
X11DeviceXI2
result'' <- ((ManagedPtr X11DeviceXI2 -> X11DeviceXI2)
-> Ptr X11DeviceXI2 -> IO X11DeviceXI2
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr X11DeviceXI2 -> X11DeviceXI2
GdkX11.X11DeviceXI2.X11DeviceXI2) Ptr X11DeviceXI2
result'
X11DeviceXI2 -> IO X11DeviceXI2
forall (m :: * -> *) a. Monad m => a -> m a
return X11DeviceXI2
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
deviceManager
Maybe X11DeviceXI2 -> IO (Maybe X11DeviceXI2)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe X11DeviceXI2
maybeResult
foreign import ccall "gdk_x11_device_get_id" gdk_x11_device_get_id ::
Ptr GdkX11.X11DeviceXI2.X11DeviceXI2 ->
IO Int32
x11DeviceGetId ::
(B.CallStack.HasCallStack, MonadIO m, GdkX11.X11DeviceXI2.IsX11DeviceXI2 a) =>
a
-> m Int32
x11DeviceGetId :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsX11DeviceXI2 a) =>
a -> m Int32
x11DeviceGetId a
device = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
Ptr X11DeviceXI2
device' <- a -> IO (Ptr X11DeviceXI2)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
device
Int32
result <- Ptr X11DeviceXI2 -> IO Int32
gdk_x11_device_get_id Ptr X11DeviceXI2
device'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
device
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result