    {-# LANGUAGE CPP #-}
    {-# LANGUAGE DeriveDataTypeable #-}
    {-# LANGUAGE DeriveGeneric #-}
    {-# LANGUAGE MultiParamTypeClasses #-}
    {-# LANGUAGE OverloadedStrings #-}

    module SDL.Input.Mouse
      ( -- * Relative Mouse Mode
        LocationMode(..)
      , setMouseLocationMode
      , getMouseLocationMode

        -- * Mouse and Touch Input
      , MouseButton(..)
      , MouseDevice(..)
      , MouseScrollDirection(..)

        -- * Mouse State
      , ModalLocation(..)
      , getModalMouseLocation
      , getAbsoluteMouseLocation
      , getRelativeMouseLocation
      , getMouseButtons

        -- * Warping the Mouse
      , WarpMouseOrigin(..)
      , warpMouse

        -- * Cursor Visibility
      , cursorVisible

        -- * Cursor Shape
      , Cursor
      , SystemCursor(..)
      , activeCursor
      , createCursor
      , createCursorFrom
      , freeCursor
      , createColorCursor
      , createSystemCursor
      ) where

    import Control.Monad (void)
    import Control.Monad.IO.Class (MonadIO, liftIO)
    import Data.Bits
    import Data.Bool
    import Data.Data (Data)
    import Data.List (nub)
    import Data.StateVar
    import Data.Typeable
    import Data.Word
    import Foreign.C
    import Foreign.Marshal.Alloc
    import Foreign.Ptr
    import Foreign.Storable
    import GHC.Generics (Generic)
    import SDL.Vect
    import SDL.Internal.Exception
    import SDL.Internal.Numbered
    import SDL.Internal.Types (Window(Window))
    import SDL.Video.Renderer (Surface(Surface))
    import qualified Data.Vector.Storable as V
    import qualified SDL.Raw.Enum as Raw
    import qualified SDL.Raw.Event as Raw
    import qualified SDL.Raw.Types as Raw

    #if !MIN_VERSION_base(4,8,0)
    import Control.Applicative
    #endif

    data LocationMode
      = AbsoluteLocation
      | RelativeLocation
      deriving (LocationMode
    LocationMode -> LocationMode -> Bounded LocationMode
    forall a. a -> a -> Bounded a
    $cminBound :: LocationMode
    minBound :: LocationMode
    $cmaxBound :: LocationMode
    maxBound :: LocationMode
    Bounded, Typeable LocationMode
    Typeable LocationMode =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> LocationMode -> c LocationMode)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c LocationMode)
    -> (LocationMode -> Constr)
    -> (LocationMode -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c LocationMode))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c LocationMode))
    -> ((forall b. Data b => b -> b) -> LocationMode -> LocationMode)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> LocationMode -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> LocationMode -> r)
    -> (forall u. (forall d. Data d => d -> u) -> LocationMode -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> LocationMode -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> LocationMode -> m LocationMode)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> LocationMode -> m LocationMode)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> LocationMode -> m LocationMode)
    -> Data LocationMode
    LocationMode -> Constr
    LocationMode -> DataType
    (forall b. Data b => b -> b) -> LocationMode -> LocationMode
    forall a.
    Typeable a =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        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 :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> LocationMode -> u
    forall u. (forall d. Data d => d -> u) -> LocationMode -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LocationMode -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LocationMode -> r
    forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> LocationMode -> m LocationMode
    forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LocationMode -> m LocationMode
    forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LocationMode
    forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LocationMode -> c LocationMode
    forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LocationMode)
    forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c LocationMode)
    $cgfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LocationMode -> c LocationMode
    gfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LocationMode -> c LocationMode
    $cgunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LocationMode
    gunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LocationMode
    $ctoConstr :: LocationMode -> Constr
    toConstr :: LocationMode -> Constr
    $cdataTypeOf :: LocationMode -> DataType
    dataTypeOf :: LocationMode -> DataType
    $cdataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LocationMode)
    dataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LocationMode)
    $cdataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c LocationMode)
    dataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c LocationMode)
    $cgmapT :: (forall b. Data b => b -> b) -> LocationMode -> LocationMode
    gmapT :: (forall b. Data b => b -> b) -> LocationMode -> LocationMode
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LocationMode -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LocationMode -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LocationMode -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LocationMode -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> LocationMode -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> LocationMode -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LocationMode -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LocationMode -> u
    $cgmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> LocationMode -> m LocationMode
    gmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> LocationMode -> m LocationMode
    $cgmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LocationMode -> m LocationMode
    gmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LocationMode -> m LocationMode
    $cgmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LocationMode -> m LocationMode
    gmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LocationMode -> m LocationMode
    Data, LocationMode -> LocationMode -> Bool
    (LocationMode -> LocationMode -> Bool)
    -> (LocationMode -> LocationMode -> Bool) -> Eq LocationMode
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: LocationMode -> LocationMode -> Bool
    == :: LocationMode -> LocationMode -> Bool
    $c/= :: LocationMode -> LocationMode -> Bool
    /= :: LocationMode -> LocationMode -> Bool
    Eq, Int -> LocationMode
    LocationMode -> Int
    LocationMode -> [LocationMode]
    LocationMode -> LocationMode
    LocationMode -> LocationMode -> [LocationMode]
    LocationMode -> LocationMode -> LocationMode -> [LocationMode]
    (LocationMode -> LocationMode)
    -> (LocationMode -> LocationMode)
    -> (Int -> LocationMode)
    -> (LocationMode -> Int)
    -> (LocationMode -> [LocationMode])
    -> (LocationMode -> LocationMode -> [LocationMode])
    -> (LocationMode -> LocationMode -> [LocationMode])
    -> (LocationMode -> LocationMode -> LocationMode -> [LocationMode])
    -> Enum LocationMode
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: LocationMode -> LocationMode
    succ :: LocationMode -> LocationMode
    $cpred :: LocationMode -> LocationMode
    pred :: LocationMode -> LocationMode
    $ctoEnum :: Int -> LocationMode
    toEnum :: Int -> LocationMode
    $cfromEnum :: LocationMode -> Int
    fromEnum :: LocationMode -> Int
    $cenumFrom :: LocationMode -> [LocationMode]
    enumFrom :: LocationMode -> [LocationMode]
    $cenumFromThen :: LocationMode -> LocationMode -> [LocationMode]
    enumFromThen :: LocationMode -> LocationMode -> [LocationMode]
    $cenumFromTo :: LocationMode -> LocationMode -> [LocationMode]
    enumFromTo :: LocationMode -> LocationMode -> [LocationMode]
    $cenumFromThenTo :: LocationMode -> LocationMode -> LocationMode -> [LocationMode]
    enumFromThenTo :: LocationMode -> LocationMode -> LocationMode -> [LocationMode]
    Enum, (forall x. LocationMode -> Rep LocationMode x)
    -> (forall x. Rep LocationMode x -> LocationMode)
    -> Generic LocationMode
    forall x. Rep LocationMode x -> LocationMode
    forall x. LocationMode -> Rep LocationMode x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. LocationMode -> Rep LocationMode x
    from :: forall x. LocationMode -> Rep LocationMode x
    $cto :: forall x. Rep LocationMode x -> LocationMode
    to :: forall x. Rep LocationMode x -> LocationMode
    Generic, Eq LocationMode
    Eq LocationMode =>
    (LocationMode -> LocationMode -> Ordering)
    -> (LocationMode -> LocationMode -> Bool)
    -> (LocationMode -> LocationMode -> Bool)
    -> (LocationMode -> LocationMode -> Bool)
    -> (LocationMode -> LocationMode -> Bool)
    -> (LocationMode -> LocationMode -> LocationMode)
    -> (LocationMode -> LocationMode -> LocationMode)
    -> Ord LocationMode
    LocationMode -> LocationMode -> Bool
    LocationMode -> LocationMode -> Ordering
    LocationMode -> LocationMode -> LocationMode
    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
    $ccompare :: LocationMode -> LocationMode -> Ordering
    compare :: LocationMode -> LocationMode -> Ordering
    $c< :: LocationMode -> LocationMode -> Bool
    < :: LocationMode -> LocationMode -> Bool
    $c<= :: LocationMode -> LocationMode -> Bool
    <= :: LocationMode -> LocationMode -> Bool
    $c> :: LocationMode -> LocationMode -> Bool
    > :: LocationMode -> LocationMode -> Bool
    $c>= :: LocationMode -> LocationMode -> Bool
    >= :: LocationMode -> LocationMode -> Bool
    $cmax :: LocationMode -> LocationMode -> LocationMode
    max :: LocationMode -> LocationMode -> LocationMode
    $cmin :: LocationMode -> LocationMode -> LocationMode
    min :: LocationMode -> LocationMode -> LocationMode
    Ord, ReadPrec [LocationMode]
    ReadPrec LocationMode
    Int -> ReadS LocationMode
    ReadS [LocationMode]
    (Int -> ReadS LocationMode)
    -> ReadS [LocationMode]
    -> ReadPrec LocationMode
    -> ReadPrec [LocationMode]
    -> Read LocationMode
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS LocationMode
    readsPrec :: Int -> ReadS LocationMode
    $creadList :: ReadS [LocationMode]
    readList :: ReadS [LocationMode]
    $creadPrec :: ReadPrec LocationMode
    readPrec :: ReadPrec LocationMode
    $creadListPrec :: ReadPrec [LocationMode]
    readListPrec :: ReadPrec [LocationMode]
    Read, Int -> LocationMode -> ShowS
    [LocationMode] -> ShowS
    LocationMode -> [Char]
    (Int -> LocationMode -> ShowS)
    -> (LocationMode -> [Char])
    -> ([LocationMode] -> ShowS)
    -> Show LocationMode
    forall a.
    (Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> LocationMode -> ShowS
    showsPrec :: Int -> LocationMode -> ShowS
    $cshow :: LocationMode -> [Char]
    show :: LocationMode -> [Char]
    $cshowList :: [LocationMode] -> ShowS
    showList :: [LocationMode] -> ShowS
    Show, Typeable)

    -- | Sets the current relative mouse mode.
    --
    -- When relative mouse mode is enabled, cursor is hidden and mouse position
    -- will not change. However, you will be delivered relative mouse position
    -- change events.
    setMouseLocationMode :: (Functor m, MonadIO m) => LocationMode -> m LocationMode
    setMouseLocationMode :: forall (m :: Type -> Type).
    (Functor m, MonadIO m) =>
    LocationMode -> m LocationMode
    setMouseLocationMode LocationMode
    mode =
      Bool -> m CInt
    forall (m :: Type -> Type). MonadIO m => Bool -> m CInt
    Raw.setRelativeMouseMode (LocationMode
    mode LocationMode -> LocationMode -> Bool
    forall a. Eq a => a -> a -> Bool
    == LocationMode
    RelativeLocation) m CInt -> m LocationMode -> m LocationMode
    forall a b. m a -> m b -> m b
    forall (m :: Type -> Type) a b. Monad m => m a -> m b -> m b
    >> m LocationMode
    forall (m :: Type -> Type). MonadIO m => m LocationMode
    getMouseLocationMode

    -- | Check which mouse location mode is currently active.
    getMouseLocationMode :: MonadIO m => m LocationMode
    getMouseLocationMode :: forall (m :: Type -> Type). MonadIO m => m LocationMode
    getMouseLocationMode = do
      Bool
    relativeMode <- m Bool
    forall (m :: Type -> Type). MonadIO m => m Bool
    Raw.getRelativeMouseMode
      LocationMode -> m LocationMode
    forall a. a -> m a
    forall (m :: Type -> Type) a. Monad m => a -> m a
    return (LocationMode -> m LocationMode) -> LocationMode -> m LocationMode
    forall a b. (a -> b) -> a -> b
    $ if Bool
    relativeMode then LocationMode
    RelativeLocation else LocationMode
    AbsoluteLocation

    data ModalLocation
      = AbsoluteModalLocation (Point V2 CInt)
      | RelativeModalLocation (V2 CInt)
      deriving (ModalLocation -> ModalLocation -> Bool
    (ModalLocation -> ModalLocation -> Bool)
    -> (ModalLocation -> ModalLocation -> Bool) -> Eq ModalLocation
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ModalLocation -> ModalLocation -> Bool
    == :: ModalLocation -> ModalLocation -> Bool
    $c/= :: ModalLocation -> ModalLocation -> Bool
    /= :: ModalLocation -> ModalLocation -> Bool
    Eq, (forall x. ModalLocation -> Rep ModalLocation x)
    -> (forall x. Rep ModalLocation x -> ModalLocation)
    -> Generic ModalLocation
    forall x. Rep ModalLocation x -> ModalLocation
    forall x. ModalLocation -> Rep ModalLocation x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. ModalLocation -> Rep ModalLocation x
    from :: forall x. ModalLocation -> Rep ModalLocation x
    $cto :: forall x. Rep ModalLocation x -> ModalLocation
    to :: forall x. Rep ModalLocation x -> ModalLocation
    Generic, Eq ModalLocation
    Eq ModalLocation =>
    (ModalLocation -> ModalLocation -> Ordering)
    -> (ModalLocation -> ModalLocation -> Bool)
    -> (ModalLocation -> ModalLocation -> Bool)
    -> (ModalLocation -> ModalLocation -> Bool)
    -> (ModalLocation -> ModalLocation -> Bool)
    -> (ModalLocation -> ModalLocation -> ModalLocation)
    -> (ModalLocation -> ModalLocation -> ModalLocation)
    -> Ord ModalLocation
    ModalLocation -> ModalLocation -> Bool
    ModalLocation -> ModalLocation -> Ordering
    ModalLocation -> ModalLocation -> ModalLocation
    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
    $ccompare :: ModalLocation -> ModalLocation -> Ordering
    compare :: ModalLocation -> ModalLocation -> Ordering
    $c< :: ModalLocation -> ModalLocation -> Bool
    < :: ModalLocation -> ModalLocation -> Bool
    $c<= :: ModalLocation -> ModalLocation -> Bool
    <= :: ModalLocation -> ModalLocation -> Bool
    $c> :: ModalLocation -> ModalLocation -> Bool
    > :: ModalLocation -> ModalLocation -> Bool
    $c>= :: ModalLocation -> ModalLocation -> Bool
    >= :: ModalLocation -> ModalLocation -> Bool
    $cmax :: ModalLocation -> ModalLocation -> ModalLocation
    max :: ModalLocation -> ModalLocation -> ModalLocation
    $cmin :: ModalLocation -> ModalLocation -> ModalLocation
    min :: ModalLocation -> ModalLocation -> ModalLocation
    Ord, ReadPrec [ModalLocation]
    ReadPrec ModalLocation
    Int -> ReadS ModalLocation
    ReadS [ModalLocation]
    (Int -> ReadS ModalLocation)
    -> ReadS [ModalLocation]
    -> ReadPrec ModalLocation
    -> ReadPrec [ModalLocation]
    -> Read ModalLocation
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS ModalLocation
    readsPrec :: Int -> ReadS ModalLocation
    $creadList :: ReadS [ModalLocation]
    readList :: ReadS [ModalLocation]
    $creadPrec :: ReadPrec ModalLocation
    readPrec :: ReadPrec ModalLocation
    $creadListPrec :: ReadPrec [ModalLocation]
    readListPrec :: ReadPrec [ModalLocation]
    Read, Int -> ModalLocation -> ShowS
    [ModalLocation] -> ShowS
    ModalLocation -> [Char]
    (Int -> ModalLocation -> ShowS)
    -> (ModalLocation -> [Char])
    -> ([ModalLocation] -> ShowS)
    -> Show ModalLocation
    forall a.
    (Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ModalLocation -> ShowS
    showsPrec :: Int -> ModalLocation -> ShowS
    $cshow :: ModalLocation -> [Char]
    show :: ModalLocation -> [Char]
    $cshowList :: [ModalLocation] -> ShowS
    showList :: [ModalLocation] -> ShowS
    Show, Typeable)

    -- | Return proper mouse location depending on mouse mode
    getModalMouseLocation :: MonadIO m => m ModalLocation
    getModalMouseLocation :: forall (m :: Type -> Type). MonadIO m => m ModalLocation
    getModalMouseLocation = do
      LocationMode
    mode <- m LocationMode
    forall (m :: Type -> Type). MonadIO m => m LocationMode
    getMouseLocationMode
      case LocationMode
    mode of
        LocationMode
    AbsoluteLocation -> do
          Point V2 CInt
    location <- m (Point V2 CInt)
    forall (m :: Type -> Type). MonadIO m => m (Point V2 CInt)
    getAbsoluteMouseLocation
          ModalLocation -> m ModalLocation
    forall a. a -> m a
    forall (m :: Type -> Type) a. Monad m => a -> m a
    return (Point V2 CInt -> ModalLocation
    AbsoluteModalLocation Point V2 CInt
    location)
        LocationMode
    RelativeLocation -> do
          V2 CInt
    location <- m (V2 CInt)
    forall (m :: Type -> Type). MonadIO m => m (V2 CInt)
    getRelativeMouseLocation
          ModalLocation -> m ModalLocation
    forall a. a -> m a
    forall (m :: Type -> Type) a. Monad m => a -> m a
    return (V2 CInt -> ModalLocation
    RelativeModalLocation V2 CInt
    location)

    data MouseButton
      = ButtonLeft
      | ButtonMiddle
      | ButtonRight
      | ButtonX1
      | ButtonX2
      | ButtonExtra !Int -- ^ An unknown mouse button.
      deriving (Typeable MouseButton
    Typeable MouseButton =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> MouseButton -> c MouseButton)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c MouseButton)
    -> (MouseButton -> Constr)
    -> (MouseButton -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c MouseButton))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c MouseButton))
    -> ((forall b. Data b => b -> b) -> MouseButton -> MouseButton)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> MouseButton -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> MouseButton -> r)
    -> (forall u. (forall d. Data d => d -> u) -> MouseButton -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> MouseButton -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> MouseButton -> m MouseButton)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> MouseButton -> m MouseButton)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> MouseButton -> m MouseButton)
    -> Data MouseButton
    MouseButton -> Constr
    MouseButton -> DataType
    (forall b. Data b => b -> b) -> MouseButton -> MouseButton
    forall a.
    Typeable a =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        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 :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> MouseButton -> u
    forall u. (forall d. Data d => d -> u) -> MouseButton -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseButton -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseButton -> r
    forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> MouseButton -> m MouseButton
    forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MouseButton -> m MouseButton
    forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MouseButton
    forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> MouseButton -> c MouseButton
    forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MouseButton)
    forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c MouseButton)
    $cgfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> MouseButton -> c MouseButton
    gfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> MouseButton -> c MouseButton
    $cgunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MouseButton
    gunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MouseButton
    $ctoConstr :: MouseButton -> Constr
    toConstr :: MouseButton -> Constr
    $cdataTypeOf :: MouseButton -> DataType
    dataTypeOf :: MouseButton -> DataType
    $cdataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MouseButton)
    dataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MouseButton)
    $cdataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c MouseButton)
    dataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c MouseButton)
    $cgmapT :: (forall b. Data b => b -> b) -> MouseButton -> MouseButton
    gmapT :: (forall b. Data b => b -> b) -> MouseButton -> MouseButton
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseButton -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseButton -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseButton -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseButton -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> MouseButton -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> MouseButton -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MouseButton -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MouseButton -> u
    $cgmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> MouseButton -> m MouseButton
    gmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> MouseButton -> m MouseButton
    $cgmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MouseButton -> m MouseButton
    gmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MouseButton -> m MouseButton
    $cgmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MouseButton -> m MouseButton
    gmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MouseButton -> m MouseButton
    Data, MouseButton -> MouseButton -> Bool
    (MouseButton -> MouseButton -> Bool)
    -> (MouseButton -> MouseButton -> Bool) -> Eq MouseButton
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: MouseButton -> MouseButton -> Bool
    == :: MouseButton -> MouseButton -> Bool
    $c/= :: MouseButton -> MouseButton -> Bool
    /= :: MouseButton -> MouseButton -> Bool
    Eq, (forall x. MouseButton -> Rep MouseButton x)
    -> (forall x. Rep MouseButton x -> MouseButton)
    -> Generic MouseButton
    forall x. Rep MouseButton x -> MouseButton
    forall x. MouseButton -> Rep MouseButton x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. MouseButton -> Rep MouseButton x
    from :: forall x. MouseButton -> Rep MouseButton x
    $cto :: forall x. Rep MouseButton x -> MouseButton
    to :: forall x. Rep MouseButton x -> MouseButton
    Generic, Eq MouseButton
    Eq MouseButton =>
    (MouseButton -> MouseButton -> Ordering)
    -> (MouseButton -> MouseButton -> Bool)
    -> (MouseButton -> MouseButton -> Bool)
    -> (MouseButton -> MouseButton -> Bool)
    -> (MouseButton -> MouseButton -> Bool)
    -> (MouseButton -> MouseButton -> MouseButton)
    -> (MouseButton -> MouseButton -> MouseButton)
    -> Ord MouseButton
    MouseButton -> MouseButton -> Bool
    MouseButton -> MouseButton -> Ordering
    MouseButton -> MouseButton -> MouseButton
    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
    $ccompare :: MouseButton -> MouseButton -> Ordering
    compare :: MouseButton -> MouseButton -> Ordering
    $c< :: MouseButton -> MouseButton -> Bool
    < :: MouseButton -> MouseButton -> Bool
    $c<= :: MouseButton -> MouseButton -> Bool
    <= :: MouseButton -> MouseButton -> Bool
    $c> :: MouseButton -> MouseButton -> Bool
    > :: MouseButton -> MouseButton -> Bool
    $c>= :: MouseButton -> MouseButton -> Bool
    >= :: MouseButton -> MouseButton -> Bool
    $cmax :: MouseButton -> MouseButton -> MouseButton
    max :: MouseButton -> MouseButton -> MouseButton
    $cmin :: MouseButton -> MouseButton -> MouseButton
    min :: MouseButton -> MouseButton -> MouseButton
    Ord, ReadPrec [MouseButton]
    ReadPrec MouseButton
    Int -> ReadS MouseButton
    ReadS [MouseButton]
    (Int -> ReadS MouseButton)
    -> ReadS [MouseButton]
    -> ReadPrec MouseButton
    -> ReadPrec [MouseButton]
    -> Read MouseButton
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS MouseButton
    readsPrec :: Int -> ReadS MouseButton
    $creadList :: ReadS [MouseButton]
    readList :: ReadS [MouseButton]
    $creadPrec :: ReadPrec MouseButton
    readPrec :: ReadPrec MouseButton
    $creadListPrec :: ReadPrec [MouseButton]
    readListPrec :: ReadPrec [MouseButton]
    Read, Int -> MouseButton -> ShowS
    [MouseButton] -> ShowS
    MouseButton -> [Char]
    (Int -> MouseButton -> ShowS)
    -> (MouseButton -> [Char])
    -> ([MouseButton] -> ShowS)
    -> Show MouseButton
    forall a.
    (Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> MouseButton -> ShowS
    showsPrec :: Int -> MouseButton -> ShowS
    $cshow :: MouseButton -> [Char]
    show :: MouseButton -> [Char]
    $cshowList :: [MouseButton] -> ShowS
    showList :: [MouseButton] -> ShowS
    Show, Typeable)

    instance FromNumber MouseButton Word8 where
      fromNumber :: Word8 -> MouseButton
    fromNumber Word8
    Raw.SDL_BUTTON_LEFT   = MouseButton
    ButtonLeft
      fromNumber Word8
    Raw.SDL_BUTTON_MIDDLE = MouseButton
    ButtonMiddle
      fromNumber Word8
    Raw.SDL_BUTTON_RIGHT  = MouseButton
    ButtonRight
      fromNumber Word8
    Raw.SDL_BUTTON_X1     = MouseButton
    ButtonX1
      fromNumber Word8
    Raw.SDL_BUTTON_X2     = MouseButton
    ButtonX2
      fromNumber Word8
    buttonCode            = Int -> MouseButton
    ButtonExtra (Int -> MouseButton) -> Int -> MouseButton
    forall a b. (a -> b) -> a -> b
    $ Word8 -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Word8
    buttonCode

    instance ToNumber MouseButton Word8 where
      toNumber :: MouseButton -> Word8
    toNumber MouseButton
    ButtonLeft      = Word8
    forall {a}. (Eq a, Num a) => a
    Raw.SDL_BUTTON_LEFT
      toNumber MouseButton
    ButtonMiddle    = Word8
    forall {a}. (Eq a, Num a) => a
    Raw.SDL_BUTTON_MIDDLE
      toNumber MouseButton
    ButtonRight     = Word8
    forall {a}. (Eq a, Num a) => a
    Raw.SDL_BUTTON_RIGHT
      toNumber MouseButton
    ButtonX1        = Word8
    forall {a}. (Eq a, Num a) => a
    Raw.SDL_BUTTON_X1
      toNumber MouseButton
    ButtonX2        = Word8
    forall {a}. (Eq a, Num a) => a
    Raw.SDL_BUTTON_X2
      toNumber (ButtonExtra Int
    i) = Int -> Word8
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Int
    i

    -- | Identifies what kind of mouse-like device this is.
    data MouseDevice
      = Mouse !Int -- ^ An actual mouse. The number identifies which mouse.
      | Touch      -- ^ Some sort of touch device.
      deriving (Typeable MouseDevice
    Typeable MouseDevice =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> MouseDevice -> c MouseDevice)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c MouseDevice)
    -> (MouseDevice -> Constr)
    -> (MouseDevice -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c MouseDevice))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c MouseDevice))
    -> ((forall b. Data b => b -> b) -> MouseDevice -> MouseDevice)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> MouseDevice -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> MouseDevice -> r)
    -> (forall u. (forall d. Data d => d -> u) -> MouseDevice -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> MouseDevice -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> MouseDevice -> m MouseDevice)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> MouseDevice -> m MouseDevice)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> MouseDevice -> m MouseDevice)
    -> Data MouseDevice
    MouseDevice -> Constr
    MouseDevice -> DataType
    (forall b. Data b => b -> b) -> MouseDevice -> MouseDevice
    forall a.
    Typeable a =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        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 :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> MouseDevice -> u
    forall u. (forall d. Data d => d -> u) -> MouseDevice -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseDevice -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseDevice -> r
    forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> MouseDevice -> m MouseDevice
    forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MouseDevice -> m MouseDevice
    forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MouseDevice
    forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> MouseDevice -> c MouseDevice
    forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MouseDevice)
    forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c MouseDevice)
    $cgfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> MouseDevice -> c MouseDevice
    gfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> MouseDevice -> c MouseDevice
    $cgunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MouseDevice
    gunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MouseDevice
    $ctoConstr :: MouseDevice -> Constr
    toConstr :: MouseDevice -> Constr
    $cdataTypeOf :: MouseDevice -> DataType
    dataTypeOf :: MouseDevice -> DataType
    $cdataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MouseDevice)
    dataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MouseDevice)
    $cdataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c MouseDevice)
    dataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c MouseDevice)
    $cgmapT :: (forall b. Data b => b -> b) -> MouseDevice -> MouseDevice
    gmapT :: (forall b. Data b => b -> b) -> MouseDevice -> MouseDevice
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseDevice -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseDevice -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseDevice -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseDevice -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> MouseDevice -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> MouseDevice -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MouseDevice -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> MouseDevice -> u
    $cgmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> MouseDevice -> m MouseDevice
    gmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> MouseDevice -> m MouseDevice
    $cgmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MouseDevice -> m MouseDevice
    gmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MouseDevice -> m MouseDevice
    $cgmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MouseDevice -> m MouseDevice
    gmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> MouseDevice -> m MouseDevice
    Data, MouseDevice -> MouseDevice -> Bool
    (MouseDevice -> MouseDevice -> Bool)
    -> (MouseDevice -> MouseDevice -> Bool) -> Eq MouseDevice
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: MouseDevice -> MouseDevice -> Bool
    == :: MouseDevice -> MouseDevice -> Bool
    $c/= :: MouseDevice -> MouseDevice -> Bool
    /= :: MouseDevice -> MouseDevice -> Bool
    Eq, (forall x. MouseDevice -> Rep MouseDevice x)
    -> (forall x. Rep MouseDevice x -> MouseDevice)
    -> Generic MouseDevice
    forall x. Rep MouseDevice x -> MouseDevice
    forall x. MouseDevice -> Rep MouseDevice x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. MouseDevice -> Rep MouseDevice x
    from :: forall x. MouseDevice -> Rep MouseDevice x
    $cto :: forall x. Rep MouseDevice x -> MouseDevice
    to :: forall x. Rep MouseDevice x -> MouseDevice
    Generic, Eq MouseDevice
    Eq MouseDevice =>
    (MouseDevice -> MouseDevice -> Ordering)
    -> (MouseDevice -> MouseDevice -> Bool)
    -> (MouseDevice -> MouseDevice -> Bool)
    -> (MouseDevice -> MouseDevice -> Bool)
    -> (MouseDevice -> MouseDevice -> Bool)
    -> (MouseDevice -> MouseDevice -> MouseDevice)
    -> (MouseDevice -> MouseDevice -> MouseDevice)
    -> Ord MouseDevice
    MouseDevice -> MouseDevice -> Bool
    MouseDevice -> MouseDevice -> Ordering
    MouseDevice -> MouseDevice -> MouseDevice
    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
    $ccompare :: MouseDevice -> MouseDevice -> Ordering
    compare :: MouseDevice -> MouseDevice -> Ordering
    $c< :: MouseDevice -> MouseDevice -> Bool
    < :: MouseDevice -> MouseDevice -> Bool
    $c<= :: MouseDevice -> MouseDevice -> Bool
    <= :: MouseDevice -> MouseDevice -> Bool
    $c> :: MouseDevice -> MouseDevice -> Bool
    > :: MouseDevice -> MouseDevice -> Bool
    $c>= :: MouseDevice -> MouseDevice -> Bool
    >= :: MouseDevice -> MouseDevice -> Bool
    $cmax :: MouseDevice -> MouseDevice -> MouseDevice
    max :: MouseDevice -> MouseDevice -> MouseDevice
    $cmin :: MouseDevice -> MouseDevice -> MouseDevice
    min :: MouseDevice -> MouseDevice -> MouseDevice
    Ord, ReadPrec [MouseDevice]
    ReadPrec MouseDevice
    Int -> ReadS MouseDevice
    ReadS [MouseDevice]
    (Int -> ReadS MouseDevice)
    -> ReadS [MouseDevice]
    -> ReadPrec MouseDevice
    -> ReadPrec [MouseDevice]
    -> Read MouseDevice
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS MouseDevice
    readsPrec :: Int -> ReadS MouseDevice
    $creadList :: ReadS [MouseDevice]
    readList :: ReadS [MouseDevice]
    $creadPrec :: ReadPrec MouseDevice
    readPrec :: ReadPrec MouseDevice
    $creadListPrec :: ReadPrec [MouseDevice]
    readListPrec :: ReadPrec [MouseDevice]
    Read, Int -> MouseDevice -> ShowS
    [MouseDevice] -> ShowS
    MouseDevice -> [Char]
    (Int -> MouseDevice -> ShowS)
    -> (MouseDevice -> [Char])
    -> ([MouseDevice] -> ShowS)
    -> Show MouseDevice
    forall a.
    (Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> MouseDevice -> ShowS
    showsPrec :: Int -> MouseDevice -> ShowS
    $cshow :: MouseDevice -> [Char]
    show :: MouseDevice -> [Char]
    $cshowList :: [MouseDevice] -> ShowS
    showList :: [MouseDevice] -> ShowS
    Show, Typeable)

    instance FromNumber MouseDevice Word32 where
      fromNumber :: Word32 -> MouseDevice
    fromNumber Word32
    n' = case Word32
    n' of
        Word32
    Raw.SDL_TOUCH_MOUSEID -> MouseDevice
    Touch
        Word32
    n -> Int -> MouseDevice
    Mouse (Int -> MouseDevice) -> Int -> MouseDevice
    forall a b. (a -> b) -> a -> b
    $ Word32 -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Word32
    n

    -- | Identifies mouse scroll direction.
    data MouseScrollDirection
      = ScrollNormal
      | ScrollFlipped
      deriving (MouseScrollDirection
    MouseScrollDirection
    -> MouseScrollDirection -> Bounded MouseScrollDirection
    forall a. a -> a -> Bounded a
    $cminBound :: MouseScrollDirection
    minBound :: MouseScrollDirection
    $cmaxBound :: MouseScrollDirection
    maxBound :: MouseScrollDirection
    Bounded, Typeable MouseScrollDirection
    Typeable MouseScrollDirection =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g)
     -> MouseScrollDirection
     -> c MouseScrollDirection)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c MouseScrollDirection)
    -> (MouseScrollDirection -> Constr)
    -> (MouseScrollDirection -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c MouseScrollDirection))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c MouseScrollDirection))
    -> ((forall b. Data b => b -> b)
        -> MouseScrollDirection -> MouseScrollDirection)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> MouseScrollDirection -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> MouseScrollDirection -> r)
    -> (forall u.
        (forall d. Data d => d -> u) -> MouseScrollDirection -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> MouseScrollDirection -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d)
        -> MouseScrollDirection -> m MouseScrollDirection)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> MouseScrollDirection -> m MouseScrollDirection)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> MouseScrollDirection -> m MouseScrollDirection)
    -> Data MouseScrollDirection
    MouseScrollDirection -> Constr
    MouseScrollDirection -> DataType
    (forall b. Data b => b -> b)
    -> MouseScrollDirection -> MouseScrollDirection
    forall a.
    Typeable a =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        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 :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u.
    Int -> (forall d. Data d => d -> u) -> MouseScrollDirection -> u
    forall u.
    (forall d. Data d => d -> u) -> MouseScrollDirection -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseScrollDirection -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseScrollDirection -> r
    forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> MouseScrollDirection -> m MouseScrollDirection
    forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> MouseScrollDirection -> m MouseScrollDirection
    forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MouseScrollDirection
    forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> MouseScrollDirection
    -> c MouseScrollDirection
    forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MouseScrollDirection)
    forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c MouseScrollDirection)
    $cgfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> MouseScrollDirection
    -> c MouseScrollDirection
    gfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> MouseScrollDirection
    -> c MouseScrollDirection
    $cgunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MouseScrollDirection
    gunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MouseScrollDirection
    $ctoConstr :: MouseScrollDirection -> Constr
    toConstr :: MouseScrollDirection -> Constr
    $cdataTypeOf :: MouseScrollDirection -> DataType
    dataTypeOf :: MouseScrollDirection -> DataType
    $cdataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MouseScrollDirection)
    dataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MouseScrollDirection)
    $cdataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c MouseScrollDirection)
    dataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c MouseScrollDirection)
    $cgmapT :: (forall b. Data b => b -> b)
    -> MouseScrollDirection -> MouseScrollDirection
    gmapT :: (forall b. Data b => b -> b)
    -> MouseScrollDirection -> MouseScrollDirection
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseScrollDirection -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseScrollDirection -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseScrollDirection -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MouseScrollDirection -> r
    $cgmapQ :: forall u.
    (forall d. Data d => d -> u) -> MouseScrollDirection -> [u]
    gmapQ :: forall u.
    (forall d. Data d => d -> u) -> MouseScrollDirection -> [u]
    $cgmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> MouseScrollDirection -> u
    gmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> MouseScrollDirection -> u
    $cgmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> MouseScrollDirection -> m MouseScrollDirection
    gmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> MouseScrollDirection -> m MouseScrollDirection
    $cgmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> MouseScrollDirection -> m MouseScrollDirection
    gmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> MouseScrollDirection -> m MouseScrollDirection
    $cgmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> MouseScrollDirection -> m MouseScrollDirection
    gmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> MouseScrollDirection -> m MouseScrollDirection
    Data, MouseScrollDirection -> MouseScrollDirection -> Bool
    (MouseScrollDirection -> MouseScrollDirection -> Bool)
    -> (MouseScrollDirection -> MouseScrollDirection -> Bool)
    -> Eq MouseScrollDirection
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: MouseScrollDirection -> MouseScrollDirection -> Bool
    == :: MouseScrollDirection -> MouseScrollDirection -> Bool
    $c/= :: MouseScrollDirection -> MouseScrollDirection -> Bool
    /= :: MouseScrollDirection -> MouseScrollDirection -> Bool
    Eq, Int -> MouseScrollDirection
    MouseScrollDirection -> Int
    MouseScrollDirection -> [MouseScrollDirection]
    MouseScrollDirection -> MouseScrollDirection
    MouseScrollDirection
    -> MouseScrollDirection -> [MouseScrollDirection]
    MouseScrollDirection
    -> MouseScrollDirection
    -> MouseScrollDirection
    -> [MouseScrollDirection]
    (MouseScrollDirection -> MouseScrollDirection)
    -> (MouseScrollDirection -> MouseScrollDirection)
    -> (Int -> MouseScrollDirection)
    -> (MouseScrollDirection -> Int)
    -> (MouseScrollDirection -> [MouseScrollDirection])
    -> (MouseScrollDirection
        -> MouseScrollDirection -> [MouseScrollDirection])
    -> (MouseScrollDirection
        -> MouseScrollDirection -> [MouseScrollDirection])
    -> (MouseScrollDirection
        -> MouseScrollDirection
        -> MouseScrollDirection
        -> [MouseScrollDirection])
    -> Enum MouseScrollDirection
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: MouseScrollDirection -> MouseScrollDirection
    succ :: MouseScrollDirection -> MouseScrollDirection
    $cpred :: MouseScrollDirection -> MouseScrollDirection
    pred :: MouseScrollDirection -> MouseScrollDirection
    $ctoEnum :: Int -> MouseScrollDirection
    toEnum :: Int -> MouseScrollDirection
    $cfromEnum :: MouseScrollDirection -> Int
    fromEnum :: MouseScrollDirection -> Int
    $cenumFrom :: MouseScrollDirection -> [MouseScrollDirection]
    enumFrom :: MouseScrollDirection -> [MouseScrollDirection]
    $cenumFromThen :: MouseScrollDirection
    -> MouseScrollDirection -> [MouseScrollDirection]
    enumFromThen :: MouseScrollDirection
    -> MouseScrollDirection -> [MouseScrollDirection]
    $cenumFromTo :: MouseScrollDirection
    -> MouseScrollDirection -> [MouseScrollDirection]
    enumFromTo :: MouseScrollDirection
    -> MouseScrollDirection -> [MouseScrollDirection]
    $cenumFromThenTo :: MouseScrollDirection
    -> MouseScrollDirection
    -> MouseScrollDirection
    -> [MouseScrollDirection]
    enumFromThenTo :: MouseScrollDirection
    -> MouseScrollDirection
    -> MouseScrollDirection
    -> [MouseScrollDirection]
    Enum, (forall x. MouseScrollDirection -> Rep MouseScrollDirection x)
    -> (forall x. Rep MouseScrollDirection x -> MouseScrollDirection)
    -> Generic MouseScrollDirection
    forall x. Rep MouseScrollDirection x -> MouseScrollDirection
    forall x. MouseScrollDirection -> Rep MouseScrollDirection x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. MouseScrollDirection -> Rep MouseScrollDirection x
    from :: forall x. MouseScrollDirection -> Rep MouseScrollDirection x
    $cto :: forall x. Rep MouseScrollDirection x -> MouseScrollDirection
    to :: forall x. Rep MouseScrollDirection x -> MouseScrollDirection
    Generic, Eq MouseScrollDirection
    Eq MouseScrollDirection =>
    (MouseScrollDirection -> MouseScrollDirection -> Ordering)
    -> (MouseScrollDirection -> MouseScrollDirection -> Bool)
    -> (MouseScrollDirection -> MouseScrollDirection -> Bool)
    -> (MouseScrollDirection -> MouseScrollDirection -> Bool)
    -> (MouseScrollDirection -> MouseScrollDirection -> Bool)
    -> (MouseScrollDirection
        -> MouseScrollDirection -> MouseScrollDirection)
    -> (MouseScrollDirection
        -> MouseScrollDirection -> MouseScrollDirection)
    -> Ord MouseScrollDirection
    MouseScrollDirection -> MouseScrollDirection -> Bool
    MouseScrollDirection -> MouseScrollDirection -> Ordering
    MouseScrollDirection
    -> MouseScrollDirection -> MouseScrollDirection
    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
    $ccompare :: MouseScrollDirection -> MouseScrollDirection -> Ordering
    compare :: MouseScrollDirection -> MouseScrollDirection -> Ordering
    $c< :: MouseScrollDirection -> MouseScrollDirection -> Bool
    < :: MouseScrollDirection -> MouseScrollDirection -> Bool
    $c<= :: MouseScrollDirection -> MouseScrollDirection -> Bool
    <= :: MouseScrollDirection -> MouseScrollDirection -> Bool
    $c> :: MouseScrollDirection -> MouseScrollDirection -> Bool
    > :: MouseScrollDirection -> MouseScrollDirection -> Bool
    $c>= :: MouseScrollDirection -> MouseScrollDirection -> Bool
    >= :: MouseScrollDirection -> MouseScrollDirection -> Bool
    $cmax :: MouseScrollDirection
    -> MouseScrollDirection -> MouseScrollDirection
    max :: MouseScrollDirection
    -> MouseScrollDirection -> MouseScrollDirection
    $cmin :: MouseScrollDirection
    -> MouseScrollDirection -> MouseScrollDirection
    min :: MouseScrollDirection
    -> MouseScrollDirection -> MouseScrollDirection
    Ord, ReadPrec [MouseScrollDirection]
    ReadPrec MouseScrollDirection
    Int -> ReadS MouseScrollDirection
    ReadS [MouseScrollDirection]
    (Int -> ReadS MouseScrollDirection)
    -> ReadS [MouseScrollDirection]
    -> ReadPrec MouseScrollDirection
    -> ReadPrec [MouseScrollDirection]
    -> Read MouseScrollDirection
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS MouseScrollDirection
    readsPrec :: Int -> ReadS MouseScrollDirection
    $creadList :: ReadS [MouseScrollDirection]
    readList :: ReadS [MouseScrollDirection]
    $creadPrec :: ReadPrec MouseScrollDirection
    readPrec :: ReadPrec MouseScrollDirection
    $creadListPrec :: ReadPrec [MouseScrollDirection]
    readListPrec :: ReadPrec [MouseScrollDirection]
    Read, Int -> MouseScrollDirection -> ShowS
    [MouseScrollDirection] -> ShowS
    MouseScrollDirection -> [Char]
    (Int -> MouseScrollDirection -> ShowS)
    -> (MouseScrollDirection -> [Char])
    -> ([MouseScrollDirection] -> ShowS)
    -> Show MouseScrollDirection
    forall a.
    (Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> MouseScrollDirection -> ShowS
    showsPrec :: Int -> MouseScrollDirection -> ShowS
    $cshow :: MouseScrollDirection -> [Char]
    show :: MouseScrollDirection -> [Char]
    $cshowList :: [MouseScrollDirection] -> ShowS
    showList :: [MouseScrollDirection] -> ShowS
    Show, Typeable)

    instance FromNumber MouseScrollDirection Word32 where
      fromNumber :: Word32 -> MouseScrollDirection
    fromNumber Word32
    n' = case Word32
    n' of
        Word32
    Raw.SDL_MOUSEWHEEL_NORMAL -> MouseScrollDirection
    ScrollNormal
        Word32
    Raw.SDL_MOUSEWHEEL_FLIPPED -> MouseScrollDirection
    ScrollFlipped
        Word32
    _ -> MouseScrollDirection
    ScrollNormal

    data WarpMouseOrigin
      = WarpInWindow Window
        -- ^ Move the mouse pointer within a given 'Window'.
      | WarpCurrentFocus
        -- ^ Move the mouse pointer within whichever 'Window' currently has focus.
      | WarpGlobal
        -- ^ Move the mouse pointer in global screen space.
      deriving (Typeable WarpMouseOrigin
    Typeable WarpMouseOrigin =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> WarpMouseOrigin -> c WarpMouseOrigin)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c WarpMouseOrigin)
    -> (WarpMouseOrigin -> Constr)
    -> (WarpMouseOrigin -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c WarpMouseOrigin))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c WarpMouseOrigin))
    -> ((forall b. Data b => b -> b)
        -> WarpMouseOrigin -> WarpMouseOrigin)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> WarpMouseOrigin -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> WarpMouseOrigin -> r)
    -> (forall u.
        (forall d. Data d => d -> u) -> WarpMouseOrigin -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> WarpMouseOrigin -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d)
        -> WarpMouseOrigin -> m WarpMouseOrigin)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> WarpMouseOrigin -> m WarpMouseOrigin)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d)
        -> WarpMouseOrigin -> m WarpMouseOrigin)
    -> Data WarpMouseOrigin
    WarpMouseOrigin -> Constr
    WarpMouseOrigin -> DataType
    (forall b. Data b => b -> b) -> WarpMouseOrigin -> WarpMouseOrigin
    forall a.
    Typeable a =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        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 :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u.
    Int -> (forall d. Data d => d -> u) -> WarpMouseOrigin -> u
    forall u. (forall d. Data d => d -> u) -> WarpMouseOrigin -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> WarpMouseOrigin -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> WarpMouseOrigin -> r
    forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> WarpMouseOrigin -> m WarpMouseOrigin
    forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> WarpMouseOrigin -> m WarpMouseOrigin
    forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c WarpMouseOrigin
    forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> WarpMouseOrigin -> c WarpMouseOrigin
    forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c WarpMouseOrigin)
    forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c WarpMouseOrigin)
    $cgfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> WarpMouseOrigin -> c WarpMouseOrigin
    gfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> WarpMouseOrigin -> c WarpMouseOrigin
    $cgunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c WarpMouseOrigin
    gunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c WarpMouseOrigin
    $ctoConstr :: WarpMouseOrigin -> Constr
    toConstr :: WarpMouseOrigin -> Constr
    $cdataTypeOf :: WarpMouseOrigin -> DataType
    dataTypeOf :: WarpMouseOrigin -> DataType
    $cdataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c WarpMouseOrigin)
    dataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c WarpMouseOrigin)
    $cdataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c WarpMouseOrigin)
    dataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c WarpMouseOrigin)
    $cgmapT :: (forall b. Data b => b -> b) -> WarpMouseOrigin -> WarpMouseOrigin
    gmapT :: (forall b. Data b => b -> b) -> WarpMouseOrigin -> WarpMouseOrigin
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> WarpMouseOrigin -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> WarpMouseOrigin -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> WarpMouseOrigin -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> WarpMouseOrigin -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> WarpMouseOrigin -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> WarpMouseOrigin -> [u]
    $cgmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> WarpMouseOrigin -> u
    gmapQi :: forall u.
    Int -> (forall d. Data d => d -> u) -> WarpMouseOrigin -> u
    $cgmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> WarpMouseOrigin -> m WarpMouseOrigin
    gmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> WarpMouseOrigin -> m WarpMouseOrigin
    $cgmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> WarpMouseOrigin -> m WarpMouseOrigin
    gmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> WarpMouseOrigin -> m WarpMouseOrigin
    $cgmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> WarpMouseOrigin -> m WarpMouseOrigin
    gmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> WarpMouseOrigin -> m WarpMouseOrigin
    Data, WarpMouseOrigin -> WarpMouseOrigin -> Bool
    (WarpMouseOrigin -> WarpMouseOrigin -> Bool)
    -> (WarpMouseOrigin -> WarpMouseOrigin -> Bool)
    -> Eq WarpMouseOrigin
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    == :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    $c/= :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    /= :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    Eq, (forall x. WarpMouseOrigin -> Rep WarpMouseOrigin x)
    -> (forall x. Rep WarpMouseOrigin x -> WarpMouseOrigin)
    -> Generic WarpMouseOrigin
    forall x. Rep WarpMouseOrigin x -> WarpMouseOrigin
    forall x. WarpMouseOrigin -> Rep WarpMouseOrigin x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. WarpMouseOrigin -> Rep WarpMouseOrigin x
    from :: forall x. WarpMouseOrigin -> Rep WarpMouseOrigin x
    $cto :: forall x. Rep WarpMouseOrigin x -> WarpMouseOrigin
    to :: forall x. Rep WarpMouseOrigin x -> WarpMouseOrigin
    Generic, Eq WarpMouseOrigin
    Eq WarpMouseOrigin =>
    (WarpMouseOrigin -> WarpMouseOrigin -> Ordering)
    -> (WarpMouseOrigin -> WarpMouseOrigin -> Bool)
    -> (WarpMouseOrigin -> WarpMouseOrigin -> Bool)
    -> (WarpMouseOrigin -> WarpMouseOrigin -> Bool)
    -> (WarpMouseOrigin -> WarpMouseOrigin -> Bool)
    -> (WarpMouseOrigin -> WarpMouseOrigin -> WarpMouseOrigin)
    -> (WarpMouseOrigin -> WarpMouseOrigin -> WarpMouseOrigin)
    -> Ord WarpMouseOrigin
    WarpMouseOrigin -> WarpMouseOrigin -> Bool
    WarpMouseOrigin -> WarpMouseOrigin -> Ordering
    WarpMouseOrigin -> WarpMouseOrigin -> WarpMouseOrigin
    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
    $ccompare :: WarpMouseOrigin -> WarpMouseOrigin -> Ordering
    compare :: WarpMouseOrigin -> WarpMouseOrigin -> Ordering
    $c< :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    < :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    $c<= :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    <= :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    $c> :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    > :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    $c>= :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    >= :: WarpMouseOrigin -> WarpMouseOrigin -> Bool
    $cmax :: WarpMouseOrigin -> WarpMouseOrigin -> WarpMouseOrigin
    max :: WarpMouseOrigin -> WarpMouseOrigin -> WarpMouseOrigin
    $cmin :: WarpMouseOrigin -> WarpMouseOrigin -> WarpMouseOrigin
    min :: WarpMouseOrigin -> WarpMouseOrigin -> WarpMouseOrigin
    Ord, Int -> WarpMouseOrigin -> ShowS
    [WarpMouseOrigin] -> ShowS
    WarpMouseOrigin -> [Char]
    (Int -> WarpMouseOrigin -> ShowS)
    -> (WarpMouseOrigin -> [Char])
    -> ([WarpMouseOrigin] -> ShowS)
    -> Show WarpMouseOrigin
    forall a.
    (Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> WarpMouseOrigin -> ShowS
    showsPrec :: Int -> WarpMouseOrigin -> ShowS
    $cshow :: WarpMouseOrigin -> [Char]
    show :: WarpMouseOrigin -> [Char]
    $cshowList :: [WarpMouseOrigin] -> ShowS
    showList :: [WarpMouseOrigin] -> ShowS
    Show, Typeable)

    -- | Move the current location of a mouse pointer. The 'WarpMouseOrigin' specifies the origin for the given warp coordinates.
    warpMouse :: MonadIO m => WarpMouseOrigin -> Point V2 CInt -> m ()
    warpMouse :: forall (m :: Type -> Type).
    MonadIO m =>
    WarpMouseOrigin -> Point V2 CInt -> m ()
    warpMouse (WarpInWindow (Window Window
    w)) (P (V2 CInt
    x CInt
    y)) = Window -> CInt -> CInt -> m ()
    forall (m :: Type -> Type).
    MonadIO m =>
    Window -> CInt -> CInt -> m ()
    Raw.warpMouseInWindow Window
    w CInt
    x CInt
    y
    warpMouse WarpMouseOrigin
    WarpCurrentFocus (P (V2 CInt
    x CInt
    y)) = Window -> CInt -> CInt -> m ()
    forall (m :: Type -> Type).
    MonadIO m =>
    Window -> CInt -> CInt -> m ()
    Raw.warpMouseInWindow Window
    forall a. Ptr a
    nullPtr CInt
    x CInt
    y
    warpMouse WarpMouseOrigin
    WarpGlobal (P (V2 CInt
    x CInt
    y)) = Text -> Text -> m CInt -> m ()
    forall (m :: Type -> Type) a.
    (MonadIO m, Num a, Ord a) =>
    Text -> Text -> m a -> m ()
    throwIfNeg_ Text
    "SDL.Mouse.warpMouse" Text
    "SDL_WarpMouseGlobal" (m CInt -> m ()) -> m CInt -> m ()
    forall a b. (a -> b) -> a -> b
    $
      CInt -> CInt -> m CInt
    forall (m :: Type -> Type). MonadIO m => CInt -> CInt -> m CInt
    Raw.warpMouseGlobal CInt
    x CInt
    y

    -- | Get or set whether the cursor is currently visible.
    --
    -- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
    --
    -- See @<https://wiki.libsdl.org/SDL_ShowCursor SDL_ShowCursor>@ and @<https://wiki.libsdl.org/SDL_HideCursor SDL_HideCursor>@ for C documentation.
    cursorVisible :: StateVar Bool
    cursorVisible :: StateVar Bool
    cursorVisible = IO Bool -> (Bool -> IO ()) -> StateVar Bool
    forall a. IO a -> (a -> IO ()) -> StateVar a
    makeStateVar IO Bool
    forall (m :: Type -> Type). (Functor m, MonadIO m) => m Bool
    getCursorVisible Bool -> IO ()
    forall (m :: Type -> Type). (Functor m, MonadIO m) => Bool -> m ()
    setCursorVisible
      where
      -- The usage of 'void' is OK here - Raw.showCursor just returns the old state.
      setCursorVisible :: (Functor m, MonadIO m) => Bool -> m ()
      setCursorVisible :: forall (m :: Type -> Type). (Functor m, MonadIO m) => Bool -> m ()
    setCursorVisible Bool
    True = m CInt -> m ()
    forall (f :: Type -> Type) a. Functor f => f a -> f ()
    void (m CInt -> m ()) -> m CInt -> m ()
    forall a b. (a -> b) -> a -> b
    $ CInt -> m CInt
    forall (m :: Type -> Type). MonadIO m => CInt -> m CInt
    Raw.showCursor CInt
    1
      setCursorVisible Bool
    False = m CInt -> m ()
    forall (f :: Type -> Type) a. Functor f => f a -> f ()
    void (m CInt -> m ()) -> m CInt -> m ()
    forall a b. (a -> b) -> a -> b
    $ CInt -> m CInt
    forall (m :: Type -> Type). MonadIO m => CInt -> m CInt
    Raw.showCursor CInt
    0

      getCursorVisible :: (Functor m, MonadIO m) => m Bool
      getCursorVisible :: forall (m :: Type -> Type). (Functor m, MonadIO m) => m Bool
    getCursorVisible = (CInt -> CInt -> Bool
    forall a. Eq a => a -> a -> Bool
    == CInt
    1) (CInt -> Bool) -> m CInt -> m Bool
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    <$> CInt -> m CInt
    forall (m :: Type -> Type). MonadIO m => CInt -> m CInt
    Raw.showCursor (-CInt
    1)

    -- | Retrieve the current location of the mouse, relative to the currently focused window.
    getAbsoluteMouseLocation :: MonadIO m => m (Point V2 CInt)
    getAbsoluteMouseLocation :: forall (m :: Type -> Type). MonadIO m => m (Point V2 CInt)
    getAbsoluteMouseLocation = IO (Point V2 CInt) -> m (Point V2 CInt)
    forall a. IO a -> m a
    forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
    liftIO (IO (Point V2 CInt) -> m (Point V2 CInt))
    -> IO (Point V2 CInt) -> m (Point V2 CInt)
    forall a b. (a -> b) -> a -> b
    $
      (Ptr CInt -> IO (Point V2 CInt)) -> IO (Point V2 CInt)
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CInt -> IO (Point V2 CInt)) -> IO (Point V2 CInt))
    -> (Ptr CInt -> IO (Point V2 CInt)) -> IO (Point V2 CInt)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CInt
    x ->
      (Ptr CInt -> IO (Point V2 CInt)) -> IO (Point V2 CInt)
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CInt -> IO (Point V2 CInt)) -> IO (Point V2 CInt))
    -> (Ptr CInt -> IO (Point V2 CInt)) -> IO (Point V2 CInt)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CInt
    y -> do
        Word32
    _ <- Ptr CInt -> Ptr CInt -> IO Word32
    forall (m :: Type -> Type).
    MonadIO m =>
    Ptr CInt -> Ptr CInt -> m Word32
    Raw.getMouseState Ptr CInt
    x Ptr CInt
    y -- We don't deal with button states here
        V2 CInt -> Point V2 CInt
    forall (f :: Type -> Type) a. f a -> Point f a
    P (V2 CInt -> Point V2 CInt) -> IO (V2 CInt) -> IO (Point V2 CInt)
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    <$> (CInt -> CInt -> V2 CInt
    forall a. a -> a -> V2 a
    V2 (CInt -> CInt -> V2 CInt) -> IO CInt -> IO (CInt -> V2 CInt)
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    <$> Ptr CInt -> IO CInt
    forall a. Storable a => Ptr a -> IO a
    peek Ptr CInt
    x IO (CInt -> V2 CInt) -> IO CInt -> IO (V2 CInt)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: Type -> Type) a b.
    Applicative f =>
    f (a -> b) -> f a -> f b
    <*> Ptr CInt -> IO CInt
    forall a. Storable a => Ptr a -> IO a
    peek Ptr CInt
    y)

    -- | Retrieve mouse motion
    getRelativeMouseLocation :: MonadIO m => m (V2 CInt)
    getRelativeMouseLocation :: forall (m :: Type -> Type). MonadIO m => m (V2 CInt)
    getRelativeMouseLocation = IO (V2 CInt) -> m (V2 CInt)
    forall a. IO a -> m a
    forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
    liftIO (IO (V2 CInt) -> m (V2 CInt)) -> IO (V2 CInt) -> m (V2 CInt)
    forall a b. (a -> b) -> a -> b
    $
      (Ptr CInt -> IO (V2 CInt)) -> IO (V2 CInt)
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CInt -> IO (V2 CInt)) -> IO (V2 CInt))
    -> (Ptr CInt -> IO (V2 CInt)) -> IO (V2 CInt)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CInt
    x ->
      (Ptr CInt -> IO (V2 CInt)) -> IO (V2 CInt)
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CInt -> IO (V2 CInt)) -> IO (V2 CInt))
    -> (Ptr CInt -> IO (V2 CInt)) -> IO (V2 CInt)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CInt
    y -> do
        Word32
    _ <- Ptr CInt -> Ptr CInt -> IO Word32
    forall (m :: Type -> Type).
    MonadIO m =>
    Ptr CInt -> Ptr CInt -> m Word32
    Raw.getRelativeMouseState Ptr CInt
    x Ptr CInt
    y
        CInt -> CInt -> V2 CInt
    forall a. a -> a -> V2 a
    V2 (CInt -> CInt -> V2 CInt) -> IO CInt -> IO (CInt -> V2 CInt)
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    <$> Ptr CInt -> IO CInt
    forall a. Storable a => Ptr a -> IO a
    peek Ptr CInt
    x IO (CInt -> V2 CInt) -> IO CInt -> IO (V2 CInt)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: Type -> Type) a b.
    Applicative f =>
    f (a -> b) -> f a -> f b
    <*> Ptr CInt -> IO CInt
    forall a. Storable a => Ptr a -> IO a
    peek Ptr CInt
    y

    -- | Retrieve a mapping of which buttons are currently held down.
    getMouseButtons :: MonadIO m => m (MouseButton -> Bool)
    getMouseButtons :: forall (m :: Type -> Type). MonadIO m => m (MouseButton -> Bool)
    getMouseButtons = IO (MouseButton -> Bool) -> m (MouseButton -> Bool)
    forall a. IO a -> m a
    forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
    liftIO (IO (MouseButton -> Bool) -> m (MouseButton -> Bool))
    -> IO (MouseButton -> Bool) -> m (MouseButton -> Bool)
    forall a b. (a -> b) -> a -> b
    $
      Word32 -> MouseButton -> Bool
    forall {a} {a} {a}. (Bits a, ToNumber a a) => a -> a -> Bool
    convert (Word32 -> MouseButton -> Bool)
    -> IO Word32 -> IO (MouseButton -> Bool)
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    <$> Ptr CInt -> Ptr CInt -> IO Word32
    forall (m :: Type -> Type).
    MonadIO m =>
    Ptr CInt -> Ptr CInt -> m Word32
    Raw.getMouseState Ptr CInt
    forall a. Ptr a
    nullPtr Ptr CInt
    forall a. Ptr a
    nullPtr
      where
        convert :: a -> a -> Bool
    convert a
    w a
    b = a
    w a -> Int -> Bool
    forall a. Bits a => a -> Int -> Bool
    `testBit` a -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral (a -> a
    forall a b. ToNumber a b => a -> b
    toNumber a
    b a -> a -> a
    forall a. Num a => a -> a -> a
    - a
    1)

    newtype Cursor = Cursor { Cursor -> Window
    unwrapCursor :: Raw.Cursor }
        deriving (Cursor -> Cursor -> Bool
    (Cursor -> Cursor -> Bool)
    -> (Cursor -> Cursor -> Bool) -> Eq Cursor
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Cursor -> Cursor -> Bool
    == :: Cursor -> Cursor -> Bool
    $c/= :: Cursor -> Cursor -> Bool
    /= :: Cursor -> Cursor -> Bool
    Eq, Typeable)

    data SystemCursor
      = SystemCursorArrow
      | SystemCursorIBeam
      | SystemCursorWait
      | SystemCursorCrossHair
      | SystemCursorWaitArrow
      | SystemCursorSizeNWSE
      | SystemCursorSizeNESW
      | SystemCursorSizeWE
      | SystemCursorSizeNS
      | SystemCursorSizeAll
      | SystemCursorNo
      | SystemCursorHand

    instance ToNumber SystemCursor Word32 where
      toNumber :: SystemCursor -> Word32
    toNumber SystemCursor
    SystemCursorArrow        = Word32
    Raw.SDL_SYSTEM_CURSOR_ARROW
      toNumber SystemCursor
    SystemCursorIBeam        = Word32
    Raw.SDL_SYSTEM_CURSOR_IBEAM
      toNumber SystemCursor
    SystemCursorWait         = Word32
    Raw.SDL_SYSTEM_CURSOR_WAIT
      toNumber SystemCursor
    SystemCursorCrossHair    = Word32
    Raw.SDL_SYSTEM_CURSOR_CROSSHAIR
      toNumber SystemCursor
    SystemCursorWaitArrow    = Word32
    Raw.SDL_SYSTEM_CURSOR_WAITARROW
      toNumber SystemCursor
    SystemCursorSizeNWSE     = Word32
    Raw.SDL_SYSTEM_CURSOR_SIZENWSE
      toNumber SystemCursor
    SystemCursorSizeNESW     = Word32
    Raw.SDL_SYSTEM_CURSOR_SIZENESW
      toNumber SystemCursor
    SystemCursorSizeWE       = Word32
    Raw.SDL_SYSTEM_CURSOR_SIZEWE
      toNumber SystemCursor
    SystemCursorSizeNS       = Word32
    Raw.SDL_SYSTEM_CURSOR_SIZENS
      toNumber SystemCursor
    SystemCursorSizeAll      = Word32
    Raw.SDL_SYSTEM_CURSOR_SIZEALL
      toNumber SystemCursor
    SystemCursorNo           = Word32
    Raw.SDL_SYSTEM_CURSOR_NO
      toNumber SystemCursor
    SystemCursorHand         = Word32
    Raw.SDL_SYSTEM_CURSOR_HAND

    -- | Get or set the currently active cursor. You can create new 'Cursor's with 'createCursor'.
    --
    -- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
    --
    -- See @<https://wiki.libsdl.org/SDL_SetCursor SDL_SetCursor>@ and @<https://wiki.libsdl.org/SDL_GetCursor SDL_GetCursor>@ for C documentation.
    activeCursor :: StateVar Cursor
    activeCursor :: StateVar Cursor
    activeCursor = IO Cursor -> (Cursor -> IO ()) -> StateVar Cursor
    forall a. IO a -> (a -> IO ()) -> StateVar a
    makeStateVar IO Cursor
    forall (m :: Type -> Type). MonadIO m => m Cursor
    getCursor Cursor -> IO ()
    forall (m :: Type -> Type). MonadIO m => Cursor -> m ()
    setCursor
      where
      getCursor :: MonadIO m => m Cursor
      getCursor :: forall (m :: Type -> Type). MonadIO m => m Cursor
    getCursor = IO Cursor -> m Cursor
    forall a. IO a -> m a
    forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
    liftIO (IO Cursor -> m Cursor)
    -> (IO Window -> IO Cursor) -> IO Window -> m Cursor
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Window -> Cursor) -> IO Window -> IO Cursor
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    fmap Window -> Cursor
    Cursor (IO Window -> m Cursor) -> IO Window -> m Cursor
    forall a b. (a -> b) -> a -> b
    $
          Text -> Text -> IO Window -> IO Window
    forall (m :: Type -> Type) a.
    MonadIO m =>
    Text -> Text -> m (Ptr a) -> m (Ptr a)
    throwIfNull Text
    "SDL.Input.Mouse.getCursor" Text
    "SDL_getCursor"
              IO Window
    forall (m :: Type -> Type). MonadIO m => m Window
    Raw.getCursor

      setCursor :: MonadIO m => Cursor -> m ()
      setCursor :: forall (m :: Type -> Type). MonadIO m => Cursor -> m ()
    setCursor = Window -> m ()
    forall (m :: Type -> Type). MonadIO m => Window -> m ()
    Raw.setCursor (Window -> m ()) -> (Cursor -> Window) -> Cursor -> m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Cursor -> Window
    unwrapCursor

    -- | Create a cursor using the specified bitmap data and mask (in MSB format).
    createCursor :: MonadIO m
                 => V.Vector Word8 -- ^ Whether this part of the cursor is black. Use 'False' for white and 'True' for black.
                 -> V.Vector Word8 -- ^ Whether or not pixels are visible. Use 'True' for visible and 'False' for transparent.
                 -> V2 CInt -- ^ The width and height of the cursor.
                 -> Point V2 CInt -- ^ The X- and Y-axis location of the upper left corner of the cursor relative to the actual mouse position
                 -> m Cursor
    createCursor :: forall (m :: Type -> Type).
    MonadIO m =>
    Vector Word8
    -> Vector Word8 -> V2 CInt -> Point V2 CInt -> m Cursor
    createCursor Vector Word8
    dta Vector Word8
    msk (V2 CInt
    w CInt
    h) (P (V2 CInt
    hx CInt
    hy)) =
        IO Cursor -> m Cursor
    forall a. IO a -> m a
    forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
    liftIO (IO Cursor -> m Cursor)
    -> (IO Window -> IO Cursor) -> IO Window -> m Cursor
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Window -> Cursor) -> IO Window -> IO Cursor
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    fmap Window -> Cursor
    Cursor (IO Window -> m Cursor) -> IO Window -> m Cursor
    forall a b. (a -> b) -> a -> b
    $
            Text -> Text -> IO Window -> IO Window
    forall (m :: Type -> Type) a.
    MonadIO m =>
    Text -> Text -> m (Ptr a) -> m (Ptr a)
    throwIfNull Text
    "SDL.Input.Mouse.createCursor" Text
    "SDL_createCursor" (IO Window -> IO Window) -> IO Window -> IO Window
    forall a b. (a -> b) -> a -> b
    $
                Vector Word8 -> (Ptr Word8 -> IO Window) -> IO Window
    forall a b. Storable a => Vector a -> (Ptr a -> IO b) -> IO b
    V.unsafeWith Vector Word8
    dta ((Ptr Word8 -> IO Window) -> IO Window)
    -> (Ptr Word8 -> IO Window) -> IO Window
    forall a b. (a -> b) -> a -> b
    $ \Ptr Word8
    unsafeDta ->
                Vector Word8 -> (Ptr Word8 -> IO Window) -> IO Window
    forall a b. Storable a => Vector a -> (Ptr a -> IO b) -> IO b
    V.unsafeWith Vector Word8
    msk ((Ptr Word8 -> IO Window) -> IO Window)
    -> (Ptr Word8 -> IO Window) -> IO Window
    forall a b. (a -> b) -> a -> b
    $ \Ptr Word8
    unsafeMsk ->
                    Ptr Word8 -> Ptr Word8 -> CInt -> CInt -> CInt -> CInt -> IO Window
    forall (m :: Type -> Type).
    MonadIO m =>
    Ptr Word8 -> Ptr Word8 -> CInt -> CInt -> CInt -> CInt -> m Window
    Raw.createCursor Ptr Word8
    unsafeDta Ptr Word8
    unsafeMsk CInt
    w CInt
    h CInt
    hx CInt
    hy

    {- | Create a cursor from a bit art painting of it.

    The number of columns must be a multiple of 8.

    Symbols used: @ @ (space) - transparent, @.@ - visible black, @#@ (or anything else) - visible white.

    A minimal cursor template:
    @
    source8x8 :: [[Char]]
    source8x8 =
      [ "        "
      , "        "
      , "        "
      , "        "
      , "        "
      , "        "
      , "        "
      , "        "
      ]
    @
    -}
    createCursorFrom :: MonadIO m
                 => Point V2 CInt -- ^ The X- and Y-axis location of the upper left corner of the cursor relative to the actual mouse position
                 -> [[Char]]
                 -> m Cursor
    createCursorFrom :: forall (m :: Type -> Type).
    MonadIO m =>
    Point V2 CInt -> [[Char]] -> m Cursor
    createCursorFrom Point V2 CInt
    point [[Char]]
    source = do
      Vector Word8
    -> Vector Word8 -> V2 CInt -> Point V2 CInt -> m Cursor
    forall (m :: Type -> Type).
    MonadIO m =>
    Vector Word8
    -> Vector Word8 -> V2 CInt -> Point V2 CInt -> m Cursor
    createCursor Vector Word8
    color Vector Word8
    mask (CInt -> CInt -> V2 CInt
    forall a. a -> a -> V2 a
    V2 CInt
    w CInt
    h) Point V2 CInt
    point
      where
        h :: CInt
    h = Int -> CInt
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral ([[Char]] -> Int
    forall a. [a] -> Int
    forall (t :: Type -> Type) a. Foldable t => t a -> Int
    length [[Char]]
    source)
        w :: CInt
    w = case [Int] -> [Int]
    forall a. Eq a => [a] -> [a]
    nub ([Int] -> [Int]) -> [Int] -> [Int]
    forall a b. (a -> b) -> a -> b
    $ ([Char] -> Int) -> [[Char]] -> [Int]
    forall a b. (a -> b) -> [a] -> [b]
    map [Char] -> Int
    forall a. [a] -> Int
    forall (t :: Type -> Type) a. Foldable t => t a -> Int
    length [[Char]]
    source of
          [Int
    okay] ->
            Int -> CInt
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Int
    okay
          [Int]
    mismatch ->
            [Char] -> CInt
    forall a. HasCallStack => [Char] -> a
    error ([Char] -> CInt) -> [Char] -> CInt
    forall a b. (a -> b) -> a -> b
    $ [Char]
    "Inconsistent row widths: " [Char] -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> [Int] -> [Char]
    forall a. Show a => a -> [Char]
    show [Int]
    mismatch

        color :: Vector Word8
    color =  [Bool] -> Vector Word8
    packBools [Bool]
    colorBits
        mask :: Vector Word8
    mask = [Bool] -> Vector Word8
    packBools [Bool]
    maskBits
        ([Bool]
    colorBits, [Bool]
    maskBits) = [(Bool, Bool)] -> ([Bool], [Bool])
    forall a b. [(a, b)] -> ([a], [b])
    unzip ([(Bool, Bool)] -> ([Bool], [Bool]))
    -> [(Bool, Bool)] -> ([Bool], [Bool])
    forall a b. (a -> b) -> a -> b
    $ (Char -> (Bool, Bool)) -> [Char] -> [(Bool, Bool)]
    forall a b. (a -> b) -> [a] -> [b]
    map Char -> (Bool, Bool)
    charToBool ([Char] -> [(Bool, Bool)]) -> [Char] -> [(Bool, Bool)]
    forall a b. (a -> b) -> a -> b
    $ [[Char]] -> [Char]
    forall (t :: Type -> Type) a. Foldable t => t [a] -> [a]
    concat [[Char]]
    source

        packBools :: [Bool] -> Vector Word8
    packBools = [Word8] -> Vector Word8
    forall a. Storable a => [a] -> Vector a
    V.fromList ([Word8] -> Vector Word8)
    -> ([Bool] -> [Word8]) -> [Bool] -> Vector Word8
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Bool] -> [Word8]
    forall {a}. Num a => [Bool] -> [a]
    boolListToWord8List

        charToBool :: Char -> (Bool, Bool)
    charToBool Char
    ' ' = (Bool
    False, Bool
    False)  -- transparent
        charToBool Char
    '.' = (Bool
    True, Bool
    True)  -- visible black
        charToBool Char
    _ = (Bool
    True, Bool
    False)  -- visible white

        boolListToWord8List :: [Bool] -> [a]
    boolListToWord8List [Bool]
    xs =
          case [Bool]
    xs of
            Bool
    b1 : Bool
    b2 : Bool
    b3 : Bool
    b4 : Bool
    b5 : Bool
    b6 : Bool
    b7 : Bool
    b8 : [Bool]
    rest ->
              let
                packed :: a
    packed =
                  Bool -> a -> a
    forall {p}. Num p => Bool -> p -> p
    i Bool
    b1 a
    128 a -> a -> a
    forall a. Num a => a -> a -> a
    +
                  Bool -> a -> a
    forall {p}. Num p => Bool -> p -> p
    i Bool
    b2 a
    64 a -> a -> a
    forall a. Num a => a -> a -> a
    +
                  Bool -> a -> a
    forall {p}. Num p => Bool -> p -> p
    i Bool
    b3 a
    32 a -> a -> a
    forall a. Num a => a -> a -> a
    +
                  Bool -> a -> a
    forall {p}. Num p => Bool -> p -> p
    i Bool
    b4 a
    16 a -> a -> a
    forall a. Num a => a -> a -> a
    +
                  Bool -> a -> a
    forall {p}. Num p => Bool -> p -> p
    i Bool
    b5 a
    8 a -> a -> a
    forall a. Num a => a -> a -> a
    +
                  Bool -> a -> a
    forall {p}. Num p => Bool -> p -> p
    i Bool
    b6 a
    4 a -> a -> a
    forall a. Num a => a -> a -> a
    +
                  Bool -> a -> a
    forall {p}. Num p => Bool -> p -> p
    i Bool
    b7 a
    2 a -> a -> a
    forall a. Num a => a -> a -> a
    +
                  Bool -> a -> a
    forall {p}. Num p => Bool -> p -> p
    i Bool
    b8 a
    1
                in
                  a
    packed a -> [a] -> [a]
    forall a. a -> [a] -> [a]
    : [Bool] -> [a]
    boolListToWord8List [Bool]
    rest
            [] ->
              []
            [Bool]
    _leftovers ->
              [Char] -> [a]
    forall a. HasCallStack => [Char] -> a
    error [Char]
    "The number of columns must be a multiple of 8."
          where
            i :: Bool -> p -> p
    i Bool
    True p
    multiple = p
    multiple
            i Bool
    False p
    _ = p
    0

    -- | Free a cursor created with 'createCursor', 'createColorCusor' and 'createSystemCursor'.
    --
    -- See @<https://wiki.libsdl.org/SDL_FreeCursor SDL_FreeCursor>@ for C documentation.
    freeCursor :: MonadIO m => Cursor -> m ()
    freeCursor :: forall (m :: Type -> Type). MonadIO m => Cursor -> m ()
    freeCursor = Window -> m ()
    forall (m :: Type -> Type). MonadIO m => Window -> m ()
    Raw.freeCursor (Window -> m ()) -> (Cursor -> Window) -> Cursor -> m ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Cursor -> Window
    unwrapCursor

    -- | Create a color cursor.
    --
    -- See @<https://wiki.libsdl.org/SDL_CreateColorCursor SDL_CreateColorCursor>@ for C documentation.
    createColorCursor :: MonadIO m
                      => Surface
                      -> Point V2 CInt -- ^ The location of the cursor hot spot
                      -> m Cursor
    createColorCursor :: forall (m :: Type -> Type).
    MonadIO m =>
    Surface -> Point V2 CInt -> m Cursor
    createColorCursor (Surface Ptr Surface
    surfPtr Maybe (IOVector Word8)
    _) (P (V2 CInt
    hx CInt
    hy)) =
        IO Cursor -> m Cursor
    forall a. IO a -> m a
    forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
    liftIO (IO Cursor -> m Cursor)
    -> (IO Window -> IO Cursor) -> IO Window -> m Cursor
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Window -> Cursor) -> IO Window -> IO Cursor
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    fmap Window -> Cursor
    Cursor (IO Window -> m Cursor) -> IO Window -> m Cursor
    forall a b. (a -> b) -> a -> b
    $
            Text -> Text -> IO Window -> IO Window
    forall (m :: Type -> Type) a.
    MonadIO m =>
    Text -> Text -> m (Ptr a) -> m (Ptr a)
    throwIfNull Text
    "SDL.Input.Mouse.createColorCursor" Text
    "SDL_createColorCursor" (IO Window -> IO Window) -> IO Window -> IO Window
    forall a b. (a -> b) -> a -> b
    $
                Ptr Surface -> CInt -> CInt -> IO Window
    forall (m :: Type -> Type).
    MonadIO m =>
    Ptr Surface -> CInt -> CInt -> m Window
    Raw.createColorCursor Ptr Surface
    surfPtr CInt
    hx CInt
    hy

    -- | Create system cursor.
    --
    -- See @<https://wiki.libsdl.org/SDL_CreateSystemCursor SDL_CreateSystemCursor>@ for C documentation.
    createSystemCursor :: MonadIO m => SystemCursor -> m Cursor
    createSystemCursor :: forall (m :: Type -> Type). MonadIO m => SystemCursor -> m Cursor
    createSystemCursor SystemCursor
    sc =
        IO Cursor -> m Cursor
    forall a. IO a -> m a
    forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
    liftIO (IO Cursor -> m Cursor)
    -> (IO Window -> IO Cursor) -> IO Window -> m Cursor
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Window -> Cursor) -> IO Window -> IO Cursor
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    fmap Window -> Cursor
    Cursor (IO Window -> m Cursor) -> IO Window -> m Cursor
    forall a b. (a -> b) -> a -> b
    $
            Text -> Text -> IO Window -> IO Window
    forall (m :: Type -> Type) a.
    MonadIO m =>
    Text -> Text -> m (Ptr a) -> m (Ptr a)
    throwIfNull Text
    "SDL.Input.Mouse.createSystemCursor" Text
    "SDL_CreateSystemCursor" (IO Window -> IO Window) -> IO Window -> IO Window
    forall a b. (a -> b) -> a -> b
    $
                Word32 -> IO Window
    forall (m :: Type -> Type). MonadIO m => Word32 -> m Window
    Raw.createSystemCursor (SystemCursor -> Word32
    forall a b. ToNumber a b => a -> b
    toNumber SystemCursor
    sc)