{-# LINE 2 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
-- -*-haskell-*-
-- GIMP Toolkit (GTK) Display - a description of a keyboard/mouse/monitors combination
--
-- Author : Axel Simon
--
-- Created: 22 October 2009
--
-- Copyright (C) 2009 Axel Simon
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- |
-- Maintainer : gtk2hs-users@lists.sourceforge.net
-- Stability : provisional
-- Portability : portable (depends on GHC)
--
-- Controls the keyboard\/mouse\/monitors combination.
--
-- * Module available since Gdk version 2.2
--
module Graphics.UI.Gtk.Gdk.Display (

-- * Detail
--
-- | 'Display' objects purpose are two fold:
--
-- * To grab\/ungrab keyboard focus and mouse pointer
--
-- * To manage and provide information about the 'Screen'(s) available for
-- this 'Display'
--
-- 'Display' objects are the GDK representation of the X Display which can
-- be described as /a workstation consisting of a keyboard a pointing device
-- (such as a mouse) and one or more screens/. It is used to open and keep
-- track of various 'Screen' objects currently instanciated by the application.
-- It is also used to grab and release the keyboard and the mouse pointer.

-- * Class Hierarchy
--
-- |
-- @
-- | 'GObject'
-- | +----Display
-- @


-- * Types
  Display,
  DisplayClass,
  castToDisplay, gTypeDisplay,
  toDisplay,

-- * Methods
  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,





-- * Signals
  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
{-# LINE 122 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
import Graphics.UI.Gtk.Signals
import Graphics.UI.Gtk.Gdk.EventM
import Graphics.UI.Gtk.General.DNDTypes (SelectionTag, TargetTag, Atom(..))


{-# LINE 127 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}


--------------------
-- Methods

-- | Opens a display.
--
displayOpen :: GlibString string
 => string -- ^ @displayName@ - the name of the display to open
 -> IO (Maybe Display)
               -- ^ returns a 'Display', or @Nothing@ if the display
               -- could not be opened.
displayOpen :: forall string. GlibString string => string -> IO (Maybe Display)
displayOpen string
displayName =
  (IO (Ptr Display) -> IO Display)
-> IO (Ptr Display) -> IO (Maybe Display)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr Display -> Display, FinalizerPtr Display)
-> IO (Ptr Display) -> IO Display
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr Display -> Display, FinalizerPtr Display)
forall {a}. (ForeignPtr Display -> Display, FinalizerPtr a)
mkDisplay) (IO (Ptr Display) -> IO (Maybe Display))
-> IO (Ptr Display) -> IO (Maybe Display)
forall a b. (a -> b) -> a -> b
$
  string -> (CString -> IO (Ptr Display)) -> IO (Ptr Display)
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
displayName ((CString -> IO (Ptr Display)) -> IO (Ptr Display))
-> (CString -> IO (Ptr Display)) -> IO (Ptr Display)
forall a b. (a -> b) -> a -> b
$ \CString
displayNamePtr ->
  CString -> IO (Ptr Display)
gdk_display_open
{-# LINE 143 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    displayNamePtr

-- | Gets the default 'Display'. This is a convenience function for
-- @displayManagerGetDefaultDisplay displayManagerGet@.
--
displayGetDefault ::
    IO (Maybe Display)
               -- ^ returns a 'Display', or @Nothing@ if there is no
               -- default display.
displayGetDefault :: IO (Maybe Display)
displayGetDefault =
  (IO (Ptr Display) -> IO Display)
-> IO (Ptr Display) -> IO (Maybe Display)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr Display -> Display, FinalizerPtr Display)
-> IO (Ptr Display) -> IO Display
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr Display -> Display, FinalizerPtr Display)
forall {a}. (ForeignPtr Display -> Display, FinalizerPtr a)
mkDisplay) (IO (Ptr Display) -> IO (Maybe Display))
-> IO (Ptr Display) -> IO (Maybe Display)
forall a b. (a -> b) -> a -> b
$
  IO (Ptr Display)
