packages feed

robot 1.0.1.1 → 1.1

raw patch · 4 files changed

+6/−22 lines, 4 files

Files

Test/Robot.hs view
@@ -20,7 +20,6 @@     , tap        -- * Miscellaneous-    , releaseAll     , sleep      ) where
Test/Robot/Internal.hs view
@@ -19,13 +19,12 @@     , keyboard     , button     , motion-    , releaseAll      ) where   import Control.Applicative-import Control.Exception (bracket_, finally)+import Control.Exception (bracket_) import Control.Monad.IO.Class import Control.Monad.Trans.Reader import Data.Map (Map)@@ -51,7 +50,7 @@ runRobotWithConnection :: Robot a -> Connection -> IO a runRobotWithConnection (Robot m) c = do     keymap <- X.getKeysymMap c-    runReaderT m (c, keymap) `finally` X.releaseAll c+    runReaderT m (c, keymap)  mkRobot :: ((Connection, Map KEYSYM KEYCODE) -> IO a) -> Robot a mkRobot = Robot . ReaderT@@ -96,9 +95,3 @@       | x < fromIntegral (minBound `asTypeOf` result) = minBound       | x > fromIntegral (maxBound `asTypeOf` result) = maxBound       | otherwise = fromIntegral x----- | Release all the keys and buttons, in case some were left held down.--- This is called automatically before 'runRobot' returns.-releaseAll :: Robot ()-releaseAll = mkRobot' $ \c -> X.releaseAll c
Test/Robot/Internal/XTest.hs view
@@ -6,7 +6,6 @@       keyboard     , button     , motion-    , releaseAll      -- * Utility functions     , getKeysymMap@@ -15,7 +14,7 @@  import Control.Arrow (second) import Control.Applicative (liftA2)-import Control.Monad (forM_, (>=>))+import Control.Monad ((>=>)) import Data.List (unfoldr) import Data.Map (Map) import qualified Data.Map as M@@ -65,15 +64,6 @@  noWindow :: WINDOW noWindow = fromXid xidNone----- | Release all the keys and buttons, in case some were left held down.-releaseAll :: Connection -> IO ()-releaseAll c = do-    let (low, high) = keycodeRange c-    forM_ [low..high] $ keyboard c False-    -- There's no limit to the number of buttons, afaik. So hazard a guess.-    forM_ [1..42] $ button c False   -- | Return a structure mapping each keycode to its keysyms.
robot.cabal view
@@ -1,5 +1,5 @@ Name:                robot-Version:             1.0.1.1+Version:             1.1 Synopsis:            Simulate keyboard and mouse events Homepage:            https://github.com/lfairy/robot License:             OtherLicense@@ -15,6 +15,8 @@     Generate native keyboard and mouse events. Using this library,     applications will respond as if the user performed the action     themselves.+    .+    For examples, see the @examples@ folder in the source distribution.  Library     Exposed-Modules: