diff options
author | Camil Staps | 2019-10-25 09:00:24 +0200 |
---|---|---|
committer | Camil Staps | 2019-10-25 09:00:24 +0200 |
commit | 1937e3368754d792ef4f9580b97b910b46d890bc (patch) | |
tree | e4a1d21873e20a5a9c324dd15329ad8b534948d7 /src/Gtk/Signal.icl | |
parent | Add tune instance for GSignalHandler (convenience) (diff) |
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)
Diffstat (limited to 'src/Gtk/Signal.icl')
-rw-r--r-- | src/Gtk/Signal.icl | 3 |
1 files changed, 3 insertions, 0 deletions
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 |