gdk_display_get_default
{-# LINE 155 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}

-- | Gets the name of the display.
--
displayGetName :: GlibString string => Display
 -> IO string -- ^ returns a string representing the display name
displayGetName :: forall string. GlibString string => Display -> IO string
displayGetName Display
self =
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO CString) -> IO CString
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CString) -> IO CString)
-> (Ptr Display -> IO CString) -> IO CString
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO CString
gdk_display_get_name Ptr Display
argPtr1)
{-# LINE 162 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
  IO CString -> (CString -> IO string) -> IO string
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= CString -> IO string
forall s. GlibString s => CString -> IO s
peekUTFString

-- | Gets the number of screen managed by the @display@.
--
displayGetNScreens :: Display
 -> IO Int -- ^ returns number of screens.
displayGetNScreens :: Display -> IO Int
displayGetNScreens Display
self =
  (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
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CInt) -> IO CInt)
-> (Ptr Display -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO CInt
gdk_display_get_n_screens Ptr Display
argPtr1)
{-# LINE 172 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self

-- | Returns a screen object for one of the screens of the display.
--
displayGetScreen :: Display
 -> Int -- ^ @screenNum@ - the screen number
 -> IO Screen -- ^ returns the 'Screen' object
displayGetScreen :: Display -> Int -> IO Screen
displayGetScreen Display
self Int
screenNum =
  (ForeignPtr Screen -> Screen, FinalizerPtr Screen)
-> IO (Ptr Screen) -> IO Screen
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr Screen -> Screen, FinalizerPtr Screen)
forall {a}. (ForeignPtr Screen -> Screen, FinalizerPtr a)
mkScreen (IO (Ptr Screen) -> IO Screen) -> IO (Ptr Screen) -> IO Screen
forall a b. (a -> b) -> a -> b
$
  (\(Display ForeignPtr Display
arg1) CInt
arg2 -> ForeignPtr Display
-> (Ptr Display -> IO (Ptr Screen)) -> IO (Ptr Screen)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO (Ptr Screen)) -> IO (Ptr Screen))
-> (Ptr Display -> IO (Ptr Screen)) -> IO (Ptr Screen)
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> CInt -> IO (Ptr Screen)
gdk_display_get_screen Ptr Display
argPtr1 CInt
arg2)
{-# LINE 182 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
screenNum)

-- | Get the default 'Screen' for @display@.
--
displayGetDefaultScreen :: Display
 -> IO Screen -- ^ returns the default 'Screen' object for @display@
displayGetDefaultScreen :: Display -> IO Screen
displayGetDefaultScreen Display
self =
  (ForeignPtr Screen -> Screen, FinalizerPtr Screen)
