From 1937e3368754d792ef4f9580b97b910b46d890bc Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Fri, 25 Oct 2019 09:00:24 +0200 Subject: Add G modifier to ccalls that may trigger GTK signals (which may cause re-entrance if there is a handler; add withPossibleCallback to save and retrieve state around such calls) --- src/Gtk/Signal.icl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Gtk/Signal.icl') diff --git a/src/Gtk/Signal.icl b/src/Gtk/Signal.icl index 6780ae9..154fd30 100644 --- a/src/Gtk/Signal.icl +++ b/src/Gtk/Signal.icl @@ -76,6 +76,9 @@ saveState = getState >>= \state -> toState (save_state state) retrieveState :: GtkM GtkState retrieveState = modState (const saved_state.[0]) +withPossibleCallback :: !(GtkM a) -> GtkM a +withPossibleCallback m = saveState >>| m >>= \r -> retrieveState >>| pure r + foreign export handleSignal handleSignal :: !Int !{#Int} -> Int handleSignal id args -- cgit v1.2.3