From 57342ae29a09f019a1d39f06b763de269512074a Mon Sep 17 00:00:00 2001 From: Ian Grant Jeffries Date: Mon, 15 Oct 2018 16:25:40 -0400 Subject: [PATCH] Add isShutdown field to Vty. --- src/Graphics/Vty.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Graphics/Vty.hs b/src/Graphics/Vty.hs index 6c065f2..94eca8c 100644 --- a/src/Graphics/Vty.hs +++ b/src/Graphics/Vty.hs @@ -94,8 +94,9 @@ data Vty = Vty -- | Clean up after vty. A call to this function is necessary to -- cleanly restore the terminal state before application exit. The -- above methods will throw an exception if executed after this is - -- executed. + -- executed. Idempotent. , shutdown :: IO () + , isShutdown :: IO Bool } -- | Create a Vty handle. At most one handle should be created at a time @@ -125,6 +126,8 @@ intMkVty input out = do releaseDisplay out releaseTerminal out + let shutdownStatus = atomically $ readTVar shutdownVar + lastPicRef <- newIORef Nothing lastUpdateRef <- newIORef Nothing @@ -175,4 +178,5 @@ intMkVty input out = do , outputIface = out , refresh = innerRefresh , shutdown = shutdownIo + , isShutdown = shutdownStatus }