-> IO (Ptr Screen) -> IO Screen
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr Screen -> Screen, FinalizerPtr Screen)
forall {a}. (ForeignPtr Screen -> Screen, FinalizerPtr a)
mkScreen (IO (Ptr Screen) -> IO Screen) -> IO (Ptr Screen) -> IO Screen
forall a b. (a -> b) -> a -> b
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display
-> (Ptr Display -> IO (Ptr Screen)) -> IO (Ptr Screen)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO (Ptr Screen)) -> IO (Ptr Screen))
-> (Ptr Display -> IO (Ptr Screen)) -> IO (Ptr Screen)
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO (Ptr Screen)
gdk_display_get_default_screen Ptr Display
argPtr1)
{-# LINE 192 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self

-- | Release any pointer grab.
--
displayPointerUngrab :: Display
 -> TimeStamp -- ^ @time@ - a timestap (e.g. 'currentTime').
 -> IO ()
displayPointerUngrab :: Display -> Word32 -> IO ()
displayPointerUngrab Display
self Word32
time =
  (\(Display ForeignPtr Display
arg1) CUInt
arg2 -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> CUInt -> IO ()
gdk_display_pointer_ungrab Ptr Display
argPtr1 CUInt
arg2)
{-# LINE 201 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    (Word32 -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
time)

-- | Release any keyboard grab
--
displayKeyboardUngrab :: Display
 -> TimeStamp -- ^ @time@ - a timestap (e.g 'currentTime').
 -> IO ()
displayKeyboardUngrab :: Display -> Word32 -> IO ()
displayKeyboardUngrab Display
self Word32
time =
  (\(Display ForeignPtr Display
arg1) CUInt
arg2 -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> CUInt -> IO ()
gdk_display_keyboard_ungrab Ptr Display
argPtr1 CUInt
arg2)
{-# LINE 211 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    (Word32 -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
time)

-- | Test if the pointer is grabbed.
--
displayPointerIsGrabbed :: Display
 -> IO Bool -- ^ returns @True@ if an active X pointer grab is in effect
displayPointerIsGrabbed :: Display -> IO Bool
displayPointerIsGrabbed Display
self =
  (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
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CInt) -> IO CInt)
-> (Ptr Display -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO CInt
gdk_display_pointer_is_grabbed Ptr Display
argPtr1)
{-# LINE 221 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self

-- | Emits a short beep on @display@
--
displayBeep :: Display -> IO ()
displayBeep :: Display -> IO ()
displayBeep Display
self =
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO ()
gdk_display_beep Ptr Display
argPtr1)
{-# LINE 228 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self

-- | Flushes any requests queued for the windowing system and waits until all
-- requests have been handled. This is often used for making sure that the
-- display is synchronized with the current state of the program. Calling
-- 'displaySync' before 'errorTrapPop' makes sure that any errors generated
-- from earlier requests are handled before the error trap is removed.
--
-- This is most useful for X11. On windowing systems where requests are
-- handled synchronously, this function will do nothing.
--
displaySync :: Display -> IO ()
displaySync :: Display -> IO ()
displaySync Display
self =
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO ()
gdk_display_sync Ptr Display
argPtr1)
{-# LINE 242 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self


-- | Flushes any requests queued for the windowing system; this happens
-- automatically when the main loop blocks waiting for new events, but if your
-- application is drawing without returning control to the main loop, you may
-- need to call this function explicitely. A common case where this function
-- needs to be called is when an application is executing drawing commands from
-- a thread other than the thread where the main loop is running.
--
-- This is most useful for X11. On windowing systems where requests are
-- handled synchronously, this function will do nothing.
--
-- * Available since Gdk version 2.4
--
displayFlush :: Display -> IO ()
displayFlush :: Display -> IO ()
displayFlush Display
self =
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO ()
gdk_display_flush Ptr Display
argPtr1)
{-# LINE 260 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self


-- | Closes the connection to the windowing system for the given display, and
-- cleans up associated resources.
--
displayClose :: Display -> IO ()
displayClose :: Display -> IO ()
displayClose Display
self =
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO ()
gdk_display_close Ptr Display
argPtr1)
{-# LINE 269 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self

-- | Returns the list of available input devices attached to @display@.
--
displayListDevices :: Display
 -> IO [Device] -- ^ returns a list of 'Device'
displayListDevices :: Display -> IO [Device]
displayListDevices Display
self =
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr Display -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO (Ptr ())
gdk_display_list_devices Ptr Display
argPtr1)
{-# LINE 277 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
  IO (Ptr ()) -> (Ptr () -> IO [Ptr Device]) -> IO [Ptr Device]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr () -> IO [Ptr Device]
forall a. Ptr () -> IO [Ptr a]
readGList
  IO [Ptr Device] -> ([Ptr Device] -> IO [Device]) -> IO [Device]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Ptr Device -> IO Device) -> [Ptr Device] -> IO [Device]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM ((ForeignPtr Device -> Device, FinalizerPtr Device)
-> IO (Ptr Device) -> IO Device
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr Device -> Device, FinalizerPtr Device)
forall {a}. (ForeignPtr Device -> Device, FinalizerPtr a)
mkDevice (IO (Ptr Device) -> IO Device)
-> (Ptr Device -> IO (Ptr Device)) -> Ptr Device -> IO Device
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Device -> IO (Ptr Device)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return)


-- | Sets the double click time (two clicks within this time interval count as
-- a double click and result in an 'eventButton' where 'eventClick' is
-- 'DoubleClick'). Applications should /not/ set this, it is a global
-- user-configured setting.
--
displaySetDoubleClickTime :: Display
 -> Int -- ^ @msec@ - double click time in milliseconds (thousandths of a
        -- second)
 -> IO ()
displaySetDoubleClickTime :: Display -> Int -> IO ()
displaySetDoubleClickTime Display
self Int
msec =
  (\(Display ForeignPtr Display
arg1) CUInt
arg2 -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> CUInt -> IO ()
gdk_display_set_double_click_time Ptr Display
argPtr1 CUInt
arg2)
{-# LINE 293 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
msec)


-- | Sets the double click distance (two clicks within this distance count as
-- a double click and result in an 'eventButton' where 'eventClick' is
-- 'DoubleClick'). See also 'displaySetDoubleClickTime'. Applications should
-- /not/ set this, it is a global user-configured setting.
--
-- * Available since Gdk version 2.4
--
displaySetDoubleClickDistance :: Display
 -> Int -- ^ @distance@ - distance in pixels
 -> IO ()
displaySetDoubleClickDistance :: Display -> Int -> IO ()
displaySetDoubleClickDistance Display
self Int
distance =
  (\(Display ForeignPtr Display
arg1) CUInt
arg2 -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> CUInt -> IO ()
gdk_display_set_double_click_distance Ptr Display
argPtr1 CUInt
arg2)
{-# LINE 309 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
distance)


-- | Gets the current location of the pointer and the current modifier mask
-- for a given display.
--
displayGetPointer :: Display
 -> IO (Screen, [Modifier], Int, Int)
  -- ^ @(s, m, x, y)@ - the screen @s@, the modifier mask @m@ and the @x@ and
  -- @y@ coordinates of the pointer
