Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/Animate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ mkInitAndGetTimeInput win = do

-- Next delta time and input
let getTimeInput _ = do
-- Seems as if we either have to yield or wait for a tick in order
-- to ensure that the thread receiving events gets a chance to
-- work. For some reason, yielding seems to result in window close
-- events getting through, wheras waiting often means they don't.
-- Maybe the process typically dies before the waiting time is up in
-- the latter case?
HGL.getWindowTick win
-- Get time
tp <- readIORef tpRef
t <- getElapsedTime `repeatUntil` (/= tp) -- Wrap around possible!
Expand Down Expand Up @@ -178,15 +185,7 @@ getWinInput win weBufRef = do
Just (HGL.MouseMove {}) -> mmFilter mwe'
Just _ -> writeIORef weBufRef mwe'
>> return jmme

-- Seems as if we either have to yield or wait for a tick in order
-- to ensure that the thread receiving events gets a chance to
-- work. For some reason, yielding seems to result in window close
-- events getting through, wheras waiting often means they don't.
-- Maybe the process typically dies before the waiting time is up in
-- the latter case?
gwi win = do
HGL.getWindowTick win
mwe <- HGL.maybeGetWindowEvent win
return mwe

Expand Down