summaryrefslogtreecommitdiff
path: root/Animator.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Animator.hs')
-rw-r--r--Animator.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Animator.hs b/Animator.hs
index e51fc50..fb0e3f6 100644
--- a/Animator.hs
+++ b/Animator.hs
@@ -55,6 +55,15 @@ addAnimation tm action = do
55 writeIORef (tmCallback tm) (Just cb) 55 writeIORef (tmCallback tm) (Just cb)
56 return k 56 return k
57 57
58
59removeAnimation :: Animator -> Int -> IO ()
60removeAnimation tm k = do
61 m <- atomicModifyIORef' (tmAnimations tm) $ \m -> (IntMap.delete k m, m)
62 when (IntMap.null $ IntMap.delete k m) $ do
63 mcb <- readIORef (tmCallback tm)
64 mapM_ (widgetRemoveTickCallback $ tmWidget tm) mcb
65 writeIORef (tmCallback tm) Nothing
66
58tick :: Animator -> Widget -> FrameClock -> IO Bool 67tick :: Animator -> Widget -> FrameClock -> IO Bool
59tick tm widget clock = widgetGetWindow widget >>= \case 68tick tm widget clock = widgetGetWindow widget >>= \case
60 Nothing -> do writeIORef (tmCallback tm) Nothing 69 Nothing -> do writeIORef (tmCallback tm) Nothing