displayGetPointer :: Display -> IO (Screen, [Modifier], Int, Int)
displayGetPointer Display
self =
  (Ptr (Ptr Screen) -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr (Ptr Screen) -> IO (Screen, [Modifier], Int, Int))
 -> IO (Screen, [Modifier], Int, Int))
-> (Ptr (Ptr Screen) -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr Screen)
sPtr ->
  (Ptr CInt -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CInt -> IO (Screen, [Modifier], Int, Int))
 -> IO (Screen, [Modifier], Int, Int))
-> (Ptr CInt -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. (a -> b) -> a -> b
$ \Ptr CInt
xPtr ->
  (Ptr CInt -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CInt -> IO (Screen, [Modifier], Int, Int))
 -> IO (Screen, [Modifier], Int, Int))
-> (Ptr CInt -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. (a -> b) -> a -> b
$ \Ptr CInt
yPtr ->
  (Ptr CInt -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CInt -> IO (Screen, [Modifier], Int, Int))
 -> IO (Screen, [Modifier], Int, Int))
-> (Ptr CInt -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. (a -> b) -> a -> b
$ \Ptr CInt
mPtr ->
  (\(Display ForeignPtr Display
arg1) Ptr Screen
arg2 Ptr CInt
arg3 Ptr CInt
arg4 Ptr CInt
arg5 -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display
-> Ptr Screen -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO ()
gdk_display_get_pointer Ptr Display
argPtr1 Ptr Screen
arg2 Ptr CInt
arg3 Ptr CInt
arg4 Ptr CInt
arg5)
{-# LINE 326 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    (Ptr (Ptr Screen) -> Ptr Screen
forall a b. Ptr a -> Ptr b
castPtr Ptr (Ptr Screen)
sPtr)
    Ptr CInt
xPtr
    Ptr CInt
yPtr
    Ptr CInt
mPtr IO () -> IO Screen -> IO Screen
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  (ForeignPtr Screen -> Screen, FinalizerPtr Screen)
-> IO (Ptr Screen) -> IO Screen
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr Screen -> Screen, FinalizerPtr Screen)
forall {a}. (ForeignPtr Screen -> Screen, FinalizerPtr a)
mkScreen (Ptr (Ptr Screen) -> IO (Ptr Screen)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Screen)
sPtr) IO Screen
-> (Screen -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Screen
s ->
  Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
xPtr IO CInt
-> (CInt -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CInt
x ->
  Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
yPtr IO CInt
-> (CInt -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CInt
y ->
  Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
mPtr IO CInt
-> (CInt -> IO (Screen, [Modifier], Int, Int))
-> IO (Screen, [Modifier], Int, Int)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CInt
m ->
  (Screen, [Modifier], Int, Int) -> IO (Screen, [Modifier], Int, Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Screen
s, Int -> [Modifier]
forall a. Flags a => Int -> [a]
toFlags (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
m), CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
x, CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
y)

-- | Obtains the window underneath the mouse pointer, returning the location
-- of the pointer in that window in @winX@, @winY@ for @screen@. Returns
-- @Nothing@ if
-- the window under the mouse pointer is not known to GDK (for example, belongs
-- to another application).
--
displayGetWindowAtPointer :: Display
 -> IO (Maybe (DrawWindow, Int, Int))
  -- ^ @(screen, winX, winY)@ returns the window under the mouse
  -- pointer, or @Nothing@. The @winX@ and @winY@ denote the pointer location
  -- relative to the window origin
displayGetWindowAtPointer :: Display -> IO (Maybe (DrawWindow, Int, Int))
displayGetWindowAtPointer Display
self =
  (Ptr CInt -> IO (Maybe (DrawWindow, Int, Int)))
-> IO (Maybe (DrawWindow, Int, Int))
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CInt -> IO (Maybe (DrawWindow, Int, Int)))
 -> IO (Maybe (DrawWindow, Int, Int)))
-> (Ptr CInt -> IO (Maybe (DrawWindow, Int, Int)))
-> IO (Maybe (DrawWindow, Int, Int))
forall a b. (a -> b) -> a -> b
$ \Ptr CInt
winXPtr ->
  (Ptr CInt -> IO (Maybe (DrawWindow, Int, Int)))
-> IO (Maybe (DrawWindow, Int, Int))
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CInt -> IO (Maybe (DrawWindow, Int, Int)))
 -> IO (Maybe (DrawWindow, Int, Int)))
-> (Ptr CInt -> IO (Maybe (DrawWindow, Int, Int)))
-> IO (Maybe (DrawWindow, Int, Int))
forall a b. (a -> b) -> a -> b
$ \Ptr CInt
winYPtr -> do
  Ptr DrawWindow
