module Graphics.UI.Gtk.Gdk.Display (
Display,
DisplayClass,
castToDisplay, gTypeDisplay,
toDisplay,
displayOpen,
displayGetDefault,
displayGetName,
displayGetNScreens,
displayGetScreen,
displayGetDefaultScreen,
displayPointerUngrab,
displayKeyboardUngrab,
displayPointerIsGrabbed,
displayBeep,
displaySync,
displayFlush,
displayClose,
displayListDevices,
displaySetDoubleClickTime,
displaySetDoubleClickDistance,
displayGetPointer,
displayGetWindowAtPointer,
displayWarpPointer,
displaySupportsCursorColor,
displaySupportsCursorAlpha,
displayGetDefaultCursorSize,
displayGetMaximalCursorSize,
displayGetDefaultGroup,
displaySupportsSelectionNotification,
displayRequestSelectionNotification,
displaySupportsClipboardPersistence,
displayStoreClipboard,
displaySupportsShapes,
displaySupportsInputShapes,
displaySupportsComposite,
displayClosed,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Flags
import System.Glib.GList
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.Signals
import Graphics.UI.Gtk.Gdk.EventM
import Graphics.UI.Gtk.General.DNDTypes (SelectionTag, TargetTag, Atom(..))
displayOpen :: GlibString string
=> string
-> IO (Maybe Display)
displayOpen displayName =
maybeNull (wrapNewGObject mkDisplay) $
withUTFString displayName $ \displayNamePtr ->
gdk_display_open
displayNamePtr
displayGetDefault ::
IO (Maybe Display)
displayGetDefault =
maybeNull (makeNewGObject mkDisplay) $
gdk_display_get_default
displayGetName :: GlibString string => Display
-> IO string
displayGetName self =
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_get_name argPtr1)
self
>>= peekUTFString
displayGetNScreens :: Display
-> IO Int
displayGetNScreens self =
liftM fromIntegral $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_get_n_screens argPtr1)
self
displayGetScreen :: Display
-> Int
-> IO Screen
displayGetScreen self screenNum =
makeNewGObject mkScreen $
(\(Display arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_get_screen argPtr1 arg2)
self
(fromIntegral screenNum)
displayGetDefaultScreen :: Display
-> IO Screen
displayGetDefaultScreen self =
makeNewGObject mkScreen $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_get_default_screen argPtr1)
self
displayPointerUngrab :: Display
-> TimeStamp
-> IO ()
displayPointerUngrab self time =
(\(Display arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_pointer_ungrab argPtr1 arg2)
self
(fromIntegral time)
displayKeyboardUngrab :: Display
-> TimeStamp
-> IO ()
displayKeyboardUngrab self time =
(\(Display arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_keyboard_ungrab argPtr1 arg2)
self
(fromIntegral time)
displayPointerIsGrabbed :: Display
-> IO Bool
displayPointerIsGrabbed self =
liftM toBool $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_pointer_is_grabbed argPtr1)
self
displayBeep :: Display -> IO ()
displayBeep self =
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_beep argPtr1)
self
displaySync :: Display -> IO ()
displaySync self =
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_sync argPtr1)
self
displayFlush :: Display -> IO ()
displayFlush self =
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_flush argPtr1)
self
displayClose :: Display -> IO ()
displayClose self =
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_close argPtr1)
self
displayListDevices :: Display
-> IO [Device]
displayListDevices self =
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_list_devices argPtr1)
self
>>= readGList
>>= mapM (makeNewGObject mkDevice . return)
displaySetDoubleClickTime :: Display
-> Int
-> IO ()
displaySetDoubleClickTime self msec =
(\(Display arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_set_double_click_time argPtr1 arg2)
self
(fromIntegral msec)
displaySetDoubleClickDistance :: Display
-> Int
-> IO ()
displaySetDoubleClickDistance self distance =
(\(Display arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_set_double_click_distance argPtr1 arg2)
self
(fromIntegral distance)
displayGetPointer :: Display
-> IO (Screen, [Modifier], Int, Int)
displayGetPointer self =
alloca $ \sPtr ->
alloca $ \xPtr ->
alloca $ \yPtr ->
alloca $ \mPtr ->
(\(Display arg1) arg2 arg3 arg4 arg5 -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_get_pointer argPtr1 arg2 arg3 arg4 arg5)
self
(castPtr sPtr)
xPtr
yPtr
mPtr >>
makeNewGObject mkScreen (peek sPtr) >>= \s ->
peek xPtr >>= \x ->
peek yPtr >>= \y ->
peek mPtr >>= \m ->
return (s, toFlags (fromIntegral m), fromIntegral x, fromIntegral y)
displayGetWindowAtPointer :: Display
-> IO (Maybe (DrawWindow, Int, Int))
displayGetWindowAtPointer self =
alloca $ \winXPtr ->
alloca $ \winYPtr -> do
wPtr <- (\(Display arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_get_window_at_pointer argPtr1 arg2 arg3)
self
winXPtr
winYPtr
if wPtr==nullPtr then return Nothing else
peek winXPtr >>= \winX ->
peek winYPtr >>= \winY ->
makeNewGObject mkDrawWindow (return wPtr) >>= \win ->
return (Just (win, fromIntegral winX, fromIntegral winY))
displayWarpPointer :: Display
-> Screen
-> Int
-> Int
-> IO ()
displayWarpPointer self screen x y =
(\(Display arg1) (Screen arg2) arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gdk_display_warp_pointer argPtr1 argPtr2 arg3 arg4)
self
screen
(fromIntegral x)
(fromIntegral y)
displaySupportsCursorColor :: Display
-> IO Bool
displaySupportsCursorColor self =
liftM toBool $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_supports_cursor_color argPtr1)
self
displaySupportsCursorAlpha :: Display
-> IO Bool
displaySupportsCursorAlpha self =
liftM toBool $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_supports_cursor_alpha argPtr1)
self
displayGetDefaultCursorSize :: Display
-> IO Int
displayGetDefaultCursorSize self =
liftM fromIntegral $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_get_default_cursor_size argPtr1)
self
displayGetMaximalCursorSize :: Display
-> IO (Int, Int)
displayGetMaximalCursorSize self =
alloca $ \widthPtr ->
alloca $ \heightPtr ->
(\(Display arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_get_maximal_cursor_size argPtr1 arg2 arg3)
self
widthPtr
heightPtr >>
peek widthPtr >>= \width ->
peek heightPtr >>= \height ->
return (fromIntegral width, fromIntegral height)
displayGetDefaultGroup :: Display
-> IO DrawWindow
displayGetDefaultGroup self =
makeNewGObject mkDrawWindow $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_get_default_group argPtr1)
self
displaySupportsSelectionNotification :: Display
-> IO Bool
displaySupportsSelectionNotification self =
liftM toBool $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_supports_selection_notification argPtr1)
self
displayRequestSelectionNotification :: Display
-> SelectionTag
-> IO Bool
displayRequestSelectionNotification self (Atom selection) =
liftM toBool $
(\(Display arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_request_selection_notification argPtr1 arg2)
self
selection
displaySupportsClipboardPersistence :: Display
-> IO Bool
displaySupportsClipboardPersistence self =
liftM toBool $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_supports_clipboard_persistence argPtr1)
self
displayStoreClipboard :: Display
-> DrawWindow
-> Word32
-> (Maybe [TargetTag])
-> IO ()
displayStoreClipboard self clipboardWindow time (Just targets) =
withArrayLen (map (\(Atom a) -> a) targets) $ \nTargets tPtr ->
(\(Display arg1) (DrawWindow arg2) arg3 arg4 arg5 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gdk_display_store_clipboard argPtr1 argPtr2 arg3 arg4 arg5)
self
clipboardWindow
(fromIntegral time)
tPtr
(fromIntegral nTargets)
displayStoreClipboard self clipboardWindow time Nothing =
(\(Display arg1) (DrawWindow arg2) arg3 arg4 arg5 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gdk_display_store_clipboard argPtr1 argPtr2 arg3 arg4 arg5)
self
clipboardWindow
(fromIntegral time)
nullPtr
0
displaySupportsShapes :: Display
-> IO Bool
displaySupportsShapes self =
liftM toBool $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_supports_shapes argPtr1)
self
displaySupportsInputShapes :: Display
-> IO Bool
displaySupportsInputShapes self =
liftM toBool $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_supports_input_shapes argPtr1)
self
displaySupportsComposite :: Display
-> IO Bool
displaySupportsComposite self =
liftM toBool $
(\(Display arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_display_supports_composite argPtr1)
self
displayClosed :: DisplayClass self => Signal self (Bool -> IO ())
displayClosed = Signal (connect_BOOL__NONE "closed")
foreign import ccall safe "gdk_display_open"
gdk_display_open :: ((Ptr CChar) -> (IO (Ptr Display)))
foreign import ccall safe "gdk_display_get_default"
gdk_display_get_default :: (IO (Ptr Display))
foreign import ccall safe "gdk_display_get_name"
gdk_display_get_name :: ((Ptr Display) -> (IO (Ptr CChar)))
foreign import ccall safe "gdk_display_get_n_screens"
gdk_display_get_n_screens :: ((Ptr Display) -> (IO CInt))
foreign import ccall safe "gdk_display_get_screen"
gdk_display_get_screen :: ((Ptr Display) -> (CInt -> (IO (Ptr Screen))))
foreign import ccall safe "gdk_display_get_default_screen"
gdk_display_get_default_screen :: ((Ptr Display) -> (IO (Ptr Screen)))
foreign import ccall safe "gdk_display_pointer_ungrab"
gdk_display_pointer_ungrab :: ((Ptr Display) -> (CUInt -> (IO ())))
foreign import ccall safe "gdk_display_keyboard_ungrab"
gdk_display_keyboard_ungrab :: ((Ptr Display) -> (CUInt -> (IO ())))
foreign import ccall safe "gdk_display_pointer_is_grabbed"
gdk_display_pointer_is_grabbed :: ((Ptr Display) -> (IO CInt))
foreign import ccall safe "gdk_display_beep"
gdk_display_beep :: ((Ptr Display) -> (IO ()))
foreign import ccall safe "gdk_display_sync"
gdk_display_sync :: ((Ptr Display) -> (IO ()))
foreign import ccall safe "gdk_display_flush"
gdk_display_flush :: ((Ptr Display) -> (IO ()))
foreign import ccall safe "gdk_display_close"
gdk_display_close :: ((Ptr Display) -> (IO ()))
foreign import ccall safe "gdk_display_list_devices"
gdk_display_list_devices :: ((Ptr Display) -> (IO (Ptr ())))
foreign import ccall safe "gdk_display_set_double_click_time"
gdk_display_set_double_click_time :: ((Ptr Display) -> (CUInt -> (IO ())))
foreign import ccall safe "gdk_display_set_double_click_distance"
gdk_display_set_double_click_distance :: ((Ptr Display) -> (CUInt -> (IO ())))
foreign import ccall safe "gdk_display_get_pointer"
gdk_display_get_pointer :: ((Ptr Display) -> ((Ptr Screen) -> ((Ptr CInt) -> ((Ptr CInt) -> ((Ptr CInt) -> (IO ()))))))
foreign import ccall safe "gdk_display_get_window_at_pointer"
gdk_display_get_window_at_pointer :: ((Ptr Display) -> ((Ptr CInt) -> ((Ptr CInt) -> (IO (Ptr DrawWindow)))))
foreign import ccall safe "gdk_display_warp_pointer"
gdk_display_warp_pointer :: ((Ptr Display) -> ((Ptr Screen) -> (CInt -> (CInt -> (IO ())))))
foreign import ccall safe "gdk_display_supports_cursor_color"
gdk_display_supports_cursor_color :: ((Ptr Display) -> (IO CInt))
foreign import ccall safe "gdk_display_supports_cursor_alpha"
gdk_display_supports_cursor_alpha :: ((Ptr Display) -> (IO CInt))
foreign import ccall safe "gdk_display_get_default_cursor_size"
gdk_display_get_default_cursor_size :: ((Ptr Display) -> (IO CUInt))
foreign import ccall safe "gdk_display_get_maximal_cursor_size"
gdk_display_get_maximal_cursor_size :: ((Ptr Display) -> ((Ptr CUInt) -> ((Ptr CUInt) -> (IO ()))))
foreign import ccall safe "gdk_display_get_default_group"
gdk_display_get_default_group :: ((Ptr Display) -> (IO (Ptr DrawWindow)))
foreign import ccall safe "gdk_display_supports_selection_notification"
gdk_display_supports_selection_notification :: ((Ptr Display) -> (IO CInt))
foreign import ccall safe "gdk_display_request_selection_notification"
gdk_display_request_selection_notification :: ((Ptr Display) -> ((Ptr ()) -> (IO CInt)))
foreign import ccall safe "gdk_display_supports_clipboard_persistence"
gdk_display_supports_clipboard_persistence :: ((Ptr Display) -> (IO CInt))
foreign import ccall safe "gdk_display_store_clipboard"
gdk_display_store_clipboard :: ((Ptr Display) -> ((Ptr DrawWindow) -> (CUInt -> ((Ptr (Ptr ())) -> (CInt -> (IO ()))))))
foreign import ccall safe "gdk_display_supports_shapes"
gdk_display_supports_shapes :: ((Ptr Display) -> (IO CInt))
foreign import ccall safe "gdk_display_supports_input_shapes"
gdk_display_supports_input_shapes :: ((Ptr Display) -> (IO CInt))
foreign import ccall safe "gdk_display_supports_composite"
gdk_display_supports_composite :: ((Ptr Display) -> (IO CInt))