packages feed

kafka-device-glut 1.0.0.0 → 1.0.1.0

raw patch · 3 files changed

+42/−20 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Network.UI.Kafka.GLUT: clearCallbacks :: [GlutCallback] -> IO ()
+ Network.UI.Kafka.GLUT: interpretJoystick :: JoystickButtons -> JoystickPosition -> Event
+ Network.UI.Kafka.GLUT: interpretKeyboardMouse :: Key -> KeyState -> Modifiers -> Position -> Event
+ Network.UI.Kafka.GLUT: interpretMotion :: Position -> Event
+ Network.UI.Kafka.GLUT: interpretSpaceball :: SpaceballInput -> Event
+ Network.UI.Kafka.GLUT: setCallbacks :: [GlutCallback] -> (Event -> IO ()) -> IO ()

Files

default.nix view
@@ -5,7 +5,7 @@  mkDerivation {   pname = "kafka-device-glut";-  version = "1.0.0.0";+  version = "1.0.1.0";   src = ./.;   isLibrary = true;   isExecutable = true;
kafka-device-glut.cabal view
@@ -1,5 +1,5 @@ name         : kafka-device-glut-version      : 1.0.0.0+version      : 1.0.1.0 synopsis     : GLUT events via a Kafka message broker description  : This package contains functions for passing GLUT events to topics on a Kafka message broker \<<https://kafka.apache.org/>\>.  Also see \<<https://hackage.haskell.org/package/kafka-device/>\>. license      : MIT
src/Network/UI/Kafka/GLUT.hs view
@@ -18,6 +18,13 @@ -- * Event handling.   GlutCallback(..) , glutLoop+-- * Internal.+, interpretKeyboardMouse+, interpretMotion+, interpretSpaceball+, interpretJoystick+, setCallbacks+, clearCallbacks ) where  @@ -52,15 +59,7 @@ glutLoop topicConnection sensor callbacks =   do     nextEvent <- newEmptyMVar-    mapM_-      (uncurry (when . (`elem` callbacks)))-      [-        (KeyboardMouse, keyboardMouseCallback $=! Just ((((putMVar nextEvent .) .) .) . interpretKeyboardMouse   ))-      , (Motion       , motionCallback        $=! Just (   putMVar nextEvent          . interpretMotion          ))-      , (PassiveMotion, passiveMotionCallback $=! Just (   putMVar nextEvent          . interpretMotion          ))-      , (Spaceball    , spaceballCallback     $=! Just (   putMVar nextEvent          . interpretSpaceball       ))-      , (Joystick     , joystickCallback      $=! Just (  (putMVar nextEvent .)       . interpretJoystick     , 0))-      ]+    setCallbacks callbacks $ putMVar nextEvent     (exit, loop) <-       producerLoop topicConnection sensor         $ (: [])@@ -70,17 +69,40 @@         exit       , do           result <- loop-          mapM_-            (uncurry (when . (`elem` callbacks)))-            [-              (KeyboardMouse, keyboardMouseCallback $=! Nothing)-            , (Motion       , motionCallback        $=! Nothing)-            , (PassiveMotion, passiveMotionCallback $=! Nothing)-            , (Spaceball    , spaceballCallback     $=! Nothing)-            , (Joystick     , joystickCallback      $=! Nothing)-            ]+          clearCallbacks callbacks           return result       )+++-- | Set a callback from GLUT callbacks \<<https://hackage.haskell.org/package/GLUT-2.7.0.10/docs/Graphics-UI-GLUT-Callbacks-Window.html>\>.+setCallbacks :: [GlutCallback]   -- ^ Which callbacks to enable.+             -> (Event -> IO ()) -- ^ The action for handling GLUT events.+             -> IO ()            -- ^ Action to create the GLUT callbacks for the channel.+setCallbacks callbacks action =+  mapM_+    (uncurry (when . (`elem` callbacks)))+    [+      (KeyboardMouse, keyboardMouseCallback $=! Just ((((action .) .) .) . interpretKeyboardMouse   ))+    , (Motion       , motionCallback        $=! Just (   action          . interpretMotion          ))+    , (PassiveMotion, passiveMotionCallback $=! Just (   action          . interpretMotion          ))+    , (Spaceball    , spaceballCallback     $=! Just (   action          . interpretSpaceball       ))+    , (Joystick     , joystickCallback      $=! Just (  (action .)       . interpretJoystick     , 0))+    ]+++-- | Clear callbacks for the specified event types.+clearCallbacks :: [GlutCallback] -- ^ Which callbacks to enable.+               -> IO ()          -- ^ Action to create the GLUT callbacks for the channel.+clearCallbacks callbacks =+  mapM_+    (uncurry (when . (`elem` callbacks)))+    [+      (KeyboardMouse, keyboardMouseCallback $=! Nothing)+    , (Motion       , motionCallback        $=! Nothing)+    , (PassiveMotion, passiveMotionCallback $=! Nothing)+    , (Spaceball    , spaceballCallback     $=! Nothing)+    , (Joystick     , joystickCallback      $=! Nothing)+    ]   -- | Interpret key presses and mouse clickes.