wPtr <- (\(Display ForeignPtr Display
arg1) Ptr CInt
arg2 Ptr CInt
arg3 -> ForeignPtr Display
-> (Ptr Display -> IO (Ptr DrawWindow)) -> IO (Ptr DrawWindow)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO (Ptr DrawWindow)) -> IO (Ptr DrawWindow))
-> (Ptr Display -> IO (Ptr DrawWindow)) -> IO (Ptr DrawWindow)
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> Ptr CInt -> Ptr CInt -> IO (Ptr DrawWindow)
gdk_display_get_window_at_pointer Ptr Display
argPtr1 Ptr CInt
arg2 Ptr CInt
arg3)
{-# LINE 352 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    Ptr CInt
winXPtr
    Ptr CInt
winYPtr
  if Ptr DrawWindow
wPtrPtr DrawWindow -> Ptr DrawWindow -> Bool
forall a. Eq a => a -> a -> Bool
==Ptr DrawWindow
forall a. Ptr a
nullPtr then Maybe (DrawWindow, Int, Int) -> IO (Maybe (DrawWindow, Int, Int))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe (DrawWindow, Int, Int)
forall a. Maybe a
Nothing else
    Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
winXPtr IO CInt
-> (CInt -> IO (Maybe (DrawWindow, Int, Int)))
-> IO (Maybe (DrawWindow, Int, Int))
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CInt
winX ->
    Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
winYPtr IO CInt
-> (CInt -> IO (Maybe (DrawWindow, Int, Int)))
-> IO (Maybe (DrawWindow, Int, Int))
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CInt
winY ->
    (ForeignPtr DrawWindow -> DrawWindow, FinalizerPtr DrawWindow)
-> IO (Ptr DrawWindow) -> IO DrawWindow
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr DrawWindow -> DrawWindow, FinalizerPtr DrawWindow)
forall {a}. (ForeignPtr DrawWindow -> DrawWindow, FinalizerPtr a)
mkDrawWindow (Ptr DrawWindow -> IO (Ptr DrawWindow)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr DrawWindow
wPtr) IO DrawWindow
-> (DrawWindow -> IO (Maybe (DrawWindow, Int, Int)))
-> IO (Maybe (DrawWindow, Int, Int))
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \DrawWindow
win ->
    Maybe (DrawWindow, Int, Int) -> IO (Maybe (DrawWindow, Int, Int))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ((DrawWindow, Int, Int) -> Maybe (DrawWindow, Int, Int)
forall a. a -> Maybe a
Just (DrawWindow
win, CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
winX, CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
winY))

