summaryrefslogtreecommitdiff
path: root/src/Gtk/Signal.icl
diff options
context:
space:
mode:
authorCamil Staps2019-10-30 22:18:12 +0100
committerCamil Staps2019-10-30 22:18:12 +0100
commitb1b8da3d432efc06faf6e662b9d6d57e6f886444 (patch)
tree47e25e9e77df218dc0098284932a69a488201d0e /src/Gtk/Signal.icl
parentAdd support for delete-event signal (diff)
Simplify timeouts (remove C code; use pushLc ABC instruction instead)
Diffstat (limited to 'src/Gtk/Signal.icl')
-rw-r--r--src/Gtk/Signal.icl9
1 files changed, 7 insertions, 2 deletions
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