{-# LINE 2 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
module Graphics.UI.Gtk.Gdk.Gdk (
flush,
screenWidth,
screenHeight,
screenWidthMM,
screenHeightMM,
GrabStatus(..),
pointerGrab,
pointerUngrab,
pointerIsGrabbed,
keyboardGrab,
keyboardUngrab,
beep
) where
import Control.Monad (liftM)
import System.Glib.Flags (fromFlags)
import System.Glib.FFI
import Graphics.UI.Gtk.Types
{-# LINE 51 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
import Graphics.UI.Gtk.Gdk.Cursor (Cursor(..))
import Graphics.UI.Gtk.Gdk.Events
import Graphics.UI.Gtk.Gdk.Enums (EventMask, GrabStatus(..))
{-# LINE 59 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
beep :: IO ()
beep :: IO ()
beep = IO ()
gdk_beep
{-# LINE 64 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
flush :: IO ()
flush :: IO ()
flush = IO ()
gdk_flush
{-# LINE 70 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
screenWidth :: IO Int
screenWidth :: IO Int
screenWidth = (CInt -> Int) -> IO CInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CInt -> IO Int) -> IO CInt -> IO Int
forall a b. (a -> b) -> a -> b
$ IO CInt
gdk_screen_width
{-# LINE 75 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
screenHeight :: IO Int
screenHeight :: IO Int
screenHeight = (CInt -> Int) -> IO CInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CInt -> IO Int) -> IO CInt -> IO Int
forall a b. (a -> b) -> a -> b
$ IO CInt
gdk_screen_height
{-# LINE 80 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
screenWidthMM :: IO Int
screenWidthMM :: IO Int
screenWidthMM = (CInt -> Int) -> IO CInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CInt -> IO Int) -> IO CInt -> IO Int
forall a b. (a -> b) -> a -> b
$ IO CInt
gdk_screen_width_mm
{-# LINE 86 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
screenHeightMM :: IO Int
screenHeightMM :: IO Int
screenHeightMM = (CInt -> Int) -> IO CInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CInt -> IO Int) -> IO CInt -> IO Int
forall a b. (a -> b) -> a -> b
$ IO CInt
gdk_screen_height_mm
{-# LINE 92 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
pointerGrab :: (DrawWindowClass window, DrawWindowClass confine_to) =>
window
-> Bool
-> [EventMask]
-> Maybe confine_to
-> Maybe Cursor
-> TimeStamp
-> IO GrabStatus
pointerGrab :: forall window confine_to.
(DrawWindowClass window, DrawWindowClass confine_to) =>
window
-> Bool
-> [EventMask]
-> Maybe confine_to
-> Maybe Cursor
-> TimeStamp
-> IO GrabStatus
pointerGrab window
window Bool
owner_events [EventMask]
event_mask Maybe confine_to
mbConfine_to Maybe Cursor
mbCursor TimeStamp
time =
(CInt -> GrabStatus) -> IO CInt -> IO GrabStatus
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Int -> GrabStatus
forall a. Enum a => Int -> a
toEnum (Int -> GrabStatus) -> (CInt -> Int) -> CInt -> GrabStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) (IO CInt -> IO GrabStatus) -> IO CInt -> IO GrabStatus
forall a b. (a -> b) -> a -> b
$
(\(DrawWindow ForeignPtr DrawWindow
arg1) CInt
arg2 CInt
arg3 (DrawWindow ForeignPtr DrawWindow
arg4) (Cursor ForeignPtr Cursor
arg5) CUInt
arg6 -> ForeignPtr DrawWindow -> (Ptr DrawWindow -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DrawWindow
arg1 ((Ptr DrawWindow -> IO CInt) -> IO CInt)
-> (Ptr DrawWindow -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr DrawWindow
argPtr1 ->ForeignPtr DrawWindow -> (Ptr DrawWindow -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DrawWindow
arg4 ((Ptr DrawWindow -> IO CInt) -> IO CInt)
-> (Ptr DrawWindow -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr DrawWindow
argPtr4 ->ForeignPtr Cursor -> (Ptr Cursor -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Cursor
arg5 ((Ptr Cursor -> IO CInt) -> IO CInt)
-> (Ptr Cursor -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Cursor
argPtr5 ->Ptr DrawWindow
-> CInt -> CInt -> Ptr DrawWindow -> Ptr Cursor -> CUInt -> IO CInt
gdk_pointer_grab Ptr DrawWindow
argPtr1 CInt
arg2 CInt
arg3 Ptr DrawWindow
argPtr4 Ptr Cursor
argPtr5 CUInt
arg6)
{-# LINE 143 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
(toDrawWindow window)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
owner_events)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> Int -> CInt
forall a b. (a -> b) -> a -> b
$ [EventMask] -> Int
forall a. Flags a => [a] -> Int
fromFlags [EventMask]
event_mask)
(DrawWindow
-> (confine_to -> DrawWindow) -> Maybe confine_to -> DrawWindow
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (ForeignPtr DrawWindow -> DrawWindow
DrawWindow ForeignPtr DrawWindow
forall a. ForeignPtr a
nullForeignPtr) confine_to -> DrawWindow
forall o. DrawWindowClass o => o -> DrawWindow
toDrawWindow Maybe confine_to
mbConfine_to)
(Cursor -> (Cursor -> Cursor) -> Maybe Cursor -> Cursor
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (ForeignPtr Cursor -> Cursor
Cursor ForeignPtr Cursor
forall a. ForeignPtr a
nullForeignPtr) Cursor -> Cursor
forall a. a -> a
id Maybe Cursor
mbCursor)
(TimeStamp -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral TimeStamp
time)
pointerUngrab ::
TimeStamp
-> IO ()
pointerUngrab :: TimeStamp -> IO ()
pointerUngrab TimeStamp
time = CUInt -> IO ()
gdk_pointer_ungrab (TimeStamp -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral TimeStamp
time)
pointerIsGrabbed :: IO Bool
pointerIsGrabbed :: IO Bool
pointerIsGrabbed = (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$ IO CInt
gdk_pointer_is_grabbed
{-# LINE 167 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
keyboardGrab :: (DrawWindowClass window) =>
window
-> Bool
-> TimeStamp
-> IO GrabStatus
keyboardGrab :: forall window.
DrawWindowClass window =>
window -> Bool -> TimeStamp -> IO GrabStatus
keyboardGrab window
window Bool
owner_events TimeStamp
time =
(CInt -> GrabStatus) -> IO CInt -> IO GrabStatus
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Int -> GrabStatus
forall a. Enum a => Int -> a
toEnum (Int -> GrabStatus) -> (CInt -> Int) -> CInt -> GrabStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) (IO CInt -> IO GrabStatus) -> IO CInt -> IO GrabStatus
forall a b. (a -> b) -> a -> b
$
(\(DrawWindow ForeignPtr DrawWindow
arg1) CInt
arg2 CUInt
arg3 -> ForeignPtr DrawWindow -> (Ptr DrawWindow -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DrawWindow
arg1 ((Ptr DrawWindow -> IO CInt) -> IO CInt)
-> (Ptr DrawWindow -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr DrawWindow
argPtr1 ->Ptr DrawWindow -> CInt -> CUInt -> IO CInt
gdk_keyboard_grab Ptr DrawWindow
argPtr1 CInt
arg2 CUInt
arg3)
{-# LINE 190 "./Graphics/UI/Gtk/Gdk/Gdk.chs" #-}
(toDrawWindow window)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
owner_events)
(TimeStamp -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral TimeStamp
time)
keyboardUngrab ::
TimeStamp
-> IO ()
keyboardUngrab :: TimeStamp -> IO ()
keyboardUngrab TimeStamp
time = CUInt -> IO ()
gdk_keyboard_ungrab (TimeStamp -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral TimeStamp
time)
foreign import ccall safe "gdk_beep"
gdk_beep :: (IO ())
foreign import ccall safe "gdk_flush"
gdk_flush :: (IO ())
foreign import ccall safe "gdk_screen_width"
gdk_screen_width :: (IO CInt)
foreign import ccall safe "gdk_screen_height"
gdk_screen_height :: (IO CInt)
foreign import ccall safe "gdk_screen_width_mm"
gdk_screen_width_mm :: (IO CInt)
foreign import ccall safe "gdk_screen_height_mm"
gdk_screen_height_mm :: (IO CInt)
foreign import ccall safe "gdk_pointer_grab"
gdk_pointer_grab :: ((Ptr DrawWindow) -> (CInt -> (CInt -> ((Ptr DrawWindow) -> ((Ptr Cursor) -> (CUInt -> (IO CInt)))))))
foreign import ccall safe "gdk_pointer_ungrab"
gdk_pointer_ungrab :: (CUInt -> (IO ()))
foreign import ccall safe "gdk_pointer_is_grabbed"
gdk_pointer_is_grabbed :: (IO CInt)
foreign import ccall safe "gdk_keyboard_grab"
gdk_keyboard_grab :: ((Ptr DrawWindow) -> (CInt -> (CUInt -> (IO CInt))))
foreign import ccall safe "gdk_keyboard_ungrab"
gdk_keyboard_ungrab :: (CUInt -> (IO ()))