{- not worth the trouble

-- | This function allows for hooking into the operation of getting the
-- current location of the pointer on a particular display. This is only useful
-- for such low-level tools as an event recorder. Applications should never
-- have any reason to use this facility.
--
displaySetPointerHooks :: Display
 -> {-const-GdkDisplayPointerHooks*-} -- ^ @newHooks@ - a table of pointers to
                                      -- functions for getting quantities
                                      -- related to the current pointer
                                      -- position, or {@NULL@, FIXME: this
                                      -- should probably be converted to a
                                      -- Maybe data type} to restore the
                                      -- default table.
 -> IO {-GdkDisplayPointerHooks*-} -- ^ returns the previous pointer hook
                                      -- table
displaySetPointerHooks self newHooks =
  {# call gdk_display_set_pointer_hooks #}
    self
    {-newHooks-}
-}


-- | Moves the pointer of @display@ to the point @x@,@y@ on the screen
-- @screen@, unless the pointer is confined to a window by a grab, in which
-- case it will be moved as far as allowed by the grab. Warping the pointer
-- creates events as if the user had moved the mouse instantaneously to the
-- destination.
--
-- Note that the pointer should normally be under the control of the user.
-- This function was added to cover some rare use cases like keyboard
-- navigation support for the color picker in the 'ColorSelectionDialog'.
--
-- * Available since Gdk version 2.8
--
displayWarpPointer :: Display
 -> Screen -- ^ @screen@ - the screen of @display@ to warp the pointer to
 -> Int -- ^ @x@ - the x coordinate of the destination
 -> Int -- ^ @y@ - the y coordinate of the destination
 -> IO ()
displayWarpPointer :: Display -> Screen -> Int -> Int -> IO ()
displayWarpPointer Display
self Screen
screen Int
x Int
y =
  (\(Display ForeignPtr Display
arg1) (Screen ForeignPtr Screen
arg2) CInt
arg3 CInt
arg4 -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->ForeignPtr Screen -> (Ptr Screen -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Screen
arg2 ((Ptr Screen -> IO ()) -> IO ()) -> (Ptr Screen -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Screen
argPtr2 ->Ptr Display -> Ptr Screen -> CInt -> CInt -> IO ()
gdk_display_warp_pointer Ptr Display
argPtr1 Ptr Screen
argPtr2 CInt
arg3 CInt
arg4)
{-# LINE 404 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    Screen
screen
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y)



-- | Returns @True@ if multicolored cursors are supported on @display@.
-- Otherwise, cursors have only a forground and a background color.
--
-- * Available since Gdk version 2.4
--
displaySupportsCursorColor :: Display
 -> IO Bool -- ^ returns whether cursors can have multiple colors.
displaySupportsCursorColor :: Display -> IO Bool
displaySupportsCursorColor Display
self =
  (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
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CInt) -> IO CInt)
-> (Ptr Display -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO CInt
gdk_display_supports_cursor_color Ptr Display
argPtr1)
{-# LINE 421 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self

-- | Returns @True@ if cursors can use an 8bit alpha channel on @display@.
-- Otherwise, cursors are restricted to bilevel alpha (i.e. a mask).
--
-- * Available since Gdk version 2.4
--
displaySupportsCursorAlpha :: Display
 -> IO Bool -- ^ returns whether cursors can have alpha channels.
displaySupportsCursorAlpha :: Display -> IO Bool
displaySupportsCursorAlpha Display
self =
  (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
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CInt) -> IO CInt)
-> (Ptr Display -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO CInt
gdk_display_supports_cursor_alpha Ptr Display
argPtr1)
{-# LINE 433 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self

-- | Returns the default size to use for cursors on @display@.
--
-- * Available since Gdk version 2.4
--
displayGetDefaultCursorSize :: Display
 -> IO Int -- ^ returns the default cursor size.
displayGetDefaultCursorSize :: Display -> IO Int
displayGetDefaultCursorSize Display
self =
  (CUInt -> Int) -> IO CUInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CUInt -> IO Int) -> IO CUInt -> IO Int
forall a b. (a -> b) -> a -> b
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO CUInt) -> IO CUInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CUInt) -> IO CUInt)
-> (Ptr Display -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO CUInt
gdk_display_get_default_cursor_size Ptr Display
argPtr1)
{-# LINE 444 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self

-- | Gets the maximal size to use for cursors on @display@.
--
-- * Available since Gdk version 2.4
--
displayGetMaximalCursorSize :: Display
 -> IO (Int, Int) -- ^ @(width, height)@
                  -- maximal @width@ and @height@ of the cursor
displayGetMaximalCursorSize :: Display -> IO (Int, Int)
displayGetMaximalCursorSize Display
self =
  (Ptr CUInt -> IO (Int, Int)) -> IO (Int, Int)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CUInt -> IO (Int, Int)) -> IO (Int, Int))
-> (Ptr CUInt -> IO (Int, Int)) -> IO (Int, Int)
forall a b. (a -> b) -> a -> b
$ \Ptr CUInt
widthPtr ->
  (Ptr CUInt -> IO (Int, Int)) -> IO (Int, Int)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CUInt -> IO (Int, Int)) -> IO (Int, Int))
