{-# LINE 1 "Graphics/X11/Xlib/Event.hsc" #-}
{-# LANGUAGE DeriveDataTypeable #-}
module Graphics.X11.Xlib.Event(
QueuedMode,
queuedAlready,
queuedAfterFlush,
queuedAfterReading,
XEvent(..),
XEventPtr,
allocaXEvent,
get_EventType,
get_Window,
XKeyEvent,
XKeyEventPtr,
asKeyEvent,
XButtonEvent,
get_KeyEvent,
get_ButtonEvent,
get_MotionEvent,
XMotionEvent,
XExposeEvent,
get_ExposeEvent,
XMappingEvent,
XConfigureEvent,
get_ConfigureEvent,
waitForEvent,
gettimeofday_in_milliseconds,
flush,
sync,
pending,
eventsQueued,
nextEvent,
allowEvents,
selectInput,
sendEvent,
windowEvent,
checkWindowEvent,
maskEvent,
checkMaskEvent,
checkTypedEvent,
checkTypedWindowEvent,
putBackEvent,
peekEvent,
refreshKeyboardMapping,
) where
import Graphics.X11.Types
import Graphics.X11.Xlib.Types
import Graphics.X11.Xlib.Display( connectionNumber )
import Foreign
import Foreign.C.Types
{-# LINE 70 "Graphics/X11/Xlib/Event.hsc" #-}
import Data.Data
{-# LINE 72 "Graphics/X11/Xlib/Event.hsc" #-}
{-# CFILES cbits/fdset.c #-}
type QueuedMode = CInt
queuedAlready :: QueuedMode
queuedAlready :: QueuedMode
queuedAlready = QueuedMode
0
queuedAfterFlush :: QueuedMode
queuedAfterFlush :: QueuedMode
queuedAfterFlush = QueuedMode
2
queuedAfterReading :: QueuedMode
queuedAfterReading :: QueuedMode
queuedAfterReading = QueuedMode
1
{-# LINE 87 "Graphics/X11/Xlib/Event.hsc" #-}
newtype XEvent = XEvent XEventPtr
{-# LINE 101 "Graphics/X11/Xlib/Event.hsc" #-}
deriving (XEvent -> XEvent -> Bool
(XEvent -> XEvent -> Bool)
-> (XEvent -> XEvent -> Bool) -> Eq XEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: XEvent -> XEvent -> Bool
$c/= :: XEvent -> XEvent -> Bool
== :: XEvent -> XEvent -> Bool
$c== :: XEvent -> XEvent -> Bool
Eq, Eq XEvent
Eq XEvent
-> (XEvent -> XEvent -> Ordering)
-> (XEvent -> XEvent -> Bool)
-> (XEvent -> XEvent -> Bool)
-> (XEvent -> XEvent -> Bool)
-> (XEvent -> XEvent -> Bool)
-> (XEvent -> XEvent -> XEvent)
-> (XEvent -> XEvent -> XEvent)
-> Ord XEvent
XEvent -> XEvent -> Bool
XEvent -> XEvent -> Ordering
XEvent -> XEvent -> XEvent
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: XEvent -> XEvent -> XEvent
$cmin :: XEvent -> XEvent -> XEvent
max :: XEvent -> XEvent -> XEvent
$cmax :: XEvent -> XEvent -> XEvent
>= :: XEvent -> XEvent -> Bool
$c>= :: XEvent -> XEvent -> Bool
> :: XEvent -> XEvent -> Bool
$c> :: XEvent -> XEvent -> Bool
<= :: XEvent -> XEvent -> Bool
$c<= :: XEvent -> XEvent -> Bool
< :: XEvent -> XEvent -> Bool
$c< :: XEvent -> XEvent -> Bool
compare :: XEvent -> XEvent -> Ordering
$ccompare :: XEvent -> XEvent -> Ordering
$cp1Ord :: Eq XEvent
Ord, Int -> XEvent -> ShowS
[XEvent] -> ShowS
XEvent -> String
(Int -> XEvent -> ShowS)
-> (XEvent -> String) -> ([XEvent] -> ShowS) -> Show XEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [XEvent] -> ShowS
$cshowList :: [XEvent] -> ShowS
show :: XEvent -> String
$cshow :: XEvent -> String
showsPrec :: Int -> XEvent -> ShowS
$cshowsPrec :: Int -> XEvent -> ShowS
Show, Typeable, Typeable XEvent
DataType
Constr
Typeable XEvent
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> XEvent -> c XEvent)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c XEvent)
-> (XEvent -> Constr)
-> (XEvent -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c XEvent))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c XEvent))
-> ((forall b. Data b => b -> b) -> XEvent -> XEvent)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> XEvent -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> XEvent -> r)
-> (forall u. (forall d. Data d => d -> u) -> XEvent -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> XEvent -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> XEvent -> m XEvent)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> XEvent -> m XEvent)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> XEvent -> m XEvent)
-> Data XEvent
XEvent -> DataType
XEvent -> Constr
(forall b. Data b => b -> b) -> XEvent -> XEvent
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> XEvent -> c XEvent
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c XEvent
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> XEvent -> u
forall u. (forall d. Data d => d -> u) -> XEvent -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> XEvent -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> XEvent -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> XEvent -> m XEvent
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> XEvent -> m XEvent
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c XEvent
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> XEvent -> c XEvent
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c XEvent)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c XEvent)
$cXEvent :: Constr
$tXEvent :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> XEvent -> m XEvent
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> XEvent -> m XEvent
gmapMp :: (forall d. Data d => d -> m d) -> XEvent -> m XEvent
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> XEvent -> m XEvent
gmapM :: (forall d. Data d => d -> m d) -> XEvent -> m XEvent
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> XEvent -> m XEvent
gmapQi :: Int -> (forall d. Data d => d -> u) -> XEvent -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> XEvent -> u
gmapQ :: (forall d. Data d => d -> u) -> XEvent -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> XEvent -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> XEvent -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> XEvent -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> XEvent -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> XEvent -> r
gmapT :: (forall b. Data b => b -> b) -> XEvent -> XEvent
$cgmapT :: (forall b. Data b => b -> b) -> XEvent -> XEvent
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c XEvent)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c XEvent)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c XEvent)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c XEvent)
dataTypeOf :: XEvent -> DataType
$cdataTypeOf :: XEvent -> DataType
toConstr :: XEvent -> Constr
$ctoConstr :: XEvent -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c XEvent
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c XEvent
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> XEvent -> c XEvent
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> XEvent -> c XEvent
$cp1Data :: Typeable XEvent
Data)
{-# LINE 105 "Graphics/X11/Xlib/Event.hsc" #-}
type XEventPtr = Ptr XEvent
allocaXEvent :: (XEventPtr -> IO a) -> IO a
allocaXEvent :: (XEventPtr -> IO a) -> IO a
allocaXEvent = Int -> (XEventPtr -> IO a) -> IO a
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes (Int
192)
{-# LINE 109 "Graphics/X11/Xlib/Event.hsc" #-}
get_EventType :: XEventPtr -> IO EventType
get_EventType :: XEventPtr -> IO EventType
get_EventType = (\XEventPtr
hsc_ptr -> XEventPtr -> Int -> IO EventType
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff XEventPtr
hsc_ptr Int
0)
{-# LINE 112 "Graphics/X11/Xlib/Event.hsc" #-}
get_Window :: XEventPtr -> IO Window
get_Window :: XEventPtr -> IO Window
get_Window = (\XEventPtr
hsc_ptr -> XEventPtr -> Int -> IO Window
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff XEventPtr
hsc_ptr Int
32)
{-# LINE 115 "Graphics/X11/Xlib/Event.hsc" #-}
type XKeyEvent =
( Window
, Window
, Time
, CInt
, CInt
, CInt
, CInt
, Modifier
, KeyCode
, Bool
)
peekXKeyEvent :: Ptr XKeyEvent -> IO XKeyEvent
peekXKeyEvent :: Ptr XKeyEvent -> IO XKeyEvent
peekXKeyEvent Ptr XKeyEvent
p = do
Window
root <- (\Ptr XKeyEvent
hsc_ptr -> Ptr XKeyEvent -> Int -> IO Window
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XKeyEvent
hsc_ptr Int
40) Ptr XKeyEvent
p
{-# LINE 138 "Graphics/X11/Xlib/Event.hsc" #-}
Window
subwindow <- (\Ptr XKeyEvent
hsc_ptr -> Ptr XKeyEvent -> Int -> IO Window
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XKeyEvent
hsc_ptr Int
48) Ptr XKeyEvent
p
{-# LINE 139 "Graphics/X11/Xlib/Event.hsc" #-}
Window
time <- (\Ptr XKeyEvent
hsc_ptr -> Ptr XKeyEvent -> Int -> IO Window
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XKeyEvent
hsc_ptr Int
56) Ptr XKeyEvent
p
{-# LINE 140 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
x <- (\Ptr XKeyEvent
hsc_ptr -> Ptr XKeyEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XKeyEvent
hsc_ptr Int
64) Ptr XKeyEvent
p
{-# LINE 141 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
y <- (\Ptr XKeyEvent
hsc_ptr -> Ptr XKeyEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XKeyEvent
hsc_ptr Int
68) Ptr XKeyEvent
p
{-# LINE 142 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
x_root <- (\Ptr XKeyEvent
hsc_ptr -> Ptr XKeyEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XKeyEvent
hsc_ptr Int
72) Ptr XKeyEvent
p
{-# LINE 143 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
y_root <- (\Ptr XKeyEvent
hsc_ptr -> Ptr XKeyEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XKeyEvent
hsc_ptr Int
76) Ptr XKeyEvent
p
{-# LINE 144 "Graphics/X11/Xlib/Event.hsc" #-}
CUInt
state <- ((\Ptr XKeyEvent
hsc_ptr -> Ptr XKeyEvent -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XKeyEvent
hsc_ptr Int
80) Ptr XKeyEvent
p) :: IO CUInt
{-# LINE 145 "Graphics/X11/Xlib/Event.hsc" #-}
CUInt
keycode <- ((\Ptr XKeyEvent
hsc_ptr -> Ptr XKeyEvent -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XKeyEvent
hsc_ptr Int
84) Ptr XKeyEvent
p) :: IO CUInt
{-# LINE 146 "Graphics/X11/Xlib/Event.hsc" #-}
Bool
same_screen <- (\Ptr XKeyEvent
hsc_ptr -> Ptr XKeyEvent -> Int -> IO Bool
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XKeyEvent
hsc_ptr Int
88) Ptr XKeyEvent
p
{-# LINE 147 "Graphics/X11/Xlib/Event.hsc" #-}
XKeyEvent -> IO XKeyEvent
forall (m :: * -> *) a. Monad m => a -> m a
return (Window
root, Window
subwindow, Window
time, QueuedMode
x, QueuedMode
y, QueuedMode
x_root, QueuedMode
y_root,
CUInt -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
state, CUInt -> KeyCode
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
keycode, Bool
same_screen)
get_KeyEvent :: XEventPtr -> IO XKeyEvent
get_KeyEvent :: XEventPtr -> IO XKeyEvent
get_KeyEvent XEventPtr
p = Ptr XKeyEvent -> IO XKeyEvent
peekXKeyEvent (XEventPtr -> Ptr XKeyEvent
forall a b. Ptr a -> Ptr b
castPtr XEventPtr
p)
type XKeyEventPtr = Ptr XKeyEvent
asKeyEvent :: XEventPtr -> XKeyEventPtr
asKeyEvent :: XEventPtr -> Ptr XKeyEvent
asKeyEvent = XEventPtr -> Ptr XKeyEvent
forall a b. Ptr a -> Ptr b
castPtr
type XButtonEvent =
( Window
, Window
, Time
, CInt
, CInt
, CInt
, CInt
, Modifier
, Button
, Bool
)
peekXButtonEvent :: Ptr XButtonEvent -> IO XButtonEvent
peekXButtonEvent :: Ptr XButtonEvent -> IO XButtonEvent
peekXButtonEvent Ptr XButtonEvent
p = do
Window
root <- (\Ptr XButtonEvent
hsc_ptr -> Ptr XButtonEvent -> Int -> IO Window
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XButtonEvent
hsc_ptr Int
40) Ptr XButtonEvent
p
{-# LINE 174 "Graphics/X11/Xlib/Event.hsc" #-}
Window
subwindow <- (\Ptr XButtonEvent
hsc_ptr -> Ptr XButtonEvent -> Int -> IO Window
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XButtonEvent
hsc_ptr Int
48) Ptr XButtonEvent
p
{-# LINE 175 "Graphics/X11/Xlib/Event.hsc" #-}
Window
time <- (\Ptr XButtonEvent
hsc_ptr -> Ptr XButtonEvent -> Int -> IO Window
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XButtonEvent
hsc_ptr Int
56) Ptr XButtonEvent
p
{-# LINE 176 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
x <- (\Ptr XButtonEvent
hsc_ptr -> Ptr XButtonEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XButtonEvent
hsc_ptr Int
64) Ptr XButtonEvent
p
{-# LINE 177 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
y <- (\Ptr XButtonEvent
hsc_ptr -> Ptr XButtonEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XButtonEvent
hsc_ptr Int
68) Ptr XButtonEvent
p
{-# LINE 178 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
x_root <- (\Ptr XButtonEvent
hsc_ptr -> Ptr XButtonEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XButtonEvent
hsc_ptr Int
72) Ptr XButtonEvent
p
{-# LINE 179 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
y_root <- (\Ptr XButtonEvent
hsc_ptr -> Ptr XButtonEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XButtonEvent
hsc_ptr Int
76) Ptr XButtonEvent
p
{-# LINE 180 "Graphics/X11/Xlib/Event.hsc" #-}
CUInt
state <- (\Ptr XButtonEvent
hsc_ptr -> Ptr XButtonEvent -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XButtonEvent
hsc_ptr Int
80) Ptr XButtonEvent
p
{-# LINE 181 "Graphics/X11/Xlib/Event.hsc" #-}
EventType
button <- (\Ptr XButtonEvent
hsc_ptr -> Ptr XButtonEvent -> Int -> IO EventType
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XButtonEvent
hsc_ptr Int
84) Ptr XButtonEvent
p
{-# LINE 182 "Graphics/X11/Xlib/Event.hsc" #-}
Bool
same_screen <- (\Ptr XButtonEvent
hsc_ptr -> Ptr XButtonEvent -> Int -> IO Bool
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XButtonEvent
hsc_ptr Int
88) Ptr XButtonEvent
p
{-# LINE 183 "Graphics/X11/Xlib/Event.hsc" #-}
XButtonEvent -> IO XButtonEvent
forall (m :: * -> *) a. Monad m => a -> m a
return (Window
root, Window
subwindow, Window
time, QueuedMode
x, QueuedMode
y, QueuedMode
x_root, QueuedMode
y_root,
CUInt
state, EventType
button, Bool
same_screen)
get_ButtonEvent :: XEventPtr -> IO XButtonEvent
get_ButtonEvent :: XEventPtr -> IO XButtonEvent
get_ButtonEvent XEventPtr
p = Ptr XButtonEvent -> IO XButtonEvent
peekXButtonEvent (XEventPtr -> Ptr XButtonEvent
forall a b. Ptr a -> Ptr b
castPtr XEventPtr
p)
type XMotionEvent =
( Window
, Window
, Time
, CInt
, CInt
, CInt
, CInt
, Modifier
, NotifyMode
, Bool
)
peekXMotionEvent :: Ptr XMotionEvent -> IO XMotionEvent
peekXMotionEvent :: Ptr XMotionEvent -> IO XMotionEvent
peekXMotionEvent Ptr XMotionEvent
p = do
Window
root <- (\Ptr XMotionEvent
hsc_ptr -> Ptr XMotionEvent -> Int -> IO Window
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XMotionEvent
hsc_ptr Int
40) Ptr XMotionEvent
p
{-# LINE 205 "Graphics/X11/Xlib/Event.hsc" #-}
Window
subwindow <- (\Ptr XMotionEvent
hsc_ptr -> Ptr XMotionEvent -> Int -> IO Window
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XMotionEvent
hsc_ptr Int
48) Ptr XMotionEvent
p
{-# LINE 206 "Graphics/X11/Xlib/Event.hsc" #-}
Window
time <- (\Ptr XMotionEvent
hsc_ptr -> Ptr XMotionEvent -> Int -> IO Window
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XMotionEvent
hsc_ptr Int
56) Ptr XMotionEvent
p
{-# LINE 207 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
x <- (\Ptr XMotionEvent
hsc_ptr -> Ptr XMotionEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XMotionEvent
hsc_ptr Int
64) Ptr XMotionEvent
p
{-# LINE 208 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
y <- (\Ptr XMotionEvent
hsc_ptr -> Ptr XMotionEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XMotionEvent
hsc_ptr Int
68) Ptr XMotionEvent
p
{-# LINE 209 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
x_root <- (\Ptr XMotionEvent
hsc_ptr -> Ptr XMotionEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XMotionEvent
hsc_ptr Int
72) Ptr XMotionEvent
p
{-# LINE 210 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
y_root <- (\Ptr XMotionEvent
hsc_ptr -> Ptr XMotionEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XMotionEvent
hsc_ptr Int
76) Ptr XMotionEvent
p
{-# LINE 211 "Graphics/X11/Xlib/Event.hsc" #-}
CUInt
state <- (\Ptr XMotionEvent
hsc_ptr -> Ptr XMotionEvent -> Int -> IO CUInt
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XMotionEvent
hsc_ptr Int
80) Ptr XMotionEvent
p
{-# LINE 212 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
is_hint <- (\Ptr XMotionEvent
hsc_ptr -> Ptr XMotionEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XMotionEvent
hsc_ptr Int
84) Ptr XMotionEvent
p
{-# LINE 213 "Graphics/X11/Xlib/Event.hsc" #-}
Bool
same_screen <- (\Ptr XMotionEvent
hsc_ptr -> Ptr XMotionEvent -> Int -> IO Bool
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XMotionEvent
hsc_ptr Int
88) Ptr XMotionEvent
p
{-# LINE 214 "Graphics/X11/Xlib/Event.hsc" #-}
XMotionEvent -> IO XMotionEvent
forall (m :: * -> *) a. Monad m => a -> m a
return (Window
root, Window
subwindow, Window
time, QueuedMode
x, QueuedMode
y, QueuedMode
x_root, QueuedMode
y_root,
CUInt
state, QueuedMode
is_hint, Bool
same_screen)
get_MotionEvent :: XEventPtr -> IO XMotionEvent
get_MotionEvent :: XEventPtr -> IO XMotionEvent
get_MotionEvent XEventPtr
p = Ptr XMotionEvent -> IO XMotionEvent
peekXMotionEvent (XEventPtr -> Ptr XMotionEvent
forall a b. Ptr a -> Ptr b
castPtr XEventPtr
p)
type XExposeEvent =
( Position
, Position
, Dimension
, Dimension
, CInt
)
peekXExposeEvent :: Ptr XExposeEvent -> IO XExposeEvent
peekXExposeEvent :: Ptr XExposeEvent -> IO XExposeEvent
peekXExposeEvent Ptr XExposeEvent
p = do
Position
x <- (\Ptr XExposeEvent
hsc_ptr -> Ptr XExposeEvent -> Int -> IO Position
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XExposeEvent
hsc_ptr Int
40) Ptr XExposeEvent
p
{-# LINE 256 "Graphics/X11/Xlib/Event.hsc" #-}
Position
y <- (\Ptr XExposeEvent
hsc_ptr -> Ptr XExposeEvent -> Int -> IO Position
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XExposeEvent
hsc_ptr Int
44) Ptr XExposeEvent
p
{-# LINE 257 "Graphics/X11/Xlib/Event.hsc" #-}
EventType
width <- (\Ptr XExposeEvent
hsc_ptr -> Ptr XExposeEvent -> Int -> IO EventType
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XExposeEvent
hsc_ptr Int
48) Ptr XExposeEvent
p
{-# LINE 258 "Graphics/X11/Xlib/Event.hsc" #-}
EventType
height <- (\Ptr XExposeEvent
hsc_ptr -> Ptr XExposeEvent -> Int -> IO EventType
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XExposeEvent
hsc_ptr Int
52) Ptr XExposeEvent
p
{-# LINE 259 "Graphics/X11/Xlib/Event.hsc" #-}
QueuedMode
count <- (\Ptr XExposeEvent
hsc_ptr -> Ptr XExposeEvent -> Int -> IO QueuedMode
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XExposeEvent
hsc_ptr Int
56) Ptr XExposeEvent
p
{-# LINE 260 "Graphics/X11/Xlib/Event.hsc" #-}
XExposeEvent -> IO XExposeEvent
forall (m :: * -> *) a. Monad m => a -> m a
return (Position
x, Position
y, EventType
width, EventType
height, QueuedMode
count)
get_ExposeEvent :: XEventPtr -> IO XExposeEvent
get_ExposeEvent :: XEventPtr -> IO XExposeEvent
get_ExposeEvent XEventPtr
p = Ptr XExposeEvent -> IO XExposeEvent
peekXExposeEvent (XEventPtr -> Ptr XExposeEvent
forall a b. Ptr a -> Ptr b
castPtr XEventPtr
p)
type XMappingEvent =
( MappingRequest
, KeyCode
, CInt
)
withXMappingEvent :: XMappingEvent -> (Ptr XMappingEvent -> IO a) -> IO a
withXMappingEvent :: XMappingEvent -> (Ptr XMappingEvent -> IO a) -> IO a
withXMappingEvent XMappingEvent
event_map Ptr XMappingEvent -> IO a
f =
Int -> (Ptr XMappingEvent -> IO a) -> IO a
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes (Int
56) ((Ptr XMappingEvent -> IO a) -> IO a)
-> (Ptr XMappingEvent -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \ Ptr XMappingEvent
event_map_ptr -> do
{-# LINE 317 "Graphics/X11/Xlib/Event.hsc" #-}
Ptr XMappingEvent -> XMappingEvent -> IO ()
pokeXMappingEvent Ptr XMappingEvent
event_map_ptr XMappingEvent
event_map
Ptr XMappingEvent -> IO a
f Ptr XMappingEvent
event_map_ptr
pokeXMappingEvent :: Ptr XMappingEvent -> XMappingEvent -> IO ()
pokeXMappingEvent :: Ptr XMappingEvent -> XMappingEvent -> IO ()
pokeXMappingEvent Ptr XMappingEvent
p (QueuedMode
request, KeyCode
first_keycode, QueuedMode
count) = do
(\Ptr XMappingEvent
hsc_ptr -> Ptr XMappingEvent -> Int -> QueuedMode -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr XMappingEvent
hsc_ptr Int
40) Ptr XMappingEvent
p QueuedMode
request
{-# LINE 323 "Graphics/X11/Xlib/Event.hsc" #-}
(\Ptr XMappingEvent
hsc_ptr -> Ptr XMappingEvent -> Int -> KeyCode -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr XMappingEvent
hsc_ptr Int
44) Ptr XMappingEvent
p KeyCode
first_keycode
{-# LINE 324 "Graphics/X11/Xlib/Event.hsc" #-}
(\Ptr XMappingEvent
hsc_ptr -> Ptr XMappingEvent -> Int -> QueuedMode -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr XMappingEvent
hsc_ptr Int
48) Ptr XMappingEvent
p QueuedMode
count
{-# LINE 325 "Graphics/X11/Xlib/Event.hsc" #-}
type XConfigureEvent =
( Position
, Position
, Dimension
, Dimension
)
peekXConfigureEvent :: Ptr XConfigureEvent -> IO XConfigureEvent
peekXConfigureEvent :: Ptr XConfigureEvent -> IO XConfigureEvent
peekXConfigureEvent Ptr XConfigureEvent
p = do
Position
x <- (\Ptr XConfigureEvent
hsc_ptr -> Ptr XConfigureEvent -> Int -> IO Position
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XConfigureEvent
hsc_ptr Int
48) Ptr XConfigureEvent
p
{-# LINE 336 "Graphics/X11/Xlib/Event.hsc" #-}
Position
y <- (\Ptr XConfigureEvent
hsc_ptr -> Ptr XConfigureEvent -> Int -> IO Position
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XConfigureEvent
hsc_ptr Int
52) Ptr XConfigureEvent
p
{-# LINE 337 "Graphics/X11/Xlib/Event.hsc" #-}
EventType
width <- (\Ptr XConfigureEvent
hsc_ptr -> Ptr XConfigureEvent -> Int -> IO EventType
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XConfigureEvent
hsc_ptr Int
56) Ptr XConfigureEvent
p
{-# LINE 338 "Graphics/X11/Xlib/Event.hsc" #-}
EventType
height <- (\Ptr XConfigureEvent
hsc_ptr -> Ptr XConfigureEvent -> Int -> IO EventType
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr XConfigureEvent
hsc_ptr Int
60) Ptr XConfigureEvent
p
{-# LINE 339 "Graphics/X11/Xlib/Event.hsc" #-}
XConfigureEvent -> IO XConfigureEvent
forall (m :: * -> *) a. Monad m => a -> m a
return (Position
x, Position
y, EventType
width, EventType
height)
get_ConfigureEvent :: XEventPtr -> IO XConfigureEvent
get_ConfigureEvent :: XEventPtr -> IO XConfigureEvent
get_ConfigureEvent XEventPtr
p = Ptr XConfigureEvent -> IO XConfigureEvent
peekXConfigureEvent (XEventPtr -> Ptr XConfigureEvent
forall a b. Ptr a -> Ptr b
castPtr XEventPtr
p)
waitForEvent :: Display -> Word32 -> IO Bool
waitForEvent :: Display -> EventType -> IO Bool
waitForEvent Display
display EventType
usecs =
TimeVal -> (Ptr TimeVal -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (EventType -> EventType -> TimeVal
TimeVal (EventType
usecs EventType -> EventType -> EventType
forall a. Integral a => a -> a -> a
`div` EventType
1000000) (EventType
usecs EventType -> EventType -> EventType
forall a. Integral a => a -> a -> a
`mod` EventType
1000000)) ((Ptr TimeVal -> IO Bool) -> IO Bool)
-> (Ptr TimeVal -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \ Ptr TimeVal
tv_ptr ->
Int -> (Ptr FdSet -> IO Bool) -> IO Bool
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes (Int
128) ((Ptr FdSet -> IO Bool) -> IO Bool)
-> (Ptr FdSet -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \ Ptr FdSet
readfds ->
{-# LINE 403 "Graphics/X11/Xlib/Event.hsc" #-}
Int -> (Ptr FdSet -> IO Bool) -> IO Bool
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes (Int
128) ((Ptr FdSet -> IO Bool) -> IO Bool)
-> (Ptr FdSet -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \ Ptr FdSet
nofds -> do
{-# LINE 404 "Graphics/X11/Xlib/Event.hsc" #-}
let fd :: QueuedMode
fd = Display -> QueuedMode
connectionNumber Display
display
Ptr FdSet -> IO ()
fdZero Ptr FdSet
readfds
Ptr FdSet -> IO ()
fdZero Ptr FdSet
nofds
QueuedMode -> Ptr FdSet -> IO ()
fdSet (QueuedMode -> QueuedMode
forall a b. (Integral a, Num b) => a -> b
fromIntegral QueuedMode
fd) Ptr FdSet
readfds
QueuedMode
n <- QueuedMode
-> Ptr FdSet
-> Ptr FdSet
-> Ptr FdSet
-> Ptr TimeVal
-> IO QueuedMode
select ((QueuedMode -> QueuedMode
forall a b. (Integral a, Num b) => a -> b
fromIntegral QueuedMode
fd)QueuedMode -> QueuedMode -> QueuedMode
forall a. Num a => a -> a -> a
+QueuedMode
1) Ptr FdSet
readfds Ptr FdSet
nofds Ptr FdSet
nofds Ptr TimeVal
tv_ptr
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return (QueuedMode
n QueuedMode -> QueuedMode -> Bool
forall a. Eq a => a -> a -> Bool
== QueuedMode
0)
newtype FdSet = FdSet (Ptr FdSet)
{-# LINE 413 "Graphics/X11/Xlib/Event.hsc" #-}
deriving (FdSet -> FdSet -> Bool
(FdSet -> FdSet -> Bool) -> (FdSet -> FdSet -> Bool) -> Eq FdSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FdSet -> FdSet -> Bool
$c/= :: FdSet -> FdSet -> Bool
== :: FdSet -> FdSet -> Bool
$c== :: FdSet -> FdSet -> Bool
Eq, Eq FdSet
Eq FdSet
-> (FdSet -> FdSet -> Ordering)
-> (FdSet -> FdSet -> Bool)
-> (FdSet -> FdSet -> Bool)
-> (FdSet -> FdSet -> Bool)
-> (FdSet -> FdSet -> Bool)
-> (FdSet -> FdSet -> FdSet)
-> (FdSet -> FdSet -> FdSet)
-> Ord FdSet
FdSet -> FdSet -> Bool
FdSet -> FdSet -> Ordering
FdSet -> FdSet -> FdSet
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FdSet -> FdSet -> FdSet
$cmin :: FdSet -> FdSet -> FdSet
max :: FdSet -> FdSet -> FdSet
$cmax :: FdSet -> FdSet -> FdSet
>= :: FdSet -> FdSet -> Bool
$c>= :: FdSet -> FdSet -> Bool
> :: FdSet -> FdSet -> Bool
$c> :: FdSet -> FdSet -> Bool
<= :: FdSet -> FdSet -> Bool
$c<= :: FdSet -> FdSet -> Bool
< :: FdSet -> FdSet -> Bool
$c< :: FdSet -> FdSet -> Bool
compare :: FdSet -> FdSet -> Ordering
$ccompare :: FdSet -> FdSet -> Ordering
$cp1Ord :: Eq FdSet
Ord, Int -> FdSet -> ShowS
[FdSet] -> ShowS
FdSet -> String
(Int -> FdSet -> ShowS)
-> (FdSet -> String) -> ([FdSet] -> ShowS) -> Show FdSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FdSet] -> ShowS
$cshowList :: [FdSet] -> ShowS
show :: FdSet -> String
$cshow :: FdSet -> String
showsPrec :: Int -> FdSet -> ShowS
$cshowsPrec :: Int -> FdSet -> ShowS
Show, Typeable, Typeable FdSet
DataType
Constr
Typeable FdSet
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FdSet -> c FdSet)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FdSet)
-> (FdSet -> Constr)
-> (FdSet -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FdSet))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FdSet))
-> ((forall b. Data b => b -> b) -> FdSet -> FdSet)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FdSet -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FdSet -> r)
-> (forall u. (forall d. Data d => d -> u) -> FdSet -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> FdSet -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FdSet -> m FdSet)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FdSet -> m FdSet)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FdSet -> m FdSet)
-> Data FdSet
FdSet -> DataType
FdSet -> Constr
(forall b. Data b => b -> b) -> FdSet -> FdSet
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FdSet -> c FdSet
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FdSet
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FdSet -> u
forall u. (forall d. Data d => d -> u) -> FdSet -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FdSet -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FdSet -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FdSet -> m FdSet
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FdSet -> m FdSet
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FdSet
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FdSet -> c FdSet
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FdSet)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FdSet)
$cFdSet :: Constr
$tFdSet :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FdSet -> m FdSet
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FdSet -> m FdSet
gmapMp :: (forall d. Data d => d -> m d) -> FdSet -> m FdSet
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FdSet -> m FdSet
gmapM :: (forall d. Data d => d -> m d) -> FdSet -> m FdSet
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FdSet -> m FdSet
gmapQi :: Int -> (forall d. Data d => d -> u) -> FdSet -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FdSet -> u
gmapQ :: (forall d. Data d => d -> u) -> FdSet -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FdSet -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FdSet -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FdSet -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FdSet -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FdSet -> r
gmapT :: (forall b. Data b => b -> b) -> FdSet -> FdSet
$cgmapT :: (forall b. Data b => b -> b) -> FdSet -> FdSet
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FdSet)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FdSet)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FdSet)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FdSet)
dataTypeOf :: FdSet -> DataType
$cdataTypeOf :: FdSet -> DataType
toConstr :: FdSet -> Constr
$ctoConstr :: FdSet -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FdSet
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FdSet
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FdSet -> c FdSet
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FdSet -> c FdSet
$cp1Data :: Typeable FdSet
Data)
{-# LINE 417 "Graphics/X11/Xlib/Event.hsc" #-}
foreign import ccall unsafe "HsXlib.h" fdZero :: Ptr FdSet -> IO ()
foreign import ccall unsafe "HsXlib.h" fdSet :: CInt -> Ptr FdSet -> IO ()
foreign import ccall unsafe "HsXlib.h" select ::
CInt -> Ptr FdSet -> Ptr FdSet -> Ptr FdSet -> Ptr TimeVal -> IO CInt
gettimeofday_in_milliseconds :: IO Integer
gettimeofday_in_milliseconds :: IO Integer
gettimeofday_in_milliseconds =
(Ptr TimeVal -> IO Integer) -> IO Integer
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr TimeVal -> IO Integer) -> IO Integer)
-> (Ptr TimeVal -> IO Integer) -> IO Integer
forall a b. (a -> b) -> a -> b
$ \ Ptr TimeVal
tv_ptr -> do
()
_rc <- Ptr TimeVal -> Ptr TimeZone -> IO ()
gettimeofday Ptr TimeVal
tv_ptr Ptr TimeZone
forall a. Ptr a
nullPtr
TimeVal EventType
sec EventType
usec <- Ptr TimeVal -> IO TimeVal
forall a. Storable a => Ptr a -> IO a
peek Ptr TimeVal
tv_ptr
Integer -> IO Integer
forall (m :: * -> *) a. Monad m => a -> m a
return (EventType -> Integer
forall a. Integral a => a -> Integer
toInteger EventType
sec Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
* Integer
1000 Integer -> Integer -> Integer
forall a. Num a => a -> a -> a
+ EventType -> Integer
forall a. Integral a => a -> Integer
toInteger EventType
usec Integer -> Integer -> Integer
forall a. Integral a => a -> a -> a
`div` Integer
1000)
data TimeVal = TimeVal Word32 Word32
instance Storable TimeVal where
alignment :: TimeVal -> Int
alignment TimeVal
_ = (Int
4)
{-# LINE 436 "Graphics/X11/Xlib/Event.hsc" #-}
sizeOf :: TimeVal -> Int
sizeOf TimeVal
_ = (Int
16)
{-# LINE 437 "Graphics/X11/Xlib/Event.hsc" #-}
peek :: Ptr TimeVal -> IO TimeVal
peek Ptr TimeVal
p = do
EventType
sec <- (\Ptr TimeVal
hsc_ptr -> Ptr TimeVal -> Int -> IO EventType
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr TimeVal
hsc_ptr Int
0) Ptr TimeVal
p
{-# LINE 439 "Graphics/X11/Xlib/Event.hsc" #-}
EventType
usec <- (\Ptr TimeVal
hsc_ptr -> Ptr TimeVal -> Int -> IO EventType
forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr TimeVal
hsc_ptr Int
8) Ptr TimeVal
p
{-# LINE 440 "Graphics/X11/Xlib/Event.hsc" #-}
TimeVal -> IO TimeVal
forall (m :: * -> *) a. Monad m => a -> m a
return (EventType -> EventType -> TimeVal
TimeVal EventType
sec EventType
usec)
poke :: Ptr TimeVal -> TimeVal -> IO ()
poke Ptr TimeVal
p (TimeVal EventType
sec EventType
usec) = do
(\Ptr TimeVal
hsc_ptr -> Ptr TimeVal -> Int -> EventType -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr TimeVal
hsc_ptr Int
0) Ptr TimeVal
p EventType
sec
{-# LINE 443 "Graphics/X11/Xlib/Event.hsc" #-}
(\Ptr TimeVal
hsc_ptr -> Ptr TimeVal -> Int -> EventType -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr TimeVal
hsc_ptr Int
8) Ptr TimeVal
p EventType
usec
{-# LINE 444 "Graphics/X11/Xlib/Event.hsc" #-}
newtype TimeZone = TimeZone (Ptr TimeZone)
{-# LINE 447 "Graphics/X11/Xlib/Event.hsc" #-}
deriving (TimeZone -> TimeZone -> Bool
(TimeZone -> TimeZone -> Bool)
-> (TimeZone -> TimeZone -> Bool) -> Eq TimeZone
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimeZone -> TimeZone -> Bool
$c/= :: TimeZone -> TimeZone -> Bool
== :: TimeZone -> TimeZone -> Bool
$c== :: TimeZone -> TimeZone -> Bool
Eq, Eq TimeZone
Eq TimeZone
-> (TimeZone -> TimeZone -> Ordering)
-> (TimeZone -> TimeZone -> Bool)
-> (TimeZone -> TimeZone -> Bool)
-> (TimeZone -> TimeZone -> Bool)
-> (TimeZone -> TimeZone -> Bool)
-> (TimeZone -> TimeZone -> TimeZone)
-> (TimeZone -> TimeZone -> TimeZone)
-> Ord TimeZone
TimeZone -> TimeZone -> Bool
TimeZone -> TimeZone -> Ordering
TimeZone -> TimeZone -> TimeZone
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TimeZone -> TimeZone -> TimeZone
$cmin :: TimeZone -> TimeZone -> TimeZone
max :: TimeZone -> TimeZone -> TimeZone
$cmax :: TimeZone -> TimeZone -> TimeZone
>= :: TimeZone -> TimeZone -> Bool
$c>= :: TimeZone -> TimeZone -> Bool
> :: TimeZone -> TimeZone -> Bool
$c> :: TimeZone -> TimeZone -> Bool
<= :: TimeZone -> TimeZone -> Bool
$c<= :: TimeZone -> TimeZone -> Bool
< :: TimeZone -> TimeZone -> Bool
$c< :: TimeZone -> TimeZone -> Bool
compare :: TimeZone -> TimeZone -> Ordering
$ccompare :: TimeZone -> TimeZone -> Ordering
$cp1Ord :: Eq TimeZone
Ord, Int -> TimeZone -> ShowS
[TimeZone] -> ShowS
TimeZone -> String
(Int -> TimeZone -> ShowS)
-> (TimeZone -> String) -> ([TimeZone] -> ShowS) -> Show TimeZone
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimeZone] -> ShowS
$cshowList :: [TimeZone] -> ShowS
show :: TimeZone -> String
$cshow :: TimeZone -> String
showsPrec :: Int -> TimeZone -> ShowS
$cshowsPrec :: Int -> TimeZone -> ShowS
Show, Typeable, Typeable TimeZone
DataType
Constr
Typeable TimeZone
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TimeZone -> c TimeZone)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TimeZone)
-> (TimeZone -> Constr)
-> (TimeZone -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TimeZone))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeZone))
-> ((forall b. Data b => b -> b) -> TimeZone -> TimeZone)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TimeZone -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TimeZone -> r)
-> (forall u. (forall d. Data d => d -> u) -> TimeZone -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> TimeZone -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TimeZone -> m TimeZone)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TimeZone -> m TimeZone)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TimeZone -> m TimeZone)
-> Data TimeZone
TimeZone -> DataType
TimeZone -> Constr
(forall b. Data b => b -> b) -> TimeZone -> TimeZone
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TimeZone -> c TimeZone
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TimeZone
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TimeZone -> u
forall u. (forall d. Data d => d -> u) -> TimeZone -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TimeZone -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TimeZone -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TimeZone -> m TimeZone
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TimeZone -> m TimeZone
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TimeZone
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TimeZone -> c TimeZone
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TimeZone)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeZone)
$cTimeZone :: Constr
$tTimeZone :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TimeZone -> m TimeZone
gmapMp :: (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TimeZone -> m TimeZone
gmapM :: (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TimeZone -> m TimeZone
gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeZone -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TimeZone -> u
gmapQ :: (forall d. Data d => d -> u) -> TimeZone -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TimeZone -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TimeZone -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TimeZone -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TimeZone -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TimeZone -> r
gmapT :: (forall b. Data b => b -> b) -> TimeZone -> TimeZone
$cgmapT :: (forall b. Data b => b -> b) -> TimeZone -> TimeZone
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeZone)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeZone)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c TimeZone)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TimeZone)
dataTypeOf :: TimeZone -> DataType
$cdataTypeOf :: TimeZone -> DataType
toConstr :: TimeZone -> Constr
$ctoConstr :: TimeZone -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TimeZone
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TimeZone
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TimeZone -> c TimeZone
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TimeZone -> c TimeZone
$cp1Data :: Typeable TimeZone
Data)
{-# LINE 451 "Graphics/X11/Xlib/Event.hsc" #-}
foreign import ccall unsafe "HsXlib.h"
gettimeofday :: Ptr TimeVal -> Ptr TimeZone -> IO ()
foreign import ccall unsafe "HsXlib.h XFlush"
flush :: Display -> IO ()
foreign import ccall safe "HsXlib.h XSync"
sync :: Display -> Bool -> IO ()
foreign import ccall unsafe "HsXlib.h XPending"
pending :: Display -> IO CInt
foreign import ccall unsafe "HsXlib.h XEventsQueued"
eventsQueued :: Display -> QueuedMode -> IO CInt
foreign import ccall safe "HsXlib.h XNextEvent"
nextEvent :: Display -> XEventPtr -> IO ()
foreign import ccall unsafe "HsXlib.h XAllowEvents"
allowEvents :: Display -> AllowEvents -> Time -> IO ()
foreign import ccall unsafe "HsXlib.h XSelectInput"
selectInput :: Display -> Window -> EventMask -> IO ()
sendEvent :: Display -> Window -> Bool -> EventMask -> XEventPtr -> IO ()
sendEvent :: Display -> Window -> Bool -> Window -> XEventPtr -> IO ()
sendEvent Display
display Window
w Bool
propagate Window
event_mask XEventPtr
event_send =
String -> IO QueuedMode -> IO ()
throwIfZero String
"sendEvent" (IO QueuedMode -> IO ()) -> IO QueuedMode -> IO ()
forall a b. (a -> b) -> a -> b
$
Display -> Window -> Bool -> Window -> XEventPtr -> IO QueuedMode
xSendEvent Display
display Window
w Bool
propagate Window
event_mask XEventPtr
event_send
foreign import ccall unsafe "HsXlib.h XSendEvent"
xSendEvent :: Display -> Window -> Bool -> EventMask ->
XEventPtr -> IO Status
foreign import ccall safe "HsXlib.h XWindowEvent"
windowEvent :: Display -> Window -> EventMask -> XEventPtr -> IO ()
foreign import ccall unsafe "HsXlib.h XCheckWindowEvent"
checkWindowEvent :: Display -> Window -> EventMask ->
XEventPtr -> IO Bool
foreign import ccall safe "HsXlib.h XMaskEvent"
maskEvent :: Display -> EventMask -> XEventPtr -> IO ()
foreign import ccall unsafe "HsXlib.h XCheckMaskEvent"
checkMaskEvent :: Display -> EventMask -> XEventPtr -> IO Bool
foreign import ccall unsafe "HsXlib.h XCheckTypedEvent"
checkTypedEvent :: Display -> EventType -> XEventPtr -> IO Bool
foreign import ccall unsafe "HsXlib.h XCheckTypedWindowEvent"
checkTypedWindowEvent :: Display -> Window -> EventType ->
XEventPtr -> IO Bool
foreign import ccall unsafe "HsXlib.h XPutBackEvent"
putBackEvent :: Display -> XEventPtr -> IO ()
foreign import ccall safe "HsXlib.h XPeekEvent"
peekEvent :: Display -> XEventPtr -> IO ()
refreshKeyboardMapping :: XMappingEvent -> IO ()
refreshKeyboardMapping :: XMappingEvent -> IO ()
refreshKeyboardMapping XMappingEvent
event_map =
XMappingEvent -> (Ptr XMappingEvent -> IO ()) -> IO ()
forall a. XMappingEvent -> (Ptr XMappingEvent -> IO a) -> IO a
withXMappingEvent XMappingEvent
event_map ((Ptr XMappingEvent -> IO ()) -> IO ())
-> (Ptr XMappingEvent -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ Ptr XMappingEvent
event_map_ptr ->
Ptr XMappingEvent -> IO ()
xRefreshKeyboardMapping Ptr XMappingEvent
event_map_ptr
foreign import ccall unsafe "HsXlib.h XRefreshKeyboardMapping"
xRefreshKeyboardMapping :: Ptr XMappingEvent -> IO ()