From b1b8da3d432efc06faf6e662b9d6d57e6f886444 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Wed, 30 Oct 2019 22:18:12 +0100 Subject: Simplify timeouts (remove C code; use pushLc ABC instruction instead) --- src/Gtk/Signal.icl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Gtk/Signal.icl') diff --git a/src/Gtk/Signal.icl b/src/Gtk/Signal.icl index 94d6ecd..3ed3bca 100644 --- a/src/Gtk/Signal.icl +++ b/src/Gtk/Signal.icl @@ -132,8 +132,8 @@ addTimeout interval callback = , timeout_counter = id }) >>= \{timeout_counter=id} -> case interval of - Milliseconds ms -> toState (g_timeout_add ms id) - Seconds s -> toState (g_timeout_add_seconds s id) + Milliseconds ms -> toState (g_timeout_add ms get_handleTimeout_address id) + Seconds s -> toState (g_timeout_add_seconds s get_handleTimeout_address id) where wrapped_callback id = callback >>= \r -> @@ -142,6 +142,11 @@ where (modState \st -> {st & timeouts='Data.Map'.del id st.timeouts}) >>| pure r + get_handleTimeout_address :: Pointer + get_handleTimeout_address = code { + pushLc handleTimeout + } + foreign export handleTimeout handleTimeout :: !Int -> Int handleTimeout id -- cgit v1.2.3