-> (Ptr CUInt -> IO (Int, Int)) -> IO (Int, Int)
forall a b. (a -> b) -> a -> b
$ \Ptr CUInt
heightPtr ->
  (\(Display ForeignPtr Display
arg1) Ptr CUInt
arg2 Ptr CUInt
arg3 -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> Ptr CUInt -> Ptr CUInt -> IO ()
gdk_display_get_maximal_cursor_size Ptr Display
argPtr1 Ptr CUInt
arg2 Ptr CUInt
arg3)
{-# LINE 457 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    Ptr CUInt
widthPtr
    Ptr CUInt
heightPtr IO () -> IO CUInt -> IO CUInt
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
widthPtr IO CUInt -> (CUInt -> IO (Int, Int)) -> IO (Int, Int)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CUInt
width ->
  Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
heightPtr IO CUInt -> (CUInt -> IO (Int, Int)) -> IO (Int, Int)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CUInt
height ->
  (Int, Int) -> IO (Int, Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
width, CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
height)

-- | Returns the default group leader window for all toplevel windows on
-- @display@. This window is implicitly created by GDK. See 'windowSetGroup'.
--
-- * Available since Gdk version 2.4
--
displayGetDefaultGroup :: Display
 -> IO DrawWindow -- ^ returns The default group leader window for @display@
displayGetDefaultGroup :: Display -> IO DrawWindow
displayGetDefaultGroup Display
self =
  (ForeignPtr DrawWindow -> DrawWindow, FinalizerPtr DrawWindow)
-> IO (Ptr DrawWindow) -> IO DrawWindow
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr DrawWindow -> DrawWindow, FinalizerPtr DrawWindow)
forall {a}. (ForeignPtr DrawWindow -> DrawWindow, FinalizerPtr a)
mkDrawWindow (IO (Ptr DrawWindow) -> IO DrawWindow)
-> IO (Ptr DrawWindow) -> IO DrawWindow
forall a b. (a -> b) -> a -> b
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display
-> (Ptr Display -> IO (Ptr DrawWindow)) -> IO (Ptr DrawWindow)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO (Ptr DrawWindow)) -> IO (Ptr DrawWindow))
-> (Ptr Display -> IO (Ptr DrawWindow)) -> IO (Ptr DrawWindow)
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO (Ptr DrawWindow)
gdk_display_get_default_group Ptr Display
argPtr1)
{-# LINE 474 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self


-- | Returns whether 'EOwnerChange' events will be
-- sent when the owner of a selection changes.
--
-- * Available since Gdk version 2.6
--
displaySupportsSelectionNotification :: Display
 -> IO Bool -- ^ returns whether 'EOwnerChange'
            -- events will be sent.
displaySupportsSelectionNotification :: Display -> IO Bool
displaySupportsSelectionNotification Display
self =
  (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
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CInt) -> IO CInt)
-> (Ptr Display -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO CInt
gdk_display_supports_selection_notification Ptr Display
argPtr1)
{-# LINE 488 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self

-- | Request 'EOwnerChange' events for ownership
-- changes of the selection named by the given atom.
--
-- * Available since Gdk version 2.6
--
displayRequestSelectionNotification :: Display
 -> SelectionTag -- ^ @selection@ - the 'Atom' naming
                -- the selection for which ownership change notification is
                -- requested
 -> IO Bool -- ^ returns whether 'EOwnerChange'
                -- events will be sent.
displayRequestSelectionNotification :: Display -> SelectionTag -> IO Bool
displayRequestSelectionNotification Display
self (Atom Ptr ()
selection) =
  (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
$
  (\(Display ForeignPtr Display
arg1) Ptr ()
arg2 -> ForeignPtr Display -> (Ptr Display -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CInt) -> IO CInt)
-> (Ptr Display -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> Ptr () -> IO CInt
gdk_display_request_selection_notification Ptr Display
argPtr1 Ptr ()
arg2)
{-# LINE 504 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    Ptr ()
selection

-- | Returns whether the speicifed display supports clipboard persistance;
-- i.e. if it's possible to store the clipboard data after an application has
-- quit. On X11 this checks if a clipboard daemon is running.
--
-- * Available since Gdk version 2.6
--
displaySupportsClipboardPersistence :: Display
 -> IO Bool -- ^ returns @True@ if the display supports clipboard persistance.
displaySupportsClipboardPersistence :: Display -> IO Bool
displaySupportsClipboardPersistence Display
self =
  (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
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CInt) -> IO CInt)
-> (Ptr Display -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO CInt
gdk_display_supports_clipboard_persistence Ptr Display
argPtr1)
{-# LINE 518 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self

-- | Issues a request to the clipboard manager to store the clipboard data. On
-- X11, this is a special program that works according to the freedesktop
-- clipboard specification, available at
-- http:\/\/www.freedesktop.org\/Standards\/clipboard-manager-spec.
--
-- * Available since Gdk version 2.6
--
displayStoreClipboard :: Display
 -> DrawWindow -- ^ @clipboardWindow@ - a 'DrawWindow' belonging to
                       -- the clipboard owner
 -> Word32 -- ^ @time@ - a timestamp
 -> (Maybe [TargetTag]) -- ^ @targets@ - an array of targets that should be
                         -- saved, or @Nothing@ if all available
                         -- targets should be saved.
 -> IO ()
displayStoreClipboard :: Display -> DrawWindow -> Word32 -> Maybe [SelectionTag] -> IO ()
displayStoreClipboard Display
self DrawWindow
clipboardWindow Word32
time (Just [SelectionTag]
targets) =
  [Ptr ()] -> (Int -> Ptr (Ptr ()) -> IO ()) -> IO ()
forall a b. Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
withArrayLen ((SelectionTag -> Ptr ()) -> [SelectionTag] -> [Ptr ()]
forall a b. (a -> b) -> [a] -> [b]
map (\(Atom Ptr ()
a) -> Ptr ()
a) [SelectionTag]
targets) ((Int -> Ptr (Ptr ()) -> IO ()) -> IO ())
-> (Int -> Ptr (Ptr ()) -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Int
nTargets Ptr (Ptr ())
tPtr ->
  (\(Display ForeignPtr Display
arg1) (DrawWindow ForeignPtr DrawWindow
arg2) CUInt
arg3 Ptr (Ptr ())
arg4 CInt
arg5 -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->ForeignPtr DrawWindow -> (Ptr DrawWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DrawWindow
arg2 ((Ptr DrawWindow -> IO ()) -> IO ())
-> (Ptr DrawWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DrawWindow
argPtr2 ->Ptr Display
-> Ptr DrawWindow -> CUInt -> Ptr (Ptr ()) -> CInt -> IO ()
gdk_display_store_clipboard Ptr Display
argPtr1 Ptr DrawWindow
argPtr2 CUInt
arg3 Ptr (Ptr ())
arg4 CInt
arg5)
{-# LINE 538 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    DrawWindow
clipboardWindow
    (Word32 -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
time)
    Ptr (Ptr ())
tPtr
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
nTargets)
displayStoreClipboard Display
self DrawWindow
clipboardWindow Word32
time Maybe [SelectionTag]
Nothing =
  (\(Display ForeignPtr Display
arg1) (DrawWindow ForeignPtr DrawWindow
arg2) CUInt
arg3 Ptr (Ptr ())
arg4 CInt
arg5 -> ForeignPtr Display -> (Ptr Display -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO ()) -> IO ())
-> (Ptr Display -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->ForeignPtr DrawWindow -> (Ptr DrawWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DrawWindow
arg2 ((Ptr DrawWindow -> IO ()) -> IO ())
-> (Ptr DrawWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DrawWindow
argPtr2 ->Ptr Display
-> Ptr DrawWindow -> CUInt -> Ptr (Ptr ()) -> CInt -> IO ()
gdk_display_store_clipboard Ptr Display
argPtr1 Ptr DrawWindow
argPtr2 CUInt
arg3 Ptr (Ptr ())
arg4 CInt
arg5)
{-# LINE 545 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self
    DrawWindow
clipboardWindow
    (Word32 -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
time)
    Ptr (Ptr ())
forall a. Ptr a
nullPtr
    CInt
0


-- | Returns @True@ if 'windowShapeCombineMask' can be used to create shaped
-- windows on @display@.
--
-- * Available since Gdk version 2.10
--
displaySupportsShapes :: Display
 -> IO Bool -- ^ returns @True@ if shaped windows are supported
displaySupportsShapes :: Display -> IO Bool
displaySupportsShapes Display
self =
  (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
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CInt) -> IO CInt)
-> (Ptr Display -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO CInt
gdk_display_supports_shapes Ptr Display
argPtr1)
{-# LINE 562 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self

-- | Returns @True@ if 'windowInputShapeCombineMask' can be used to modify the
-- input shape of windows on @display@.
--
-- * Available since Gdk version 2.10
--
displaySupportsInputShapes :: Display
 -> IO Bool -- ^ returns @True@ if windows with modified input shape are
            -- supported
displaySupportsInputShapes :: Display -> IO Bool
displaySupportsInputShapes Display
self =
  (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
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CInt) -> IO CInt)
-> (Ptr Display -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO CInt
gdk_display_supports_input_shapes Ptr Display
argPtr1)
{-# LINE 575 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self


-- | Returns @True@ if 'windowSetComposited' can be used to redirect drawing
-- on the window using compositing.
--
-- Currently this only works on X11 with XComposite and XDamage extensions
-- available.
--
-- * Available since Gdk version 2.12
--
displaySupportsComposite :: Display
 -> IO Bool -- ^ returns @True@ if windows may be composited.
displaySupportsComposite :: Display -> IO Bool
displaySupportsComposite Display
self =
  (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
$
  (\(Display ForeignPtr Display
arg1) -> ForeignPtr Display -> (Ptr Display -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO CInt) -> IO CInt)
-> (Ptr Display -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> IO CInt
gdk_display_supports_composite Ptr Display
argPtr1)
{-# LINE 591 "./Graphics/UI/Gtk/Gdk/Display.chs" #-}
    self





--------------------
-- Signals

-- | The 'displayClosed' signal is emitted when the connection to the windowing
-- system for @display@ is closed.
--
displayClosed :: DisplayClass self => Signal self (Bool -> IO ())
displayClosed :: forall self. DisplayClass self => Signal self (Bool -> IO ())
displayClosed = (Bool -> self -> (Bool -> IO ()) -> IO (ConnectId self))
-> Signal self (Bool -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName
-> Bool -> self -> (Bool -> IO ()) -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
SignalName -> Bool -> obj -> (Bool -> IO ()) -> IO (ConnectId obj)
connect_BOOL__NONE SignalName
"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))